|
@@ -24,18 +24,25 @@ import com.platform.dao.dto.repair.RepairFeeDTO;
|
|
|
import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
import com.platform.dao.dto.store.InStoreFormDTO;
|
|
|
import com.platform.dao.dto.store.OutStoreFormDTO;
|
|
|
+import com.platform.dao.dto.store.StoreCheckJobDTO;
|
|
|
import com.platform.dao.dto.upms.SysUserDTO;
|
|
|
+import com.platform.dao.entity.check.CheckJob;
|
|
|
import com.platform.dao.entity.repair.RepairApplicationForm;
|
|
|
import com.platform.dao.entity.repair.RepairReason;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.entity.store.InStoreForm;
|
|
|
+import com.platform.dao.entity.store.StoreCheckJob;
|
|
|
import com.platform.dao.entity.upms.SysFile;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
+import com.platform.dao.entity.upms.SysUserDept;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.check.CheckJobMapper;
|
|
|
import com.platform.dao.mapper.repair.*;
|
|
|
+import com.platform.dao.mapper.sb.SbAllocateApplyMapper;
|
|
|
import com.platform.dao.mapper.store.InStoreFormMapper;
|
|
|
import com.platform.dao.mapper.store.OutStoreFormMapper;
|
|
|
+import com.platform.dao.mapper.store.StoreCheckJobMapper;
|
|
|
+import com.platform.dao.mapper.upms.SysUserDeptMapper;
|
|
|
import com.platform.dao.mapper.upms.SysUserMapper;
|
|
|
import com.platform.dao.mapper.upms.SysUserRoleMapper;
|
|
|
import com.platform.dao.mapper.workplace.WorkplaceBacklogMapper;
|
|
@@ -103,86 +110,139 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
private final ActivitiController activitiController;
|
|
|
private final InStoreFormMapper inStoreFormMapper;
|
|
|
private final OutStoreFormMapper outStoreFormMapper;
|
|
|
+ private final StoreCheckJobMapper storeCheckJobMapper;
|
|
|
+ private final SysUserDeptMapper sysUserDeptMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private NoticeNumberVO addRepairNums(NoticeNumberVO noticeNumberVO,List<RepairApplicationFormVO> repairApplicationFormVOS){
|
|
|
+ if(repairApplicationFormVOS!=null) {
|
|
|
+ for (RepairApplicationFormVO vo : repairApplicationFormVOS) {
|
|
|
+ //待分配
|
|
|
+ if (vo.getStatus() == RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue()) {
|
|
|
+ noticeNumberVO.setWaitForDistributionNum(new BigDecimal(vo.getRepairCount()));
|
|
|
+ //维修中
|
|
|
+ } else if (vo.getStatus() == RepairApplicationFormStatusEnum.PROCESSING.getValue()) {
|
|
|
+ noticeNumberVO.setInTheMaintenanceNum(new BigDecimal(vo.getRepairCount()));
|
|
|
+ //审核中
|
|
|
+ } else if (vo.getStatus() == RepairApplicationFormStatusEnum.NOT_ACCEPTANCE.getValue()) {
|
|
|
+ noticeNumberVO.setPendingApprovalNum(new BigDecimal(vo.getRepairCount()));
|
|
|
+ //已完成
|
|
|
+ } else if (vo.getStatus() == RepairApplicationFormStatusEnum.FINISHED.getValue()) {
|
|
|
+ noticeNumberVO.setFinishedNum(new BigDecimal(vo.getRepairCount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return noticeNumberVO;
|
|
|
+ }
|
|
|
|
|
|
+ public NoticeNumberVO addCheckJobNums(NoticeNumberVO noticeNumberVO, List<CheckJobVO> checkJobVOS){
|
|
|
+ BigDecimal count=new BigDecimal(0);
|
|
|
+ for (CheckJobVO vo:checkJobVOS){
|
|
|
+ if(vo.getStatus()==CheckJobStatusEnum.NOT_EXECUTE.getValue()){
|
|
|
+ noticeNumberVO.setUnexectuedMaintenanceNum(new BigDecimal(vo.getCountNum()));
|
|
|
+ }else if(vo.getStatus()==CheckJobStatusEnum.FINISHED.getValue()){
|
|
|
+ noticeNumberVO.setFinishedNum(new BigDecimal(vo.getCountNum()));
|
|
|
+ }else if(vo.getReceiveOvertime()!=null&&vo.getReceiveOvertime()){
|
|
|
+ noticeNumberVO.setTimeOutTaskNum(new BigDecimal(vo.getCountNum()));
|
|
|
+ }
|
|
|
+ count=new BigDecimal(vo.getCountNum().intValue()+count.intValue());
|
|
|
+ }
|
|
|
+ noticeNumberVO.setAllBaoYangTaskNum(count);
|
|
|
+ return noticeNumberVO;
|
|
|
+ }
|
|
|
|
|
|
+ private NoticeNumberVO addStoreNums(NoticeNumberVO noticeNumberVO,InStoreFormDTO inStoreFormDTO,OutStoreFormDTO outStoreFormDTO,StoreCheckJobDTO storeCheckJobDTO){
|
|
|
+ BigDecimal inStoreCount=inStoreFormMapper.getInStoreFormCount1(inStoreFormDTO);
|
|
|
+ noticeNumberVO.setInStoreNum(inStoreCount);
|
|
|
+ //出库
|
|
|
+ BigDecimal outStoreCount=outStoreFormMapper.getOutStoreFormCount1(outStoreFormDTO);
|
|
|
+ noticeNumberVO.setOutStoreNum(outStoreCount);
|
|
|
+ //盘点
|
|
|
+ BigDecimal storeCheckJobCount=storeCheckJobMapper.getNumByDTO(storeCheckJobDTO);
|
|
|
+ noticeNumberVO.setPdNum(storeCheckJobCount);
|
|
|
+ //调拨,根据出入库type
|
|
|
+ inStoreFormDTO.setType(InStoreTypeEnum.DIAOBO_RUKU.getValue());
|
|
|
+ BigDecimal dbCount=inStoreFormMapper.getInStoreFormCount1(inStoreFormDTO);
|
|
|
+ noticeNumberVO.setDbNum(dbCount);
|
|
|
+ return noticeNumberVO;
|
|
|
+ }
|
|
|
@Override
|
|
|
public NoticeNumberVO getNoticeNumberVO() {
|
|
|
System.out.println(LocalDateTime.now());
|
|
|
NoticeNumberVO noticeNumberVO=new NoticeNumberVO();
|
|
|
//先判断是否超级管理员
|
|
|
UserInfo userInfo=SecurityUtils.getUserInfo();
|
|
|
- //根据userId获取所有权限
|
|
|
- List<SysUserRoleVO> sysUserRoleVOS = sysUserRoleMapper.selectRoleListByUserId(userInfo.getUserId());
|
|
|
-// List<SysUserRoleVO> sysUserRoleVOS = sysUserRoleMapper.selectRoleListByUserId("1");
|
|
|
- List<RepairApplicationFormVO> repairApplicationFormVOS= mapper.getRepairCount(null);
|
|
|
+ InStoreFormDTO inStoreFormDTO=new InStoreFormDTO();
|
|
|
+ OutStoreFormDTO outStoreFormDTO=new OutStoreFormDTO();
|
|
|
+ StoreCheckJobDTO storeCheckJobDTO=new StoreCheckJobDTO();
|
|
|
+ List<SysUserRoleVO> sysUserRoleVOS;
|
|
|
+ RepairApplicationFormDTO repairApplicationFormDTO=new RepairApplicationFormDTO();
|
|
|
+ List<RepairApplicationFormVO> repairApplicationFormVOS;
|
|
|
+ List<CheckJobVO> checkJobVOS;
|
|
|
StringBuffer sb=new StringBuffer();
|
|
|
+ CheckJobDTO checkJobDTO=new CheckJobDTO();
|
|
|
+ checkJobDTO.setType(2);
|
|
|
if(userInfo.getSuperAdmin()==1){
|
|
|
-// if(1==1){
|
|
|
-
|
|
|
- //目前有维修、保养、待办、通知,只有维修判定为维修管理员,即看到所有维修数据
|
|
|
- for(RepairApplicationFormVO vo: repairApplicationFormVOS){
|
|
|
- if(vo.getStatus()==1){
|
|
|
- noticeNumberVO.setWaitForDistributionNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==2){
|
|
|
- noticeNumberVO.setInTheMaintenanceNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==4){
|
|
|
- noticeNumberVO.setPendingApprovalNum(vo.getCount());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ repairApplicationFormVOS= mapper.getRepairCount(null);
|
|
|
+ checkJobVOS=checkJobMapper.getCheckJobCount1(checkJobDTO);
|
|
|
+ noticeNumberVO=addRepairNums(noticeNumberVO,repairApplicationFormVOS);
|
|
|
+ noticeNumberVO=addCheckJobNums(noticeNumberVO,checkJobVOS);
|
|
|
+ noticeNumberVO=addStoreNums(noticeNumberVO,inStoreFormDTO,outStoreFormDTO,storeCheckJobDTO);
|
|
|
}else {
|
|
|
+ sysUserRoleVOS= sysUserRoleMapper.selectRoleListByUserId(userInfo.getUserId());
|
|
|
for(SysUserRoleVO vo:sysUserRoleVOS){
|
|
|
sb.append(vo.getRoleCode());
|
|
|
}
|
|
|
- if(sb.toString().contains(CommonConstants.WORKPLACE_REPAIR_MANAGE)){
|
|
|
- for(RepairApplicationFormVO vo: repairApplicationFormVOS){
|
|
|
- if(vo.getStatus()==1){
|
|
|
- noticeNumberVO.setWaitForDistributionNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==2){
|
|
|
- noticeNumberVO.setInTheMaintenanceNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==4){
|
|
|
- noticeNumberVO.setPendingApprovalNum(vo.getCount());
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(sb.toString().contains(CommonConstants.WORKPLACE_REPAIR_NORMAL)){
|
|
|
- RepairApplicationFormDTO queryDTO=new RepairApplicationFormDTO();
|
|
|
-// queryDTO.setRepairUserId("1");
|
|
|
- queryDTO.setRepairUserId(userInfo.getUserId());
|
|
|
- List<RepairApplicationFormVO> repairApplicationFormVOS1= mapper.getRepairCount(queryDTO);
|
|
|
- for(RepairApplicationFormVO vo: repairApplicationFormVOS1){
|
|
|
- if(vo.getStatus()==1){
|
|
|
- noticeNumberVO.setWaitForDistributionNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==2){
|
|
|
- noticeNumberVO.setInTheMaintenanceNum(vo.getCount());
|
|
|
- }else if(vo.getStatus()==4){
|
|
|
- noticeNumberVO.setPendingApprovalNum(vo.getCount());
|
|
|
- }
|
|
|
- }
|
|
|
+ if(sb.toString().contains(SysRoleCodeEnum.Maintenance.name())){
|
|
|
+ //维修人员,获取自己名下的维修数量
|
|
|
+ repairApplicationFormDTO.setRepairUserId(userInfo.getUserId());
|
|
|
+ repairApplicationFormDTO.setRepairUserId(userInfo.getUserId());
|
|
|
+ repairApplicationFormVOS= mapper.getRepairCount(repairApplicationFormDTO);
|
|
|
+ noticeNumberVO=addRepairNums(noticeNumberVO,repairApplicationFormVOS);
|
|
|
+ //保养
|
|
|
+ checkJobDTO.setCheckUserId(userInfo.getUserId());
|
|
|
+ checkJobVOS=checkJobMapper.getCheckJobCount(checkJobDTO);
|
|
|
+ noticeNumberVO=addCheckJobNums(noticeNumberVO,checkJobVOS);
|
|
|
+ } if(sb.toString().contains(SysRoleCodeEnum.REPAIR_EXAMINE.name())){
|
|
|
+ //报修人
|
|
|
+ repairApplicationFormDTO.setUserId(userInfo.getUserId());
|
|
|
+ repairApplicationFormVOS= mapper.getRepairCount(repairApplicationFormDTO);
|
|
|
+ noticeNumberVO=addRepairNums(noticeNumberVO,repairApplicationFormVOS);
|
|
|
+ }if(sb.toString().contains(CommonConstants.WORKPLACE_REPAIR_MANAGE) ||sb.toString().contains(SysRoleCodeEnum.REPAIR_MANAGE.name())){
|
|
|
+ //维修主管,先获取其deptid
|
|
|
+ String deptId=sysUserDeptMapper.selectDeptIdByUserId(userInfo.getUserId());
|
|
|
+ repairApplicationFormDTO.setDeptId(deptId);
|
|
|
+ repairApplicationFormVOS= mapper.getRepairCount(repairApplicationFormDTO);
|
|
|
+ noticeNumberVO=addRepairNums(noticeNumberVO,repairApplicationFormVOS);
|
|
|
+ //保养
|
|
|
+ checkJobDTO.setDeptId(deptId);
|
|
|
+ checkJobMapper.getCheckJobCount1(checkJobDTO);
|
|
|
+ checkJobVOS=checkJobMapper.getCheckJobCount1(checkJobDTO);
|
|
|
+ noticeNumberVO=addCheckJobNums(noticeNumberVO,checkJobVOS);
|
|
|
}
|
|
|
- }
|
|
|
- CheckJobDTO checkJobDTO=new CheckJobDTO();
|
|
|
-// checkJobDTO.setCheckUserId("1");
|
|
|
- checkJobDTO.setCheckUserId(userInfo.getUserId());
|
|
|
- checkJobDTO.setStatus(CheckJobStatusEnum.NOT_EXECUTE.getValue());
|
|
|
- //保养
|
|
|
- List<CheckJobVO> checkJobVOS=checkJobMapper.getCheckJobCount(checkJobDTO);
|
|
|
- for(CheckJobVO vo: checkJobVOS){
|
|
|
- if(vo.getType()==2){
|
|
|
- noticeNumberVO.setUnexectuedMaintenanceNum(new BigDecimal(vo.getCountNum()));
|
|
|
- break;
|
|
|
+ if(sb.toString().contains("workplace_store")){
|
|
|
+ //仓库管理员
|
|
|
+ //仓库
|
|
|
+ //入库
|
|
|
+ inStoreFormDTO.setUserId(userInfo.getUserId());
|
|
|
+ outStoreFormDTO.setUserId(userInfo.getUserId());
|
|
|
+ storeCheckJobDTO.setUserId(userInfo.getUserId());
|
|
|
+ noticeNumberVO=addStoreNums(noticeNumberVO,inStoreFormDTO,outStoreFormDTO,storeCheckJobDTO);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//待办
|
|
|
//待签收
|
|
|
- MyPage<ActApplyInfo> myPage = (MyPage<ActApplyInfo>)(activitiController.showTaskListClaim(1,10).getData());
|
|
|
- noticeNumberVO.setWaitForSignInNum(new BigDecimal(myPage.getTotal()));
|
|
|
- //待审批
|
|
|
- MyPage<ActApplyInfo> myPage1=(MyPage<ActApplyInfo>)(activitiController.showTaskList(1,10).getData());
|
|
|
- noticeNumberVO.setWaitForExamineNum(new BigDecimal(myPage1.getTotal()));
|
|
|
- //通知
|
|
|
-// BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount("1");
|
|
|
- BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount(userInfo.getUserId());
|
|
|
- noticeNumberVO.setUnreadNum(num);
|
|
|
+// MyPage<ActApplyInfo> myPage = (MyPage<ActApplyInfo>)(activitiController.showTaskListClaim(1,10).getData());
|
|
|
+// noticeNumberVO.setWaitForSignInNum(new BigDecimal(myPage.getTotal()));
|
|
|
+// //待审批
|
|
|
+// MyPage<ActApplyInfo> myPage1=(MyPage<ActApplyInfo>)(activitiController.showTaskList(1,10).getData());
|
|
|
+// noticeNumberVO.setWaitForExamineNum(new BigDecimal(myPage1.getTotal()));
|
|
|
+// //通知
|
|
|
+//// BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount("1");
|
|
|
+// BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount(userInfo.getUserId());
|
|
|
+// noticeNumberVO.setUnreadNum(num);
|
|
|
|
|
|
System.out.println(LocalDateTime.now());
|
|
|
|
|
@@ -294,14 +354,14 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
|
|
|
public RepairApplicationFormVO getRepairApplicationFormVO() {
|
|
|
RepairApplicationFormDTO repairApplicationFormDTO=new RepairApplicationFormDTO();
|
|
|
RepairApplicationFormVO repairApplicationFormVO=new RepairApplicationFormVO();
|
|
|
- UserInfo userInfo=SecurityUtils.getUserInfo();
|
|
|
-// UserInfo userInfo=new UserInfo();
|
|
|
-// List list=new ArrayList();
|
|
|
-// list.add("维修人员");
|
|
|
-// list.add("Maintenance");
|
|
|
-// userInfo.setUserId("629ec2cc6f900a3658c4726f");
|
|
|
-// userInfo.setRoleCodes(list);
|
|
|
-// userInfo.setSuperAdmin(0);
|
|
|
+// UserInfo userInfo=SecurityUtils.getUserInfo();
|
|
|
+ UserInfo userInfo=new UserInfo();
|
|
|
+ List list=new ArrayList();
|
|
|
+ list.add("维修人员");
|
|
|
+ list.add("Maintenance");
|
|
|
+ userInfo.setUserId("629ec5456f900a3658c472b5");
|
|
|
+ userInfo.setRoleCodes(list);
|
|
|
+ userInfo.setSuperAdmin(0);
|
|
|
// 根据用户的角色来定
|
|
|
StringBuilder roleCodes = new StringBuilder();
|
|
|
userInfo.getRoleCodes().forEach(item-> {
|