|
@@ -5,13 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxLowaltitudeDebtfreeCheckDetailPowerService;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxLowaltitudeDebtfreeCheckDetailService;
|
|
|
-import com.rongwei.bsentity.domain.ZhcxLowaltitudeDebtfreeCheckDetailDo;
|
|
|
-import com.rongwei.bsentity.domain.ZhcxLowaltitudeDebtfreeCheckDetailPowerDo;
|
|
|
-import com.rongwei.bsentity.domain.ZhcxLowaltitudeDebtfreeCheckMainDo;
|
|
|
+import com.rongwei.bsentity.domain.*;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxLowaltitudeDebtfreeCheckMainDao;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxLowaltitudeDebtfreeCheckMainService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
|
|
|
import com.rongwei.bsentity.dto.lowaltitude.AddHoistingPlanDateRequest;
|
|
|
import com.rongwei.bsentity.dto.lowaltitude.SaveCheckRequest;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
@@ -85,15 +82,22 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
* @param req
|
|
|
*/
|
|
|
@Override
|
|
|
- public void saveMain(SaveCheckRequest req, String mainId) {
|
|
|
+ public void saveMain(SaveCheckRequest req, ZhcxLowaltitudeDebtfreeCheckDo check) {
|
|
|
ZhcxLowaltitudeDebtfreeCheckMainDo entity = new ZhcxLowaltitudeDebtfreeCheckMainDo();
|
|
|
- entity.setId(mainId);
|
|
|
+ entity.setId(check.getMainid());
|
|
|
entity.setHoistingplandate(req.getHoistingplandate());
|
|
|
entity.setAltitude(req.getAltitude());
|
|
|
entity.setFinalassembledate(req.getFinalassembledate());
|
|
|
|
|
|
- final ZhcxLowaltitudeDebtfreeCheckMainDo main = getById(mainId);
|
|
|
- entity.setMachinedebtratio(calMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ final ZhcxLowaltitudeDebtfreeCheckMainDo main = getById(check.getMainid());
|
|
|
+
|
|
|
+ if("assembling".equals(check.getQualitystatus())) {
|
|
|
+ entity.setMachinedebtratio(calMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ } else if("powering".equals(check.getQualitystatus())) {
|
|
|
+ entity.setPtmachinedebtratio(calPtMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
updateById(entity);
|
|
|
}
|
|
@@ -104,12 +108,17 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
* @param req
|
|
|
*/
|
|
|
@Override
|
|
|
- public void saveMain4Power(SaveCheckRequest req, String mainId) {
|
|
|
+ public void saveMain4Power(SaveCheckRequest req, ZhcxLowaltitudeDebtfreeCheckDo check) {
|
|
|
ZhcxLowaltitudeDebtfreeCheckMainDo entity = new ZhcxLowaltitudeDebtfreeCheckMainDo();
|
|
|
- entity.setId(mainId);
|
|
|
+ entity.setId(check.getMainid());
|
|
|
+
|
|
|
+ final ZhcxLowaltitudeDebtfreeCheckMainDo main = getById(check.getMainid());
|
|
|
|
|
|
- final ZhcxLowaltitudeDebtfreeCheckMainDo main = getById(mainId);
|
|
|
- entity.setPowermachinedebtratio(calPowerMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ if("assembling".equals(check.getElectromechanicalstatus())) {
|
|
|
+ entity.setPowermachinedebtratio(calPowerMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ } else if("powering".equals(check.getElectromechanicalstatus())) {
|
|
|
+ entity.setPtpowermachinedebtratio(calPtPowerMachineDebtRatio(main.getProjectid(), main.getMachinenoid()));
|
|
|
+ }
|
|
|
|
|
|
updateById(entity);
|
|
|
}
|
|
@@ -120,7 +129,7 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
* @param mainId
|
|
|
*/
|
|
|
@Override
|
|
|
- public void updateMachineById(String projectId, String machineId, String mainId) {
|
|
|
+ public void updateMachine4AddById(String projectId, String machineId, String mainId) {
|
|
|
final String machineDebtRatio = calMachineDebtRatio(projectId, machineId);
|
|
|
|
|
|
ZhcxLowaltitudeDebtfreeCheckMainDo queryEntity = new ZhcxLowaltitudeDebtfreeCheckMainDo();
|
|
@@ -135,7 +144,7 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
* @param mainId
|
|
|
*/
|
|
|
@Override
|
|
|
- public void updateMachineById(String mainId) {
|
|
|
+ public void updateMachine4AddById(String mainId) {
|
|
|
final LambdaQueryWrapper<ZhcxLowaltitudeDebtfreeCheckDetailDo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(ZhcxLowaltitudeDebtfreeCheckDetailDo::getMainid, mainId);
|
|
|
final List<ZhcxLowaltitudeDebtfreeCheckDetailDo> list = lowaltitudeDebtfreeCheckDetailService.list(queryWrapper);
|
|
@@ -153,7 +162,7 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
* @param mainId
|
|
|
*/
|
|
|
@Override
|
|
|
- public void updatePowerMachineById(String projectId, String machineId, String mainId) {
|
|
|
+ public void updatePowerMachine4AddById(String projectId, String machineId, String mainId) {
|
|
|
final String machineDebtRatio = calPowerMachineDebtRatio(projectId, machineId);
|
|
|
|
|
|
ZhcxLowaltitudeDebtfreeCheckMainDo queryEntity = new ZhcxLowaltitudeDebtfreeCheckMainDo();
|
|
@@ -173,6 +182,17 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
return calPowerMachineDebtRatio(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算机台不欠债率
|
|
|
+ *
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String calPtPowerMachineDebtRatio(String projectId, String machineId) {
|
|
|
+ final List<ZhcxLowaltitudeDebtfreeCheckDetailPowerDo> list = lowaltitudeDebtfreeCheckDetailPowerService.getListByMainId(projectId, machineId);
|
|
|
+ return calPtPowerMachineDebtRatio(list);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算机台不欠债率
|
|
|
*
|
|
@@ -184,6 +204,17 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
return calMachineDebtRatio(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算机台不欠债率
|
|
|
+ *
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String calPtMachineDebtRatio(String projectId, String machineId) {
|
|
|
+ final List<ZhcxLowaltitudeDebtfreeCheckDetailDo> list = lowaltitudeDebtfreeCheckDetailService.getListByMainId(projectId, machineId);
|
|
|
+ return calPtMachineDebtRatio(list);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算机台不欠债率
|
|
|
*
|
|
@@ -219,6 +250,42 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
return machineRatio;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算机台不欠债率
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String calPtPowerMachineDebtRatio(List<ZhcxLowaltitudeDebtfreeCheckDetailPowerDo> list) {
|
|
|
+ if(ObjectUtil.isEmpty(list)) {
|
|
|
+ return "0.00%";
|
|
|
+ }
|
|
|
+
|
|
|
+ int completeCount = 0;
|
|
|
+ int totalCount = 0;
|
|
|
+ for (ZhcxLowaltitudeDebtfreeCheckDetailPowerDo row : list) {
|
|
|
+ if ("✓".equals(row.getPowerrectifyesult())) {
|
|
|
+ completeCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!"/".equals(row.getPowerrectifyesult())) {
|
|
|
+ totalCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 计算机器比率
|
|
|
+ String machineRatio;
|
|
|
+ if (totalCount == 0) {
|
|
|
+ machineRatio = "0.00%"; // 避免除以零
|
|
|
+ } else {
|
|
|
+ double ratio = (double) completeCount / totalCount * 100;
|
|
|
+ machineRatio = String.format("%.2f%%", ratio);
|
|
|
+ }
|
|
|
+
|
|
|
+ return machineRatio;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算机台不欠债率
|
|
|
*
|
|
@@ -254,4 +321,39 @@ public class ZhcxLowaltitudeDebtfreeCheckMainServiceImpl extends ServiceImpl<Zhc
|
|
|
return machineRatio;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算机台不欠债率-送电
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String calPtMachineDebtRatio(List<ZhcxLowaltitudeDebtfreeCheckDetailDo> list) {
|
|
|
+ if(ObjectUtil.isEmpty(list)) {
|
|
|
+ return "0.00%";
|
|
|
+ }
|
|
|
+
|
|
|
+ int completeCount = 0;
|
|
|
+ int totalCount = 0;
|
|
|
+ for (ZhcxLowaltitudeDebtfreeCheckDetailDo row : list) {
|
|
|
+ if ("✓".equals(row.getPowerrectifyesult())) {
|
|
|
+ completeCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!"/".equals(row.getPowerrectifyesult())) {
|
|
|
+ totalCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 计算机器比率
|
|
|
+ String machineRatio;
|
|
|
+ if (totalCount == 0) {
|
|
|
+ machineRatio = "0.00%"; // 避免除以零
|
|
|
+ } else {
|
|
|
+ double ratio = (double) completeCount / totalCount * 100;
|
|
|
+ machineRatio = String.format("%.2f%%", ratio);
|
|
|
+ }
|
|
|
+
|
|
|
+ return machineRatio;
|
|
|
+ }
|
|
|
+
|
|
|
}
|