兴安访客小程序访客改造
This commit is contained in:
@@ -74,4 +74,6 @@ public class CacheConstants
|
||||
public static final String WE_COM_TOKEN = "we_com_token:";
|
||||
|
||||
public static final String VISITOR_SMS_CODE = "visitor_sms_code:";
|
||||
|
||||
public static final String VIS_CARRY_STUFF_CODE = "vis_carry_stuff_code:";
|
||||
}
|
||||
|
||||
@@ -294,10 +294,10 @@ public class SysFileController
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
initFlowRules();
|
||||
//上传前进行人脸检测
|
||||
String imgBase64 = MinioUtil.getBase64String(file);
|
||||
checkPhoto(imgBase64);
|
||||
// initFlowRules();
|
||||
// //上传前进行人脸检测
|
||||
// String imgBase64 = MinioUtil.getBase64String(file);
|
||||
// checkPhoto(imgBase64);
|
||||
|
||||
// 上传并返回访问地址
|
||||
String fileNames = FileUploadUtils.uploadMinio(file, this.bucketName1, fileName);
|
||||
|
||||
@@ -119,6 +119,19 @@ public class SysPeople extends BaseEntity
|
||||
|
||||
private String visitorRegisterId;
|
||||
|
||||
/**
|
||||
* 携物出门审核人员,0:否,1:一级审核人2:二级审核人3:三级审核人
|
||||
*/
|
||||
private String carryStuffExamine;
|
||||
|
||||
public String getCarryStuffExamine() {
|
||||
return carryStuffExamine;
|
||||
}
|
||||
|
||||
public void setCarryStuffExamine(String carryStuffExamine) {
|
||||
this.carryStuffExamine = carryStuffExamine;
|
||||
}
|
||||
|
||||
public String getVisitorRegisterId() {
|
||||
return visitorRegisterId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.dcsoft.system.visitor.controller;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.dcsoft.common.core.constant.CacheConstants;
|
||||
import com.dcsoft.common.core.constant.Constants;
|
||||
import com.dcsoft.common.core.enums.ExamineEnum;
|
||||
import com.dcsoft.common.core.enums.MatterEnum;
|
||||
import com.dcsoft.common.core.exception.ServiceException;
|
||||
import com.dcsoft.common.core.utils.CollUtil;
|
||||
import com.dcsoft.common.core.web.controller.BaseController;
|
||||
import com.dcsoft.common.core.web.domain.AjaxResult;
|
||||
import com.dcsoft.common.core.web.page.TableDataInfo;
|
||||
import com.dcsoft.common.log.annotation.Log;
|
||||
import com.dcsoft.common.log.enums.BusinessType;
|
||||
import com.dcsoft.common.redis.service.RedisService;
|
||||
import com.dcsoft.common.security.utils.SecurityUtils;
|
||||
import com.dcsoft.system.api.model.LoginUser;
|
||||
import com.dcsoft.system.domain.SysBranch;
|
||||
import com.dcsoft.system.domain.SysManageRecord;
|
||||
import com.dcsoft.system.domain.SysPeople;
|
||||
import com.dcsoft.system.service.ISysDictDataService;
|
||||
import com.dcsoft.system.service.ISysPeopleService;
|
||||
import com.dcsoft.system.utils.UuidUtil;
|
||||
import com.dcsoft.system.visitor.domain.CheckCodeVo;
|
||||
import com.dcsoft.system.visitor.domain.VisCarryStuffVo;
|
||||
import com.dcsoft.system.visitor.domain.VisVisitorExamine;
|
||||
import com.dcsoft.system.visitor.domain.Visitor;
|
||||
import com.dcsoft.system.visitor.service.IVisCarryStuffService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/stuff")
|
||||
public class VisCarryStuffController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private IVisCarryStuffService visCarryStuffService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysPeopleService sysPeopleService;
|
||||
|
||||
@Autowired
|
||||
private VisitorController visitorController;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
private static final String APPROVE_KEY = "APPROVE_KEY:STUFF_APPROVE";
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(VisCarryStuffVo vo) {
|
||||
startPage();
|
||||
|
||||
Map<String, String> map = dictDataService.queryDictData("vis_out_stuff_type");
|
||||
List<VisCarryStuffVo> list =visCarryStuffService.selectList(vo);
|
||||
list.forEach(vis -> vis.setStuffTypeName(map.get(vis.getStuffType())));
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序查询我的携物信息列表
|
||||
*/
|
||||
@GetMapping("/app/list")
|
||||
public TableDataInfo appList(VisCarryStuffVo vo) {
|
||||
LoginUser user = SecurityUtils.getLoginUser();
|
||||
vo.setCreateBy(user.getUsername());
|
||||
Map<String, String> map = dictDataService.queryDictData("vis_out_stuff_type");
|
||||
List<VisCarryStuffVo> list =visCarryStuffService.selectList(vo);
|
||||
list.forEach(vis -> vis.setStuffTypeName(map.get(vis.getStuffType())));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取携物信息详细信息(详情)
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
VisCarryStuffVo stuffVo = visCarryStuffService.selectVisStuffById(id);
|
||||
CheckCodeVo codeVo = visCarryStuffService.selectStuffCheckCode(id);
|
||||
Map<String, String> map = dictDataService.queryDictData("vis_out_stuff_type");
|
||||
stuffVo.setStuffTypeName(map.get(stuffVo.getStuffType()));
|
||||
if (ObjectUtil.isNotNull(codeVo)) {
|
||||
stuffVo.setQrCode(codeVo.getCode());
|
||||
}
|
||||
return success(stuffVo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增访客信息
|
||||
*/
|
||||
@Log(title = "携物申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@Transactional
|
||||
public AjaxResult add(@RequestBody VisCarryStuffVo vo) {
|
||||
log.info("新增携物申请信息:{}", vo);
|
||||
try {
|
||||
visCarryStuffService.insertVisCarryStuff(vo);
|
||||
} catch (Exception e) {
|
||||
log.error("携物申请add异常:", e);
|
||||
return AjaxResult.error("系统异常,请重新提交或联系管理员!");
|
||||
}
|
||||
|
||||
//查询一级审核人信息
|
||||
// 审核通知企微发送消息(小程序来源)
|
||||
SysPeople sysPeople = new SysPeople();
|
||||
sysPeople.setCarryStuffExamine("1");
|
||||
List<SysPeople> peopleList = sysPeopleService.selectSysPeopleLists(sysPeople);
|
||||
|
||||
for (SysPeople people : peopleList) {
|
||||
String url = getExamineUrl(String.valueOf(vo.getId()), people.getPhone());
|
||||
log.info("携物申请add发送审核链接:{}", url);
|
||||
//发送钉钉信息
|
||||
String content = getContent(vo);
|
||||
visitorController.asyncsendV2(sysPeople.getPhone(), "text", content + url);
|
||||
|
||||
//发送企微信息
|
||||
try {
|
||||
visitorController.sendWeCom(sysPeople.getPhone(), url + " --访客姓名:" + vo.getName());
|
||||
} catch (Exception e) {
|
||||
log.error("携物申请add-sendWeCom异常:", e);
|
||||
return AjaxResult.error("系统异常,请重新提交或联系管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织链接内容(申请人&随访人基本信息)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getContent(VisCarryStuffVo vo) {
|
||||
String matterName = "携物出门申请";
|
||||
String visTime = DateUtil.format(vo.getVisTime(), DatePattern.NORM_DATE_FORMATTER);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("收到新的携物出门申请:").append(matterName).append("\n");
|
||||
sb.append("申请人:").append(vo.getName()).append("\n");
|
||||
sb.append("物品名称:").append(vo.getStuffName()).append("\n");
|
||||
sb.append("物品类型:").append(vo.getStuffTypeName()).append("\n");
|
||||
sb.append("物品数量:").append(vo.getStuffNumber()).append("\n");
|
||||
sb.append("点击链接进行审核:");
|
||||
log.info("getContent:{}", JSON.toJSONString(sb));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取审核链接
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getExamineUrl(String id, String telephone) {
|
||||
//生成8位短参作为缓存key
|
||||
String code = UuidUtil.getShortUuid();
|
||||
try {
|
||||
while (redisService.hasKey(code)) {
|
||||
code = UuidUtil.getShortUuid();
|
||||
}
|
||||
redisService.setCacheObject(CacheConstants.VIS_CARRY_STUFF_CODE + code, id + "&" + telephone, 30L, TimeUnit.DAYS);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("缓存数据异常:" + e.getMessage());
|
||||
}
|
||||
return "https://fk.xyxaks.cn/h5/?c=" + code + "2";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程审核
|
||||
*/
|
||||
@Log(title = "流程审核", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/approve")
|
||||
@Transactional
|
||||
public AjaxResult approve(@RequestBody VisCarryStuffVo vo) {
|
||||
log.info("携物流程审核入参 {}", JSON.toJSONString(vo));
|
||||
try {
|
||||
String telephone = StringUtils.isBlank(vo.getTelephone()) ? "1" : vo.getTelephone();
|
||||
Boolean lock = redisService.lock(APPROVE_KEY, telephone, 60 * 5, TimeUnit.SECONDS);
|
||||
if (!lock) {
|
||||
log.error("approve-审核人员正在审核中");
|
||||
return error("正在审核中");
|
||||
}
|
||||
|
||||
//查询当前审核人基本信息
|
||||
SysPeople sysPeople = sysPeopleService.queryPeopleName(telephone, null);
|
||||
|
||||
//审核通过
|
||||
if(Constants.ZERO.equals(vo.getExamineState())) {
|
||||
//被访人审核
|
||||
if (vo.getCurrentNode() == 1) {
|
||||
|
||||
}
|
||||
//二级审核人审核
|
||||
else if (vo.getCurrentNode() == 2) {
|
||||
|
||||
}
|
||||
else {//最后一级审核
|
||||
// visitor.setExamineState(examine.getExamine());
|
||||
// //保存审核历史表
|
||||
// examine.setRejectReason(visitor.getRejectReason());
|
||||
// SysPeople people = sysPeopleService.selectSysPeopleById(visitor.getUserId());
|
||||
// examine.setCreateBy(people.getName());
|
||||
// visVisitorExamineService.insertVisVisitorExamine(examine);
|
||||
//
|
||||
// //修改环节状态
|
||||
// visitorService.updateVisitorReviewProcess(visitor);
|
||||
}
|
||||
}
|
||||
//审核拒绝
|
||||
if (Constants.ONE.equals(vo.getExamineState())) {
|
||||
// visitor.setExamineState(examine.getExamine());
|
||||
// visVisitorExamineService.insertVisVisitorExamine(examine);
|
||||
|
||||
try {
|
||||
visitorController.sendWeCom(telephone, vo.getName() + "的访客审核已驳回");
|
||||
} catch (Exception e) {
|
||||
log.error("访客approve-sendWeCom驳回异常:{}", e.getMessage());
|
||||
}
|
||||
// 申请人发送短信(审核不通过)
|
||||
// visitorController.sendMessage(vo.getPhone(), "1", smsProperties.getTemplate3());
|
||||
|
||||
}
|
||||
|
||||
// visitorService.approve(visitor);
|
||||
|
||||
return toAjax(true);
|
||||
} catch (Exception e) {
|
||||
log.error("审核异常:{}", e.getMessage());
|
||||
return toAjax(false);
|
||||
}finally {
|
||||
redisService.deleteObject(APPROVE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -42,10 +42,8 @@ import com.dcsoft.system.uniubi.service.ISysApiService;
|
||||
import com.dcsoft.system.uniubi.service.ISysSdkService;
|
||||
import com.dcsoft.system.utils.FileUtils;
|
||||
import com.dcsoft.system.utils.UuidUtil;
|
||||
import com.dcsoft.system.visitor.domain.CheckCodeVo;
|
||||
import com.dcsoft.system.visitor.domain.VisVisitorExamine;
|
||||
import com.dcsoft.system.visitor.domain.Visitor;
|
||||
import com.dcsoft.system.visitor.domain.VisitorRecordVo;
|
||||
import com.dcsoft.system.visitor.domain.*;
|
||||
import com.dcsoft.system.visitor.service.IVisCarryStuffService;
|
||||
import com.dcsoft.system.visitor.service.IVisVisitorExamineService;
|
||||
import com.dcsoft.system.visitor.service.IVisitorService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -56,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.text.ParseException;
|
||||
@@ -118,6 +117,9 @@ public class VisitorController extends BaseController {
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Resource
|
||||
private IVisCarryStuffService visCarryStuffService;
|
||||
|
||||
@Value("${qd.url}")
|
||||
public String qdUrl;
|
||||
|
||||
@@ -291,6 +293,10 @@ public class VisitorController extends BaseController {
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
Visitor visitor = visitorService.selectVisitorById(id);
|
||||
|
||||
Map<String, String> map = dictDataService.queryDictData("sys_company_type");
|
||||
visitor.setMatterName(MatterEnum.getByCode(visitor.getMatter()));
|
||||
visitor.setDeptName(map.get(visitor.getDeptId()));
|
||||
return success(visitor);
|
||||
}
|
||||
|
||||
@@ -305,13 +311,23 @@ public class VisitorController extends BaseController {
|
||||
*/
|
||||
@PostMapping(value = "/getVisitorInfo")
|
||||
public AjaxResult getVisitorInfo(@RequestBody JSONObject js) throws Exception {
|
||||
String data = js.getString("data");
|
||||
if (StringUtils.isBlank(data)) {
|
||||
String str = js.getString("data");
|
||||
if (StringUtils.isBlank(str)) {
|
||||
throw new ServiceException("参数为空,请联系管理员!");
|
||||
}
|
||||
|
||||
//数据进行解密
|
||||
Object cacheObject = redisService.getCacheObject(CacheConstants.VISITOR_SMS_CODE + data);
|
||||
String type = str.substring(str.length() - 1);
|
||||
String data = str.substring(0, str.length() - 1);
|
||||
|
||||
//数据进行解密 1是临时访客,2是
|
||||
Object cacheObject = null;
|
||||
if (StringUtils.equals("1", type)) {
|
||||
cacheObject = redisService.getCacheObject(CacheConstants.VISITOR_SMS_CODE + data);
|
||||
}
|
||||
if (StringUtils.equals("2", type)) {
|
||||
cacheObject = redisService.getCacheObject(CacheConstants.VIS_CARRY_STUFF_CODE + data);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNull(cacheObject)) {
|
||||
throw new ServiceException("链接不存在或已过期!");
|
||||
}
|
||||
@@ -320,31 +336,74 @@ public class VisitorController extends BaseController {
|
||||
Long id = Long.parseLong(split[0]);
|
||||
String telephone = split[1];
|
||||
|
||||
if (StringUtils.equals("2", type)) {
|
||||
VisCarryStuffVo visCarryStuff = getVisCarryStuff(id, telephone);
|
||||
visCarryStuff.setTelephone(telephone);
|
||||
return success(visCarryStuff);
|
||||
}
|
||||
|
||||
Visitor visitor = visitorService.selectVisitorById(id);
|
||||
visitor.setTelephone(telephone);
|
||||
|
||||
//审核链接进来
|
||||
if (StringUtils.isNotBlank(telephone)) {
|
||||
if (StringUtils.equals(visitor.getExamineState(), ExamineEnum.IN_REVIEW.getCode())) {
|
||||
// if (StringUtils.equals(visitor.getExamineState(), ExamineEnum.IN_REVIEW.getCode())) {
|
||||
//查询当前点击审核链接的人员信息
|
||||
SysPeople sysPeople = sysPeopleService.queryPeopleName(telephone, null);
|
||||
|
||||
//根据手机号查询peopleId
|
||||
visitor.setReviewer(String.valueOf(sysPeople.getId()));
|
||||
visitor.setPosition(null);
|
||||
Visitor visitor1 = visitorService.queryReviewProcess(visitor);
|
||||
Visitor visitor2 = new Visitor();
|
||||
visitor2.setId(visitor.getId());
|
||||
visitor2.setReviewer(String.valueOf(sysPeople.getId()));
|
||||
visitor2.setPosition(null);
|
||||
Visitor visitor1 = visitorService.queryReviewProcess(visitor2);
|
||||
if (ObjectUtil.isNotNull(visitor1) && StrUtil.isNotBlank(visitor1.getState())) {
|
||||
visitor.setExamineState(visitor1.getState());
|
||||
visitor.setRejectReason(visitor1.getRejectReason());
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Map<String, String> map = dictDataService.queryDictData("sys_company_type");
|
||||
visitor.setMatterName(MatterEnum.getByCode(visitor.getMatter()));
|
||||
visitor.setDeptName(map.get(visitor.getDeptId()));
|
||||
log.info("临时日志:{}",JSON.toJSONString(visitor));
|
||||
return success(visitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询携物申请信息
|
||||
* @param id
|
||||
* @param telephone
|
||||
* @return
|
||||
*/
|
||||
private VisCarryStuffVo getVisCarryStuff(Long id, String telephone) {
|
||||
VisCarryStuffVo stuffVo = visCarryStuffService.selectVisStuffById(id);
|
||||
CheckCodeVo codeVo = visCarryStuffService.selectStuffCheckCode(id);
|
||||
Map<String, String> map = dictDataService.queryDictData("vis_out_stuff_type");
|
||||
stuffVo.setStuffTypeName(map.get(stuffVo.getStuffType()));
|
||||
if (ObjectUtil.isNotNull(codeVo)) {
|
||||
stuffVo.setQrCode(codeVo.getCode());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(telephone)) {
|
||||
//查询当前点击审核链接的人员信息
|
||||
SysPeople sysPeople = sysPeopleService.queryPeopleName(telephone, null);
|
||||
|
||||
//根据手机号查询peopleId
|
||||
Visitor visitor2 = new Visitor();
|
||||
visitor2.setId(stuffVo.getId());
|
||||
visitor2.setReviewer(String.valueOf(sysPeople.getId()));
|
||||
visitor2.setPosition(null);
|
||||
Visitor visitor1 = visitorService.queryReviewProcess(visitor2);
|
||||
if (ObjectUtil.isNotNull(visitor1) && StrUtil.isNotBlank(visitor1.getState())) {
|
||||
stuffVo.setExamineState(visitor1.getState());
|
||||
}
|
||||
}
|
||||
|
||||
return stuffVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增访客信息
|
||||
@@ -472,7 +531,7 @@ public class VisitorController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("缓存数据异常:" + e.getMessage());
|
||||
}
|
||||
return "https://fk.xyxaks.cn/h5/?c=" + code;
|
||||
return "https://fk.xyxaks.cn/h5/?c=" + code + "1";
|
||||
}
|
||||
|
||||
|
||||
@@ -514,7 +573,7 @@ public class VisitorController extends BaseController {
|
||||
/**
|
||||
* 钉工牌消息通知
|
||||
*/
|
||||
private void asyncsendV2(String phone, String msgType, String content) {
|
||||
public void asyncsendV2(String phone, String msgType, String content) {
|
||||
DingtalkMsgVo msgVo = new DingtalkMsgVo();
|
||||
DingtalkMsgVo.Text text = new DingtalkMsgVo.Text();
|
||||
text.setContent(content);
|
||||
@@ -668,7 +727,7 @@ public class VisitorController extends BaseController {
|
||||
* @param phone
|
||||
* @param content
|
||||
*/
|
||||
private void sendWeCom(String phone, String content) {
|
||||
public void sendWeCom(String phone, String content) {
|
||||
// 获取userId
|
||||
String weComUserId = getWeComUserId(phone);
|
||||
DingtalkMsgVo.Text text = new DingtalkMsgVo.Text();
|
||||
@@ -871,10 +930,10 @@ public class VisitorController extends BaseController {
|
||||
log.error("approve-审核人员正在审核中");
|
||||
return error("正在审核中");
|
||||
}
|
||||
List<SysManageRecord> record = visitorService.querySysManageRecord(visitor.getUserId());
|
||||
if (CollectionUtils.isEmpty(record)) {
|
||||
throw new RuntimeException("被访人未授权通行");
|
||||
}
|
||||
// List<SysManageRecord> record = visitorService.querySysManageRecord(visitor.getUserId());
|
||||
// if (CollectionUtils.isEmpty(record)) {
|
||||
// throw new RuntimeException("被访人未授权通行");
|
||||
// }
|
||||
|
||||
//查询当前审核人基本信息
|
||||
SysPeople sysPeople = sysPeopleService.queryPeopleName(telephone, null);
|
||||
@@ -900,6 +959,7 @@ public class VisitorController extends BaseController {
|
||||
Visitor visitor2 = new Visitor();
|
||||
visitor2.setId(visitor.getId());
|
||||
visitor2.setReviewer(String.valueOf(sysPeople.getId()));
|
||||
visitor2.setRejectReason(visitor.getRejectReason());
|
||||
visitor2.setState(ExamineEnum.PASSED.getCode());
|
||||
list.add(visitor2);
|
||||
Visitor visitor3 = new Visitor();
|
||||
@@ -933,12 +993,14 @@ public class VisitorController extends BaseController {
|
||||
String url = getExamineUrl(String.valueOf(visitor.getId()), nextPeople.getPhone());
|
||||
log.info("approve发送审核链接:{}", url);
|
||||
String str = content + url;
|
||||
// asyncsendV2(nextPeople.getPhone(), "text", str);
|
||||
asyncsendV2(nextPeople.getPhone(), "text", str);
|
||||
log.info("发送钉钉结束:{}", nextPeople.getPhone());
|
||||
} else {//最后一级审核
|
||||
visitor.setExamineState(examine.getExamine());
|
||||
//保存审核历史表
|
||||
examine.setRejectReason(visitor.getRejectReason());
|
||||
SysPeople people = sysPeopleService.selectSysPeopleById(visitor.getUserId());
|
||||
examine.setCreateBy(people.getName());
|
||||
visVisitorExamineService.insertVisVisitorExamine(examine);
|
||||
|
||||
//修改环节状态
|
||||
@@ -948,7 +1010,10 @@ public class VisitorController extends BaseController {
|
||||
Visitor visitor2 = new Visitor();
|
||||
visitor2.setParentId(visitor.getId());
|
||||
List<Visitor> itemList = visitorService.selectVisitorItemList(visitor2);
|
||||
|
||||
if (CollUtil.isNotEmpty(itemList)) {
|
||||
// phoneList.addAll(itemList.stream().map(Visitor::getPhone).collect(Collectors.toList()));
|
||||
// phoneList = phoneList.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
//审核拒绝
|
||||
@@ -959,12 +1024,12 @@ public class VisitorController extends BaseController {
|
||||
visVisitorExamineService.insertVisVisitorExamine(examine);
|
||||
|
||||
try {
|
||||
// sendWeCom(telephone, visitor.getName() + "的访客审核已驳回");
|
||||
sendWeCom(telephone, visitor.getName() + "的访客审核已驳回");
|
||||
} catch (Exception e) {
|
||||
log.error("访客approve-sendWeCom驳回异常:{}", e.getMessage());
|
||||
}
|
||||
// 申请人发送短信(审核不通过)
|
||||
// sendMessage(visitor.getPhone(), "1", smsProperties.getTemplate3());
|
||||
sendMessage(visitor.getPhone(), "1", smsProperties.getTemplate3());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,7 @@ public class CheckCodeVo {
|
||||
|
||||
private String visitorId;
|
||||
|
||||
private String stuffId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.dcsoft.system.visitor.domain;
|
||||
|
||||
|
||||
import com.dcsoft.common.core.annotation.Excel;
|
||||
import com.dcsoft.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class VisCarryStuffVo extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请单位
|
||||
*/
|
||||
private String visitingUnit;
|
||||
|
||||
/**
|
||||
* 物品名称
|
||||
*/
|
||||
private String stuffName;
|
||||
|
||||
/**
|
||||
* 物品类型
|
||||
*/
|
||||
private String stuffType;
|
||||
|
||||
/**
|
||||
* 物品类型名称
|
||||
*/
|
||||
private String stuffTypeName;
|
||||
|
||||
/**
|
||||
* 物品数量
|
||||
*/
|
||||
private String stuffNumber;
|
||||
|
||||
/**
|
||||
* 交通工具
|
||||
*/
|
||||
private String vehicle;
|
||||
|
||||
/**
|
||||
* 现场照片
|
||||
*/
|
||||
private String imgUrls;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date visTime;
|
||||
|
||||
/**
|
||||
* 一级审核人
|
||||
*/
|
||||
private Long reviewer1;
|
||||
|
||||
/**
|
||||
* 二级审核人
|
||||
*/
|
||||
private Long reviewer2;
|
||||
|
||||
/**
|
||||
* 三级审核人
|
||||
*/
|
||||
private Long reviewer3;
|
||||
|
||||
/**
|
||||
* 审核状态 0:通过,1:驳回,2审核中,4:已取消,5:已失效
|
||||
*/
|
||||
private String examineState;
|
||||
|
||||
/**
|
||||
* 申请类型 0:临时访客 1:携物出门
|
||||
*/
|
||||
private String visitorType = "1";
|
||||
|
||||
/**
|
||||
* 二维码信息
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 审核链接手机号
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
|
||||
/**
|
||||
* 当前审批节点
|
||||
*/
|
||||
private Integer currentNode;
|
||||
|
||||
}
|
||||
@@ -98,6 +98,19 @@ public class VisVisitorRegister extends BaseEntity {
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private String deptId;
|
||||
|
||||
public String getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(String deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.dcsoft.system.visitor.mapper;
|
||||
|
||||
import com.dcsoft.system.visitor.domain.CheckCodeVo;
|
||||
import com.dcsoft.system.visitor.domain.VisCarryStuffVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VisCarryStuffMapper {
|
||||
|
||||
List<VisCarryStuffVo> selectList(VisCarryStuffVo vo);
|
||||
|
||||
void insertVisCarryStuff(VisCarryStuffVo vo);
|
||||
|
||||
VisCarryStuffVo selectVisStuffById(Long id);
|
||||
|
||||
CheckCodeVo selectStuffCheckCode(@Param("stuffId") Long id);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.dcsoft.system.visitor.service;
|
||||
|
||||
import com.dcsoft.system.visitor.domain.CheckCodeVo;
|
||||
import com.dcsoft.system.visitor.domain.VisCarryStuffVo;
|
||||
import com.dcsoft.system.visitor.domain.Visitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IVisCarryStuffService {
|
||||
|
||||
List<VisCarryStuffVo> selectList(VisCarryStuffVo vo);
|
||||
|
||||
void insertVisCarryStuff(VisCarryStuffVo vo);
|
||||
|
||||
VisCarryStuffVo selectVisStuffById(Long id);
|
||||
|
||||
CheckCodeVo selectStuffCheckCode(Long id);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.dcsoft.system.visitor.service.impl;
|
||||
|
||||
import com.dcsoft.common.core.enums.ExamineEnum;
|
||||
import com.dcsoft.common.security.utils.SecurityUtils;
|
||||
import com.dcsoft.system.api.model.LoginUser;
|
||||
import com.dcsoft.system.visitor.domain.CheckCodeVo;
|
||||
import com.dcsoft.system.visitor.domain.VisCarryStuffVo;
|
||||
import com.dcsoft.system.visitor.domain.Visitor;
|
||||
import com.dcsoft.system.visitor.mapper.VisCarryStuffMapper;
|
||||
import com.dcsoft.system.visitor.service.IVisCarryStuffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class VisCarryStuffImpl implements IVisCarryStuffService {
|
||||
|
||||
@Resource
|
||||
private VisCarryStuffMapper visCarryStuffMapper;
|
||||
|
||||
@Override
|
||||
public List<VisCarryStuffVo> selectList(VisCarryStuffVo vo) {
|
||||
return visCarryStuffMapper.selectList(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertVisCarryStuff(VisCarryStuffVo vo) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
vo.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||
vo.setExamineState(ExamineEnum.IN_REVIEW.getCode());
|
||||
vo.setExamineState(ExamineEnum.IN_REVIEW.getCode());
|
||||
visCarryStuffMapper.insertVisCarryStuff(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisCarryStuffVo selectVisStuffById(Long id) {
|
||||
return visCarryStuffMapper.selectVisStuffById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckCodeVo selectStuffCheckCode(Long id) {
|
||||
return visCarryStuffMapper.selectStuffCheckCode(id);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,13 @@ public class VisitorServiceImpl implements IVisitorService {
|
||||
if (visitor == null) {
|
||||
return new Visitor();
|
||||
}
|
||||
|
||||
List<Long> collect = Arrays.asList(id);
|
||||
List<CheckCodeVo> checkCodeVos = visitorMapper.queryCode(collect);
|
||||
if (CollUtil.isNotEmpty(checkCodeVos)) {
|
||||
visitor.setQrCode(checkCodeVos.get(0).getCode());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotEmpty(visitor.getVisitorPosition())) {
|
||||
visitor.setPosition(visitor.getVisitorPosition());
|
||||
}
|
||||
@@ -653,6 +660,8 @@ public class VisitorServiceImpl implements IVisitorService {
|
||||
saveVisCheckCode(codeVo);
|
||||
}
|
||||
|
||||
//不修改userId信息
|
||||
visitor.setUserId(null);
|
||||
visitorMapper.updateVisitor(visitor);
|
||||
|
||||
//修改随访人员信息
|
||||
|
||||
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="openid" column="openid" />
|
||||
<result property="isExamine" column="is_examine" />
|
||||
<result property="carryStuffExamine" column="carry_stuff_examine" />
|
||||
<association property="branch" column="branch_id" javaType="SysBranch" resultMap="branchResult" />
|
||||
</resultMap>
|
||||
|
||||
@@ -42,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectSysPeopleVo">
|
||||
select p.id, p.name, p.phone, p.sex, p.avatar, p.branch_id, p.position, p.idcard, p.car_no,p.door_no, p.guid, p.face_guid, p.openid, b.is_examine,
|
||||
p.user_id, p.remark, p.create_by, p.create_time, p.update_by, p.update_time ,b.name branchName,p.gh,p.fingerprint,p.join_time,p.down,p.del_flag,b.rule_id
|
||||
p.user_id, p.remark, p.create_by, p.create_time, p.update_by, p.update_time ,b.name branchName,p.gh,p.fingerprint,p.join_time,p.down,p.del_flag,b.rule_id,
|
||||
p.carry_stuff_examine
|
||||
from sys_people p left join sys_branch b on p.branch_id=b.id
|
||||
left join sys_user u on u.user_id = p.user_id
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
@@ -103,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<if test="sysPeople.delFlag != null"> and p.del_flag = #{sysPeople.delFlag}</if>
|
||||
<if test="sysPeople.branchParent != null and sysPeople.branchParent != ''"> and b.id like concat(#{sysPeople.branchParent}, '%')</if>
|
||||
<if test="sysPeople.carryStuffExamine != null and sysPeople.carryStuffExamine != ''"> and p.carry_stuff_examine = #{sysPeople.carryStuffExamine}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<?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.dcsoft.system.visitor.mapper.VisCarryStuffMapper">
|
||||
|
||||
<resultMap type="VisCarryStuffVo" id="VisitorResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="visitingUnit" column="visiting_unit"/>
|
||||
<result property="stuffName" column="stuff_name"/>
|
||||
<result property="stuffType" column="stuff_type"/>
|
||||
<result property="stuffNumber" column="stuff_number"/>
|
||||
<result property="imgUrls" column="img_urls"/>
|
||||
<result property="visTime" column="vis_time"/>
|
||||
<result property="reviewer1" column="reviewer1"/>
|
||||
<result property="reviewer2" column="reviewer2"/>
|
||||
<result property="reviewer3" column="reviewer3"/>
|
||||
<result property="examineState" column="examine_state"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="vehicle" column="vehicle"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVisCarryStuffVo">
|
||||
select distinct
|
||||
id,
|
||||
name,
|
||||
user_id,
|
||||
visiting_unit,
|
||||
stuff_name,
|
||||
stuff_type,
|
||||
stuff_number,
|
||||
img_urls,
|
||||
vis_time,
|
||||
reviewer1,
|
||||
reviewer2,
|
||||
reviewer3,
|
||||
examine_state,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
vehicle
|
||||
from vis_carry_stuff_out
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultType="com.dcsoft.system.visitor.domain.VisCarryStuffVo">
|
||||
<include refid="selectVisCarryStuffVo"/>
|
||||
<where>
|
||||
<if test="id != null">and id = #{id}</if>
|
||||
<if test="name != null and name != ''">and `name` like concat('%', #{name}, '%')</if>
|
||||
<if test="createBy != null ">and create_by = #{createBy}</if>
|
||||
<if test="userId != null ">and user_id = #{userId}</if>
|
||||
<if test="examineState != null and examineState != 3">and examine_state = #{examineState}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectVisStuffById" resultType="com.dcsoft.system.visitor.domain.VisCarryStuffVo">
|
||||
<include refid="selectVisCarryStuffVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectStuffCheckCode" resultType="com.dcsoft.system.visitor.domain.CheckCodeVo">
|
||||
select
|
||||
code
|
||||
from vis_check_code
|
||||
where stuff_id = #{stuffId}
|
||||
order by created_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertVisCarryStuff" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into vis_carry_stuff_out
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="name != null and name != ''">`name`,</if>
|
||||
<if test="visitingUnit != null and visitingUnit != ''">visiting_unit,</if>
|
||||
<if test="stuffName != null and stuffName != ''">stuff_name,</if>
|
||||
<if test="stuffType != null and stuffType != ''">stuff_type,</if>
|
||||
<if test="stuffNumber != null and stuffNumber != ''">stuff_number,</if>
|
||||
<if test="imgUrls != null and imgUrls != ''">img_urls,</if>
|
||||
<if test="visTime != null">vis_time,</if>
|
||||
<if test="reviewer1 != null">reviewer1,</if>
|
||||
<if test="reviewer2 != null">reviewer2,</if>
|
||||
<if test="reviewer3 != null">reviewer3,</if>
|
||||
<if test="examineState != null and examineState != ''">examine_state,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="vehicle != null">vehicle,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">#{id},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="visitingUnit != null and visitingUnit != ''">#{visitingUnit},</if>
|
||||
<if test="stuffName != null and stuffName != ''">#{stuffName},</if>
|
||||
<if test="stuffType != null and stuffType != ''">#{stuffType},</if>
|
||||
<if test="stuffNumber != null and stuffNumber != ''">#{stuffNumber},</if>
|
||||
<if test="imgUrls != null and imgUrls != ''">#{imgUrls},</if>
|
||||
<if test="visTime != null">#{visTime},</if>
|
||||
<if test="reviewer1 != null">#{reviewer1},</if>
|
||||
<if test="reviewer2 != null">#{reviewer2},</if>
|
||||
<if test="reviewer3 != null">#{reviewer3},</if>
|
||||
<if test="examineState != null and examineState != ''">#{examineState},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="vehicle != null">#{vehicle},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -152,7 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
vvr.created_by,
|
||||
vvr.created_time,
|
||||
vvr.updated_by,
|
||||
vvr.updated_time
|
||||
vvr.updated_time,
|
||||
su.dept_id
|
||||
from sys_user su left join vis_visitor_register vvr on vvr.user_id = su.user_id
|
||||
where su.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
@@ -380,10 +380,10 @@
|
||||
</if>)
|
||||
</insert>
|
||||
<insert id="saveVisitorReviewProcessList">
|
||||
insert into vis_visitor_review_process (id, visitor_id, reviewer, state)
|
||||
insert into vis_visitor_review_process (id, visitor_id, reviewer, state, reject_reason)
|
||||
VALUES
|
||||
<foreach collection="list" item="i" index="index" separator=",">
|
||||
(REPLACE(uuid(), '-', ''), #{i.id}, #{i.reviewer}, #{i.state})
|
||||
(REPLACE(uuid(), '-', ''), #{i.id}, #{i.reviewer}, #{i.state}, #{i.rejectReason})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -514,6 +514,9 @@
|
||||
<update id="updateVisitorReviewProcess">
|
||||
update vis_visitor_review_process
|
||||
set state = #{state}
|
||||
<if test="rejectReason != null and rejectReason != ''">
|
||||
,reject_reason = #{rejectReason}
|
||||
</if>
|
||||
where visitor_id = #{id}
|
||||
<if test="reviewer != null and reviewer != ''">
|
||||
and reviewer = #{reviewer}
|
||||
@@ -868,7 +871,8 @@
|
||||
<select id="queryReviewProcess" resultType="com.dcsoft.system.visitor.domain.Visitor">
|
||||
select
|
||||
reviewer,
|
||||
state
|
||||
state,
|
||||
reject_reason
|
||||
from vis_visitor_review_process
|
||||
where visitor_id = #{id}
|
||||
<if test="position != null and position != ''">
|
||||
|
||||
Reference in New Issue
Block a user