From a278edbd297ce64f5f5780222ea9ad80442e1448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Wed, 22 Jan 2025 00:20:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yanzhu/auth/service/SysLoginService.java | 18 ++++-------- .../mapper/flowable/FlowBusinessKeyMapper.xml | 8 +++--- .../mapper/manage/BusExamInfoMapper.xml | 4 +-- ...ProProjectInfoSubdeptsUsersController.java | 1 + .../service/impl/BusExamUserServiceImpl.java | 3 ++ .../service/impl/SysUserServiceImpl.java | 28 ++++++++++++++++--- .../miniprogram/pages/project_qr/index.js | 15 +++++++++- 7 files changed, 54 insertions(+), 23 deletions(-) diff --git a/yanzhu-auth/src/main/java/com/yanzhu/auth/service/SysLoginService.java b/yanzhu-auth/src/main/java/com/yanzhu/auth/service/SysLoginService.java index d93e9474..7b89fd46 100644 --- a/yanzhu-auth/src/main/java/com/yanzhu/auth/service/SysLoginService.java +++ b/yanzhu-auth/src/main/java/com/yanzhu/auth/service/SysLoginService.java @@ -24,6 +24,7 @@ import com.yanzhu.system.api.model.LoginUser; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.concurrent.TimeUnit; /** * 登录校验方法 @@ -33,6 +34,10 @@ import java.util.Objects; @Component public class SysLoginService { + + @Autowired + private RedisService redisService; + @Autowired private RemoteProService remoteProService; @@ -45,9 +50,6 @@ public class SysLoginService @Autowired private SysRecordLogService recordLogService; - @Autowired - private RedisService redisService; - /** * 登录 */ @@ -210,15 +212,7 @@ public class SysLoginService if(Objects.isNull(userResult.getData())){ throw new ServiceException("登录失败,当前手机号未获取项目授权..."); } - R uniResult = remoteUserService.findByMaOpenId(loginBody.getOpenId(),SecurityConstants.INNER); - if(Objects.isNull(uniResult) || Objects.isNull(uniResult.getData())){ - SysUserUniopen uniopen = new SysUserUniopen(); - uniopen.setUserId(userInfo.getUserid()); - uniopen.setUserName(userInfo.getUsername()); - uniopen.setUserNick(userInfo.getSysUser().getNickName()); - uniopen.setMaOpenId(loginBody.getOpenId()); - remoteUserService.addSysUserUniopen(uniopen,SecurityConstants.INNER); - } + redisService.setCacheObject("SysUserUniopen::"+phoneResult.get("phoneNumber"),loginBody.getOpenId(),12L, TimeUnit.HOURS); }else{ throw new ServiceException("获取授权手机号失败..."); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml index 6b1c53af..ede931b0 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml @@ -50,10 +50,10 @@ select fa.* , sud.business_license_path as businessImg, bus.sub_dept_name as businessMk1, sdd.dict_label as businessMk2, sud.sub_dept_code as businessMk3 - , sus.user_picture as businessImg, sus.card_code as businessMk1, sdd.dict_label as businessMk2, bus.sub_dept_name as businessMk3 + , bus.user_picture as businessImg, bus.card_code as businessMk1, sdd.dict_label as businessMk2, bus.sub_dept_name as businessMk3 from vw_flow_finished fa left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join pro_project_info_subdepts sud on sud.id = bus.sub_dept_id left join sys_dict_data sdd on sdd.dict_value = bus.sub_dept_type and sdd.dict_type='sub_dept_type' - left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join sys_dict_data sdd on sdd.dict_value = bus.craft_post and sdd.dict_type='pro_craft_post' left join sys_user sus on sus.user_id = bus.user_id + left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join sys_dict_data sdd on sdd.dict_value = bus.craft_post and sdd.dict_type='pro_craft_post' where fa.ASSIGNEE_=#{assigneeId} and fa.procDefName like concat('%', #{procDefName}, '%') diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml index 05e4457a..44f9e1a9 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BusExamInfoMapper.xml @@ -51,7 +51,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java index fce70448..dda42786 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/ProProjectInfoSubdeptsUsersController.java @@ -48,6 +48,7 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController public TableDataInfo list(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) { startPage(); + proProjectInfoSubdeptsUsers.setActiveTags("finished"); List list = proProjectInfoSubdeptsUsersService.selectProProjectInfoSubdeptsUsersList(proProjectInfoSubdeptsUsers); return getDataTable(list); } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java index 211e2657..4f4fca02 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/BusExamUserServiceImpl.java @@ -216,6 +216,9 @@ public class BusExamUserServiceImpl implements IBusExamUserService findExamInfo = examInfoList.get(randomIntBound); } + findExamInfo.setComId(userEntity.getComId()); + findExamInfo.setProjectId(userEntity.getProjectId()); + // 获取试卷试题 List questions = extractExamQuestion(findExamInfo,Objects.equals(CraftTypeEnums.GLRY.getCode(),examQuery.getCraftType())?null:userEntity.getCraftPost()); // 试题重新排序 diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java index 6533afc1..87e45ed7 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java @@ -8,16 +8,17 @@ import com.yanzhu.common.core.constant.SecurityConstants; import com.yanzhu.common.core.domain.R; import com.yanzhu.common.core.enums.ShiFouEnums; import com.yanzhu.common.core.enums.UserTypeEnums; +import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.web.domain.AjaxResult; +import com.yanzhu.common.redis.service.RedisService; import com.yanzhu.common.security.service.TokenService; import com.yanzhu.manage.domain.ProProjectInfo; import com.yanzhu.manage.mapper.ProProjectInfoMapper; import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper; import com.yanzhu.system.api.RemoteProService; import com.yanzhu.system.api.RemoteUserService; -import com.yanzhu.system.api.domain.SysDept; -import com.yanzhu.system.api.domain.SysRoleDept; +import com.yanzhu.system.api.domain.*; import com.yanzhu.system.api.model.LoginUser; import com.yanzhu.system.domain.*; import com.yanzhu.system.mapper.*; @@ -39,8 +40,6 @@ import com.yanzhu.common.core.utils.StringUtils; import com.yanzhu.common.core.utils.bean.BeanValidators; import com.yanzhu.common.datascope.annotation.DataScope; import com.yanzhu.common.security.utils.SecurityUtils; -import com.yanzhu.system.api.domain.SysRole; -import com.yanzhu.system.api.domain.SysUser; import com.yanzhu.system.service.ISysConfigService; import com.yanzhu.system.service.ISysUserService; @@ -54,6 +53,9 @@ public class SysUserServiceImpl implements ISysUserService { private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); + @Autowired + private RedisService redisService; + @Autowired private SysDeptMapper deptMapper; @@ -94,6 +96,10 @@ public class SysUserServiceImpl implements ISysUserService @Autowired private ProProjectInfoMapper proProjectInfoMapper; + + @Autowired + private SysUserUniopenMapper sysUserUniopenMapper; + /** * 根据条件分页查询用户列表 * @@ -462,6 +468,20 @@ public class SysUserServiceImpl implements ISysUserService user.setCreateTime(user.getUpdateTime()); user.setUserType("99"); userMapper.insertUser(user); + try { + String maOpenId = Convert.toStr(redisService.getCacheObject("SysUserUniopen::"+user.getPhonenumber()),null); + if(StringUtils.isNotEmpty(maOpenId)){ + // 保存扫码记录 + SysUserUniopen uniopen = new SysUserUniopen(); + uniopen.setUserId(user.getUserId()); + uniopen.setUserName(user.getUserName()); + uniopen.setUserNick(user.getNickName()); + uniopen.setMaOpenId(maOpenId); + sysUserUniopenMapper.insertSysUserUniopen(uniopen); + } + }catch (Exception e){ + e.printStackTrace(); + } List userComs=userMapper.selectUserComs(user.getUserId()); if(userComs.size()==0){ user.setIsActive(1l); diff --git a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js index eca6672f..e8094ced 100644 --- a/yanzhu-ui-app/miniprogram/pages/project_qr/index.js +++ b/yanzhu-ui-app/miniprogram/pages/project_qr/index.js @@ -669,7 +669,7 @@ Page({ _fileForm.fPost = "委托人"; _fileForm.fDate = currDate[0] + "年" + currDate[1] + "月" + currDate[2] + "日"; } else { - _fileForm.fName = this.data.form.nickName; + _fileForm.fName = this.data.form.userName; _fileForm.fCardId = this.data.form.cardCode; _fileForm.fSex = this.getGenderFromIdCard(this.data.form.cardCode); this.data.craftPostAllOrginList.forEach(item => { @@ -1336,6 +1336,12 @@ Page({ if (!form.subDeptLeaderCode) { app.toast("请填写委托人身份证号!"); return false; + }else{ + const cardCodePattern = /^[1-9]\d{5}(18|19|20|21|22)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|[Xx])$/; + if(!cardCodePattern.test(form.subDeptLeaderCode)){ + app.toast("身份证号码不正确!"); + return false; + } } if (!form.subDeptLeaderPhone) { app.toast("请填写委托人联系电话!"); @@ -1518,7 +1524,14 @@ Page({ if (!form.cardCode) { app.toast("请填写身份证号!"); return false; + }else{ + const cardCodePattern = /^[1-9]\d{5}(18|19|20|21|22)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|[Xx])$/; + if(!cardCodePattern.test(form.cardCode)){ + app.toast("身份证号码不正确!"); + return false; + } } + if (!form.userPhone) { app.toast("请填写联系电话!"); return false;