更新
1.添加修改受理后的检材受理编号
This commit is contained in:
27
pom.xml
27
pom.xml
@@ -13,13 +13,18 @@
|
||||
|
||||
<description>送检受理</description>
|
||||
|
||||
<properties>
|
||||
<dlp.version>2022.10.11-snapshots</dlp.version>
|
||||
<cloud.alibaba.version>2021.1</cloud.alibaba.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--注册中心客户端-->
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>2021.1</version>
|
||||
<version>${cloud.alibaba.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--配置中心客户端-->
|
||||
@@ -27,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
<version>2021.1</version>
|
||||
<version>${cloud.alibaba.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger -->
|
||||
@@ -40,14 +45,14 @@
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-feign</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--security-->
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-security</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
<!--JDBC相关-->
|
||||
<dependency>
|
||||
@@ -71,39 +76,39 @@
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-log</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
<!-- 业务数据的依赖 -->
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-admin-api</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
<!-- 污水系统api-->
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-sewage-api</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方系统集成api工具类-->
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-othersys-api</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-oss</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-remote-word2pdf</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -170,7 +175,7 @@
|
||||
<dependency>
|
||||
<groupId>digital.laboratory.platform</groupId>
|
||||
<artifactId>dlp-common-seata</artifactId>
|
||||
<version>2022.10.11-snapshots</version>
|
||||
<version>${dlp.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package digital.laboratory.platform.entrustment.controller;
|
||||
|
||||
import digital.laboratory.platform.common.core.util.R;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.service.AcceptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 委托受理模块控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/papp/accept")
|
||||
@Api(value = "AcceptController", tags = "委托受理模块控制器相关接口")
|
||||
public class AcceptController {
|
||||
|
||||
@Resource
|
||||
private AcceptService acceptService;
|
||||
|
||||
@ApiOperation("修改受理后的检材受理编号")
|
||||
@PutMapping("/alertMaterialAcceptNo")
|
||||
@PreAuthorize("@pms.hasPermission('EntrustmentAccept')")
|
||||
public R alertMaterialAcceptNo(@RequestBody EntrustmentIdentificationMaterial material) {
|
||||
Boolean success = acceptService.alertMaterialAcceptNo(material);
|
||||
return R.ok(success);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package digital.laboratory.platform.entrustment.service;
|
||||
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
|
||||
/**
|
||||
* 受理服务层接口
|
||||
*/
|
||||
public interface AcceptService {
|
||||
|
||||
/**
|
||||
* 修改受理后的检材受理编号
|
||||
* @param material
|
||||
* @return
|
||||
*/
|
||||
Boolean alertMaterialAcceptNo(EntrustmentIdentificationMaterial material);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package digital.laboratory.platform.entrustment.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import digital.laboratory.platform.common.core.exception.ValidateCodeException;
|
||||
import digital.laboratory.platform.entrustment.entity.Entrustment;
|
||||
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
|
||||
import digital.laboratory.platform.entrustment.service.AcceptService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
|
||||
import digital.laboratory.platform.entrustment.service.EntrustmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 受理服务层接口 -- 实现类
|
||||
*/
|
||||
@Service
|
||||
public class AcceptServiceImpl implements AcceptService {
|
||||
|
||||
@Resource
|
||||
private EntrustmentService entrustmentService;
|
||||
|
||||
@Resource
|
||||
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
|
||||
|
||||
/**
|
||||
* 修改受理后的检材受理编号
|
||||
* @param material
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean alertMaterialAcceptNo(EntrustmentIdentificationMaterial material) {
|
||||
EntrustmentIdentificationMaterial identificationMaterial = entrustmentIdentificationMaterialService.getById(material.getId());
|
||||
if (identificationMaterial == null) {
|
||||
throw new ValidateCodeException("检材信息不存在!");
|
||||
}
|
||||
// 获取要修改的检材受理编号
|
||||
String materialAcceptNo = material.getAcceptNo();
|
||||
if (StrUtil.isBlank(materialAcceptNo)) {
|
||||
throw new ValidateCodeException("检材受理编号不能修改为空!");
|
||||
}
|
||||
/** 判断是否符合编号规则,
|
||||
* \\d+:表示一个或多个数字-:表示连字符
|
||||
* -:表示连字符
|
||||
* ^ 和 $:表示字符串的开始和结束
|
||||
*/
|
||||
String regex = "^\\d+-\\d+-\\d+$";
|
||||
if (Pattern.matches(regex, materialAcceptNo)) {
|
||||
throw new ValidateCodeException(String.format("%s 不符合检材受理编号的规则!", materialAcceptNo));
|
||||
}
|
||||
// 校验当前修改的检材受理编号对应的委托的受理编号存不存在, 委托的受理编号是检材受理编号截取最后一个横杠的内容
|
||||
String entrustAcceptNo = materialAcceptNo.substring(0, materialAcceptNo.lastIndexOf("-"));
|
||||
if (entrustmentService.count(Wrappers.<Entrustment>lambdaQuery().eq(Entrustment::getAcceptNo, entrustAcceptNo)) > 0) {
|
||||
throw new ValidateCodeException(String.format("%s 的委托受理信息已经存在!", entrustAcceptNo));
|
||||
}
|
||||
if (entrustmentIdentificationMaterialService.count(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery().eq(EntrustmentIdentificationMaterial::getAcceptNo, materialAcceptNo)) > 0) {
|
||||
throw new ValidateCodeException(String.format("%s 的委托检材受理信息已经存在!", materialAcceptNo));
|
||||
}
|
||||
if (entrustmentIdentificationMaterialService.update(Wrappers.<EntrustmentIdentificationMaterial>lambdaUpdate()
|
||||
.eq(EntrustmentIdentificationMaterial::getId, material.getId()).set(EntrustmentIdentificationMaterial::getAcceptNo, materialAcceptNo))) {
|
||||
// 查询该委托下面的其他已经受理的检材
|
||||
List<EntrustmentIdentificationMaterial> materialList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>lambdaQuery()
|
||||
.eq(EntrustmentIdentificationMaterial::getEntrustmentId, identificationMaterial.getEntrustmentId())
|
||||
.ne(EntrustmentIdentificationMaterial::getAcceptNo, materialAcceptNo)
|
||||
.isNotNull(EntrustmentIdentificationMaterial::getAcceptNo));
|
||||
if (CollUtil.isNotEmpty(materialList)) {
|
||||
int count = 0;
|
||||
for (EntrustmentIdentificationMaterial entrustmentIdentificationMaterial : materialList) {
|
||||
String entrustmentIdentificationMaterialAcceptNo = entrustmentIdentificationMaterial.getAcceptNo();
|
||||
if (entrustmentIdentificationMaterialAcceptNo.contains(entrustAcceptNo)) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
entrustmentIdentificationMaterial.setAcceptNo(entrustAcceptNo
|
||||
+ "-"
|
||||
+ entrustmentIdentificationMaterialAcceptNo.substring(entrustmentIdentificationMaterialAcceptNo.lastIndexOf("-")));
|
||||
}
|
||||
return count == 0 ? true : entrustmentIdentificationMaterialService.updateBatchById(materialList);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
@@ -546,19 +546,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
|
||||
updateWrapper.set("check_passed", im.getCheckPassed());
|
||||
updateWrapper.set("check_time", im.getCheckTime());
|
||||
updateWrapper.set("approve_passed", im.getApprovePassed());
|
||||
updateWrapper.set("approve_time", im.getApproveTime());
|
||||
|
||||
if (!this.update(null, updateWrapper)) {
|
||||
throw new RuntimeException("保存检材信息失败");
|
||||
}
|
||||
|
||||
// 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
|
||||
im = this.getById(identificationMaterial.getId());
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
return im;
|
||||
return getEntrustmentIdentificationMaterial(identificationMaterial, updateWrapper, im);
|
||||
|
||||
}
|
||||
|
||||
@@ -598,6 +586,17 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>();
|
||||
updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
||||
|
||||
return getEntrustmentIdentificationMaterial(identificationMaterial, updateWrapper, im);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新检材是否审批通过
|
||||
* @param identificationMaterial
|
||||
* @param updateWrapper
|
||||
* @param im
|
||||
* @return
|
||||
*/
|
||||
public EntrustmentIdentificationMaterial getEntrustmentIdentificationMaterial(EntrustmentIdentificationMaterial identificationMaterial, UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper, EntrustmentIdentificationMaterial im) {
|
||||
updateWrapper.set("approve_passed", im.getApprovePassed());
|
||||
updateWrapper.set("approve_time", im.getApproveTime());
|
||||
|
||||
@@ -610,7 +609,6 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
if (im == null) {
|
||||
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId()));
|
||||
}
|
||||
|
||||
return im;
|
||||
}
|
||||
|
||||
@@ -652,27 +650,11 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
im.setSample2RepeatWeigh(identificationMaterial.getSample2RepeatWeigh());
|
||||
this.saveRepWeigh(im, im.getSample1RepeatWeigh().doubleValue(), im.getSample2RepeatWeigh().doubleValue(), false, "");
|
||||
}
|
||||
// if (!dlpUser.getId().equals(entrustment.getAcceptClaimUser())) {
|
||||
// throw new RuntimeException(String.format("委托的受理任务是由其他人认领的。认领用户是: %s", entrustment.getAcceptClaimUser()));
|
||||
// }
|
||||
|
||||
|
||||
//-------------------
|
||||
// 更新数据库表数据
|
||||
//-------------------
|
||||
// im.setFundQuantity(identificationMaterial.getFundQuantity());
|
||||
// im.setQuantity(identificationMaterial.getQuantity());
|
||||
//
|
||||
// im.setProvidedSample1No(identificationMaterial.getProvidedSample1No());
|
||||
// im.setProvidedSample1FundQuantity(identificationMaterial.getProvidedSample1FundQuantity());
|
||||
// im.setProvidedSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
||||
//
|
||||
// im.setProvidedSample2Present(identificationMaterial.getProvidedSample2Present());
|
||||
// im.setProvidedSample2No(identificationMaterial.getProvidedSample2No());
|
||||
// im.setProvidedSample2FundQuantity(identificationMaterial.getProvidedSample2FundQuantity());
|
||||
// im.setProvidedSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
||||
// im.setSplitedSample(identificationMaterial.getSplitedSample());
|
||||
// im.setRemark(identificationMaterial.getRemark());
|
||||
im.setRemark(identificationMaterial.getRemark());
|
||||
im.setPack(identificationMaterial.getPack());
|
||||
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
||||
@@ -697,48 +679,6 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En
|
||||
im.setSample2No(sampleService.getNewSampleNo(im.getImNo(), 2));
|
||||
}
|
||||
}
|
||||
// im.setSample1No(identificationMaterial.getSample1No());
|
||||
// im.setSample1FundQuantity(identificationMaterial.getSample1FundQuantity());
|
||||
// im.setSample1Quantity(identificationMaterial.getSample1Quantity());
|
||||
// im.setSample1BoxId(identificationMaterial.getSample1BoxId());
|
||||
//
|
||||
// im.setSample2Present(identificationMaterial.getSample2Present());
|
||||
// im.setSample2No(identificationMaterial.getSample2No());
|
||||
// im.setSample2FundQuantity(identificationMaterial.getSample2FundQuantity());
|
||||
// im.setSample2Quantity(identificationMaterial.getSample2Quantity());
|
||||
// im.setSample2BoxId(identificationMaterial.getSample2BoxId());
|
||||
//
|
||||
//
|
||||
//
|
||||
// UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>();
|
||||
// updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
||||
//
|
||||
// updateWrapper.set("fund_quantity", im.getFundQuantity());
|
||||
// updateWrapper.set("quantity", im.getQuantity());
|
||||
//
|
||||
// updateWrapper.set("provided_sample1_no", im.getProvidedSample1No());
|
||||
// updateWrapper.set("provided_sample1_fund_quantity", im.getProvidedSample1FundQuantity());
|
||||
// updateWrapper.set("provided_sample1_quantity", im.getProvidedSample1Quantity());
|
||||
//
|
||||
// updateWrapper.set("provided_sample2_present", im.getProvidedSample2Present());
|
||||
// updateWrapper.set("provided_sample2_no", im.getProvidedSample2No());
|
||||
// updateWrapper.set("provided_sample2_fund_quantity", im.getProvidedSample2FundQuantity());
|
||||
// updateWrapper.set("provided_sample2_quantity", im.getProvidedSample2Quantity());
|
||||
//
|
||||
// updateWrapper.set("splited_sample", im.getSplitedSample());
|
||||
//
|
||||
// //updateWrapper.set("sample1_present", im.getSample1Present());
|
||||
// updateWrapper.set("sample1_no", im.getSample1No());
|
||||
// updateWrapper.set("sample1_fund_quantity", im.getSample1FundQuantity());
|
||||
// updateWrapper.set("sample1_quantity", im.getSample1Quantity());
|
||||
// updateWrapper.set("sample1_box_id", im.getSample1BoxId());
|
||||
// updateWrapper.set("sample2_present", im.getSample2Present());
|
||||
// updateWrapper.set("sample2_no", im.getSample2No());
|
||||
// updateWrapper.set("sample2_fund_quantity", im.getSample2FundQuantity());
|
||||
// updateWrapper.set("sample2_quantity", im.getSample2Quantity());
|
||||
// updateWrapper.set("sample2_box_id", im.getSample2BoxId());
|
||||
// updateWrapper.set("remark", im.getRemark());
|
||||
// updateWrapper.set("pack", im.getPack());
|
||||
|
||||
if (!this.updateById(im)) {
|
||||
throw new RuntimeException("保存检材信息失败");
|
||||
|
||||
Reference in New Issue
Block a user