|
@@ -19,10 +19,7 @@ import com.platform.dao.bean.MyPage;
|
|
|
import com.platform.dao.bean.MyVOPage;
|
|
|
import com.platform.dao.dto.check.CheckStandardDTO;
|
|
|
import com.platform.dao.dto.part.PartInfoDTO;
|
|
|
-import com.platform.dao.dto.sb.SbChangeRecordDTO;
|
|
|
-import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
-import com.platform.dao.dto.sb.SbModelSpareBomDTO;
|
|
|
-import com.platform.dao.dto.sb.SbTypeDTO;
|
|
|
+import com.platform.dao.dto.sb.*;
|
|
|
import com.platform.dao.dto.upms.SysDeptDTO;
|
|
|
import com.platform.dao.dto.upms.SysUserDeptDTO;
|
|
|
import com.platform.dao.dto.workplace.WorkplaceBacklogDTO;
|
|
@@ -57,6 +54,7 @@ import com.platform.dao.vo.export.sb.CustomParams;
|
|
|
import com.platform.dao.vo.export.sb.ExportSbInfoVO;
|
|
|
import com.platform.dao.vo.export.sb.ExportYiBiaoSbInfoVO;
|
|
|
import com.platform.dao.vo.query.sb.SbChangeRecordVO;
|
|
|
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
|
|
|
import com.platform.dao.vo.query.upms.SysDeptVO;
|
|
|
import com.platform.dao.vo.report.SbInfoTypeReportVO;
|
|
|
import com.platform.dao.vo.report.SbInfoTypeReportVO2;
|
|
@@ -139,6 +137,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
private final SbChangeRecordMapper sbChangeRecordMapper;
|
|
|
private final FillGatherTaskDetailMapper fillGatherTaskDetailMapper;
|
|
|
+ private final SbMeasureLogMapper sbMeasureLogMapper;
|
|
|
|
|
|
@Override
|
|
|
public AbstractPageResultBean<SbInfoVO> getSynchronousSb(SbModelSpareBomDTO dto,Integer pageNum,Integer pageSize) {
|
|
@@ -1833,6 +1832,182 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
return new MyVOPage<>(sbList);
|
|
|
}
|
|
|
|
|
|
+ public int compareTo(SbMeasureLogVO o1,SbMeasureLogVO o2) {
|
|
|
+ if (o1.getCreatedTime().isAfter(o2.getCreatedTime())) {
|
|
|
+ return 1;
|
|
|
+ } else if (o1.getCreatedTime().isBefore(o2.getCreatedTime())) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MyVOPage<SbInfoVO> selectVOPage2(SbInfoDTO model, int pageNum, int pageSize) {
|
|
|
+ // 选择该用户的设备
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ model.setSaveUser(userInfo.getUserId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.BANZU.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseGroup(sysUserDepts.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.PROJECT.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ SysDeptDTO sysDeptDTO = new SysDeptDTO();
|
|
|
+ sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
|
|
|
+ sysDeptDTO.setNature(DeptNatureEnum.XIANG_MU_BU.getValue());
|
|
|
+ List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
+ throw new BusinessException("找不到该用户所属的项目部,请先设置项目组,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseProject(list.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ if (model.getFilter() != null && DataFilterTypeEnum.COMPANY.getValue() == model.getFilter().intValue()) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<SysUserDept> sysUserDepts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if (CollectionUtil.isEmpty(sysUserDepts)) {
|
|
|
+ throw new BusinessException("找不到该用户所属班组,请先设置部门,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ SysDeptDTO sysDeptDTO = new SysDeptDTO();
|
|
|
+ sysDeptDTO.setDescendant(sysUserDepts.get(0).getDeptId());
|
|
|
+ sysDeptDTO.setNature(DeptNatureEnum.FEN_GONG_SI.getValue());
|
|
|
+ List<SysDeptVO> list = sysDeptService.allParentList(sysDeptDTO);
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
+ throw new BusinessException("找不到该用户所属的分公司,请先设置项目组,用户id:" + userInfo.getUserId());
|
|
|
+ }
|
|
|
+ model.setUseCompany(list.get(0).getDeptId());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(model.getFinancingNo())){
|
|
|
+ model.setFinancingNo(model.getFinancingNo().trim());
|
|
|
+ }
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<SbInfoVO> sbList = mapper.selectVOList(model);
|
|
|
+
|
|
|
+ List<String> sbIds = sbList.stream().map(SbInfoVO::getId).collect(Collectors.toList());
|
|
|
+ Map<String,List<SbMeasureLogVO>> maps = new HashMap<>();
|
|
|
+
|
|
|
+ SbMeasureLogDTO sbMeasureLogDTO = new SbMeasureLogDTO();
|
|
|
+ sbMeasureLogDTO.setSbIds(sbIds);
|
|
|
+ List<SbMeasureLogVO> sbMeasureLogVOS = sbMeasureLogMapper.selectList(sbMeasureLogDTO);
|
|
|
+ for (SbInfoVO sbInfoVO:sbList) {
|
|
|
+ List<SbMeasureLogVO> logVOS = new ArrayList<>();
|
|
|
+ for (SbMeasureLogVO vo : sbMeasureLogVOS) {
|
|
|
+ if (sbInfoVO.getId().equals(vo.getSbId())){
|
|
|
+ logVOS.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (logVOS.size()>1) {
|
|
|
+ logVOS.sort(((o1, o2) -> {
|
|
|
+ return compareTo(o2, o1);
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ maps.put(sbInfoVO.getId(),logVOS);
|
|
|
+ }
|
|
|
+ for (Map.Entry<String,List<SbMeasureLogVO>> entry:maps.entrySet()){
|
|
|
+ if (entry.getValue().size()>0) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ List<SbMeasureLogVO> logVOS = entry.getValue();
|
|
|
+ SbMeasureLogVO vo = logVOS.get(0);
|
|
|
+ logVOS.remove(0);
|
|
|
+ for (SbInfoVO sbInfoVO : sbList) {
|
|
|
+ if (sbInfoVO.getId().equals(key)) {
|
|
|
+ sbInfoVO.setOperator(vo.getCreatedUserName());
|
|
|
+ sbInfoVO.setOperatorContent(vo.getContent());
|
|
|
+ sbInfoVO.setOperatorType(vo.getOtherType());
|
|
|
+ sbInfoVO.setSubSbMeasureLogVO(logVOS);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (model.getUseType()!=null&&model.getUseType()==5){
|
|
|
+ Map<String, Object> map = new HashedMap();
|
|
|
+ for (SbInfoVO vo:sbList){
|
|
|
+ try {
|
|
|
+ String jsonStr = vo.getParamList().substring(1,vo.getParamList().length()-1);
|
|
|
+ String[] strArr = jsonStr.split("},");
|
|
|
+ for (int i=0;i<strArr.length;i++){
|
|
|
+ String str=null;
|
|
|
+ if (i!=strArr.length-1){
|
|
|
+ str = strArr[i]+"}";
|
|
|
+ }
|
|
|
+ Map<String,String> map1= JsonUtils.jsonToMap(str);
|
|
|
+ map.put(map1.get("name"),map1.get("content"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (map!=null) {
|
|
|
+ vo.setBpNo(map.get("标牌号") == null ? null : map.get("标牌号").toString());
|
|
|
+ vo.setSbWorkPa(map.get("设备工作压力MPa") == null ? null : Double.parseDouble(map.get("设备工作压力MPa").toString()));
|
|
|
+ vo.setSecurityType(map.get("安全阀类型") == null ? null : map.get("安全阀类型").toString());
|
|
|
+ vo.setSecurityModel(map.get("安全阀型号") == null ? null : map.get("安全阀型号").toString());
|
|
|
+ vo.setGctj(map.get("公称通径") == null ? null : Integer.parseInt(map.get("公称通径").toString()));
|
|
|
+ vo.setGcPa(map.get("公称压力MPa") == null ? null : Double.parseDouble(map.get("公称压力MPa").toString()));
|
|
|
+ vo.setMaxPa(map.get("所在设备最高工作压力") == null ? null : Double.parseDouble(map.get("所在设备最高工作压力").toString()));
|
|
|
+ vo.setZdPa(map.get("整定压力") == null ? null : Double.parseDouble(map.get("整定压力").toString()));
|
|
|
+ vo.setReportNo(map.get("报告编号") == null ? null : map.get("报告编号").toString());
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+// param.setId(vo.getId());
|
|
|
+// param.setSbName(vo.getName());
|
|
|
+// param.setPositionName(vo.getPositionName());
|
|
|
+// vo.setDeFinedParam(param);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /* for (SbInfoVO vo : sbList) {
|
|
|
+ vo.setChildren(new ArrayList<>());
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /*if (SbInfoChildEnum.IS_PARENT.getValue().equals(model.getIsChild()) && !CollectionUtils.isEmpty(sbList)) {
|
|
|
+ for (SbInfoVO vo : sbList) {
|
|
|
+ if (SbInfoChildEnum.IS_PARENT.getValue().equals(vo.getIsChild())) {
|
|
|
+ SbInfoDTO infoDTO = new SbInfoDTO();
|
|
|
+ infoDTO.setParentId(vo.getId());
|
|
|
+ List<SbInfoVO> childVOList = mapper.selectVOList(infoDTO);
|
|
|
+ if (!CollectionUtils.isEmpty(childVOList)) {
|
|
|
+ vo.setChildren(childVOList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /*List<SysUser> userList = sysUserMapper.selectAll();
|
|
|
+ for (SbInfoVO vo : sbList) {
|
|
|
+ if (vo.getRepairUser() != null) {
|
|
|
+ userList.forEach(sysUser -> {
|
|
|
+ if (sysUser.getUserId().equals(vo.getRepairUser())) {
|
|
|
+ vo.setRepairUserName(sysUser.getRealName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (vo.getRepairUserSecond() != null) {
|
|
|
+ userList.forEach(sysUser -> {
|
|
|
+ if (sysUser.getUserId().equals(vo.getRepairUserSecond())) {
|
|
|
+ vo.setRepairUserNameSecond(sysUser.getRealName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ return new MyVOPage<>(sbList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据登录用户的身份来查询列表
|
|
|
* 1:使用人员,看到自己的
|