| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | public void add(SgProgressReportDO sgProgressReportDO) { |
| | | Date now = DateUtil.now(); |
| | | sgProgressReportDO.setReportTime(now); |
| | | sgProgressReportDO.setCreateTime(now); |
| | | Long gxDeviceId = sgProgressReportDO.getGxDeviceId(); |
| | | Long gxStepId = sgProgressReportDO.getGxStepId(); |
| | | List<SgGxStepDO> list = sgGxStepMapper.selectByGxInfoId(gxDeviceId); |
| | |
| | | public Map<String, Long> countList(ProjectSearchDTO searchDTO) { |
| | | Long userId = AuthUtil.getUserId(); |
| | | searchDTO.setUserId(userId); |
| | | searchDTO.setApprovalStatus(0); |
| | | Long pending = sgProgressReportMapper.countList(searchDTO); |
| | | searchDTO.setApprovalStatus(1); |
| | | Long over = sgProgressReportMapper.countList(searchDTO); |
| | | Map<String, Long> map = new HashMap<>(); |
| | | map.put("pending",pending); |
| | |
| | | map.put("reject", (long) reject.size()); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkStep(Long gxDeviceId, Long gxStepId) { |
| | | List<SgGxStepDO> list = sgGxStepMapper.selectByGxInfoId(gxDeviceId); |
| | | SgGxStepDO sgGxStepDO = sgGxStepMapper.selectById(gxStepId); |
| | | QueryWrapper<SgProgressReportDO> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("gx_step_id", gxStepId).eq("gx_device_id",gxDeviceId); |
| | | List<SgProgressReportDO> sgProgressReportDOS = sgProgressReportMapper.selectList(wrapper); |
| | | if ( sgProgressReportDOS!=null && sgProgressReportDOS.size()>0){ |
| | | return false; |
| | | } |
| | | for (SgGxStepDO gxStepDO : list) { |
| | | if (Integer.parseInt(sgGxStepDO.getGxStepNum()) - Integer.parseInt(gxStepDO.getGxStepNum()) == 1) { |
| | | QueryWrapper<SgProgressReportDO> wrapper1 = new QueryWrapper<>(); |
| | | wrapper1.eq("gx_step_id", gxStepDO.getId()); |
| | | SgProgressReportDO one = sgProgressReportMapper.selectOne(wrapper1); |
| | | if (one == null || one.getStatus() != 2) { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SgProgressReportVO> progressPage(IPage<SgProgressReportVO> page, ProjectSearchDTO searchDTO) { |
| | | Long userId = AuthUtil.getUserId(); |
| | | searchDTO.setUserId(userId); |
| | | List<SgProgressReportVO> list = sgProgressReportMapper.queryList(page, searchDTO); |
| | | return page.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public String getDeviceReport(Long gxDeviceId, Long gxStepId) { |
| | | QueryWrapper<SgProgressReportDO> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("gx_device_id",gxDeviceId); |
| | | if (gxStepId!=null){ |
| | | wrapper.eq("gx_step_id",gxStepId); |
| | | } |
| | | List<SgProgressReportDO> sgProgressReportDOS = sgProgressReportMapper.selectList(wrapper); |
| | | if (CollectionUtils.isNotEmpty(sgProgressReportDOS)){ |
| | | sgProgressReportDOS.sort((u1, u2) -> u2.getCreateTime().compareTo(u1.getCreateTime())); |
| | | return sgProgressReportDOS.get(0).getId().toString(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |