diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java index 94bda9a8..a1dde3ee 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdeptsUsers.java @@ -19,35 +19,51 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity { private static final long serialVersionUID = 1L; + + @Excel(name = "所属项目") + private String projectName; + /** 分包单位名称 */ + @Excel(name = "所属单位") + private String subDeptName; + /** 主键 */ private Long id; + @Excel(name = "姓名") + private String userName; + @Excel(name = "身份证") + private String cardCode; + @Excel(name = "性别") + private String userSex; + @Excel(name = "民族") + private String userNation; + @Excel(name = "年龄") + private Integer userAge; + /** 公司主键 */ - @Excel(name = "公司主键") + private Long comId; /** 项目主键 */ - @Excel(name = "项目主键") + private Long projectId; /** 分包单位 */ - @Excel(name = "分包单位") + private Long subDeptId; /** 单位类型 */ - @Excel(name = "单位类型") + private String subDeptType; - /** 分包单位名称 */ - @Excel(name = "分包单位名称") - private String subDeptName; + /** 用户主键 */ - @Excel(name = "用户主键") + private Long userId; /** 班组编号(外键) */ - @Excel(name = "班组编号(外键)") + private Long subDeptGroup; /** 班组名称 */ @@ -55,50 +71,129 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity private String subDeptGroupName; /** 工种类型 */ - @Excel(name = "工种类型") + private String craftType; - + @Excel(name = "工种类型") + private String craftTypeName; /** 工种岗位 */ - @Excel(name = "工种岗位") - private String craftPost; + private String craftPost; + @Excel(name = "工种岗位") + private String craftPostName; + + @Excel(name = "状态") + private String enterState; /** 学习状态 */ @Excel(name = "学习状态") private String eduStatus; /** 学习文件地址 */ - @Excel(name = "学习文件地址") + private String eduFilePath; /** 学习签名地址 */ - @Excel(name = "学习签名地址") + private String eduSignPath; /** 学习时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "学习时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date eduDate; /** 审批状态 */ - @Excel(name = "审批状态") + private Long approveStatus; /** 进场状态 */ - @Excel(name = "进场状态") + private String useStatus; /** 进行步骤 */ - @Excel(name = "进行步骤") + private Long subStep; + private String comName; + + public String getComName() { + return comName; + } + + public void setComName(String comName) { + this.comName = comName; + } + /** 疾病状态 */ - @Excel(name = "疾病状态") + private Long illnessStatus; /** 严重疾病状态 */ - @Excel(name = "严重疾病状态") + private Long supIllnessStatus; + public String getEnterState() { + return enterState; + } + + public void setEnterState(String enterState) { + this.enterState = enterState; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getCardCode() { + return cardCode; + } + + public void setCardCode(String cardCode) { + this.cardCode = cardCode; + } + + public String getUserSex() { + return userSex; + } + + public void setUserSex(String userSex) { + this.userSex = userSex; + } + + public String getUserNation() { + return userNation; + } + + public void setUserNation(String userNation) { + this.userNation = userNation; + } + + public Integer getUserAge() { + return userAge; + } + + public void setUserAge(Integer userAge) { + this.userAge = userAge; + } + + public String getCraftTypeName() { + return craftTypeName; + } + + public void setCraftTypeName(String craftTypeName) { + this.craftTypeName = craftTypeName; + } + + public String getCraftPostName() { + return craftPostName; + } + + public void setCraftPostName(String craftPostName) { + this.craftPostName = craftPostName; + } + public SysUser getUser() { return user; } @@ -119,7 +214,7 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity private SysUser user; /** 删除标识 */ - @Excel(name = "删除标识") + private Long isDel; public void setId(Long id) @@ -312,7 +407,6 @@ public class ProProjectInfoSubdeptsUsers extends BaseEntity return isDel; } - private String projectName; public String getProjectName() { return projectName; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml index a6469354..451add76 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsersMapper.xml @@ -7,7 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -26,6 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -60,11 +65,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" psu.sub_dept_group_name, psu.craft_type, psu.craft_post, psu.edu_status, psu.edu_file_path, psu.edu_sign_path, psu.edu_date, psu.approve_status, psu.use_status, psu.sub_step, psu.illness_status, psu.sup_illness_status, psu.is_del, psu.create_by, psu.create_time, psu.update_by, psu.update_time, psu.remark,su.`user_name`,su.`nick_name`,su.`user_type`,su.`card_type`,su.`card_code`,su.admitGuid,su.admitGuid usAdmitGuid, + dic1.dict_label craft_type_name,dic2.dict_label craft_post_name,psu.enter_state,sd.dept_name comName, su.`user_picture`, su.`card_img_inv`,su.`card_img_pos`,su.`user_infos`,su.`email`,su.`phonenumber`,su.`sex`,su.`avatar`,su.`login_ip`,su.`login_date` FROM pro_project_info_subdepts_users psu LEFT JOIN sys_user su ON psu.user_id=su.user_id LEFT JOIN pro_project_info PI ON pi.id = psu.project_id LEFT JOIN sys_dept sd ON sd.dept_id = pi.com_id + LEFT JOIN sys_dict_data dic1 ON psu.`craft_type`=dic1.`dict_value` AND dic1.`dict_type`='pro_craft_type' + LEFT JOIN sys_dict_data dic2 ON psu.`craft_post`=dic2.`dict_value` AND dic2.`dict_type`='pro_craft_post' @@ -82,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and psu.craft_type = #{craftType} and psu.craft_post = #{craftPost} and psu.edu_status = #{eduStatus} + and psu.enter_state = #{enterState} and psu.edu_file_path = #{eduFilePath} and psu.edu_sign_path = #{eduSignPath} and psu.edu_date = #{eduDate} @@ -124,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" illness_status, sup_illness_status, is_del, + enter_state, create_by, create_time, update_by, @@ -151,6 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{illnessStatus}, #{supIllnessStatus}, #{isDel}, + #{enterState}, #{createBy}, #{createTime}, #{updateBy}, @@ -182,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" illness_status = #{illnessStatus}, sup_illness_status = #{supIllnessStatus}, is_del = #{isDel}, + enter_state = #{enterState}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, 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 7765f4e4..39ccdb65 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 @@ -1,5 +1,8 @@ package com.yanzhu.manage.controller; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; +import com.yanzhu.common.core.utils.DateUtils; import com.yanzhu.common.core.utils.poi.ExcelUtil; import com.yanzhu.common.core.web.controller.BaseController; import com.yanzhu.common.core.web.domain.AjaxResult; @@ -9,13 +12,15 @@ import com.yanzhu.common.log.enums.BusinessType; import com.yanzhu.common.security.annotation.RequiresPermissions; import com.yanzhu.manage.domain.ProProjectInfoSubdeptsUsers; import com.yanzhu.manage.service.IProProjectInfoSubdeptsUsersService; +import com.yanzhu.manage.service.IUniService; import com.yanzhu.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.Calendar; +import java.util.Date; import java.util.List; -import java.util.Map; /** * 分包单位工人Controller @@ -30,6 +35,8 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController @Autowired private IProProjectInfoSubdeptsUsersService proProjectInfoSubdeptsUsersService; + @Autowired + private IUniService uniService; /** * 查询分包单位工人列表 */ @@ -51,6 +58,20 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController public void export(HttpServletResponse response, ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) { List list = proProjectInfoSubdeptsUsersService.selectProProjectInfoSubdeptsUsersList(proProjectInfoSubdeptsUsers); + for(ProProjectInfoSubdeptsUsers u :list){ + SysUser su=u.getUser(); + u.setUserName(su.getUserName()); + u.setCardCode(su.getCardCode()); + u.setUserSex(su.getSex()); + u.setEnterState("0".equals(u.getEnterState())?"在场":"离场"); + JSONObject jo=JSONObject.parseObject(su.getUserInfos()); + u.setUserNation(jo.getString("nation")); + Date dt=jo.getDate("birthDay"); + if(dt!=null){ + int age=(int)((new Date().getTime()-dt.getTime())/1000/3600/24/365); + u.setUserAge(age); + } + } ExcelUtil util = new ExcelUtil(ProProjectInfoSubdeptsUsers.class); util.exportExcel(response, list, "分包单位工人数据"); } @@ -97,4 +118,25 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController { return toAjax(proProjectInfoSubdeptsUsersService.deleteProProjectInfoSubdeptsUsersByIds(ids)); } + @RequiresPermissions("manage:proProjectInfoSubdeptsUsers:remove") + @PostMapping("/enterState/{state}") + public AjaxResult updateEnterState(@RequestBody List ids,@PathVariable int state){ + try { + for (Long id : ids) { + ProProjectInfoSubdeptsUsers user=proProjectInfoSubdeptsUsersService.selectProProjectInfoSubdeptsUsersById(id); + if(user!=null) { + if (state == 0) {//进场 + uniService.syncUserAuthDevice(id); + } else { + uniService.syncUserRevoke(id); + } + user.setEnterState(""+state); + proProjectInfoSubdeptsUsersService.updateProProjectInfoSubdeptsUsers(user); + } + } + return AjaxResult.success(); + }catch (Exception ex){ + return AjaxResult.error(ex.getMessage()); + } + } } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java index 6b95f42f..4163e0cf 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/controller/UniCallBackController.java @@ -127,7 +127,7 @@ public class UniCallBackController { if(proUser!=null && proUser.getUser()!=null){ AttendanceUbiData addData=new AttendanceUbiData(); addData.setAdmitGuid(admitGuid); - addData.setComName(proUser.getActiveComName()); + addData.setComName(proUser.getComName()); addData.setProjectName(proUser.getProjectName()); addData.setComId(proUser.getComId()); addData.setUserId(proUser.getUserId()); diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java index 4da5b401..84bffe65 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IUniService.java @@ -152,4 +152,16 @@ public interface IUniService { public Long syncUniDeviceUser(Long deviceId,Long projectId); public long syncUniDeviceDelete(Long[] ids); + + /** + * 用户设备销权识别主体 + * @param id + */ + public void syncUserRevoke(Long id); + + /** + * 用户设备授权识别主体 + * @param id + */ + public void syncUserAuthDevice(Long id); } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java index 3a1d8f2a..18c391bb 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsUsersServiceImpl.java @@ -31,6 +31,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Autowired private IUniService uniService; + /** * 查询分包单位工人 * @@ -112,6 +113,9 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Override public int deleteProProjectInfoSubdeptsUsersByIds(Long[] ids) { + for(Long id:ids){ + uniService.syncUserRevoke(id); + } return proProjectInfoSubdeptsUsersMapper.deleteProProjectInfoSubdeptsUsersByIds(ids); } @@ -124,6 +128,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu @Override public int deleteProProjectInfoSubdeptsUsersById(Long id) { + uniService.syncUserRevoke(id); return proProjectInfoSubdeptsUsersMapper.deleteProProjectInfoSubdeptsUsersById(id); } } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java index 0b978b35..e51c0803 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/UniServiceImpl.java @@ -357,12 +357,56 @@ public class UniServiceImpl implements IUniService{ public long syncUniDeviceDelete(Long[] ids) { long cnt=0; for(Long id :ids){ - cnt+=deletDevice(id); + cnt+=deleteDevice(id); } return cnt; } - private Long deletDevice(Long id) { + /** + * 用户设备销权识别主体 + * @param id + */ + @Override + public void syncUserRevoke(Long id) { + ProProjectInfoSubdeptsUsers user= proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id); + if(user==null){ + return; + } + AttendanceUbiDevice where=new AttendanceUbiDevice(); + where.setProjectId(user.getProjectId()); + List devList=attendanceUbiDeviceMapper.selectAttendanceUbiDeviceList(where); + for(AttendanceUbiDevice device :devList){ + JSONObject jo=new JSONObject(); + jo.put("projectId",user.getProjectId()); + jo.put("deviceNo",device.getDeviceNo()); + jo.put("admitGuids",user.getAdmitGuid()); + authDeviceRevoke(jo); + } + } + + /** + * 用户设备授权识别主体 + * @param id + */ + @Override + public void syncUserAuthDevice(Long id) { + ProProjectInfoSubdeptsUsers user= proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id); + if(user==null){ + return; + } + AttendanceUbiDevice where=new AttendanceUbiDevice(); + where.setProjectId(user.getProjectId()); + List devList=attendanceUbiDeviceMapper.selectAttendanceUbiDeviceList(where); + for(AttendanceUbiDevice device :devList) { + JSONObject jo=new JSONObject(); + jo.put("projectId",user.getProjectId()); + jo.put("deviceNo",device.getDeviceNo()); + jo.put("admitGuids",user.getAdmitGuid()); + authDevice(jo); + } + } + + private Long deleteDevice(Long id) { AttendanceUbiDevice device=attendanceUbiDeviceMapper.selectAttendanceUbiDeviceById(id); if(device==null){ return 0l; @@ -440,7 +484,7 @@ public class UniServiceImpl implements IUniService{ userJo.put("tag",user.getNickName()); userJo.put("cardNo",user.getUserId()+","+projectId); userJo.put("idCardNo",user.getCardCode()); - userJo.put("password","123456"); + userJo.put("password",""); userJo.put("addition",""); boolean hasUpdate=false; if(StringUtils.isEmpty(admitGuid)){ @@ -492,6 +536,7 @@ public class UniServiceImpl implements IUniService{ } return ret.longValue(); } + return 0l; } diff --git a/yanzhu-ui-vue3/src/api/manage/proProjectInfoSubdeptsUsers.js b/yanzhu-ui-vue3/src/api/manage/proProjectInfoSubdeptsUsers.js index 4c47d0a6..89d0ff1e 100644 --- a/yanzhu-ui-vue3/src/api/manage/proProjectInfoSubdeptsUsers.js +++ b/yanzhu-ui-vue3/src/api/manage/proProjectInfoSubdeptsUsers.js @@ -42,3 +42,12 @@ export function delProProjectInfoSubdeptsUsers(id) { method: 'delete' }) } + +// 删除分包单位工人 +export function updateEnterState(ids,state) { + return request({ + url: '/manage/proProjectInfoSubdeptsUsers/enterState/' + state, + method: 'post', + data: ids + }) +} diff --git a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue index b16d0215..f7010c98 100644 --- a/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue +++ b/yanzhu-ui-vue3/src/views/manage/attendance_ubi_device/ubiDeviceDrawer.vue @@ -79,7 +79,7 @@ {{ form.projectName }} - + @@ -157,6 +157,10 @@ const data = reactive({ }) const { queryParams, form, rules } = toRefs(data); +/*行进场,离场操作 */ +function handleEnter(row){ + +} /** * 设备人员同步 */ @@ -244,6 +248,7 @@ function handleSelectionChange(selection) { /** 新增按钮操作 */ function handleAdd() { reset(); + data.mode="add" form.value.projectId = data.row.projectId; form.value.projectName = data.row.projectName; form.value.source=ubi_device_source.value[0].value; @@ -254,6 +259,7 @@ function handleAdd() { /** 修改按钮操作 */ function handleUpdate(row) { reset(); + data.mode="edit" const _id = row.id || ids.value getAttendance_ubi_device(_id).then(response => { form.value = response.data; diff --git a/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdeptsUsers/index.vue b/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdeptsUsers/index.vue index 65630379..08ce3bf3 100644 --- a/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdeptsUsers/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdeptsUsers/index.vue @@ -56,26 +56,31 @@ v-hasPermi="['manage:proProjectInfoSubdeptsUsers:export']">导出花名册 - 批量离场 - 批量入场 - - - + - + + + + + + + + - - - - - + + + + + + @@ -248,7 +261,7 @@