|
@@ -1,11 +1,24 @@
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.rongwei.bscommon.sys.service.ZhcxBaseCheckDetailService;
|
|
|
|
+import com.rongwei.bscommon.sys.service.ZhcxQualityPowerHandoverDetailService;
|
|
|
|
+import com.rongwei.bsentity.domain.ZhcxBaseCheckDetailDo;
|
|
|
|
+import com.rongwei.bsentity.domain.ZhcxLowaltitudeDebtfreeCheckMainDo;
|
|
|
|
+import com.rongwei.bsentity.domain.ZhcxQualityPowerHandoverDetailDo;
|
|
import com.rongwei.bsentity.domain.ZhcxQualityPowerHandoverDo;
|
|
import com.rongwei.bsentity.domain.ZhcxQualityPowerHandoverDo;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxQualityPowerHandoverDao;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxQualityPowerHandoverDao;
|
|
import com.rongwei.bscommon.sys.service.ZhcxQualityPowerHandoverService;
|
|
import com.rongwei.bscommon.sys.service.ZhcxQualityPowerHandoverService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 质量奖惩-送电前交接 服务实现类
|
|
* 质量奖惩-送电前交接 服务实现类
|
|
@@ -17,4 +30,70 @@ import org.springframework.stereotype.Service;
|
|
@Service
|
|
@Service
|
|
public class ZhcxQualityPowerHandoverServiceImpl extends ServiceImpl<ZhcxQualityPowerHandoverDao, ZhcxQualityPowerHandoverDo> implements ZhcxQualityPowerHandoverService {
|
|
public class ZhcxQualityPowerHandoverServiceImpl extends ServiceImpl<ZhcxQualityPowerHandoverDao, ZhcxQualityPowerHandoverDo> implements ZhcxQualityPowerHandoverService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxBaseCheckDetailService baseCheckDetailService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxQualityPowerHandoverDetailService qualityPowerHandoverDetailService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过低空不欠债生成
|
|
|
|
+ *
|
|
|
|
+ * @param main
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void saveByLowaltitude(ZhcxLowaltitudeDebtfreeCheckMainDo main) {
|
|
|
|
+ final LambdaQueryWrapper<ZhcxQualityPowerHandoverDo> queryCountWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryCountWrapper.eq(ZhcxQualityPowerHandoverDo::getProjectid, main.getProjectid())
|
|
|
|
+ .eq(ZhcxQualityPowerHandoverDo::getMachinenoid, main.getMachinenoid());
|
|
|
|
+ final int count = count(queryCountWrapper);
|
|
|
|
+ if(count > 0) { //已生成不重复生成
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //送电前检查项
|
|
|
|
+ final List<ZhcxBaseCheckDetailDo> checkDetailList = baseCheckDetailService.getByType("送电前");
|
|
|
|
+
|
|
|
|
+ //主表
|
|
|
|
+ ZhcxQualityPowerHandoverDo handover = new ZhcxQualityPowerHandoverDo();
|
|
|
|
+ handover.setId(SecurityUtil.getUUID());
|
|
|
|
+ handover.setType("送电前");
|
|
|
|
+ handover.setDeleted("0");
|
|
|
|
+ handover.setProjectid(main.getProjectid());
|
|
|
|
+ handover.setProjectcode(main.getProjectcode());
|
|
|
|
+ handover.setProjectname(main.getProjectname());
|
|
|
|
+ handover.setMachinenoid(main.getMachinenoid());
|
|
|
|
+ handover.setMachineno(main.getMachineno());
|
|
|
|
+ handover.setConstcomplate(0);
|
|
|
|
+ if(ObjectUtil.isEmpty(checkDetailList)) {
|
|
|
|
+ handover.setConsttotal(0);
|
|
|
|
+ handover.setReceivetotal(0);
|
|
|
|
+ } else {
|
|
|
|
+ handover.setConsttotal(checkDetailList.size());
|
|
|
|
+ handover.setReceivetotal(checkDetailList.size());
|
|
|
|
+ }
|
|
|
|
+ handover.setReceivecomplate(0);
|
|
|
|
+ save(handover);
|
|
|
|
+
|
|
|
|
+ //明细保存
|
|
|
|
+ List<ZhcxQualityPowerHandoverDetailDo> list = new ArrayList<>(checkDetailList.size());
|
|
|
|
+ int countIdx = 0;
|
|
|
|
+
|
|
|
|
+ for(ZhcxBaseCheckDetailDo detail : checkDetailList) {
|
|
|
|
+ countIdx++;
|
|
|
|
+ ZhcxQualityPowerHandoverDetailDo row = new ZhcxQualityPowerHandoverDetailDo();
|
|
|
|
+ row.setId(SecurityUtil.getUUID());
|
|
|
|
+ row.setDeleted("0");
|
|
|
|
+ row.setHandoverid(handover.getId());
|
|
|
|
+ row.setClassify(detail.getClassify());
|
|
|
|
+ row.setCheckcontent(detail.getCheckcontent());
|
|
|
|
+ row.setSpecificreq(detail.getSpecificreq());
|
|
|
|
+ row.setConstdepart(detail.getConstdepart());
|
|
|
|
+ row.setBasecheckid(detail.getCheckid());
|
|
|
|
+ row.setBasecheckdetailid(detail.getId());
|
|
|
|
+ row.setSeqsort(countIdx);
|
|
|
|
+ list.add(row);
|
|
|
|
+ }
|
|
|
|
+ qualityPowerHandoverDetailService.saveBatch(list);
|
|
|
|
+ }
|
|
}
|
|
}
|