Просмотр исходного кода

优化删除员工后删除员工下的巡检计划保养计划 考勤计划等等

wuxw 1 год назад
Родитель
Сommit
9aca14009b

+ 7 - 7
service-community/src/main/java/com/java110/community/dao/impl/MaintainancePlanStaffV1ServiceDaoImpl.java

@@ -71,9 +71,9 @@ public class MaintainancePlanStaffV1ServiceDaoImpl extends BaseServiceDao implem
     public List<Map> getMaintainancePlanStaffInfo(Map info) throws DAOException {
         logger.debug("查询 getMaintainancePlanStaffInfo 入参 info : {}",info);
 
-        List<Map> businessMaintainancePlanStaffInfos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.getMaintainancePlanStaffInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.getMaintainancePlanStaffInfo",info);
 
-        return businessMaintainancePlanStaffInfos;
+        return infos;
     }
 
 
@@ -100,12 +100,12 @@ public class MaintainancePlanStaffV1ServiceDaoImpl extends BaseServiceDao implem
     public int queryMaintainancePlanStaffsCount(Map info) {
         logger.debug("查询 queryMaintainancePlanStaffsCount 入参 info : {}",info);
 
-        List<Map> businessMaintainancePlanStaffInfos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.queryMaintainancePlanStaffsCount", info);
-        if (businessMaintainancePlanStaffInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.queryMaintainancePlanStaffsCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessMaintainancePlanStaffInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     /**
@@ -118,9 +118,9 @@ public class MaintainancePlanStaffV1ServiceDaoImpl extends BaseServiceDao implem
     public List<Map> queryMaintainancePlanStaffsGroupCount(Map info) throws DAOException {
         logger.debug("查询 queryMaintainancePlanStaffsGroupCount 入参 info : {}",info);
 
-        List<Map> businessMaintainancePlanStaffInfos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.queryMaintainancePlanStaffsGroupCount",info);
+        List<Map> infos = sqlSessionTemplate.selectList("maintainancePlanStaffV1ServiceDaoImpl.queryMaintainancePlanStaffsGroupCount",info);
 
-        return businessMaintainancePlanStaffInfos;
+        return infos;
     }
 
 }

+ 7 - 7
service-store/src/main/java/com/java110/store/dao/impl/ScheduleClassesStaffV1ServiceDaoImpl.java

@@ -71,9 +71,9 @@ public class ScheduleClassesStaffV1ServiceDaoImpl extends BaseServiceDao impleme
     public List<Map> getScheduleClassesStaffInfo(Map info) throws DAOException {
         logger.debug("查询 getScheduleClassesStaffInfo 入参 info : {}",info);
 
-        List<Map> businessScheduleClassesStaffInfos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.getScheduleClassesStaffInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.getScheduleClassesStaffInfo",info);
 
-        return businessScheduleClassesStaffInfos;
+        return infos;
     }
 
 
@@ -100,12 +100,12 @@ public class ScheduleClassesStaffV1ServiceDaoImpl extends BaseServiceDao impleme
     public int queryScheduleClassesStaffsCount(Map info) {
         logger.debug("查询 queryScheduleClassesStaffsCount 入参 info : {}",info);
 
-        List<Map> businessScheduleClassesStaffInfos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.queryScheduleClassesStaffsCount", info);
-        if (businessScheduleClassesStaffInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.queryScheduleClassesStaffsCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessScheduleClassesStaffInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     /**
@@ -118,9 +118,9 @@ public class ScheduleClassesStaffV1ServiceDaoImpl extends BaseServiceDao impleme
     public List<Map> getGroupScheduleClassesStaffInfo(Map info) throws DAOException {
         logger.debug("查询 getGroupScheduleClassesStaffInfo 入参 info : {}",info);
 
-        List<Map> businessScheduleClassesStaffInfos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.getGroupScheduleClassesStaffInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("scheduleClassesStaffV1ServiceDaoImpl.getGroupScheduleClassesStaffInfo",info);
 
-        return businessScheduleClassesStaffInfos;
+        return infos;
     }
 
 }

+ 173 - 11
service-user/src/main/java/com/java110/user/cmd/user/UserStaffDeleteCmd.java

@@ -6,20 +6,35 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.doc.annotation.*;
+import com.java110.dto.attendance.AttendanceClassesStaffDto;
+import com.java110.dto.classes.ScheduleClassesStaffDto;
+import com.java110.dto.data.DataPrivilegeStaffDto;
+import com.java110.dto.inspection.InspectionPlanStaffDto;
+import com.java110.dto.maintainance.MaintainancePlanStaffDto;
 import com.java110.dto.privilege.PrivilegeUserDto;
 import com.java110.dto.repair.RepairTypeUserDto;
+import com.java110.dto.user.StaffAppAuthDto;
+import com.java110.intf.community.IInspectionPlanStaffV1InnerServiceSMO;
+import com.java110.intf.community.IMaintainancePlanStaffV1InnerServiceSMO;
 import com.java110.intf.community.IRepairTypeUserInnerServiceSMO;
 import com.java110.intf.community.IRepairTypeUserV1InnerServiceSMO;
+import com.java110.intf.store.IScheduleClassesStaffV1InnerServiceSMO;
 import com.java110.intf.store.IStoreUserV1InnerServiceSMO;
-import com.java110.intf.user.IPrivilegeUserV1InnerServiceSMO;
-import com.java110.intf.user.IUserV1InnerServiceSMO;
+import com.java110.intf.user.*;
+import com.java110.po.attendance.AttendanceClassesStaffPo;
+import com.java110.po.classes.ScheduleClassesStaffPo;
+import com.java110.po.inspection.InspectionPlanStaffPo;
+import com.java110.po.maintainance.MaintainancePlanStaffPo;
+import com.java110.po.privilege.DataPrivilegeStaffPo;
 import com.java110.po.privilege.PrivilegeUserPo;
 import com.java110.po.repair.RepairTypeUserPo;
 import com.java110.po.store.StoreUserPo;
+import com.java110.po.user.StaffAppAuthPo;
 import com.java110.po.user.UserPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.ParseException;
@@ -48,8 +63,8 @@ import java.util.List;
 )
 
 @Java110ExampleDoc(
-        reqBody="{\"userId\":\"123123\"}",
-        resBody="{'code':0,'msg':'成功'"
+        reqBody = "{\"userId\":\"123123\"}",
+        resBody = "{'code':0,'msg':'成功'"
 )
 
 @Java110Cmd(serviceCode = "user.staff.delete")
@@ -71,6 +86,24 @@ public class UserStaffDeleteCmd extends Cmd {
     @Autowired
     private IRepairTypeUserV1InnerServiceSMO repairTypeUserV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IScheduleClassesStaffV1InnerServiceSMO scheduleClassesStaffV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IAttendanceClassesStaffV1InnerServiceSMO attendanceClassesStaffV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IInspectionPlanStaffV1InnerServiceSMO inspectionPlanStaffV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMOImpl;
+
+    @Autowired
+    private IDataPrivilegeStaffV1InnerServiceSMO dataPrivilegeStaffV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IMaintainancePlanStaffV1InnerServiceSMO maintainancePlanStaffV1InnerServiceSMOImpl;
+
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
@@ -83,25 +116,154 @@ public class UserStaffDeleteCmd extends Cmd {
 
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        //todo 删除员工信息
         deleteStaff(reqJson);
 
-        //删除用户
+        //todo 删除用户
         deleteUser(reqJson);
 
-        //删除报修设置
+        //todo 删除报修设置
         RepairTypeUserDto repairTypeUserDto = new RepairTypeUserDto();
         repairTypeUserDto.setStaffId(reqJson.getString("userId"));
         repairTypeUserDto.setStatusCd("0");
         List<RepairTypeUserDto> repairTypeUserDtoList = repairTypeUserInnerServiceSMOImpl.queryRepairTypeUsers(repairTypeUserDto);
-        if (repairTypeUserDtoList != null && repairTypeUserDtoList.size() > 0) {
-            for (RepairTypeUserDto repairTypeUserDto1 : repairTypeUserDtoList) {
-                JSONObject typeUserJson1 = (JSONObject) JSONObject.toJSON(repairTypeUserDto1);
+        if (!ListUtil.isNull(repairTypeUserDtoList)) {
+            for (RepairTypeUserDto tmpRepairTypeUserDto : repairTypeUserDtoList) {
+                JSONObject typeUserJson1 = (JSONObject) JSONObject.toJSON(tmpRepairTypeUserDto);
                 deleteRepairTypeUser(typeUserJson1);
             }
         }
+        //todo 删除员工排班数据
+        deleteScheduleClassesStaff(reqJson);
 
-        //赋权
+        //todo 删除员工考勤组
+        deleteAttendanceClassesStaff(reqJson);
+
+        // todo 删除巡检员工
+        deleteInspectionPlanStaff(reqJson);
+
+        //todo 赋权
         deleteUserPrivilege(reqJson);
+
+        // todo 删除员工认证
+        deleteStaffAppAuth(reqJson);
+
+        // todo 删除数据权限
+        deleteStaffDataPri(reqJson);
+
+        //todo 删除保养员工
+        deleteMaintainanceStaff(reqJson);
+    }
+
+
+
+    /**
+     * 删除数据权限
+     * @param reqJson
+     */
+    private void deleteStaffDataPri(JSONObject reqJson) {
+
+        DataPrivilegeStaffDto dataPrivilegeStaffDto = new DataPrivilegeStaffDto();
+        dataPrivilegeStaffDto.setStaffId(reqJson.getString("userId"));
+        List<DataPrivilegeStaffDto> dataPrivilegeStaffDtos
+                = dataPrivilegeStaffV1InnerServiceSMOImpl.queryDataPrivilegeStaffs(dataPrivilegeStaffDto);
+        if(ListUtil.isNull(dataPrivilegeStaffDtos)){
+            return;
+        }
+        for(DataPrivilegeStaffDto tmpDataPrivilegeStaffDto:dataPrivilegeStaffDtos){
+
+            DataPrivilegeStaffPo dataPrivilegeStaffPo = new DataPrivilegeStaffPo();
+            dataPrivilegeStaffPo.setDpsId(tmpDataPrivilegeStaffDto.getDpsId());
+            dataPrivilegeStaffV1InnerServiceSMOImpl.deleteDataPrivilegeStaff(dataPrivilegeStaffPo);
+        }
+    }
+
+    private void deleteStaffAppAuth(JSONObject reqJson) {
+
+        StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto();
+        staffAppAuthDto.setStaffId(reqJson.getString("userId"));
+        List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMOImpl.queryStaffAppAuths(staffAppAuthDto);
+        if(ListUtil.isNull(staffAppAuthDtos)){
+            return;
+        }
+        for(StaffAppAuthDto tmpStaffAppAuthDto:staffAppAuthDtos){
+            StaffAppAuthPo staffAppAuthPo = new StaffAppAuthPo();
+            staffAppAuthPo.setAuId(tmpStaffAppAuthDto.getAuId());
+            staffAppAuthInnerServiceSMOImpl.deleteStaffAppAuth(staffAppAuthPo);
+        }
+    }
+
+    private void deleteInspectionPlanStaff(JSONObject reqJson) {
+
+        InspectionPlanStaffDto inspectionPlanStaffDto = new InspectionPlanStaffDto();
+        inspectionPlanStaffDto.setStaffId(reqJson.getString("userId"));
+        List<InspectionPlanStaffDto> inspectionPlanStaffDtos
+                = inspectionPlanStaffV1InnerServiceSMOImpl.queryInspectionPlanStaffs(inspectionPlanStaffDto);
+        if(ListUtil.isNull(inspectionPlanStaffDtos)){
+            return;
+        }
+
+        for(InspectionPlanStaffDto tmpInspectionPlanStaffDto:inspectionPlanStaffDtos){
+            InspectionPlanStaffPo inspectionPlanStaffPo = new InspectionPlanStaffPo();
+            inspectionPlanStaffPo.setIpStaffId(tmpInspectionPlanStaffDto.getIpStaffId());
+            inspectionPlanStaffV1InnerServiceSMOImpl.deleteInspectionPlanStaff(inspectionPlanStaffPo);
+        }
+    }
+
+    /**
+     * 删除保养员工
+     * @param reqJson
+     */
+    private void deleteMaintainanceStaff(JSONObject reqJson) {
+        MaintainancePlanStaffDto maintainancePlanStaffDto = new MaintainancePlanStaffDto();
+        maintainancePlanStaffDto.setStaffId(reqJson.getString("userId"));
+        List<MaintainancePlanStaffDto> maintainancePlanStaffDtos
+                = maintainancePlanStaffV1InnerServiceSMOImpl.queryMaintainancePlanStaffs(maintainancePlanStaffDto);
+        if(ListUtil.isNull(maintainancePlanStaffDtos)){
+            return;
+        }
+
+        for(MaintainancePlanStaffDto tmpMaintainancePlanStaffDto:maintainancePlanStaffDtos){
+            MaintainancePlanStaffPo maintainancePlanStaffPo = new MaintainancePlanStaffPo();
+            maintainancePlanStaffPo.setMpsId(tmpMaintainancePlanStaffDto.getMpsId());
+            maintainancePlanStaffV1InnerServiceSMOImpl.deleteMaintainancePlanStaff(maintainancePlanStaffPo);
+        }
+    }
+
+    private void deleteAttendanceClassesStaff(JSONObject reqJson) {
+
+        AttendanceClassesStaffDto attendanceClassesStaffDto = new AttendanceClassesStaffDto();
+        attendanceClassesStaffDto.setStaffId(reqJson.getString("userId"));
+        List<AttendanceClassesStaffDto> attendanceClassesStaffDtos
+                = attendanceClassesStaffV1InnerServiceSMOImpl.queryAttendanceClassesStaffs(attendanceClassesStaffDto);
+        if(ListUtil.isNull(attendanceClassesStaffDtos)){
+            return;
+        }
+        for(AttendanceClassesStaffDto tmpAttendanceClassesStaffDto:attendanceClassesStaffDtos){
+            AttendanceClassesStaffPo attendanceClassesStaffPo = new AttendanceClassesStaffPo();
+            attendanceClassesStaffPo.setCsId(tmpAttendanceClassesStaffDto.getCsId());
+            attendanceClassesStaffV1InnerServiceSMOImpl.deleteAttendanceClassesStaff(attendanceClassesStaffPo);
+        }
+    }
+
+    /**
+     * 删除考勤员工
+     * @param reqJson
+     */
+    private void deleteScheduleClassesStaff(JSONObject reqJson) {
+        ScheduleClassesStaffDto scheduleClassesStaffDto = new ScheduleClassesStaffDto();
+        scheduleClassesStaffDto.setStaffId(reqJson.getString("userId"));
+        List<ScheduleClassesStaffDto> scheduleClassesStaffDtos
+                = scheduleClassesStaffV1InnerServiceSMOImpl.queryScheduleClassesStaffs(scheduleClassesStaffDto);
+        if(ListUtil.isNull(scheduleClassesStaffDtos)){
+            return;
+        }
+        for (ScheduleClassesStaffDto tmpScheduleClassesStaffDto : scheduleClassesStaffDtos) {
+            ScheduleClassesStaffPo scheduleClassesStaffPo = new ScheduleClassesStaffPo();
+            scheduleClassesStaffPo.setScsId(tmpScheduleClassesStaffDto.getScsId());
+            scheduleClassesStaffV1InnerServiceSMOImpl.deleteScheduleClassesStaff(scheduleClassesStaffPo);
+        }
+
     }
 
     /**
@@ -115,7 +277,7 @@ public class UserStaffDeleteCmd extends Cmd {
         privilegeUserDto.setUserId(paramInJson.getString("userId"));
         List<PrivilegeUserDto> privilegeUserDtos = privilegeUserV1InnerServiceSMOImpl.queryPrivilegeUsers(privilegeUserDto);
 
-        if (privilegeUserDtos == null || privilegeUserDtos.size() < 1) {
+        if (ListUtil.isNull(privilegeUserDtos)) {
             return;
         }
 

+ 5 - 5
service-user/src/main/java/com/java110/user/dao/impl/AttendanceClassesStaffV1ServiceDaoImpl.java

@@ -67,9 +67,9 @@ public class AttendanceClassesStaffV1ServiceDaoImpl extends BaseServiceDao imple
     public List<Map> getAttendanceClassesStaffInfo(Map info) throws DAOException {
         logger.debug("查询 getAttendanceClassesStaffInfo 入参 info : {}",info);
 
-        List<Map> businessAttendanceClassesStaffInfos = sqlSessionTemplate.selectList("attendanceClassesStaffV1ServiceDaoImpl.getAttendanceClassesStaffInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("attendanceClassesStaffV1ServiceDaoImpl.getAttendanceClassesStaffInfo",info);
 
-        return businessAttendanceClassesStaffInfos;
+        return infos;
     }
 
 
@@ -96,12 +96,12 @@ public class AttendanceClassesStaffV1ServiceDaoImpl extends BaseServiceDao imple
     public int queryAttendanceClassesStaffsCount(Map info) {
         logger.debug("查询 queryAttendanceClassesStaffsCount 入参 info : {}",info);
 
-        List<Map> businessAttendanceClassesStaffInfos = sqlSessionTemplate.selectList("attendanceClassesStaffV1ServiceDaoImpl.queryAttendanceClassesStaffsCount", info);
-        if (businessAttendanceClassesStaffInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("attendanceClassesStaffV1ServiceDaoImpl.queryAttendanceClassesStaffsCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessAttendanceClassesStaffInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
 

+ 5 - 5
service-user/src/main/java/com/java110/user/dao/impl/StaffAppAuthServiceDaoImpl.java

@@ -55,9 +55,9 @@ public class StaffAppAuthServiceDaoImpl extends BaseServiceDao implements IStaff
     public List<Map> getStaffAppAuthInfo(Map info) throws DAOException {
         logger.debug("查询员工微信认证信息 入参 info : {}",info);
 
-        List<Map> businessStaffAppAuthInfos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.getStaffAppAuthInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.getStaffAppAuthInfo",info);
 
-        return businessStaffAppAuthInfos;
+        return infos;
     }
 
 
@@ -86,12 +86,12 @@ public class StaffAppAuthServiceDaoImpl extends BaseServiceDao implements IStaff
     public int queryStaffAppAuthsCount(Map info) {
         logger.debug("查询员工微信认证数据 入参 info : {}",info);
 
-        List<Map> businessStaffAppAuthInfos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.queryStaffAppAuthsCount", info);
-        if (businessStaffAppAuthInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.queryStaffAppAuthsCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessStaffAppAuthInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
 

+ 1 - 1
springboot/src/main/resources/application-debug.yml

@@ -29,7 +29,7 @@ spring:
   activiti:
     database-schema-update: false
   datasource:
-    url: jdbc:mysql://118.182.119.121:3306/TT?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
+    url: jdbc:mysql://192.168.100.108:3306/TT?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
     username: TT
     password: hc12345678
     type: com.alibaba.druid.pool.DruidDataSource