记得上下班打卡 | git大法好,push需谨慎

Commit 3984a402 authored by 胡佳晨's avatar 胡佳晨

Merge branch 'dev_volunteers' into dev_kid

parents 415ecda5 2f776f33
......@@ -17,11 +17,11 @@
</properties>
<dependencies>
<!--<dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-smile-do</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-kylin-api</artifactId>
......
......@@ -3,6 +3,8 @@ package com.liquidnet.service.goblin.constant;
public class SmileRedisConst {
public static final String PREFIX = "smile:";
public static final String VOLUNTEERS = "volunteers:";
public static final String SMILE_USER = PREFIX.concat("user"); //用户key
public static final String SMILE_USER_VALIDATE = PREFIX.concat("user:validate"); //用户key
......@@ -29,4 +31,9 @@ public class SmileRedisConst {
public static final String SELL_SHOW_TOTAL_SALE_PRICE_USER = PREFIX.concat("show:total:sale:price:user:"); //用户销售总销售金额
public static final String PROJECT_DETAILS = PREFIX.concat(VOLUNTEERS).concat("project:"); //志愿者活动详情 $key:$projectId
public static final String TEAM_DETAILS = PREFIX.concat(VOLUNTEERS).concat("team:"); //志愿者职责组详情 $key:$teamId
public static final String PROJECT_ID_LIST = PREFIX.concat(VOLUNTEERS).concat("list"); //志愿者活动列表 $key
public static final String VOLUNTEERS_DETAILS = PREFIX.concat(VOLUNTEERS).concat(":"); //志愿者报名详情 $key:$projectId:uid:$uid
public static final String PROJECT_ID_CARD = PREFIX.concat(VOLUNTEERS).concat("project:");//身份证报名 $key:$projectId:idCard:$idCard
}
package com.liquidnet.service.goblin.dto.vo;
import com.liquidnet.service.smile.entity.SmileVolunteersProject;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* @author 志愿者活动创建修改
*/
@Data
public class SmileProjectDetailsVo implements Cloneable {
@ApiModelProperty(value = "活动id", example = "")
private String projectId;
@ApiModelProperty(value = "项目名称", example = "")
private String title;
@ApiModelProperty(value = "开始时间", example = "")
private String timeStart;
@ApiModelProperty(value = "结束时间", example = "")
private String timeEnd;
@ApiModelProperty(value = "活动地址", example = "")
private String address;
@ApiModelProperty(value = "活动介绍", example = "")
private String introduce;
@ApiModelProperty(value = "封面图", example = "")
private String img;
@ApiModelProperty(value = "职责组集合", example = "")
private List<SmileVolunteersTeam> teamArray;
@ApiModelProperty(value = "职责组集合Vo", example = "")
private List<SmileVolunteersTeamVo> teamVoArray;
private static final SmileProjectDetailsVo obj = new SmileProjectDetailsVo();
public static SmileProjectDetailsVo getNew() {
try {
return (SmileProjectDetailsVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileProjectDetailsVo();
}
}
public SmileProjectDetailsVo copy(SmileVolunteersProject source, List<SmileVolunteersTeam> teamList) {
this.setProjectId(source.getProjectId());
this.setTitle(source.getTitle());
this.setTimeStart(source.getTimeStart().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
this.setTimeEnd(source.getTimeEnd().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
this.setAddress(source.getAddress());
this.setIntroduce(source.getIntroduce());
this.setImg(source.getImg());
this.setTeamArray(teamList);
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
/**
* <p>
*
* </p>
*
* @author jobob
* @since 2022-03-11
*/
@ApiModel(value = "SmileVProjectListVo")
@Data
public class SmileVProjectListVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "活动id")
private String projectId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "开始时间")
private String timeStart;
@ApiModelProperty(value = "结束时间")
private String timeEnd;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "封面图")
private String img;
@ApiModelProperty(value = "报名状态[0-未报名|1-已报名]")
private Integer applyStatus;
@ApiModelProperty(value = "活动状态[0-未开始|1-进行中|2-已结束]")
private Integer projectStatus;
private static final SmileVProjectListVo obj = new SmileVProjectListVo();
public static SmileVProjectListVo getNew() {
try {
return (SmileVProjectListVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVProjectListVo();
}
}
public SmileVProjectListVo copy(SmileProjectDetailsVo source, Integer applyStatus) {
this.setProjectId(source.getProjectId());
this.setTitle(source.getTitle());
this.setTimeStart(source.getTimeStart());
this.setTimeEnd(source.getTimeEnd());
this.setAddress(source.getAddress());
this.setImg(source.getImg());
this.setApplyStatus(applyStatus);
LocalDateTime now = LocalDateTime.now();
LocalDateTime ldtStart = LocalDateTime.parse(source.getTimeStart(), DTF_YMD_HMS);
LocalDateTime ldtEnd = LocalDateTime.parse(source.getTimeEnd(), DTF_YMD_HMS);
if (now.isAfter(ldtEnd)) {
this.setProjectStatus(2);
} else if (now.isBefore(ldtStart)) {
this.setProjectStatus(0);
}else{
this.setProjectStatus(1);
}
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
/**
* <p>
*
* </p>
*
* @author jobob
* @since 2022-03-11
*/
@ApiModel(value = "SmileVProjectListVo")
@Data
public class SmileVProjectVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "活动id")
private String projectId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "开始时间")
private String timeStart;
@ApiModelProperty(value = "结束时间")
private String timeEnd;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "封面图")
private String img;
@ApiModelProperty(value = "报名状态[0-未报名|1-已报名]")
private Integer applyStatus;
@ApiModelProperty(value = "活动状态[0-未开始|1-进行中|2-已结束]")
private Integer projectStatus;
@ApiModelProperty(value = "活动介绍")
private String introduce;
@ApiModelProperty(value = "关联职责组")
private List<SmileVTeamVo> teamList;
private static final SmileVProjectVo obj = new SmileVProjectVo();
public static SmileVProjectVo getNew() {
try {
return (SmileVProjectVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVProjectVo();
}
}
public SmileVProjectVo copy(SmileProjectDetailsVo source, Integer applyStatus, List<SmileVTeamVo> teamVos) {
this.setProjectId(source.getProjectId());
this.setTitle(source.getTitle());
this.setTimeStart(source.getTimeStart());
this.setTimeEnd(source.getTimeEnd());
this.setAddress(source.getAddress());
this.setImg(source.getImg());
this.setApplyStatus(applyStatus);
this.setIntroduce(source.getIntroduce());
this.setTeamList(teamVos);
LocalDateTime now = LocalDateTime.now();
LocalDateTime ldtStart = LocalDateTime.parse(source.getTimeStart(), DTF_YMD_HMS);
LocalDateTime ldtEnd = LocalDateTime.parse(source.getTimeEnd(), DTF_YMD_HMS);
if (now.isAfter(ldtEnd)) {
this.setProjectStatus(2);
} else if (now.isBefore(ldtStart)) {
this.setProjectStatus(0);
} else {
this.setProjectStatus(1);
}
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jobob
* @since 2022-03-11
*/
@ApiModel(value = "SmileVProjectListVo")
@Data
public class SmileVTeamVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "活动id")
private String teamId;
@ApiModelProperty(value = "标题")
private String name;
@ApiModelProperty(value = "组介绍")
private String introduce;
@ApiModelProperty(value = "用户是否选择[0-未选择|1-已选择]")
private Integer status;
private static final SmileVTeamVo obj = new SmileVTeamVo();
public static SmileVTeamVo getNew() {
try {
return (SmileVTeamVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVTeamVo();
}
}
public SmileVTeamVo copy(SmileVolunteersTeam source,Integer checkStatus) {
this.setTeamId(source.getTeamId());
this.setName(source.getName());
this.setIntroduce(source.getIntroduce());
this.setStatus(checkStatus);
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.liquidnet.service.smile.entity.SmileVolunteers;
import com.liquidnet.service.smile.entity.SmileVolunteersProject;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* @author 志愿者活动创建修改
*/
@Data
public class SmileVolunteersDetailsVo implements Cloneable {
@ApiModelProperty(value = "用户id", example = "")
private String uid;
@ApiModelProperty(value = "活动Id", example = "")
private String projectId;
@ApiModelProperty(value = "活动名称", example = "")
private String projectName;
@ApiModelProperty(value = "姓名", example = "")
private String name;
@ApiModelProperty(value = "头像", example = "")
private String img;
@ApiModelProperty(value = "证件号", example = "")
private String idCard;
@ApiModelProperty(value = "性别", example = "")
private Integer sex;
@ApiModelProperty(value = "审核状态", example = "")
private Integer status;
@ApiModelProperty(value = "学校", example = "")
private String school;
@ApiModelProperty(value = "学校地址", example = "")
private String schoolAddress;
@ApiModelProperty(value = "专长", example = "")
private String specialty;
@ApiModelProperty(value = "特长", example = "")
private String specialty2;
@ApiModelProperty(value = "手机号", example = "")
private String phone;
@ApiModelProperty(value = "自我介绍", example = "")
private String introduce;
@ApiModelProperty(value = "创建时间", example = "")
private String createdAt;
@ApiModelProperty(value = "职责组集合", example = "")
private List<SmileVolunteersTeam> teamArray;
private static final SmileVolunteersDetailsVo obj = new SmileVolunteersDetailsVo();
public static SmileVolunteersDetailsVo getNew() {
try {
return (SmileVolunteersDetailsVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteersDetailsVo();
}
}
public SmileVolunteersDetailsVo copy(SmileVolunteers source, List<SmileVolunteersTeam> teamList,String projectName) {
this.setUid(source.getUid());
this.setProjectId(source.getProjectId());
this.setProjectName(projectName);
this.setName(source.getName());
this.setImg(source.getImg());
this.setIdCard(source.getIdCard());
this.setSex(source.getSex());
this.setStatus(source.getStatus());
this.setSchool(source.getSchool());
this.setSchoolAddress(source.getSchoolAddress());
this.setSpecialty(source.getSpecialty());
this.setSpecialty2(source.getSpecialty2());
this.setPhone(source.getPhone());
this.setIntroduce(source.getIntroduce());
this.setCreatedAt(source.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
this.setTeamArray(teamList);
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 志愿者-项目职责组表
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileVolunteersTeamVo implements Serializable,Cloneable {
private static final long serialVersionUID = 1L;
/**
* 职责组id
*/
private String teamId;
/**
* 组名称
*/
private String name;
/**
* 组介绍
*/
private String introduce;
/**
* 是否选中
*/
private Integer isCheck;
private static final SmileVolunteersTeamVo obj = new SmileVolunteersTeamVo();
public static SmileVolunteersTeamVo getNew() {
try {
return (SmileVolunteersTeamVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteersTeamVo();
}
}
}
package com.liquidnet.service.goblin.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author jobob
* @since 2022-03-11
*/
@ApiModel(value = "SmileVolunteersApplyVo")
@Data
public class SmileVolunteersApplyParam implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "活动id")
private String projectId;
@ApiModelProperty(value = "头像")
private String img;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "证件号")
private String idCard;
@ApiModelProperty(value = "性别[0-未知|1-男|2-女]")
private Integer sex;
@ApiModelProperty(value = "学校名称")
private String school;
@ApiModelProperty(value = "学校地址")
private String schoolAddress;
@ApiModelProperty(value = "专长")
private String specialty;
@ApiModelProperty(value = "特长")
private String specialty2;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "自我介绍")
private String introduce;
@ApiModelProperty(value = "申请职责ID[职责组Id]")
private String teamId1;
@ApiModelProperty(value = "申请职责ID[职责组Id]")
private String teamId2;
@ApiModelProperty(value = "申请职责ID[职责组Id]")
private String teamId3;
}
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.SmileSellDataDetailVO;
import com.liquidnet.service.goblin.dto.vo.SmileUserVO;
import com.liquidnet.service.goblin.dto.vo.SmileVProjectListVo;
import com.liquidnet.service.goblin.dto.vo.SmileVProjectVo;
import com.liquidnet.service.goblin.param.SmileVolunteersApplyParam;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.sun.org.apache.xpath.internal.operations.Bool;
import java.util.List;
public interface SmileVolunteersService {
ResponseDto<List<SmileVProjectListVo>> projectList(String uid);
ResponseDto<SmileVProjectVo> projectDetails(String uid, String projectId);
ResponseDto<Boolean> apply(SmileVolunteersApplyParam param);
}
package com.liquidnet.client.admin.web.controller.zhengzai.smile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.common.utils.poi.ExcelUtil;
import com.liquidnet.client.admin.framework.web.domain.server.Sys;
import com.liquidnet.client.admin.zhengzai.kylin.dto.OrderExportVo;
import com.liquidnet.client.admin.zhengzai.smile.dto.*;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersProjectService;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersService;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersTeamService;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.dto.vo.SmileProjectDetailsVo;
import com.liquidnet.service.goblin.dto.vo.SmileVolunteersDetailsVo;
import com.liquidnet.service.goblin.dto.vo.SmileVolunteersTeamVo;
import com.liquidnet.service.smile.entity.SmileVolunteers;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Api(tags = "志愿者")
@Controller
@RequestMapping("/smile/volunteers")
public class SmileVolunteersController extends BaseController {
@Autowired
ISmileVolunteersProjectService volunteersProjectService;
@Autowired
ISmileVolunteersTeamService volunteersTeamService;
@Autowired
ISmileVolunteersService volunteersService;
@Value("${liquidnet.client.admin.platformUrl}")
private String platformUrl;
private final String prefix = "zhengzai/smile/volunteers";
/**
* 组列表
*/
@GetMapping("/team")
public String listTeam() {
return prefix + "/team/list";
}
/**
* 活动列表
*/
@GetMapping("/project")
public String listProject() {
return prefix + "/project/list";
}
/**
* 志愿者列表
*/
@GetMapping()
public String list() {
return prefix + "/list";
}
/**
* 新增组
*/
@GetMapping("/team/add")
public String addTeam() {
return prefix + "/team/add";
}
/**
* 新增活动
*/
@GetMapping("/project/add")
public String addProject(ModelMap mmap) {
SmileVTSParam param = new SmileVTSParam();
param.setPageNum(1);
param.setPageSize(40);
List<SmileVolunteersTeam> list = volunteersTeamService.list(param);
mmap.put("platformUrl", platformUrl);
mmap.put("listData", list);
return prefix + "/project/add";
}
@PostMapping("team/list")
@ApiOperation("职责组列表")
@ResponseBody
public TableDataInfo listTeam(SmileVTSParam param) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
return getDataTable(volunteersTeamService.list(param));
}
@PostMapping("team/insert")
@ApiOperation("添加职责组")
@ResponseBody
public AjaxResult insertTeam(SmileVolunteersTeam bean) {
return volunteersTeamService.insertData(bean);
}
@PostMapping("team/update")
@ApiOperation("修改职责组")
@ResponseBody
public AjaxResult upDateTeam(SmileVolunteersTeam bean) {
return volunteersTeamService.updateData(bean);
}
@GetMapping("team/details/{teamId}")
@ApiOperation("修改职责组")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "teamId", value = "组id"),
})
public String detailsTeam(@PathVariable("teamId") String teamId, ModelMap mmap) {
SmileVolunteersTeam data = volunteersTeamService.details(teamId);
mmap.put("smileVolunteersTeam", data);
return prefix + "/team/edit";
}
@GetMapping("team/search")
@ApiOperation("组名字搜索")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "title", value = "组名称")
})
public AjaxResult search(@RequestParam(value = "title", required = false) String title) {
return volunteersTeamService.search(title);
}
@GetMapping("team/ByProjectId")
@ApiOperation("根据活动id查询关联组")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "projectId", value = "活动id"),
})
public AjaxResult getListByProjectId(@RequestParam(value = "projectId", required = false) String projectId) {
return volunteersTeamService.getListByProjectId(projectId);
}
@PostMapping("project/list")
@ApiOperation("活动列表")
@ResponseBody
public TableDataInfo listProject(SmileVPSParam param) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
return getDataTable(volunteersProjectService.list(param));
}
@PostMapping("project/insert")
@ApiOperation("活动新增")
@ResponseBody
public AjaxResult insertProject(SmileVPParam param) {
return volunteersProjectService.insertData(param);
}
@PostMapping("project/update")
@ApiOperation("活动修改")
@ResponseBody
public AjaxResult updateProject(SmileVPParam param) {
return volunteersProjectService.updateData(param);
}
@PostMapping("project/status")
@ApiOperation("活动修改状态")
@ResponseBody
public AjaxResult updateProject(String projectId, Integer status) {
return volunteersProjectService.updateStatus(projectId, status);
}
@GetMapping("project/details/{projectId}")
@ApiOperation("活动详情")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "projectId", value = "活动id"),
})
public String detailsProject(@PathVariable("projectId") String projectId, ModelMap mmap) {
SmileProjectDetailsVo data = volunteersProjectService.details(projectId);
SmileVTSParam param = new SmileVTSParam();
param.setPageNum(1);
param.setPageSize(40);
List<SmileVolunteersTeamVo> listVo = new ArrayList<>();
List<SmileVolunteersTeam> listBean = volunteersTeamService.list(param);
List<String> list = data.getTeamArray().stream().map(SmileVolunteersTeam::getTeamId).collect(Collectors.toList());
for (SmileVolunteersTeam bean : listBean) {
SmileVolunteersTeamVo vo = SmileVolunteersTeamVo.getNew();
vo.setTeamId(bean.getTeamId());
vo.setName(bean.getName());
vo.setIntroduce(bean.getIntroduce());
if (list.contains(bean.getTeamId())) {
vo.setIsCheck(1);
} else {
vo.setIsCheck(0);
}
listVo.add(vo);
}
data.setTeamVoArray(listVo);
mmap.put("platformUrl", platformUrl);
mmap.put("smileProjectDetailsVo", data);
return prefix + "/project/edit";
}
@PostMapping("/list")
@ApiOperation("志愿者列表")
@ResponseBody
public TableDataInfo listVolunteers(SmileVSParam param) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
return getDataTable(volunteersService.list(param));
}
@GetMapping("/details/{mid}")
@ApiOperation("志愿者详情")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mid", value = "mid"),
})
public String detailsVolunteers(@PathVariable("mid") String mid, ModelMap mmap) {
SmileVolunteersDetailsVo data = volunteersService.details(mid);
mmap.put("smileVolunteersDetailsVo", data);
AjaxResult ajaxResult = volunteersTeamService.getListByProjectId(data.getProjectId());
List<SmileVolunteersTeam> list = ((List<SmileVolunteersTeam>) ajaxResult.get("value"));
mmap.put("listData", list);
return prefix + "/edit";
}
@PostMapping("/audit")
@ApiOperation("志愿者审核")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "projectId", value = "活动id"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "uid", value = "用户id"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "teamId", value = "被分配组id"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "status", value = "审核状态[0-待审核|1-审核通过|2-审核未通过]"),
})
public AjaxResult auditVolunteers(String projectId, String uid, String teamId, Integer status) {
return volunteersService.audit(projectId, uid, teamId, status);
}
@PostMapping("/export")
@ApiOperation("志愿者导出")
@ResponseBody
public AjaxResult exportVolunteers(SmileVSParam param) {
List<VolunteersExportVo> beanList = volunteersService.volunteersExport(param);
ExcelUtil<VolunteersExportVo> util = new ExcelUtil(VolunteersExportVo.class);
return util.exportExcel(beanList, "V");
}
}
......@@ -1154,7 +1154,11 @@ var table = {
// 修改信息,以tab页展现
editTab: function(id) {
table.set();
if(table.options.modalName.indexOf("审核")!=-1){
$.modal.openTab("" + table.options.modalName, $.operate.editUrl(id));
}else{
$.modal.openTab("修改" + table.options.modalName, $.operate.editUrl(id));
}
},
// 修改信息 全屏
editFull: function(id) {
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('修改职责组')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-volunteers-edit" th:object="${smileVolunteersDetailsVo}">
<input name="projectId" th:value="*{projectId}" type="hidden">
<input name="uid" th:value="*{uid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">审核状态:</label>
<div class="col-sm-8">
<input name="status" class="form-control" type="text" th:if="*{status==0}" th:value="待审核" readonly
required>
<input name="status" class="form-control" type="text" th:if="*{status==1}" th:value="通过" readonly
required>
<input name="status" class="form-control" type="text" th:if="*{status==2}" th:value="拒绝" readonly
required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">姓名:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text" th:value="*{name}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">头像:</label>
<div class="col-sm-8">
<!-- <input name="img" class="form-control" type="text" th:value="*{img}" readonly required>-->
<img class="img-details" name="img" th:src="*{img}"
th:onclick="click_big([[*{img}]])">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">证件号:</label>
<div class="col-sm-8">
<input name="idCard" class="form-control" type="text" th:value="*{idCard}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">性别:</label>
<div class="col-sm-8">
<input name="sex" class="form-control" type="text" th:if="*{sex==0}" th:value="未知" readonly required>
<input name="sex" class="form-control" type="text" th:if="*{sex==1}" th:value="男" readonly required>
<input name="sex" class="form-control" type="text" th:if="*{sex==2}" th:value="女" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">学校:</label>
<div class="col-sm-8">
<input name="school" class="form-control" type="text" th:value="*{school}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">学校地址:</label>
<div class="col-sm-8">
<input name="schoolAddress" class="form-control" type="text" th:value="*{schoolAddress}" readonly
required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">专长:</label>
<div class="col-sm-8">
<input name="specialty" class="form-control" type="text" th:value="*{specialty}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">特长:</label>
<div class="col-sm-8">
<input name="specialty2" class="form-control" type="text" th:value="*{specialty2}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">手机号:</label>
<div class="col-sm-8">
<input name="phone" class="form-control" type="text" th:value="*{phone}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">项目名称:</label>
<div class="col-sm-8">
<input name="projectName" class="form-control" type="text" th:value="*{projectName}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">自我介绍:</label>
<div class="col-sm-8">
<input name="introduce" class="form-control" type="text" th:value="*{introduce}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请时间:</label>
<div class="col-sm-8">
<input name="createdAt" class="form-control" type="text" th:value="*{createdAt}" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">用户申请/分配职责组:</label>
<table id="team-table_user" class="table table-condensed table-sm" th:border="1">
<tr>
<td>名称</td>
<td>介绍</td>
<tr/>
<div th:each="item : ${smileVolunteersDetailsVo.teamArray}">
<tr class="content-tr">
<td th:value="${item.name}" th:text="${item.name}">
</td>
<td th:text="${item.introduce}">
</td>
</tr>
</div>
</table>
</div>
<div class="form-group" th:if="*{status==0}">
<label class="col-sm-3 control-label is-required">可分配申请职责组:</label>
<table id="team-table" class="table table-condensed table-sm" th:border="1">
<tr>
<td>名称</td>
<td>介绍</td>
<td>选中</td>
<tr/>
<div th:each="item : ${listData}">
<tr class="content-tr">
<td th:value="${item.name}" th:text="${item.name}">
</td>
<td th:text="${item.introduce}">
</td>
<td>
<input name="teamCheck" type="radio" th:value="${item.teamId}"> 选中</label>
</td>
</tr>
</div>
</table>
</div>
<button type="button" class="btn btn-w-m btn-success" onclick="submitHandler(1)" th:if="*{status==0}">
通过
</button>
<button type="button" class="btn btn-w-m btn-warning" onclick="submitHandler(2)" th:if="*{status==0}">
拒绝
</button>
</form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
$("#form-roadShow-edit").validate({
focusCleanup: true
});
function submitHandler(status) {
var teamIds = $("input[name^='teamCheck']:checked").val()
var uid = $("input[name^='uid']").val()
var projectId = $("input[name^='projectId']").val()
if (status === 1 && typeof (teamIds) == "undefined") {
alert("请分配职责组");
} else {
$.operate.post(smilePrefix + "/audit",
{
"projectId": projectId,
"uid": uid,
"teamId": teamIds,
"status": status
}, function (res) {
location.reload();
});
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('志愿者列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>活动名称:</label>
<input type="text" name="title"/>
</li>
<li>
<label>用户名称:</label>
<input type="text" name="name"/>
</li>
<li>
<label>职责组:</label>
<input type="text" name="team"/>
</li>
<li>
<label>手机号:</label>
<input type="text" name="phone"/>
</li>
<li>
<label>审核状态:</label>
<select name="status">
<option value="-1">全部</option>
<option value="0">待审核</option>
<option value="1">通过审核</option>
<option value="2">未通过待审核</option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.table.exportExcel()">
<i class="fa fa-download"></i> 导出
</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var prefix = ctx + "smile/volunteers";
$(function () {
var options = {
url: prefix + "/list",
updateUrl: prefix + "/details/{id}",
// sortName: "sort",
modalName: "审核志愿者",
exportUrl: prefix + "/export",
orderSc: "desc",
orderItem: "created_at",
columns: [{
checkbox: true
},
{
field: 'mid',
title: '序号'
},
{
field: 'uid',
title: '用户id'
},
{
field: 'name',
title: '姓名'
},
{
field: 'img',
title: '头像',
formatter: function (value, row, index) {
return $.table.imageView(value, "300", "300");
}
},
{
field: 'sex',
title: '性别',
formatter: function (value, row, index) {
if (value == 1) {
return '男';
} else if (value == 2) {
return '女';
} else {
return '未知';
}
}
},
{
field: 'status',
title: '状态',
formatter: function (value, row, index) {
if (value == 1) {
return '通过';
} else if (value == 2) {
return '拒绝';
} else {
return '待审核';
}
}
},
{
field: 'school',
title: '学校'
},
{
field: 'phone',
title: '手机号'
},
{
field: 'createdAt',
title: '创建时间'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-warning btn-xs " href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.mid + '\')"><i class="fa fa-remove"></i>管理</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('新增活动')"/>
<th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-team-add">
<input id="teamIdArray" name="teamIdArray" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动名称:</label>
<div class="col-sm-8">
<input name="title" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-8">
<input id="fileinput10" type="file">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">封面图地址:</label>
<div class="col-sm-8">
<input id="iptUrl" name="img" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">地址:</label>
<div class="col-sm-8">
<input name="address" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">介绍:</label>
<div class="col-sm-8">
<input name="introduce" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动时间: </label>
<input type="text" style="width: 200px;float: left"
class="form-control" id="startTime" placeholder="开始时间选择" name="timeStart"
required/>
<span class="control-label" style="float: left;margin-left: 10px;margin-right: 10px"></span>
<input type="text" style="width: 200px;float: left"
class="form-control" id="endTime" placeholder="结束时间选择" name="timeEnd"
required/>
</div>
</form>
<form class="form-horizontal m" id="form-team" th:object="${listData}">
<table id="team-table" class="table table-condensed table-sm" th:border="1">
<tr>
<td>名称</td>
<td>介绍</td>
<td>选中</td>
<tr/>
<div th:each="item : ${listData}">
<tr class="content-tr">
<td th:value="${item.name}" th:text="${item.name}">
</td>
<td th:text="${item.introduce}">
</td>
<td>
<input name="checkbox" type="checkbox" th:value="${item.teamId}"> 选中</label>
</td>
</tr>
</div>
</table>
</form>
<div class="cover_pop" style="display: none">
<div class="pop_inner">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<div class="file-loading">
<input id="fileinput-demo-1" type="file" name="file" data-browse-on-zone-click="true"
data-msg-placeholder="Select {files} for upload...">
<input hidden id="coverImg" name="coverImg">
</div>
</div>
<div class="pop_btns">
<div class="confirm_btn" onclick="popBtn(1)">确认</div>
<div class="confirm_btn confirm_cancel" onclick="popBtn(0)">取消</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
var platformUrl = [[${platformUrl}]];
var teamIds = [];
$("#form-team-add").validate({
focusCleanup: true
});
$("#startTime").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
autoclose: true
});
$("#endTime").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
autoclose: true
});
$("input:checkbox").click(function () {
var domName = $(this).attr('name');//获取当前单选框控件name 属性值
var checkedState = $(this).attr('checked');//记录当前选中状态
var value = $(this).val();
$("input:radio[name='" + domName + "']").attr('checked', false);//1.
$(this).attr('checked', true);//2.
if (checkedState == 'checked') {
$(this).attr('checked', false); //3.
teamIds.remove(value)
} else {
teamIds.push(value);
}
});
//扩展数组方法:查找指定元素的下标
//author cjianquan 2016-1-14
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
}
return -1;
};
//扩展数组方法:删除指定元素
//author cjianquan 2016-1-14
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
while (index > -1) {
this.splice(index, 1);
index = this.indexOf(val);
}
};
$("#fileinput10").change((e) => {
if (!e.target.files[0]) {
return
}
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function (res) {
console.log(res, 'res')
let imgPath = 'https://img.zhengzai.tv/' + res.data.ossPath;
$("#iptUrl").val(imgPath);
}
});
})
function submitHandler() {
if (teamIds.length === 0) {
alert("未选择职责组");
} else {
document.getElementById("teamIdArray").value = teamIds.join(",");
if ($.validate.form()) {
$.operate.save(smilePrefix + "/project/insert", $('#form-team-add').serialize());
}
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('修改活动')"/>
<th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-project-edit" th:object="${smileProjectDetailsVo}">
<input id="teamIdArray" name="teamIdArray" type="hidden">
<input id="projectId" name="projectId" type="hidden" th:value="${smileProjectDetailsVo.projectId}">
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动名称:</label>
<div class="col-sm-8">
<input name="title" class="form-control" type="text" th:value="${smileProjectDetailsVo.title}" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-8">
<input id="fileinput10" type="file">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">封面图地址:</label>
<div class="col-sm-8">
<input id="iptUrl" name="img" class="form-control" type="text" th:value="${smileProjectDetailsVo.img}"
required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">地址:</label>
<div class="col-sm-8">
<input name="address" class="form-control" type="text" th:value="${smileProjectDetailsVo.address}"
required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">介绍:</label>
<div class="col-sm-8">
<input name="introduce" class="form-control" type="text" th:value="${smileProjectDetailsVo.introduce}"
required>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label is-required">开始时间:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="timeStart" class="form-control" type="date" th:value="${smileProjectDetailsVo.timeStart}"-->
<!-- required>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label is-required">结束时间:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="timeEnd" class="form-control" type="date" th:value="${smileProjectDetailsVo.timeEnd}"-->
<!-- required>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动时间: </label>
<input th:field="${smileProjectDetailsVo.timeStart}" type="text" style="width: 200px;float: left"
class="form-control" id="startTime" placeholder="开始时间选择" name="timeStart"
required/>
<span class="control-label" style="float: left;margin-left: 10px;margin-right: 10px"></span>
<input th:field="${smileProjectDetailsVo.timeEnd}" type="text" style="width: 200px;float: left"
class="form-control" id="endTime" placeholder="结束时间选择" name="timeEnd"
required/>
</div>
</form>
<form class="form-horizontal m" id="form-team">
<table id="team-table" class="table table-condensed table-sm" th:border="1">
<tr>
<td>名称</td>
<td>介绍</td>
<td>选中</td>
<tr/>
<div th:each="item : ${smileProjectDetailsVo.teamVoArray}">
<tr class="content-tr">
<td th:value="${item.name}" th:text="${item.name}">
</td>
<td th:text="${item.introduce}">
</td>
<td>
<input name="checkbox" type="checkbox" th:value="${item.teamId}"
th:if="${item.isCheck==1}" th:text="选中" checked></label>
<input name="checkbox" type="checkbox" th:value="${item.teamId}" th:if="${item.isCheck==0}"
th:text="选中"></label>
</td>
</tr>
</div>
</table>
</form>
<div class="cover_pop" style="display: none">
<div class="pop_inner">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<div class="file-loading">
<input id="fileinput-demo-1" type="file" name="file" data-browse-on-zone-click="true"
data-msg-placeholder="Select {files} for upload...">
<input hidden id="coverImg" name="coverImg">
</div>
</div>
<div class="pop_btns">
<div class="confirm_btn" onclick="popBtn(1)">确认</div>
<div class="confirm_btn confirm_cancel" onclick="popBtn(0)">取消</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
var platformUrl = [[${platformUrl}]];
var teamIds = [];
$("#form-roadShow-edit").validate({
focusCleanup: true
});
$("#startTime").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
autoclose: true
});
$("#endTime").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
autoclose: true
});
$(function () {
var data = [[${smileProjectDetailsVo.teamVoArray}]]
for (var i = 0; i < data.length; i++) {
if(data[i].isCheck===1){
teamIds.push(data[i].teamId);
}
}
});
$("input:checkbox").click(function () {
var domName = $(this).attr('name');//获取当前单选框控件name 属性值
var checkedState = $(this).attr('checked');//记录当前选中状态
var value = $(this).val();
$("input:radio[name='" + domName + "']").attr('checked', false);//1.
$(this).attr('checked', true);//2.
if (checkedState == 'checked') {
$(this).attr('checked', false); //3.
teamIds.remove(value)
} else {
teamIds.push(value);
}
});
//扩展数组方法:查找指定元素的下标
//author cjianquan 2016-1-14
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
}
return -1;
};
//扩展数组方法:删除指定元素
//author cjianquan 2016-1-14
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
while (index > -1) {
this.splice(index, 1);
index = this.indexOf(val);
}
};
$("#fileinput10").change((e) => {
if (!e.target.files[0]) {
return
}
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function (res) {
console.log(res, 'res')
let imgPath = 'https://img.zhengzai.tv/' + res.data.ossPath;
$("#iptUrl").val(imgPath);
}
});
})
function submitHandler() {
if (teamIds.length === 0) {
alert("未选择职责组");
} else {
document.getElementById("teamIdArray").value = teamIds.join(",");
if ($.validate.form()) {
$.operate.save(smilePrefix + "/project/update", $('#form-project-edit').serialize());
}
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('项目列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>项目名称:</label>
<input type="text" name="title"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()">
<i class="fa fa-plus"></i> 添加
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
$(function () {
var options = {
url: smilePrefix + "/project/list",
createUrl: smilePrefix + "/project/add",
updateUrl: smilePrefix + "/project/details/{id}",
// sortName: "sort",
modalName: "活动",
orderSc: "desc",
orderItem: "created_at",
pageSize: 200,
pageList: [200],
columns: [{
checkbox: true
},
{
field: 'projectId',
title: '活动id'
},
{
field: 'title',
title: '活动名称'
},
{
field: 'img',
title: '封面图',
formatter: function (value, row, index) {
return $.table.imageView(value, "300", "300");
}
},
{
field: 'timeStart',
title: '开始时间'
},
{
field: 'timeEnd',
title: '结束时间'
},
{
field: 'createdAt',
title: '创建时间'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.projectId + '\')"><i class="fa fa-edit"></i>管理</a> ');
if (row.status == 1) {
actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="f(\'' + row.projectId + '\',0)"><i class="fa fa-remove"></i>下线</a>');
} else {
actions.push('<a class="btn btn-warning btn-xs " href="javascript:void(0)" onclick="f(\'' + row.projectId + '\',1)"><i class="fa fa-remove"></i>上线</a>');
}
return actions.join('');
}
}]
};
$.table.init(options);
});
function f(a1, a2) {
$.post(smilePrefix +"/project/status", {projectId: a1, status: a2}, function (res) {
alert(res.msg);
location.reload();
});
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增职责组')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-team-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">职责组名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">职责组介绍:</label>
<div class="col-sm-8">
<input name="introduce" class="form-control" type="text" required>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
$("#form-team-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(smilePrefix + "/team/insert", $('#form-team-add').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改职责组')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-team-edit" th:object="${smileVolunteersTeam}">
<input name="teamId" th:value="*{teamId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">职责组名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text" th:value="*{name}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">职责组介绍:</label>
<div class="col-sm-8">
<input name="introduce" class="form-control" type="text" th:value="*{introduce}" required>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
$("#form-roadShow-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(smilePrefix + "/team/update", $('#form-team-edit').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('职责组列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>职责组名称:</label>
<input type="text" name="title"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()">
<i class="fa fa-plus"></i> 添加
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var smilePrefix = ctx + "smile/volunteers";
$(function () {
var options = {
url: smilePrefix + "/team/list",
// detailUrl: prefix + "/team/details/{id}",
createUrl: smilePrefix + "/team/add",
updateUrl: smilePrefix + "/team/details/{id}",
modalName: "职责组",
orderSc: "desc",
pageSize: 200,
pageList: [200],
orderItem: "created_at",
columns: [{
checkbox: true
},
{
field: 'teamId',
title: '职责组id'
},
{
field: 'name',
title: '组名称'
},
{
field: 'introduce',
title: '组介绍'
},
{
field: 'createdAt',
title: '创建时间'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.teamId + '\')"><i class="fa fa-edit"></i>管理</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
package com.liquidnet.client.admin.zhengzai.smile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
/**
* @author 志愿者活动创建修改
*/
@Data
public class SmileVPParam {
@ApiModelProperty(value = "活动id", example = "")
private String projectId;
@ApiModelProperty(value = "项目名称", example = "")
private String title;
@ApiModelProperty(value = "开始时间", example = "")
private String timeStart;
@ApiModelProperty(value = "结束时间", example = "")
private String timeEnd;
@ApiModelProperty(value = "活动地址", example = "")
private String address;
@ApiModelProperty(value = "活动介绍", example = "")
private String introduce;
@ApiModelProperty(value = "封面图", example = "")
private String img;
@ApiModelProperty(value = "职责组id数组", example = "")
private String teamIdArray;
}
package com.liquidnet.client.admin.zhengzai.smile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 志愿者活动搜索
*/
@Data
public class SmileVPSParam {
@ApiModelProperty(value = "职责组名称", example = "")
private String title;
@ApiModelProperty(value = "页数", example = "1")
@NotNull(message = "页数不能为空")
private Integer pageSize;
@ApiModelProperty(value = "数量", example = "20")
@NotNull(message = "数量不能为空")
private Integer pageNum;
@ApiModelProperty(value = "排序字段", hidden = true)
private String orderItem;
@ApiModelProperty(value = "排序方式", hidden = true)
private String orderSc;
}
package com.liquidnet.client.admin.zhengzai.smile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 志愿者搜索
*/
@Data
public class SmileVSParam {
@ApiModelProperty(value = "活动名称", example = "")
private String title;
@ApiModelProperty(value = "志愿者姓名", example = "")
private String name;
@ApiModelProperty(value = "志愿者手机号", example = "")
private String phone;
@ApiModelProperty(value = "审核状态", example = "")
private Integer status;
@ApiModelProperty(value = "职责组名称", example = "")
private String team;
@ApiModelProperty(value = "页数", example = "1")
@NotNull(message = "页数不能为空")
private Integer pageSize;
@ApiModelProperty(value = "数量", example = "20")
@NotNull(message = "数量不能为空")
private Integer pageNum;
@ApiModelProperty(value = "排序字段", hidden = true)
private String orderItem;
@ApiModelProperty(value = "排序方式", hidden = true)
private String orderSc;
}
package com.liquidnet.client.admin.zhengzai.smile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 志愿者职责组搜索
*/
@Data
public class SmileVTSParam {
@ApiModelProperty(value = "职责组名称", example = "")
private String title;
@ApiModelProperty(value = "页数", example = "1")
@NotNull(message = "页数不能为空")
private Integer pageSize;
@ApiModelProperty(value = "数量", example = "20")
@NotNull(message = "数量不能为空")
private Integer pageNum;
@ApiModelProperty(value = "排序字段", hidden = true)
private String orderItem;
@ApiModelProperty(value = "排序方式", hidden = true)
private String orderSc;
}
package com.liquidnet.client.admin.zhengzai.smile.dto;
import com.liquidnet.client.admin.common.annotation.Excel;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.kylin.dao.OrderExportDao;
import com.liquidnet.service.smile.entity.dto.VolunteersExportDto;
import lombok.Data;
import java.io.Serializable;
@Data
public class VolunteersExportVo implements Serializable, Cloneable{
@Excel(name = "用户姓名", cellType = Excel.ColumnType.STRING)
private String name;
@Excel(name = "证件号", cellType = Excel.ColumnType.STRING)
private String idCard;
@Excel(name = "性别", cellType = Excel.ColumnType.STRING)
private String sex;
@Excel(name = "审核状态", cellType = Excel.ColumnType.STRING)
private String status;
@Excel(name = "学校", cellType = Excel.ColumnType.STRING)
private String school;
// @Excel(name = "学校地址", cellType = Excel.ColumnType.STRING)
// private String schoolAddress;
@Excel(name = "手机号", cellType = Excel.ColumnType.STRING)
private String phone;
@Excel(name = "项目名称", cellType = Excel.ColumnType.STRING)
private String projectName;
@Excel(name = "申请时间", cellType = Excel.ColumnType.STRING)
private String createdAt;
// @Excel(name = "特长", cellType = Excel.ColumnType.STRING)
// private String specialty;
// @Excel(name = "专长", cellType = Excel.ColumnType.STRING)
// private String specialty2;
// @Excel(name = "申请组1名称", cellType = Excel.ColumnType.STRING)
// private String team1;
// @Excel(name = "申请组2名称", cellType = Excel.ColumnType.STRING)
// private String team2;
// @Excel(name = "申请组3名称", cellType = Excel.ColumnType.STRING)
// private String team3;
// @Excel(name = "自我介绍", cellType = Excel.ColumnType.STRING)
// private String introduce;
private static final VolunteersExportVo obj = new VolunteersExportVo();
public static VolunteersExportVo getNew() {
try {
return (VolunteersExportVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new VolunteersExportVo();
}
public VolunteersExportVo copy(VolunteersExportDto source) {
this.setName(source.getName());
this.setIdCard(source.getIdCard());
this.setSex(source.getSex());
this.setStatus(source.getStatus());
this.setSchool(source.getSchool());
// this.setSchoolAddress(source.getSchoolAddress());
this.setPhone(source.getPhone());
this.setProjectName(source.getProjectName());
this.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(source.getCreatedAt()));
// this.setSpecialty(source.getSpecialty());
// this.setSpecialty2(source.getSpecialty2());
// this.setTeam1(source.getTeam1()==null?"":source.getTeam1());
// this.setTeam2(source.getTeam2()==null?"":source.getTeam2());
// this.setTeam3(source.getTeam3()==null?"":source.getTeam3());
// this.setIntroduce(source.getIntroduce());
return this;
}
}
package com.liquidnet.client.admin.zhengzai.smile.service;
import com.liquidnet.service.smile.entity.SmileProjectTeamRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 志愿者-项目关联职责表 服务类
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface ISmileProjectTeamRelationService extends IService<SmileProjectTeamRelation> {
}
package com.liquidnet.client.admin.zhengzai.smile.service;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVPParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVPSParam;
import com.liquidnet.service.goblin.dto.vo.SmileProjectDetailsVo;
import com.liquidnet.service.smile.entity.SmileVolunteersProject;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 志愿者-志愿者项目表 服务类
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface ISmileVolunteersProjectService extends IService<SmileVolunteersProject> {
//活动列表
List<SmileVolunteersProject> list(SmileVPSParam param);
//活动添加
AjaxResult insertData(SmileVPParam param);
//活动修改
AjaxResult updateData(SmileVPParam param);
//活动详情
SmileProjectDetailsVo details(String projectId);
//活动状态修改
AjaxResult updateStatus(String projectId,Integer status);
}
package com.liquidnet.client.admin.zhengzai.smile.service;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVSParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.VolunteersExportVo;
import com.liquidnet.service.goblin.dto.vo.SmileVolunteersDetailsVo;
import com.liquidnet.service.smile.entity.SmileVolunteers;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 志愿者-志愿者表 服务类
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface ISmileVolunteersService extends IService<SmileVolunteers> {
//志愿者列表
List<SmileVolunteers> list(SmileVSParam param);
//志愿者审核
AjaxResult audit(String projectId, String uid, String teamId, Integer status);
//志愿者详情详情
SmileVolunteersDetailsVo details(String mid);
List<VolunteersExportVo> volunteersExport(SmileVSParam param);
}
package com.liquidnet.client.admin.zhengzai.smile.service;
import com.liquidnet.service.smile.entity.SmileVolunteersTeamRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 志愿者-项目职责组志愿者关系 服务类
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface ISmileVolunteersTeamRelationService extends IService<SmileVolunteersTeamRelation> {
}
package com.liquidnet.client.admin.zhengzai.smile.service;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVTSParam;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 志愿者-项目职责组表 服务类
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface ISmileVolunteersTeamService extends IService<SmileVolunteersTeam> {
//组列表
List<SmileVolunteersTeam> list(SmileVTSParam param);
//组添加
AjaxResult insertData(SmileVolunteersTeam bean);
//组修改
AjaxResult updateData(SmileVolunteersTeam bean);
//组详情
SmileVolunteersTeam details(String teamId);
//组搜索
AjaxResult search(String title);
//根据活动id获取关联组
AjaxResult getListByProjectId(String projectId);
}
package com.liquidnet.client.admin.zhengzai.smile.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVPParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVPSParam;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersProjectService;
import com.liquidnet.client.admin.zhengzai.smile.utils.SmileRedisUtils;
import com.liquidnet.service.goblin.dto.vo.SmileProjectDetailsVo;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.smile.entity.SmileProjectTeamRelation;
import com.liquidnet.service.smile.entity.SmileVolunteersProject;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import com.liquidnet.service.smile.mapper.SmileProjectTeamRelationMapper;
import com.liquidnet.service.smile.mapper.SmileVolunteersProjectMapper;
import com.liquidnet.service.smile.mapper.SmileVolunteersTeamMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
@Slf4j
@Service
public class SmileVolunteersProjectServiceImpl extends ServiceImpl<SmileVolunteersProjectMapper, SmileVolunteersProject> implements ISmileVolunteersProjectService {
@Autowired
SmileVolunteersProjectMapper volunteersProjectMapper;
@Autowired
SmileProjectTeamRelationMapper projectTeamRelationMapper;
@Autowired
SmileVolunteersTeamMapper volunteersTeamMapper;
@Autowired
SmileRedisUtils redisUtils;
@Override
public List<SmileVolunteersProject> list(SmileVPSParam param) {
try {
TableDataInfo rspData = new TableDataInfo();
LambdaQueryWrapper<SmileVolunteersProject> wrappers = Wrappers.lambdaQuery(SmileVolunteersProject.class);
if (param.getTitle() != null && !param.getTitle().equals("")) {
wrappers.like(SmileVolunteersProject::getTitle, param.getTitle());
}
wrappers.orderByDesc(SmileVolunteersProject::getCreatedAt);
List<SmileVolunteersProject> data = volunteersProjectMapper.selectList(wrappers);
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public AjaxResult insertData(SmileVPParam param) {
LambdaQueryWrapper<SmileVolunteersProject> wrappers = Wrappers.lambdaQuery(SmileVolunteersProject.class);
wrappers.eq(SmileVolunteersProject::getTitle, param.getTitle());
List<SmileVolunteersProject> dataList = volunteersProjectMapper.selectList(wrappers);
if (dataList.size() > 0) {
return AjaxResult.error("活动名称重复");
}
param.setProjectId(IDGenerator.nextTimeId2());
LocalDateTime now = LocalDateTime.now();
List<SmileVolunteersTeam> teamList = new ArrayList<>();
SmileVolunteersProject data = copySmileVolunteersProject(param, now, null);
int count = volunteersProjectMapper.insert(data);
for (String teamId : param.getTeamIdArray().split(",")) {
SmileProjectTeamRelation smileProjectTeamRelation = SmileProjectTeamRelation.getNew();
smileProjectTeamRelation.setProjectId(param.getProjectId());
smileProjectTeamRelation.setTeamId(teamId);
smileProjectTeamRelation.setCreatedAt(now);
SmileVolunteersTeam volunteersTeam = SmileVolunteersTeam.getNew();
volunteersTeam.setTeamId(teamId);
teamList.add(volunteersTeam);
projectTeamRelationMapper.insert(smileProjectTeamRelation);
}
if (count > 0) {
redisUtils.setProject(param.getProjectId(), SmileProjectDetailsVo.getNew().copy(data, teamList));
redisUtils.addProjectId(param.getProjectId());
return AjaxResult.success("添加成功");
}
return AjaxResult.error("添加失败");
}
@Override
public AjaxResult updateData(SmileVPParam param) {
LocalDateTime now = LocalDateTime.now();
List<SmileVolunteersTeam> teamList = new ArrayList<>();
LambdaQueryWrapper<SmileVolunteersProject> wrappers = Wrappers.lambdaQuery(SmileVolunteersProject.class);
wrappers.eq(SmileVolunteersProject::getTitle, param.getTitle());
List<SmileVolunteersProject> dataList = volunteersProjectMapper.selectList(wrappers);
for (SmileVolunteersProject data : dataList) {
if (!data.getProjectId().equals(param.getProjectId()) && data.getTitle().equals(param.getTitle())) {
return AjaxResult.error("项目名称重复不可修改");
}
}
SmileVolunteersProject data = copySmileVolunteersProject(param, null, now);
int count = volunteersProjectMapper.update(data, Wrappers.lambdaQuery(SmileVolunteersProject.class).eq(SmileVolunteersProject::getProjectId, param.getProjectId()));
//删除所有关联关系
projectTeamRelationMapper.delete(Wrappers.lambdaQuery(SmileProjectTeamRelation.class).eq(SmileProjectTeamRelation::getProjectId, param.getProjectId()));
for (String teamId : param.getTeamIdArray().split(",")) {
SmileProjectTeamRelation smileProjectTeamRelation = SmileProjectTeamRelation.getNew();
smileProjectTeamRelation.setProjectId(param.getProjectId());
smileProjectTeamRelation.setTeamId(teamId);
smileProjectTeamRelation.setCreatedAt(now);
SmileVolunteersTeam volunteersTeam = SmileVolunteersTeam.getNew();
volunteersTeam.setTeamId(teamId);
teamList.add(volunteersTeam);
projectTeamRelationMapper.insert(smileProjectTeamRelation);
}
if (count > 0) {
redisUtils.setProject(param.getProjectId(), SmileProjectDetailsVo.getNew().copy(data, teamList));
return AjaxResult.success("修改成功");
}
return AjaxResult.error("修改失败");
}
@Override
public SmileProjectDetailsVo details(String projectId) {
LambdaQueryWrapper<SmileVolunteersProject> wrappers = Wrappers.lambdaQuery(SmileVolunteersProject.class);
wrappers.eq(SmileVolunteersProject::getProjectId, projectId);
SmileVolunteersProject data = volunteersProjectMapper.selectOne(wrappers);
//获取 活动 组 关系
List<String> teamIdList = projectTeamRelationMapper.selectList(Wrappers.lambdaQuery(SmileProjectTeamRelation.class).eq(SmileProjectTeamRelation::getProjectId, projectId)).stream().map(SmileProjectTeamRelation::getTeamId).collect(Collectors.toList());
//获取 关联组详情
List<SmileVolunteersTeam> smileVolunteersTeamList = volunteersTeamMapper.selectList(Wrappers.lambdaQuery(SmileVolunteersTeam.class).in(SmileVolunteersTeam::getTeamId, teamIdList));
//构建返回数据
return SmileProjectDetailsVo.getNew().copy(data, smileVolunteersTeamList);
}
@Override
public AjaxResult updateStatus(String projectId, Integer status) {
LambdaQueryWrapper<SmileVolunteersProject> wrappers = Wrappers.lambdaQuery(SmileVolunteersProject.class);
SmileVolunteersProject smileVolunteersProject = SmileVolunteersProject.getNew();
smileVolunteersProject.setStatus(status);
volunteersProjectMapper.update(smileVolunteersProject, wrappers.eq(SmileVolunteersProject::getProjectId, projectId));
if(status==1){
redisUtils.addProjectId(projectId);
}else{
redisUtils.delProjectId(projectId);
}
return AjaxResult.success("修改成功");
}
private SmileVolunteersProject copySmileVolunteersProject(SmileVPParam source, LocalDateTime ct, LocalDateTime ut) {
SmileVolunteersProject smileVolunteersProject = SmileVolunteersProject.getNew();
smileVolunteersProject.setProjectId(source.getProjectId());
smileVolunteersProject.setTitle(source.getTitle());
smileVolunteersProject.setTimeStart(LocalDateTime.parse(source.getTimeStart(), DTF_YMD_HMS));
smileVolunteersProject.setTimeEnd(LocalDateTime.parse(source.getTimeEnd(), DTF_YMD_HMS));
smileVolunteersProject.setAddress(source.getAddress());
smileVolunteersProject.setIntroduce(source.getIntroduce());
smileVolunteersProject.setImg(source.getImg());
if (ct != null) {
smileVolunteersProject.setCreatedAt(ct);
}
if (ut != null) {
smileVolunteersProject.setUpdatedAt(ut);
}
return smileVolunteersProject;
}
}
package com.liquidnet.client.admin.zhengzai.smile.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVSParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.VolunteersExportVo;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersService;
import com.liquidnet.service.goblin.dto.vo.SmileVolunteersDetailsVo;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.smile.entity.*;
import com.liquidnet.service.smile.entity.dto.VolunteersExportDto;
import com.liquidnet.service.smile.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@Slf4j
@Service
public class SmileVolunteersServiceImpl extends ServiceImpl<SmileVolunteersMapper, SmileVolunteers> implements ISmileVolunteersService {
@Autowired
SmileVolunteersMapper volunteersMapper;
@Autowired
SmileVolunteersProjectMapper volunteersProjectMapper;
@Autowired
SmileVolunteersTeamMapper volunteersTeamMapper;
@Autowired
SmileVolunteersTeamRelationMapper volunteersTeamRelationMapper;
@Override
public List<SmileVolunteers> list(SmileVSParam param) {
try {
LambdaQueryWrapper<SmileVolunteers> wrappers = Wrappers.lambdaQuery(SmileVolunteers.class);
if (param.getTitle() != null && !param.getTitle().equals("")) {
List<String> projectIdArray = volunteersProjectMapper.selectList(Wrappers.lambdaQuery(SmileVolunteersProject.class).like(SmileVolunteersProject::getTitle, param.getTitle())).stream().map(SmileVolunteersProject::getProjectId).collect(Collectors.toList());
wrappers.in(SmileVolunteers::getProjectId, projectIdArray);
}
if (param.getTeam() != null && !param.getTeam().equals("")) {
SmileVolunteersTeam smileVolunteersTeam = volunteersTeamMapper.selectOne(Wrappers.lambdaQuery(SmileVolunteersTeam.class).eq(SmileVolunteersTeam::getName, param.getTeam()));
if (smileVolunteersTeam != null) {
wrappers.and(
i -> i.eq(SmileVolunteers::getTeamId1, smileVolunteersTeam.getTeamId())
.or().eq(SmileVolunteers::getTeamId2, smileVolunteersTeam.getTeamId())
.or().eq(SmileVolunteers::getTeamId3, smileVolunteersTeam.getTeamId())
);
}
}
if (param.getName() != null && !param.getName().equals("")) {
wrappers.eq(SmileVolunteers::getName, param.getName());
}
if (param.getPhone() != null && !param.getPhone().equals("")) {
wrappers.eq(SmileVolunteers::getPhone, param.getPhone());
}
if (param.getStatus() != null && !param.getStatus().equals(-1)) {
wrappers.eq(SmileVolunteers::getStatus, param.getStatus());
}
List<SmileVolunteers> data = volunteersMapper.selectList(wrappers.orderByDesc(SmileVolunteers::getCreatedAt));
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public AjaxResult audit(String projectId, String uid, String teamId, Integer status) {
try {
LambdaQueryWrapper<SmileVolunteers> wrappers = Wrappers.lambdaQuery(SmileVolunteers.class).eq(SmileVolunteers::getProjectId, projectId).eq(SmileVolunteers::getUid, uid);
SmileVolunteers bean = volunteersMapper.selectOne(wrappers);
if (bean != null && !bean.getStatus().equals(0)) {
return AjaxResult.warn("已审核");
}
//审核
SmileVolunteers smileVolunteers = SmileVolunteers.getNew();
smileVolunteers.setStatus(status);
volunteersMapper.update(smileVolunteers, wrappers);
//添加组
SmileVolunteersTeamRelation smileVolunteersTeamRelation = SmileVolunteersTeamRelation.getNew();
smileVolunteersTeamRelation.setTeamId(teamId);
smileVolunteersTeamRelation.setProjectId(projectId);
smileVolunteersTeamRelation.setUid(uid);
smileVolunteersTeamRelation.setCreatedAt(LocalDateTime.now());
volunteersTeamRelationMapper.insert(smileVolunteersTeamRelation);
} catch (Exception e) {
e.printStackTrace();
AjaxResult.warn("审核失败");
}
return AjaxResult.success("审核完成");
}
@Override
public SmileVolunteersDetailsVo details(String mid) {
SmileVolunteers bean = volunteersMapper.selectOne(Wrappers.lambdaQuery(SmileVolunteers.class).eq(SmileVolunteers::getMid, mid));
ArrayList<String> teamIdArray = CollectionUtil.arrayListString();
if (bean == null) {
return null;
} else if (bean.getStatus().equals(0) || bean.getStatus().equals(2)) {//未审核通过显示用户的选择的组
if (bean.getTeamId1() != null && !bean.getTeamId1().equals("")) {
teamIdArray.add(bean.getTeamId1());
}
if (bean.getTeamId2() != null && !bean.getTeamId2().equals("")) {
teamIdArray.add(bean.getTeamId2());
}
if (bean.getTeamId3() != null && !bean.getTeamId3().equals("")) {
teamIdArray.add(bean.getTeamId3());
}
} else if (bean.getStatus().equals(1)) {//审核通过 显示分配的组
List<String> teamIds = volunteersTeamRelationMapper.selectList(Wrappers.lambdaQuery(SmileVolunteersTeamRelation.class).eq(SmileVolunteersTeamRelation::getProjectId, bean.getProjectId()).eq(SmileVolunteersTeamRelation::getUid, bean.getUid()))
.stream().map(SmileVolunteersTeamRelation::getTeamId).collect(Collectors.toList());
teamIdArray.addAll(teamIds);
} else {
return null;
}
//获取 组内容
List<SmileVolunteersTeam> volunteersTeamList = volunteersTeamMapper.selectList(Wrappers.lambdaQuery(SmileVolunteersTeam.class).in(SmileVolunteersTeam::getTeamId, teamIdArray));
if (volunteersTeamList == null || volunteersTeamList.size() == 0) {
return null;
}
//获取 活动名称
SmileVolunteersProject volunteersProject = volunteersProjectMapper.selectOne(Wrappers.lambdaQuery(SmileVolunteersProject.class).in(SmileVolunteersProject::getProjectId, bean.getProjectId()));
if (volunteersProject == null) {
return null;
}
SmileVolunteersDetailsVo vo = SmileVolunteersDetailsVo.getNew().copy(bean, volunteersTeamList, volunteersProject.getTitle());
return vo;
}
@Override
public List<VolunteersExportVo> volunteersExport(SmileVSParam param) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("name", param.getName());
map.put("phone", param.getPhone());
map.put("team", param.getTeam());
map.put("title", param.getTitle());
map.put("status", param.getStatus() + "");
List<VolunteersExportDto> dtoList = volunteersMapper.expertVolunteer(map);
List<VolunteersExportVo> voList = new ArrayList();
for (VolunteersExportDto dto : dtoList) {
VolunteersExportVo vo = VolunteersExportVo.getNew().copy(dto);
voList.add(vo);
}
return voList;
}
}
package com.liquidnet.client.admin.zhengzai.smile.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileVTSParam;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileVolunteersTeamService;
import com.liquidnet.client.admin.zhengzai.smile.utils.SmileRedisUtils;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.smile.entity.SmileProjectTeamRelation;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import com.liquidnet.service.smile.mapper.SmileProjectTeamRelationMapper;
import com.liquidnet.service.smile.mapper.SmileVolunteersTeamMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
public class SmileVolunteersTeamServiceImpl extends ServiceImpl<SmileVolunteersTeamMapper, SmileVolunteersTeam> implements ISmileVolunteersTeamService {
@Autowired
SmileVolunteersTeamMapper volunteersTeamMapper;
@Autowired
SmileProjectTeamRelationMapper projectTeamRelationMapper;
@Autowired
SmileRedisUtils redisUtils;
@Override
public List<SmileVolunteersTeam> list(SmileVTSParam param) {
try {
TableDataInfo rspData = new TableDataInfo();
LambdaQueryWrapper<SmileVolunteersTeam> wrappers = Wrappers.lambdaQuery(SmileVolunteersTeam.class);
if (param.getTitle() != null && !param.getTitle().equals("")) {
wrappers.like(SmileVolunteersTeam::getName, param.getTitle());
}
wrappers.orderByDesc(SmileVolunteersTeam::getCreatedAt);
List<SmileVolunteersTeam> data = volunteersTeamMapper.selectList(wrappers);
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public AjaxResult insertData(SmileVolunteersTeam bean) {
LambdaQueryWrapper<SmileVolunteersTeam> wrappers = Wrappers.lambdaQuery(SmileVolunteersTeam.class);
wrappers.eq(SmileVolunteersTeam::getName, bean.getName());
List<SmileVolunteersTeam> dataList = volunteersTeamMapper.selectList(wrappers);
if (dataList.size() > 0) {
return AjaxResult.error("职责组名称重复");
}
bean.setTeamId(IDGenerator.nextTimeId2());
int count = volunteersTeamMapper.insert(bean);
if (count > 0) {
redisUtils.setTeam(bean.getTeamId(), bean);
return AjaxResult.success("添加成功");
}
return AjaxResult.error("添加失败");
}
@Override
public AjaxResult updateData(SmileVolunteersTeam bean) {
LambdaQueryWrapper<SmileVolunteersTeam> wrappers = Wrappers.lambdaQuery(SmileVolunteersTeam.class);
wrappers.eq(SmileVolunteersTeam::getName, bean.getName());
List<SmileVolunteersTeam> dataList = volunteersTeamMapper.selectList(wrappers);
for (SmileVolunteersTeam data : dataList) {
if (!data.getTeamId().equals(bean.getTeamId()) && data.getName().equals(bean.getName())) {
return AjaxResult.error("职责组名称重复不可修改");
}
}
bean.setUpdatedAt(LocalDateTime.now());
int count = volunteersTeamMapper.update(bean, Wrappers.lambdaQuery(SmileVolunteersTeam.class).eq(SmileVolunteersTeam::getTeamId, bean.getTeamId()));
if (count > 0) {
redisUtils.setTeam(bean.getTeamId(), bean);
return AjaxResult.success("修改成功");
}
return AjaxResult.error("修改失败");
}
@Override
public SmileVolunteersTeam details(String teamId) {
LambdaQueryWrapper<SmileVolunteersTeam> wrappers = Wrappers.lambdaQuery(SmileVolunteersTeam.class);
wrappers.eq(SmileVolunteersTeam::getTeamId, teamId);
SmileVolunteersTeam data = volunteersTeamMapper.selectOne(wrappers);
return data;
}
@Override
public AjaxResult search(String title) {
LambdaQueryWrapper<SmileVolunteersTeam> wrappers = Wrappers.lambdaQuery(SmileVolunteersTeam.class);
wrappers.select(SmileVolunteersTeam::getTeamId, SmileVolunteersTeam::getName, SmileVolunteersTeam::getIntroduce);
wrappers.like(SmileVolunteersTeam::getName, title);
List<SmileVolunteersTeam> beanList = volunteersTeamMapper.selectList(wrappers);
AjaxResult ajax = new AjaxResult();
ajax.put("value", beanList);
return ajax;
}
@Override
public AjaxResult getListByProjectId(String projectId) {
//获取 活动 组 关系
List<String> teamIdList = projectTeamRelationMapper.selectList(Wrappers.lambdaQuery(SmileProjectTeamRelation.class).eq(SmileProjectTeamRelation::getProjectId, projectId)).stream().map(SmileProjectTeamRelation::getTeamId).collect(Collectors.toList());
//获取 关联组详情
List<SmileVolunteersTeam> beanList = volunteersTeamMapper.selectList(Wrappers.lambdaQuery(SmileVolunteersTeam.class).in(SmileVolunteersTeam::getTeamId, teamIdList));
AjaxResult ajax = new AjaxResult();
ajax.put("value", beanList);
return ajax;
}
}
......@@ -34,7 +34,7 @@ public final class RedisUtil extends AbstractRedisUtil{
public static void main(String[] args) {
String[] keys = {
"smile:user1013431194887946248794794",
"kylin:member:uid:809406",
};
for (String key : keys) {
long value = key.hashCode();
......
......@@ -101,7 +101,8 @@ global-auth:
- ${liquidnet.info.context}/v2/api-docs*
- ${liquidnet.info.context}/inner/**
- ${liquidnet.info.context}/frontNoLogin/**
- ${liquidnet.info.context}/volunteers/project/list
- ${liquidnet.info.context}/volunteers/project/details
oncheck-url-pattern:
-
......
package com.liquidnet.service.smile.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 志愿者-项目关联职责表
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileProjectTeamRelation implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 活动id
*/
private String projectId;
/**
* 职责组id
*/
private String teamId;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SmileProjectTeamRelation obj = new SmileProjectTeamRelation();
public static SmileProjectTeamRelation getNew() {
try {
return (SmileProjectTeamRelation) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileProjectTeamRelation();
}
}
}
package com.liquidnet.service.smile.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 志愿者-志愿者表
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileVolunteers implements Serializable ,Cloneable{
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 用户id
*/
private String uid;
/**
* 活动id
*/
private String projectId;
/**
* 姓名
*/
private String name;
/**
* 头像
*/
private String img;
/**
* 证件号
*/
private String idCard;
/**
* 性别[0-未知|1-男|2-女]
*/
private Integer sex;
/**
* 状态[0-待审核|1-审核通过|2-审核未通过]
*/
private Integer status;
/**
* 学校
*/
private String school;
/**
* 学校地址
*/
private String schoolAddress;
/**
* 专长
*/
private String specialty;
/**
* 特长
*/
private String specialty2;
/**
* 手机号
*/
private String phone;
/**
* 微信号
*/
private String wxNum;
/**
* 申请组ID-1
*/
private String teamId1;
/**
* 申请组ID-2
*/
private String teamId2;
/**
* 申请组ID-3
*/
private String teamId3;
/**
* 自我介绍
*/
private String introduce;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SmileVolunteers obj = new SmileVolunteers();
public static SmileVolunteers getNew() {
try {
return (SmileVolunteers) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteers();
}
}
}
package com.liquidnet.service.smile.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 志愿者-志愿者项目表
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileVolunteersProject implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 活动id
*/
private String projectId;
/**
* 项目名称
*/
private String title;
/**
* 开始时间
*/
private LocalDateTime timeStart;
/**
* 结束时间
*/
private LocalDateTime timeEnd;
/**
* 活动地址
*/
private String address;
/**
* 活动介绍
*/
private String introduce;
/**
* 封面图
*/
private String img;
/**
* 状态[1-上线|0-下线]
*/
private Integer status;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SmileVolunteersProject obj = new SmileVolunteersProject();
public static SmileVolunteersProject getNew() {
try {
return (SmileVolunteersProject) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteersProject();
}
}
}
package com.liquidnet.service.smile.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 志愿者-项目职责组表
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileVolunteersTeam implements Serializable,Cloneable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 职责组id
*/
private String teamId;
/**
* 组名称
*/
private String name;
/**
* 组介绍
*/
private String introduce;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SmileVolunteersTeam obj = new SmileVolunteersTeam();
public static SmileVolunteersTeam getNew() {
try {
return (SmileVolunteersTeam) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteersTeam();
}
}
}
package com.liquidnet.service.smile.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 志愿者-项目职责组志愿者关系
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SmileVolunteersTeamRelation implements Serializable,Cloneable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 活动id
*/
private String projectId;
/**
* 职责组id
*/
private String teamId;
/**
* 用户id
*/
private String uid;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SmileVolunteersTeamRelation obj = new SmileVolunteersTeamRelation();
public static SmileVolunteersTeamRelation getNew() {
try {
return (SmileVolunteersTeamRelation) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmileVolunteersTeamRelation();
}
}
}
package com.liquidnet.service.smile.entity.dto;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class VolunteersExportDto implements Serializable, Cloneable{
private String name;
private String idCard;
private String sex;
private String status;
private String school;
private String schoolAddress;
private String phone;
private String projectName;
private LocalDateTime createdAt;
private String specialty;
private String specialty2;
private String team1;
private String team2;
private String team3;
private String introduce;
private static final VolunteersExportDto obj = new VolunteersExportDto();
public static VolunteersExportDto getNew() {
try {
return (VolunteersExportDto) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new VolunteersExportDto();
}
}
package com.liquidnet.service.smile.mapper;
import com.liquidnet.service.smile.entity.SmileProjectTeamRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 志愿者-项目关联职责表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface SmileProjectTeamRelationMapper extends BaseMapper<SmileProjectTeamRelation> {
}
package com.liquidnet.service.smile.mapper;
import com.liquidnet.service.smile.entity.SmileVolunteers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.smile.entity.dto.VolunteersExportDto;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 志愿者-志愿者表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface SmileVolunteersMapper extends BaseMapper<SmileVolunteers> {
List<VolunteersExportDto> expertVolunteer(HashMap<String, String> param);
}
package com.liquidnet.service.smile.mapper;
import com.liquidnet.service.smile.entity.SmileVolunteersProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 志愿者-志愿者项目表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface SmileVolunteersProjectMapper extends BaseMapper<SmileVolunteersProject> {
void getDetailsById(String projectId);
}
package com.liquidnet.service.smile.mapper;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 志愿者-项目职责组表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface SmileVolunteersTeamMapper extends BaseMapper<SmileVolunteersTeam> {
}
package com.liquidnet.service.smile.mapper;
import com.liquidnet.service.smile.entity.SmileVolunteersTeamRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 志愿者-项目职责组志愿者关系 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2022-04-01
*/
public interface SmileVolunteersTeamRelationMapper extends BaseMapper<SmileVolunteersTeamRelation> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.smile.mapper.SmileProjectTeamRelationMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.smile.mapper.SmileVolunteersMapper">
<resultMap id="volunteersExportDto" type="com.liquidnet.service.smile.entity.dto.VolunteersExportDto">
<result column="name" property="name"/>
<result column="id_card" property="idCard"/>
<result column="sex" property="sex"/>
<result column="status" property="status"/>
<result column="school" property="school"/>
<result column="school_address" property="schoolAddress"/>
<result column="phone" property="phone"/>
<result column="project_name" property="projectName"/>
<result column="created_at" property="createdAt"/>
<result column="specialty" property="specialty"/>
<result column="specialty2" property="specialty2"/>
<result column="team1Name" property="team1"/>
<result column="team2Name" property="team2"/>
<result column="team3Name" property="team3"/>
<result column="introduce" property="introduce"/>
</resultMap>
<select id="expertVolunteer" parameterType="java.util.Map" resultMap="volunteersExportDto">
select sv.name,
id_card,
(CASE
WHEN sex = 0 THEN '未知'
WHEN sex = 1 THEN '男'
WHEN sex = 2 THEN '女'
ELSE '其他' END) as 'sex',
(CASE
WHEN sv.status = 0 THEN '待审核'
WHEN sv.status = 1 THEN '审核通过'
WHEN sv.status = 2 THEN '审核拒绝'
ELSE '其他' END) as 'status',
school,
school_address,
phone,
svp.title as 'project_name',
sv.created_at,
specialty,
specialty2,
svt1.name as 'team1Name',
svt2.name as 'team2Name',
svt3.name as 'team3Name',
sv.introduce
from smile_volunteers as sv
inner join smile_volunteers_project as svp on svp.project_id = sv.project_id
left join smile_volunteers_team as svt1 on svt1.team_id = sv.team_id1
left join smile_volunteers_team as svt2 on svt2.team_id = sv.team_id2
left join smile_volunteers_team as svt3 on svt3.team_id = sv.team_id3
<where>
<if test="title!=''">
AND svp.title like concat('%',#{title},'%')
</if>
<if test="name!=''">
AND sv.name like concat('%',#{name},'%')
</if>
<if test="phone!=''">
AND phone like concat('%',#{phone},'%')
</if>
<if test="status!='-1'">
AND sv.status = #{status}
</if>
<if test="team!=''">
AND (svt1.name = #{team} OR svt2.name = #{team} OR svt3.name = #{team})
</if>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.smile.mapper.SmileVolunteersProjectMapper">
<select id="selectUserList" resultType="com.liquidnet.service.smile.entity.SmileUser">
select * from smile_user
<where>
del_tag = 0 AND type != 0 AND type != 3 AND type != 4
<if test="phone!='' and phone !=null">
AND phone Like concat('%',#{phone},'%')
</if>
</where>
ORDER BY id desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.smile.mapper.SmileVolunteersTeamMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.smile.mapper.SmileVolunteersTeamRelationMapper">
</mapper>
......@@ -32,8 +32,11 @@ public class GoblinInnerServiceImpl implements IGoblinInnerService {
@Override
public ResponseDto<String> insertCoupon(MultipartFile file, String performanceId) {
try {
EasyExcel.read(file.getInputStream(), TempCouponDto.class, new PageReadListener<TempCouponDto>(dataList -> {
if(file!=null){
redisUtils.delMarketTempCoupon(performanceId);
}
redisUtils.delMarketTempCoupon(performanceId);
EasyExcel.read(file.getInputStream(), TempCouponDto.class, new PageReadListener<TempCouponDto>(dataList -> {
for (TempCouponDto data : dataList) {
if (data.getSpuId() == null) {
continue;
......
DROP TABLE IF EXISTS `smile_volunteers`;
CREATE TABLE `smile_volunteers`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`uid` varchar(64) DEFAULT '' COMMENT '用户id',
`project_id` varchar(64) DEFAULT '' COMMENT '活动id',
`name` varchar(32) DEFAULT '' COMMENT '姓名',
`img` varchar(256) DEFAULT '' COMMENT '头像',
`id_card` varchar(32) DEFAULT '' COMMENT '证件号',
`sex` tinyint(2) DEFAULT 0 COMMENT '性别[0-未知|1-男|2-女]',
`status` tinyint(2) DEFAULT 0 COMMENT '状态[0-待审核|1-审核通过|2-审核未通过]',
`school` varchar(64) DEFAULT '' COMMENT '学校',
`school_address` varchar(64) DEFAULT '' COMMENT '学校地址',
`specialty` varchar(32) DEFAULT '' COMMENT '专长',
`specialty2` varchar(32) DEFAULT '' COMMENT '特长',
`phone` varchar(16) DEFAULT '' COMMENT '手机号',
`wx_num` varchar(64) DEFAULT '' COMMENT '微信号',
`team_id1` varchar(64) DEFAULT '' COMMENT '申请组ID-1',
`team_id2` varchar(64) DEFAULT '' COMMENT '申请组ID-2',
`team_id3` varchar(64) DEFAULT '' COMMENT '申请组ID-3',
`introduce` varchar(500) DEFAULT '' COMMENT '自我介绍',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '志愿者-志愿者表'
ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `smile_volunteers_project`;
CREATE TABLE `smile_volunteers_project`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`project_id` varchar(64) DEFAULT '' COMMENT '活动id',
`title` varchar(64) DEFAULT '' COMMENT '项目名称',
`time_start` datetime DEFAULT NULL COMMENT '开始时间',
`time_end` datetime DEFAULT NULL COMMENT '结束时间',
`address` varchar(256) DEFAULT '' COMMENT '活动地址',
`introduce` varchar(1028) DEFAULT '' COMMENT '活动介绍',
`img` varchar(256) DEFAULT '' COMMENT '封面图',
`status` tinyint(2) DEFAULT 1 COMMENT '状态[1-上线|0-下线]',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '志愿者-志愿者项目表'
ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `smile_project_team_relation`;
CREATE TABLE `smile_project_team_relation`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`project_id` varchar(64) DEFAULT '' COMMENT '活动id',
`team_id` varchar(64) DEFAULT '' COMMENT '职责组id',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '志愿者-项目关联职责表'
ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `smile_volunteers_team`;
CREATE TABLE `smile_volunteers_team`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`team_id` varchar(64) DEFAULT '' COMMENT '职责组id',
`name` varchar(64) DEFAULT '' COMMENT '组名称',
`introduce` varchar(512) DEFAULT '' COMMENT '组介绍',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '志愿者-项目职责组表'
ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `smile_volunteers_team_relation`;
CREATE TABLE `smile_volunteers_team_relation`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`project_id` varchar(64) DEFAULT '' COMMENT '活动id',
`team_id` varchar(64) DEFAULT '' COMMENT '职责组id',
`uid` varchar(64) DEFAULT '' COMMENT '用户id',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '志愿者-项目职责组志愿者关系'
ROW_FORMAT = DYNAMIC;
\ No newline at end of file
......@@ -11,6 +11,7 @@ import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.service.manage.SmileFrontService;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.util.SmileRedisUtils;
import com.liquidnet.service.util.Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -39,7 +40,7 @@ public class SmileUserController {
@Autowired
private SmileFrontService smileFrontService;
@Autowired
private MongoTemplate mongoTemplate;
private Utils utils;
@GetMapping("getUser")
@ApiOperation("获取用户状态,如果没查到,则返回null")
......@@ -147,7 +148,7 @@ public class SmileUserController {
}
if(StringUtil.isNotBlank(smileUserVO.getIdCard())&&StringUtil.isNotBlank(smileUserVO.getName())){
String userId = CurrentUtil.getCurrentUid();
if(validate(smileUserVO.getName(),smileUserVO.getIdCard(),userId)){
if(utils.validate(smileUserVO.getName(),smileUserVO.getIdCard())){
smileUserVO.setUid(userId);
SmileUserVO smileUserVORedis=smileRedisUtils.getSmileUserVo(userId);
if(null!=smileUserVORedis&&null!=smileUserVORedis.getType()&&(smileUserVORedis.getType()==1||smileUserVORedis.getType()==2)){
......@@ -162,24 +163,7 @@ public class SmileUserController {
return ResponseDto.success();
}
public boolean validate(String realName,String cardNo,String userid){
//查看是否之前这个 身份证和 名字(1:验证失败 2:验证成功)
String status= smileRedisUtils.getValidate(realName,cardNo);
if(null!=status&&"1".equals(status)){
return false;
}
String respStr = IdentityUtils.aliThird(realName, cardNo), respErrorCode = null;
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respErrorCode = String.valueOf(respJNode.get("error_code")))) {
log.info("###实名认证失败[{}]", respJNode);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
smileRedisUtils.setValidate(realName,cardNo,"1");
return false;
}
smileRedisUtils.setValidate(realName,cardNo,"2");
return true;
}
@PostMapping("saveOrUpdateUserThreeStep")
@ApiOperation("增加或者删除第三步")
public ResponseDto saveOrUpdateUserThreeStep(@Validated(SmileUserVO.saveThree.class) @RequestBody SmileUserVO smileUserVO, MethodArgumentNotValidException exception) {
......
package com.liquidnet.service.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.SmileVProjectListVo;
import com.liquidnet.service.goblin.dto.vo.SmileVProjectVo;
import com.liquidnet.service.goblin.param.SmileVolunteersApplyParam;
import com.liquidnet.service.goblin.service.manage.SmileVolunteersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author zhangfuxin
* @Description:用户接口
* @date 2021/12/27 下午6:25
*/
@Api(tags = "志愿者相关接口")
@RestController
@RequestMapping("/volunteers")
@Slf4j
public class SmileVolunteersController {
@Autowired
SmileVolunteersService volunteersService;
@PostMapping("/project/list")
@ApiOperation("活动列表")
public ResponseDto<List<SmileVProjectListVo>> projectList(String uid) {
return volunteersService.projectList(uid);
}
@PostMapping("/project/details")
@ApiOperation("活动详情")
public ResponseDto<SmileVProjectVo> projectDetails(String uid, String projectId) {
return volunteersService.projectDetails(uid, projectId);
}
@PostMapping("apply")
@ApiOperation("活动报名")
public ResponseDto<Boolean> apply(@RequestBody SmileVolunteersApplyParam param) {
return volunteersService.apply(param);
}
}
package com.liquidnet.service.service.impl;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.SmileVolunteersApplyParam;
import com.liquidnet.service.goblin.service.manage.SmileFrontService;
import com.liquidnet.service.goblin.service.manage.SmileVolunteersService;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import com.liquidnet.service.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
@Service
@Slf4j
public class SmileVolunteerServerImpl implements SmileVolunteersService {
@Autowired
private SmileRedisUtils smileRedisUtils;
@Autowired
QueueUtils queueUtils;
@Autowired
Utils utils;
@Override
public ResponseDto<List<SmileVProjectListVo>> projectList(String uid) {
List<SmileVProjectListVo> voList = ObjectUtil.smileVProjectListVoList();
List<String> projectIds = smileRedisUtils.getProjectId();
for (String projectId : projectIds) {
SmileProjectDetailsVo redisData = smileRedisUtils.getProject(projectId);
ArrayList<String> teamIds = smileRedisUtils.getVolunteers(projectId, uid);
SmileVProjectListVo vo = SmileVProjectListVo.getNew().copy(redisData, teamIds == null ? 0 : 1);
// if (LocalDateTime.now().isBefore(LocalDateTime.parse(vo.getTimeEnd(), DTF_YMD_HMS))) {
voList.add(vo);
// }
}
voList = voList.stream().sorted(Comparator.comparing(SmileVProjectListVo::getTimeStart)).collect(Collectors.toList());
return ResponseDto.success(voList);
}
@Override
public ResponseDto<SmileVProjectVo> projectDetails(String uid, String projectId) {
List<SmileVTeamVo> teamVos = ObjectUtil.smileVTeamVoList();
SmileProjectDetailsVo redisData = smileRedisUtils.getProject(projectId);
ArrayList<String> teamIds = smileRedisUtils.getVolunteers(projectId, uid);
List<SmileVolunteersTeam> beanList = redisData.getTeamArray();
if (beanList != null) {
List<String> projectTeamR = beanList.stream().map(SmileVolunteersTeam::getTeamId).collect(Collectors.toList());
for (String teamId : projectTeamR) {
SmileVolunteersTeam bean = smileRedisUtils.getTeam(teamId);
int checkStatus = 0;
if (teamIds != null) {
checkStatus = teamIds.contains(teamId) ? 1 : 0;
}
SmileVTeamVo teamVo = SmileVTeamVo.getNew().copy(bean, checkStatus);
teamVos.add(teamVo);
}
}
Integer applyStatus = teamIds == null ? 0 : 1;
SmileVProjectVo vo = SmileVProjectVo.getNew().copy(redisData, applyStatus, teamVos);
return ResponseDto.success(vo);
}
@Override
public ResponseDto<Boolean> apply(SmileVolunteersApplyParam param) {
String uid = CurrentUtil.getCurrentUid();
ArrayList<String> teamIds = CollectionUtil.arrayListString();
try {
if (smileRedisUtils.getVolunteers(param.getProjectId(), uid) != null) {
return ResponseDto.failure("该账号已经报名");
}
if (smileRedisUtils.getProjectIdCard(param.getProjectId(), param.getIdCard()) != null) {
return ResponseDto.failure("该证件已经报名");
}
if (!utils.validate(param.getName(), param.getIdCard())) {
return ResponseDto.failure("验证身份证失败!");
}
smileRedisUtils.setProjectIdCard(param.getProjectId(), param.getIdCard());
if (!param.getTeamId1().equals("") && param.getTeamId1() != null) {
teamIds.add(param.getTeamId1());
}
if (!param.getTeamId2().equals("") && param.getTeamId2() != null) {
teamIds.add(param.getTeamId2());
}
if (!param.getTeamId3().equals("") && param.getTeamId3() != null) {
teamIds.add(param.getTeamId3());
}
smileRedisUtils.setVolunteers(param.getProjectId(), uid, teamIds);
queueUtils.sendMsgByRedis(MQConst.SmileQueue.SMILE_USER.getKey(),
SqlMapping.get("smile_volunteers.apply",
uid, param.getProjectId(), param.getName(), param.getImg(),
param.getIdCard(), param.getSex(), param.getSchool(), param.getSchoolAddress(),
param.getSpecialty(), param.getSpecialty2(), param.getPhone(), param.getTeamId1(),
param.getTeamId2(), param.getTeamId3(), param.getIntroduce(), LocalDateTime.now()
));
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.failure();
}
return ResponseDto.success();
}
}
package com.liquidnet.service.util;
import com.liquidnet.service.goblin.dto.vo.SmileVProjectListVo;
import com.liquidnet.service.goblin.dto.vo.SmileVTeamVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import java.util.ArrayList;
import java.util.List;
public class ObjectUtil {
private static final ArrayList<KylinPerformanceVo> kylinPerformanceVoList = new ArrayList<>();
private static final ArrayList<SmileVProjectListVo> smileVProjectListVoList = new ArrayList<>();
private static final ArrayList<SmileVTeamVo> smileVTeamVoList = new ArrayList<>();
public static ArrayList<SmileVTeamVo> smileVTeamVoList(){
return (ArrayList<SmileVTeamVo>) smileVTeamVoList.clone();
}
public static ArrayList<SmileVProjectListVo> smileVProjectListVoList(){
return (ArrayList<SmileVProjectListVo>) smileVProjectListVoList.clone();
}
public static ArrayList<KylinPerformanceVo> kylinPerformanceVoList(){
return (ArrayList<KylinPerformanceVo>) kylinPerformanceVoList.clone();
......
......@@ -17,17 +17,6 @@ public class QueueUtils {
@Autowired
StringRedisTemplate stringRedisTemplate;
/**
* 发送消息 - RABBIT
*
* @param exchange 交换机
* @param routeKey 路径
* @param jsonMsg Json字符串
*/
// public void sendMsgByRabbit(String exchange, String routeKey, String jsonMsg) {
// rabbitTemplate.convertAndSend(exchange, routeKey, jsonMsg);
// }
/**
* 发送消息 - REDIS
*
......@@ -39,23 +28,4 @@ public class QueueUtils {
map.put("message", jsonMsg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(streamKey));
}
/**
* 发送消息 - REDIS [XLS]
*
* @param xlsPath xls 对应的OSS 全量路径
* @param type [1-添加|2-删除]
* @param skuId skuId
*/
public void sendMsgByRedisXls(String xlsPath, String type, String skuId) {
if (xlsPath == null || xlsPath.equals("") || type == null || type.equals("") || skuId == null || skuId.equals("")) {
} else {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", xlsPath);
map.put("type", type);
map.put("skuId", skuId);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(MQConst.GoblinQueue.GOBLIN_XLS_OPERA.getKey()));
}
}
}
package com.liquidnet.service.util;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.goblin.constant.SmileRedisConst;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Slf4j
......@@ -20,40 +23,133 @@ public class SmileRedisUtils {
public void del(String... keys) {
redisUtil.del(keys);
}
/* ---------------------------------------- smileUser ---------------------------------------- */
public SmileUserVO getSmileUserVo(String userId){
public SmileUserVO getSmileUserVo(String userId) {
return (SmileUserVO) redisUtil.get(SmileRedisConst.SMILE_USER.concat(userId));
}
public void setSmileUserVo(String userId,SmileUserVO smileUserVORedis){
redisUtil.set(SmileRedisConst.SMILE_USER.concat(userId),smileUserVORedis);
public void setSmileUserVo(String userId, SmileUserVO smileUserVORedis) {
redisUtil.set(SmileRedisConst.SMILE_USER.concat(userId), smileUserVORedis);
}
/* ---------------------------------------- school ---------------------------------------- */
public List<SmileSchoolVo> getSchool(){
public List<SmileSchoolVo> getSchool() {
return (List<SmileSchoolVo>) redisUtil.get(SmileRedisConst.SMILE_SCHOOL);
}
/* ---------------------------------------- 认证 ---------------------------------------- */
public String getValidate(String realName,String cardNo){
return (String) redisUtil.get(SmileRedisConst.SMILE_USER_VALIDATE.concat(realName+cardNo));
public String getValidate(String realName, String cardNo) {
return (String) redisUtil.get(SmileRedisConst.SMILE_USER_VALIDATE.concat(realName + cardNo));
}
public void setValidate(String realName,String cardNo,String type){
redisUtil.set(SmileRedisConst.SMILE_USER_VALIDATE.concat(realName+cardNo),type);
public void setValidate(String realName, String cardNo, String type) {
redisUtil.set(SmileRedisConst.SMILE_USER_VALIDATE.concat(realName + cardNo), type);
}
/* ---------------------------------------- 销售数据 ---------------------------------------- */
public SmileSellDataVO getSellDataVo(String userId, String performanceId){
public SmileSellDataVO getSellDataVo(String userId, String performanceId) {
return (SmileSellDataVO) redisUtil.get(SmileRedisConst.SELL_DATA.concat(userId).concat(performanceId));
}
/* ---------------------------------------- 佣金明细数据 ---------------------------------------- */
public CommissionVO getCommissionVO(String userId){
public CommissionVO getCommissionVO(String userId) {
return (CommissionVO) redisUtil.get(SmileRedisConst.SELL_DATA_COMMISSION.concat(userId));
}
/* ---------------------------------------- 演出列表数据 ---------------------------------------- */
public String getSmileShow(){
public String getSmileShow() {
return (String) redisUtil.get(SmileRedisConst.SMILE_SHOW);
}
/* ---------------------------------------- 代理数据 ---------------------------------------- */
public SmileAgentVo getSmileAgentVo(String performanceId,String ticketId){
public SmileAgentVo getSmileAgentVo(String performanceId, String ticketId) {
return (SmileAgentVo) redisUtil.get(SmileRedisConst.SMILE_AGENT.concat(performanceId).concat(":").concat(ticketId));
}
/**
* 添加 身份证报名活动
* @param projectId
* @param idCard
*/
public void setProjectIdCard(String projectId, String idCard) {
String rdk = SmileRedisConst.PROJECT_ID_LIST.concat(projectId).concat(":idCard:").concat(idCard);
redisUtil.set(rdk, 1);
}
/**
* 添加 身份证报名活动
* @param projectId
* @param idCard
*/
public Integer getProjectIdCard(String projectId, String idCard) {
String rdk = SmileRedisConst.PROJECT_ID_LIST.concat(projectId).concat(":idCard:").concat(idCard);
Object obj =redisUtil.get(rdk);
if(obj==null){
return null;
}else{
return (int) obj;
}
}
/**
* 添加志愿者报名情况
*
* @param projectId 活动id
* @param uid 用户id
* @param teamIds 组id数组
*/
public void setVolunteers(String projectId, String uid, ArrayList<String> teamIds) {
String rdk = SmileRedisConst.VOLUNTEERS_DETAILS.concat(projectId).concat(":uid:").concat(uid);
redisUtil.set(rdk, teamIds);
}
/**
* 获取志愿者报名情况
*
* @param projectId 活动id
* @param uid 用户id
*/
public ArrayList<String> getVolunteers(String projectId, String uid) {
String rdk = SmileRedisConst.VOLUNTEERS_DETAILS.concat(projectId).concat(":uid:").concat(uid);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return null;
} else {
return (ArrayList<String>) obj;
}
}
//获取 志愿者活动详情
public SmileProjectDetailsVo getProject(String projectId) {
String rdk = SmileRedisConst.PROJECT_DETAILS.concat(projectId);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return null;
} else {
return (SmileProjectDetailsVo) obj;
}
}
//获取 志愿者职责组详情
public SmileVolunteersTeam getTeam(String teamId) {
String rdk = SmileRedisConst.TEAM_DETAILS.concat(teamId);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return null;
} else {
return (SmileVolunteersTeam) obj;
}
}
// 获取活动列表id
public ArrayList<String> getProjectId() {
String rdk = SmileRedisConst.PROJECT_ID_LIST;
Object obj = redisUtil.get(rdk);
if (obj == null) {
return CollectionUtil.arrayListString();
} else {
return (ArrayList<String>) obj;
}
}
}
package com.liquidnet.service.util;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.commons.lang.util.IdentityUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class Utils {
@Autowired
private SmileRedisUtils smileRedisUtils;
public boolean validate(String realName, String cardNo) {
//查看是否之前这个 身份证和 名字(1:验证失败 2:验证成功)
String status = smileRedisUtils.getValidate(realName, cardNo);
if (null != status && "1".equals(status)) {
return false;
}
String respStr = IdentityUtils.aliThird(realName, cardNo), respErrorCode = null;
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respErrorCode = String.valueOf(respJNode.get("error_code")))) {
log.debug("###实名认证失败[{}]", respJNode);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
smileRedisUtils.setValidate(realName, cardNo, "1");
return false;
}
smileRedisUtils.setValidate(realName, cardNo, "2");
return true;
}
}
......@@ -7,7 +7,7 @@ liquidnet:
password: user123
eureka:
#127.0.0.1
host: 39.107.71.112:7001
host: 127.0.0.1:7001
# end-dev-这里是配置信息基本值
spring:
......
......@@ -4,3 +4,7 @@ goblin_service_support.insert_byreplace=REPLACE INTO goblin_service_support (ssi
smile_service.insert_user= insert into smile_user(img,`name`,`uid`,birthday,sex,phone,province_id,province,city_id,city,area_id,area,address,wechat,`type`,org_id,id_card,school_name,school_major,`identity`,tag,agent,error_reason,introduce,specialty1,specialty2,specialty3,`state`,del_tag,created_date,updated_date,school_id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
smile_service.update_user= update smile_user set img =?,`name`=?,birthday=?,sex =?,phone=?,province_key=?,province=?,city_key =?,city=?,area_key=?,area =?,address =?,wechat =?,`type`=?,org_id =?,id_card=?,school_name =?,school_major =?,`identity`=?,tag =?,agent =?,auth_tag =?,error_reason =?,introduce =?,specialty1 =?,specialty2 =?,specialty3 =?,`state`=?,updated_date=?,school_id=? where `uid`=?
smile_service.delete_user= delete from smile_user where uid=?
#---- 志愿者报名
smile_volunteers.apply = INSERT INTO smile_volunteers (`uid`,`project_id`,`name`,`img`,`id_card`,`sex`,`school`,`school_address`,`specialty`,`specialty2`,`phone`,`team_id1`,`team_id2`,`team_id3`,`introduce`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment