|
@@ -1,11 +1,23 @@
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionDispatchService;
|
|
|
|
+import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionOperLogService;
|
|
|
|
+import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
import com.rongwei.bsentity.domain.ZhcxInsideInspectionDo;
|
|
import com.rongwei.bsentity.domain.ZhcxInsideInspectionDo;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxInsideInspectionDao;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxInsideInspectionDao;
|
|
import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionService;
|
|
import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.rongwei.bsentity.dto.InsideInspectionOperRequest;
|
|
|
|
+import com.rongwei.bsentity.dto.InsideOperLogDto;
|
|
|
|
+import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
|
+import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 内部报验-报验管理 服务实现类
|
|
* 内部报验-报验管理 服务实现类
|
|
@@ -17,4 +29,72 @@ import org.springframework.stereotype.Service;
|
|
@Service
|
|
@Service
|
|
public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspectionDao, ZhcxInsideInspectionDo> implements ZhcxInsideInspectionService {
|
|
public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspectionDao, ZhcxInsideInspectionDo> implements ZhcxInsideInspectionService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxInsideInspectionDispatchService dispatchService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysSerialNumberService serialNumberService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxInsideInspectionOperLogService zhcxInsideInspectionOperLogService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxCommon zhcxCommon;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存后操作
|
|
|
|
+ *
|
|
|
|
+ * @param req
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void launch(InsideInspectionOperRequest req) {
|
|
|
|
+ ZhcxInsideInspectionDo inspectionDo = getById(req.getId());
|
|
|
|
+ //生成报验单号
|
|
|
|
+ genInspectionCode(inspectionDo);
|
|
|
|
+ //生成空派单信息
|
|
|
|
+ dispatchService.genEmptyDispatch(req.getId());
|
|
|
|
+
|
|
|
|
+ //生成操作记录
|
|
|
|
+ SysUserVo user = zhcxCommon.getCurrentUser();
|
|
|
|
+ InsideOperLogDto operLogDto = InsideOperLogDto.builder()
|
|
|
|
+ .id(req.getId())
|
|
|
|
+ .operType("5")
|
|
|
|
+ .launchSource(ObjectUtil.isEmpty(req.getLaunchSource()) ? "mobile" : req.getLaunchSource())
|
|
|
|
+ .build();
|
|
|
|
+ operLogDto.setOperUser(user);
|
|
|
|
+ operLogDto.setOperTime(new Date());
|
|
|
|
+ zhcxInsideInspectionOperLogService.saveOperLog(operLogDto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成报验单号
|
|
|
|
+ *
|
|
|
|
+ * @param inspectionDo
|
|
|
|
+ */
|
|
|
|
+ private void genInspectionCode(ZhcxInsideInspectionDo inspectionDo) {
|
|
|
|
+ //存在报验单号,则不再生成
|
|
|
|
+ if(ObjectUtil.isNotEmpty(inspectionDo.getInspectioncode())) {
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ZhcxInsideInspectionDo entity = new ZhcxInsideInspectionDo();
|
|
|
|
+ entity.setId(inspectionDo.getId());
|
|
|
|
+ entity.setInspectioncode(genCode());
|
|
|
|
+ updateById(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成单号
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String genCode() {
|
|
|
|
+ SysSerialVo sysSerialVo = new SysSerialVo();
|
|
|
|
+ sysSerialVo.setRuleTemplateStr("N@{date:yyyyMMdd}@{serialNumber:#0000}");
|
|
|
|
+ sysSerialVo.setModulecode("ZHCX_INSIDE_INSPECTION");
|
|
|
|
+ sysSerialVo.setIfautomaticreset("y");
|
|
|
|
+ sysSerialVo.setResetrule("date:yyyyMMdd");
|
|
|
|
+ sysSerialVo.setInitValue(0L);
|
|
|
|
+ return serialNumberService.getCodeByTemplate(sysSerialVo);
|
|
|
|
+ }
|
|
}
|
|
}
|