|
@@ -4,10 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.core.util.ZipUtil;
|
|
|
+import cn.hutool.core.util.*;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -22,9 +19,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bsentity.dto.*;
|
|
|
import com.rongwei.bsentity.dto.outside.OutsideInspectionInsertRequest;
|
|
|
import com.rongwei.bsentity.dto.outside.OutsideInspectionUpdateRequest;
|
|
|
+import com.rongwei.bsentity.dto.project.indicator.DelPhysicalParam;
|
|
|
import com.rongwei.bsentity.dto.project.node.ProjectNodeStateBo;
|
|
|
import com.rongwei.bsentity.dto.project.node.UnItpNodeStateBo;
|
|
|
import com.rongwei.bsentity.vo.*;
|
|
|
+import com.rongwei.bsentity.vo.outside.OutsideInspectionVo;
|
|
|
+import com.rongwei.bsentity.vo.project.ShipOffStoreNodeTotal;
|
|
|
import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
import com.rongwei.rwadmincommon.system.service.SysGeneralCRUDService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
@@ -47,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
@@ -115,6 +116,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
@Autowired
|
|
|
private ZhcxInsideInspectionDao insideInspectionDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZhcxProjectDeviceIndicatorService projectDeviceIndicatorService;
|
|
|
+
|
|
|
/**
|
|
|
* 保存外部报验单
|
|
|
*
|
|
@@ -1464,6 +1468,110 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
return dao.getInitNodeStateInspection();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加统计完成指标指标
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void addUpComplateIndicators() {
|
|
|
+ //删除外部报验数据
|
|
|
+ DelPhysicalParam param = DelPhysicalParam.builder()
|
|
|
+ .type("outside_inspection_complate")
|
|
|
+ .build();
|
|
|
+ projectDeviceIndicatorService.delPhysical(param);
|
|
|
+
|
|
|
+
|
|
|
+ final List<ShipOffStoreNodeTotal> nodeTotalList = itpProjectNodesService.getShipOffStoreNodeTotal(); //分母为为空
|
|
|
+ if(ObjectUtil.isEmpty(nodeTotalList)) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ //外部报验
|
|
|
+ Map<String, JSONObject> inspectionMap = new HashMap<>();
|
|
|
+ final Map<String, Set<String>> inspectionTolalMap = getInspectionPointTolal(inspectionMap);
|
|
|
+
|
|
|
+ List<ZhcxProjectDeviceIndicatorDo> saveLsit = new ArrayList<>(nodeTotalList.size());
|
|
|
+ for(ShipOffStoreNodeTotal nodeTotal : nodeTotalList) {
|
|
|
+ JSONObject inspection = inspectionMap.get(nodeTotal.getProjectid());
|
|
|
+
|
|
|
+ if(ObjectUtil.isNull(inspection)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ ZhcxProjectDeviceIndicatorDo indicator = new ZhcxProjectDeviceIndicatorDo();
|
|
|
+ indicator.setId(SecurityUtil.getUUID());
|
|
|
+ indicator.setDate(inspection.getDate("inspectionComplateTime"));
|
|
|
+ indicator.setDeleted("0");
|
|
|
+ indicator.setProjectid(inspection.getString("projectId"));
|
|
|
+ indicator.setProjectcode(inspection.getString("projectCode"));
|
|
|
+ indicator.setProjectname(inspection.getString("projectName"));
|
|
|
+ indicator.setProjectshortname(inspection.getString("projectName"));
|
|
|
+ indicator.setMachineid(inspection.getString("machineId"));
|
|
|
+ indicator.setMachineno(inspection.getString("machineNo"));
|
|
|
+ indicator.setDisplayboard("绿");
|
|
|
+ indicator.setIndicatorname("到期检验情况");
|
|
|
+ indicator.setType("outside_inspection_complate");
|
|
|
+ indicator.setSort(1);
|
|
|
+
|
|
|
+ if(ObjectUtil.isEmpty(inspectionTolalMap.get(nodeTotal.getProjectid()))) {
|
|
|
+ indicator.setCompleted(0);
|
|
|
+ } else {
|
|
|
+ indicator.setCompleted(inspectionTolalMap.get(nodeTotal.getProjectid()).size());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isNull(nodeTotal.getTotal())) {
|
|
|
+ indicator.setCompletionrate(BigDecimal.ZERO);
|
|
|
+ } else {
|
|
|
+ indicator.setTotal(nodeTotal.getTotal());
|
|
|
+ Float f = indicator.getCompleted().floatValue() / indicator.getTotal().floatValue() * 100;
|
|
|
+ indicator.setCompletionrate(new BigDecimal(String.format("%.2f", f)));
|
|
|
+ }
|
|
|
+
|
|
|
+ saveLsit.add(indicator);
|
|
|
+ }
|
|
|
+
|
|
|
+ projectDeviceIndicatorService.saveBatch(saveLsit);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取报验单中所有接收和有条件接收的报验点总和
|
|
|
+ *
|
|
|
+ * @return key:项目id,value:报验点id集合
|
|
|
+ */
|
|
|
+ private Map<String, Set<String>> getInspectionPointTolal(Map<String, JSONObject> inspectionMap) {
|
|
|
+ final List<OutsideInspectionVo> inspectionLst = dao.getShipInspectionDisplay();//接收/有条件接收报验单
|
|
|
+ if(ObjectUtil.isEmpty(inspectionLst)) {
|
|
|
+ return Collections.EMPTY_MAP;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Set<String>> inspectionNodeMap = new HashMap();
|
|
|
+ for(OutsideInspectionVo outside : inspectionLst) {
|
|
|
+ Set<String> prjNodeSet = inspectionNodeMap.get(outside.getProjectid());
|
|
|
+
|
|
|
+ //报验单
|
|
|
+ final JSONObject inspection = inspectionMap.get(outside.getProjectid());
|
|
|
+ if(ObjectUtil.isNull(inspection)) {
|
|
|
+ JSONObject prjObj = new JSONObject();
|
|
|
+ prjObj.put("projectId", outside.getProjectid());
|
|
|
+ prjObj.put("projectCode", outside.getProjectcode());
|
|
|
+ prjObj.put("projectName", outside.getProjectname());
|
|
|
+ prjObj.put("inspectionComplateTime", outside.getInspectioncomplatetime());
|
|
|
+
|
|
|
+ prjObj.put("machineId", outside.getShipMachineNoId());
|
|
|
+ prjObj.put("machineNo", outside.getShipMachineNo());
|
|
|
+ inspectionMap.put(outside.getProjectid(), prjObj);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isNull(prjNodeSet)) {
|
|
|
+ prjNodeSet = new HashSet<>();
|
|
|
+ }
|
|
|
+ prjNodeSet.add(outside.getInspectioncontentid());
|
|
|
+ inspectionNodeMap.put(outside.getProjectid(), prjNodeSet);
|
|
|
+ }
|
|
|
+
|
|
|
+ return inspectionNodeMap;
|
|
|
+ }
|
|
|
+
|
|
|
private boolean isWithinAllowedTime() {
|
|
|
// 获取当前时间
|
|
|
LocalTime now = LocalTime.now();
|