| | |
| | | @Slf4j |
| | | public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocation> implements AllocationService { |
| | | |
| | | private final Integer NEW_BUILT = 10; |
| | | @Autowired |
| | | private SysDictTypeMapper sysDictTypeMapper; |
| | | @Autowired |
| | |
| | | if(Objects.nonNull(allocationCond.getEscalationUnitId())&&allocationCond.getEscalationUnitId().toString().length()==6) { |
| | | allocation.setEscalationType(AllocationEscalationTypeEnum.CHECK.getValue()); |
| | | } |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationCond.getState())) { |
| | | if(NEW_BUILT.equals(allocationCond.getState())) { |
| | | allocation.setState(AllocationApproveEnum.UNDER_RECTIFICATION.value); |
| | | } |
| | | //获取新建图片 |
| | | allocationMapper.insert(allocation); |
| | | redisTemplate.opsForValue().set(RedisConstants.JBD_DATA,i); |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationCond.getState())) { |
| | | if(NEW_BUILT.equals(allocationCond.getState())) { |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | approveTable.setState(AllocationApproveEnum.NEW_BUILT.value); |
| | | approveTable.setState(NEW_BUILT); |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTable.setStateName(AllocationApproveEnum.NEW_BUILT.name); |
| | | approveTable.setStateName("新建"); |
| | | approveTableService.saveResult(approveTable); |
| | | } |
| | | fileTableService.upDateResult(allocationCond.getFileBaseList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | |
| | | if(Objects.nonNull(allocationUpdateCond.getEscalationUnitId())&&allocationUpdateCond.getEscalationUnitId().toString().length()==6) { |
| | | allocation.setEscalationType(AllocationEscalationTypeEnum.CHECK.getValue()); |
| | | } |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationUpdateCond.getState())) { |
| | | if(NEW_BUILT.equals(allocationUpdateCond.getState())) { |
| | | //添加流程数据 |
| | | ApproveTable approveTable = new ApproveTable(); |
| | | approveTable.setRelationId(allocation.getAllocationId()); |
| | | approveTable.setState(AllocationApproveEnum.NEW_BUILT.value); |
| | | approveTable.setState(NEW_BUILT); |
| | | approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | | approveTable.setStateName(AllocationApproveEnum.NEW_BUILT.name); |
| | | approveTable.setStateName("新建"); |
| | | approveTableService.saveResult(approveTable); |
| | | } |
| | | if(AllocationApproveEnum.NEW_BUILT.value.equals(allocationUpdateCond.getState())) { |
| | | if(NEW_BUILT.equals(allocationUpdateCond.getState())) { |
| | | allocation.setState(AllocationApproveEnum.UNDER_RECTIFICATION.value); |
| | | } |
| | | fileTableService.upDateResult(allocationUpdateCond.getFileBaseList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value); |
| | |
| | | String state = allocation.getState()+""; |
| | | if (state.equals("40")||state.equals("50")){ |
| | | complete++; |
| | | }else if(state.equals("10")||state.equals("20") ||state.equals("30")) { |
| | | }else { |
| | | unComplete++; |
| | | } |
| | | } |
| | |
| | | Date dateOfDay = DateUtils.getDateOfDay(allocation.getEscalationTime(), allocation.getChangeDay()); |
| | | Date date = new Date(); |
| | | boolean timeBefor = DateUtils.isTimeBefor(date, dateOfDay); |
| | | if (timeBefor && !state.equals("40") && !state.equals("50")){ |
| | | if (timeBefor && !state.equals("40") && !state.equals("50") && !state.equals("9")){ |
| | | //逾期次数 |
| | | overdue++; |
| | | } |
| | |
| | | rsMap.put("unitView",allocationUnitViewDtos); |
| | | //总数 |
| | | rsMap.put("total",allocations.size()); |
| | | //完成数 |
| | | //已完成 |
| | | rsMap.put("complete",complete); |
| | | //未完成数 |
| | | //进行中 |
| | | rsMap.put("unComplete",unComplete); |
| | | //预期 |
| | | rsMap.put("overdue",overdue); |
| | |
| | | @Override |
| | | public Page<AllocationPageExt> extPage(AllocationPageCond allocationPageCond) { |
| | | List<Integer> unitList = unitResult(); |
| | | Integer codeId = unitAreaCode(); |
| | | allocationPageCond.setUnitList(unitList); |
| | | return this.baseMapper.extPage(allocationPageCond.getPage().convertPage(), allocationPageCond); |
| | | Page<AllocationPageExt> page = this.baseMapper.extPage(allocationPageCond.getPage().convertPage(), allocationPageCond); |
| | | if(CollectionUtils.isNotEmpty(page.getRecords())){ |
| | | page.getRecords().forEach(it->{ |
| | | if((CollectionUtils.isEmpty(unitList)&&codeId.equals(1))||codeId.equals(2)){ |
| | | it.setIsApprove(1); |
| | | }else { |
| | | it.setIsApprove(0); |
| | | } |
| | | }); |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return Arrays.asList(0); |
| | | } |
| | | |
| | | @Override |
| | | public Integer unitAreaCode() { |
| | | QxUser user = UserHelper.getCurrentUser(); |
| | | List<Integer> userList = responsibilityUnitMapper.selectCodeList("JBD",user.getUserId()); |
| | | if(CollectionUtils.isNotEmpty(userList)){ |
| | | return 1; |
| | | } |
| | | if(Objects.nonNull(user.getUnitId())){ |
| | | String code = responsibilityUnitMapper.selectAreaCode(user.getUnitId()); |
| | | if(code.length()>6){ |
| | | return 0; |
| | | }else { |
| | | return 2; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | } |