提交代码

dev_xd
姜玉琦 2025-06-21 11:32:29 +08:00
parent 5724ba1ea9
commit 64859c3130
9 changed files with 316 additions and 282 deletions

View File

@ -206,6 +206,9 @@ public class AttendanceJgwTask {
quartzProSubdeptsService.insertQuartzProSubdepts(quartzProSubdepts);
redisService.setCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"),quartzProSubdepts,2L,TimeUnit.HOURS);
}else{
QuartzProSubdepts quartzProSubdepts = list.get(0);
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("contractorId"));
quartzProSubdeptsService.updateQuartzProSubdepts(quartzProSubdepts);
redisService.setCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"),list.get(0),2L,TimeUnit.HOURS);
}
}else{
@ -328,6 +331,7 @@ public class AttendanceJgwTask {
redisService.setCacheObject("doSyncDirectlyUnderGroup.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
}else{
QuartzProSubdeptsGroup quartzProSubdeptsGroup = list.get(0);
quartzProSubdeptsGroup.setSource(code.toUpperCase()+"::"+json.getString("id"));
quartzProSubdeptsGroup.setIsDel(Convert.toLong(json.getString("deleteFlag"),0L));
quartzProSubdeptsGroup.setUpdateBy("JGW-TASK");
quartzProSubdeptsGroup.setUpdateTime(DateUtils.getNowDate());
@ -652,6 +656,7 @@ public class AttendanceJgwTask {
}else{
QuartzProSubdeptsUsers quartzProSubdeptsUsers = list.get(0);
quartzProSubdeptsUsers.setUseStatus(StringUtils.eqObj(json.getString("workerStatus"),"01")?UseStateEnums.IN.getCode() : UseStateEnums.OUT.getCode());
quartzProSubdeptsUsers.setSource(code.toUpperCase()+"::"+json.getString("workerId"));
quartzProSubdeptsUsers.setUpdateBy("JGW-TASK");
quartzProSubdeptsUsers.setUpdateTime(DateUtils.getNowDate());
quartzProSubdeptsUsersService.updateQuartzProSubdeptsUsers(quartzProSubdeptsUsers);

View File

@ -141,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="source != null">source = #{source},</if>
</trim>
where id = #{id}
</update>

View File

@ -149,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="source != null">source = #{source},</if>
</trim>
where id = #{id}
</update>

View File

@ -247,6 +247,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="source != null">source = #{source},</if>
</trim>
where id = #{id}
</update>

View File

@ -83,6 +83,7 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController
List<ProProjectInfoSubdeptsUsers> list = proProjectInfoSubdeptsUsersService.groupByCraftTypeByAttendance(where);
return AjaxResult.success(list);
}
/**
*
*/

View File

@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import com.yanzhu.common.core.constant.SecurityConstants;
import com.yanzhu.common.core.enums.*;
import com.yanzhu.common.core.exception.ServiceException;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.security.utils.SecurityUtils;
@ -450,7 +451,7 @@ public class ProProjectInfoSubdeptsGroupServiceImpl implements IProProjectInfoSu
userQuery.setSubDeptGroup(proProjectInfoSubdeptsGroup.getId());
List<ProProjectInfoSubdeptsUsers> users = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersList(userQuery);
proProjectInfoSubdeptsUsersMapper.updateUseStatusByParams(proProjectInfoSubdeptsGroup.getSubDeptId(),proProjectInfoSubdeptsGroup.getId());
if(users.size()>0){
if("SYSTEM".equals(Convert.toStr(proProjectInfoSubdeptsGroup.getSource(),"SYSTEM")) && users.size()>0){
for(ProProjectInfoSubdeptsUsers user:users){
uniService.syncUserRevoke(user.getId());
}

View File

@ -6,6 +6,7 @@ import com.yanzhu.common.core.constant.SecurityConstants;
import com.yanzhu.common.core.domain.R;
import com.yanzhu.common.core.enums.*;
import com.yanzhu.common.core.exception.ServiceException;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.redis.service.RedisService;
@ -15,6 +16,7 @@ import com.yanzhu.manage.domain.ProProjectInfo;
import com.yanzhu.manage.domain.ProProjectInfoSubdepts;
import com.yanzhu.manage.domain.ProProjectInfoSubdeptsGroup;
import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers;
import com.yanzhu.manage.mapper.AttendanceUbiDeviceMapper;
import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsGroupMapper;
import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsMapper;
import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper;
@ -55,6 +57,9 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept
@Autowired
private RemoteUserService remoteUserService;
@Autowired
private AttendanceUbiDeviceMapper attendanceUbiDeviceMapper;
@Autowired
private ProProjectInfoSubdeptsMapper proProjectInfoSubdeptsMapper;
@ -580,7 +585,7 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept
List<ProProjectInfoSubdeptsUsers> users = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersList(userQuery);
proProjectInfoSubdeptsGroupMapper.updateUseStatusByParams(proProjectInfoSubdepts.getId());
proProjectInfoSubdeptsUsersMapper.updateUseStatusByParams(proProjectInfoSubdepts.getId(),null);
if(users.size()>0){
if("SYSTEM".equals(Convert.toStr(proProjectInfoSubdepts.getSource(),"SYSTEM")) && users.size()>0){
for(ProProjectInfoSubdeptsUsers user:users){
uniService.syncUserRevoke(user.getId());
}

View File

@ -1,6 +1,5 @@
package com.yanzhu.manage.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
@ -30,6 +29,9 @@ import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
*
*/
@Service
public class UniServiceImpl implements IUniService {
@ -44,6 +46,7 @@ public class UniServiceImpl implements IUniService{
@Autowired
private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper;
private void clearAuthCache(long projectId) {
String cacheKey = CacheConstants.UNI_AUTH + projectId;
redisService.deleteObject(cacheKey);
@ -319,9 +322,11 @@ public class UniServiceImpl implements IUniService{
}
return jo.getString("msg");
}
@Override
public Long syncUniDeviceUser(Long deviceId, Long projectId) {
AttendanceUbiDevice device = attendanceUbiDeviceMapper.selectAttendanceUbiDeviceById(deviceId);
if (Objects.nonNull(device)) {
ProProjectInfoSubdeptsUsers userWhere = new ProProjectInfoSubdeptsUsers();
userWhere.setProjectId(projectId);
List<ProProjectInfoSubdeptsUsers> userList = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersList(userWhere);
@ -348,9 +353,12 @@ public class UniServiceImpl implements IUniService{
}
return 1l;
}
return 0L;
}
/**
* 1. 2.
*
* @param ids
* @return
*/
@ -365,17 +373,17 @@ public class UniServiceImpl implements IUniService{
/**
*
*
* @param id
*/
@Override
public void syncUserRevoke(Long id) {
ProProjectInfoSubdeptsUsers user = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id);
if(user==null){
return;
}
if (Objects.nonNull(user)) {
AttendanceUbiDevice where = new AttendanceUbiDevice();
where.setProjectId(user.getProjectId());
List<AttendanceUbiDevice> devList = attendanceUbiDeviceMapper.selectAttendanceUbiDeviceList(where);
if (devList.size() > 0) {
for (AttendanceUbiDevice device : devList) {
JSONObject jo = new JSONObject();
jo.put("projectId", user.getProjectId());
@ -384,20 +392,22 @@ public class UniServiceImpl implements IUniService{
authDeviceRevoke(jo);
}
}
}
}
/**
*
*
* @param id
*/
@Override
public void syncUserAuthDevice(Long id) {
ProProjectInfoSubdeptsUsers user = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id);
if(user==null){
return;
}
if (Objects.nonNull(user)) {
AttendanceUbiDevice where = new AttendanceUbiDevice();
where.setProjectId(user.getProjectId());
List<AttendanceUbiDevice> devList = attendanceUbiDeviceMapper.selectAttendanceUbiDeviceList(where);
if (devList.size() > 0) {
for (AttendanceUbiDevice device : devList) {
JSONObject jo = new JSONObject();
jo.put("projectId", user.getProjectId());
@ -406,9 +416,12 @@ public class UniServiceImpl implements IUniService{
authDevice(jo);
}
}
}
}
/**
*
*
* @param user
*/
private void syncUserAuthDeviceByInfo(ProProjectInfoSubdeptsUsers user) {
@ -492,11 +505,16 @@ public class UniServiceImpl implements IUniService{
/**
*
*
* @param puser
* @param authFlag
*/
@Override
public void syncUniUser(ProProjectInfoSubdeptsUsers puser, boolean authFlag) {
AttendanceUbiDevice where = new AttendanceUbiDevice();
where.setProjectId(puser.getProjectId());
List<AttendanceUbiDevice> devList = attendanceUbiDeviceMapper.selectAttendanceUbiDeviceList(where);
if (devList.size() > 0) {
JSONObject jo;
if (StringUtils.isNotEmpty(puser.getUserInfos())) {
jo = JSON.parseObject(puser.getUserInfos());
@ -571,5 +589,6 @@ public class UniServiceImpl implements IUniService{
syncUserAuthDeviceByInfo(puser);
}
}
}
}

View File

@ -523,7 +523,7 @@ public class SysUserServiceImpl implements ISysUserService
public Long registerUser(SysUser user) throws ServiceException
{
SysUser sysUser = userMapper.selectByPhone(user.getPhonenumber());
String userPost = user.getUserType();
String userType = user.getUserType();
if(Objects.nonNull(sysUser)){
user.setUserId(sysUser.getUserId());
sysUser.setUserName(user.getUserName());
@ -540,7 +540,7 @@ public class SysUserServiceImpl implements ISysUserService
user.setCreateTime(user.getUpdateTime());
user.setWorkType(user.getWorkType());
if(StringUtils.isEmpty(user.getPassword())){
user.setPassword(SecurityUtils.encryptPassword(user.getPhonenumber()+"@"+user.getUserType()));
user.setPassword(SecurityUtils.encryptPassword(user.getPhonenumber()));
}
userMapper.insertUser(user);
try {
@ -587,14 +587,14 @@ public class SysUserServiceImpl implements ISysUserService
}
}
Long userId = user.getUserId();
if(Objects.nonNull(userPost) && Objects.nonNull(user.getDeptId())){
if(Objects.nonNull(userType) && Objects.nonNull(user.getDeptId())){
// 删除用户与角色关联
List<SysUserRole> sysUserRoleList = new ArrayList<>();
SysUserRole userRole = new SysUserRole();
userRole.setUserId(userId);
userRole.setDeptId(user.getDeptId());
userRoleMapper.deleteUserRoleByUserRole(userRole);
if(Objects.equals(userPost, UserTypeEnums.FBWTDL.getCode())){
if(Objects.equals(userType, UserTypeEnums.FBWTDL.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBWTDL.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -605,7 +605,7 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.FBXMJL.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.FBXMJL.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBXMJL.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -616,7 +616,7 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.FBBZZZ.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.FBBZZZ.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBBZZZ.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -627,7 +627,7 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.FBLWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.FBLWRY.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBLWRY.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -638,7 +638,7 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.FBCLRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.FBCLRY.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBCLRY.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -649,7 +649,7 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.FBAQRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.FBAQRY.getCode())){
List<SysRole> list = roleMapper.findDeptRoleListByDeptIdAndKey(user.getDeptId(),UserTypeEnums.FBAQRY.getKeys()+"_"+user.getDeptId());
if(StringUtils.isEmpty(list)){
//新增单位角色...
@ -660,23 +660,23 @@ public class SysUserServiceImpl implements ISysUserService
}
sysUserRoleList.add(userRole);
userRoleMapper.batchUserRole(sysUserRoleList);
}else if(Objects.equals(userPost, UserTypeEnums.JSDWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.JSDWRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.JLDWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.JLDWRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.SGDWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.SGDWRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.CLFBRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.CLFBRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.HQFBRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.HQFBRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.TSSBRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.TSSBRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.KTDWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.KTDWRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.SJDWRY.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.SJDWRY.getCode())){
}else if(Objects.equals(userPost, UserTypeEnums.OTHERS.getCode())){
}else if(Objects.equals(userType, UserTypeEnums.OTHERS.getCode())){
}
}