实验数据添加总金额字段
This commit is contained in:
parent
99dc4b0baa
commit
50157ab96a
8
pom.xml
8
pom.xml
|
|
@ -31,10 +31,10 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验管理", operation = "查询列表", operDesc = "系统级事件", operType = "查询")
|
||||
@LogAnnotation(operModul = "试验管理", operation = "查询列表", operDesc = "业务级事件", operType = "查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimental:query')" )
|
||||
public ServerResponse getList(EncryptedReq<ParamsDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
|
|
@ -48,7 +48,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "getDetailList")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "查询试验详情列表", operDesc = "系统级事件", operType = "查询")
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "查询试验详情列表", operDesc = "业务级事件", operType = "查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:query')")
|
||||
public ServerResponse getDetailList(EncryptedReq<ParamsDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
|
|
@ -73,7 +73,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "addTestData")
|
||||
@DecryptAndVerify(decryptedClass = TestVo.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "新增试验数据", operDesc = "系统级事件", operType = "新增")
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "新增试验数据", operDesc = "业务级事件", operType = "新增")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:add')")
|
||||
public ServerResponse addTestData(EncryptedReq<TestVo> data) {
|
||||
return service.addTestData(data.getData());
|
||||
|
|
@ -81,7 +81,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "editTestData")
|
||||
@DecryptAndVerify(decryptedClass = TestVo.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "修改试验数据", operDesc = "系统级事件", operType = "修改")
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "修改试验数据", operDesc = "业务级事件", operType = "修改")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:edit')")
|
||||
public ServerResponse editTestData(EncryptedReq<TestVo> data) {
|
||||
return service.editTestData(data.getData());
|
||||
|
|
@ -89,7 +89,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "delTestData")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "删除试验数据", operDesc = "系统级事件", operType = "删除")
|
||||
@LogAnnotation(operModul = "试验详情管理", operation = "删除试验数据", operDesc = "业务级事件", operType = "删除")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:del')")
|
||||
public ServerResponse delTestData(EncryptedReq<ParamsDto> data) {
|
||||
return service.delTestData(data.getData());
|
||||
|
|
@ -103,7 +103,7 @@ public class ExperimentalController {
|
|||
|
||||
@PostMapping(value = "commitCheckTestData")
|
||||
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "试验管理", operation = "提交审查数据", operDesc = "系统级事件", operType = "提交审查")
|
||||
@LogAnnotation(operModul = "试验管理", operation = "提交审查数据", operDesc = "业务级事件", operType = "提交审查")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:commitCheck')")
|
||||
public ServerResponse commitCheckTestData(EncryptedReq<ParamsDto> data) {
|
||||
return service.commitCheckTestData(data.getData());
|
||||
|
|
|
|||
|
|
@ -401,4 +401,10 @@ public interface ExperimentalMapper {
|
|||
* @date 2024/7/28 15:52
|
||||
*/
|
||||
List<Long> getRecordNum(TestVo testVo);
|
||||
|
||||
/**
|
||||
* 更新总结
|
||||
* @param vo
|
||||
*/
|
||||
void updateExperMony(TestVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public class ExperDevVo {
|
|||
/*是否合格*/
|
||||
private String isHg;
|
||||
|
||||
private String experAmount;
|
||||
|
||||
public interface Query {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,8 @@ public class TestVo {
|
|||
private List<ExperDevVo> experDevVos;
|
||||
|
||||
|
||||
private String allMoney;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -138,6 +140,7 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
if (StringUtils.isNotBlank(result2)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result2);
|
||||
}
|
||||
BigDecimal allMony = new BigDecimal("0");
|
||||
// 添加试验信息数据
|
||||
mapper.addExper(vo);
|
||||
// 添加试验依据信息数据
|
||||
|
|
@ -145,17 +148,24 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
for (int i = 0; i < vo.getExperDevVos().size(); i++) {
|
||||
ExperDevVo experDevVo = vo.getExperDevVos().get(i);
|
||||
experDevVo.setIsHg(setHgData(experDevVo.getDevData()));
|
||||
mapper.addExperDev(experDevVo, vo.getId());
|
||||
BigDecimal bigDecimal = new BigDecimal("0");
|
||||
if (i == 0) {
|
||||
for (ConfigItemsVo configItemsVo : vo.getConfigItemsVos()) {
|
||||
// 添加试验项数据
|
||||
mapper.addExperItems(configItemsVo, vo.getId());
|
||||
BigDecimal amount = new BigDecimal(configItemsVo.getAmount());
|
||||
bigDecimal=bigDecimal.add(amount);
|
||||
// 添加试验项内容数据
|
||||
for (ConfigItemVo configItemVo : configItemsVo.getItemList()) {
|
||||
mapper.addExperItem(configItemVo, configItemsVo.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//计算设备总金额
|
||||
experDevVo.setExperAmount(bigDecimal.toString());
|
||||
BigDecimal amount= new BigDecimal(experDevVo.getAmount());
|
||||
allMony=allMony.add(bigDecimal).add(amount);
|
||||
mapper.addExperDev(experDevVo, vo.getId());
|
||||
List<ExperDevItemsVo> experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo);
|
||||
for (ExperDevItemsVo experDevItemsVo : experDevItemsVos) {
|
||||
// 添加设备试验项信息
|
||||
|
|
@ -171,6 +181,9 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
// 更新收样表中的状态为待提交
|
||||
mapper.editSampleStatus(vo.getSampleId());
|
||||
}
|
||||
|
||||
vo.setAllMoney(allMony.toString());
|
||||
mapper.updateExperMony(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -215,6 +228,15 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
if (StringUtils.isNotBlank(result2)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result2);
|
||||
}
|
||||
//论实验全部金额
|
||||
BigDecimal allMony= new BigDecimal("0");
|
||||
//获取试验项金额
|
||||
BigDecimal bigDecimal = new BigDecimal("0");
|
||||
for (ConfigItemsVo configItemsVo : vo.getConfigItemsVos()) {
|
||||
// 添加试验项数据
|
||||
BigDecimal amount = new BigDecimal(configItemsVo.getAmount());
|
||||
bigDecimal=bigDecimal.add(amount);
|
||||
}
|
||||
// 删除试验依据、试验样品设备、设备试验项信息、设备试验项数据
|
||||
List<Long> experDevIds = mapper.getExperDevIds(vo.getId());
|
||||
List<Long> experDevItemsIds = mapper.getExperDevItems(experDevIds);
|
||||
|
|
@ -234,16 +256,21 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
ExperDevVo experDevVo = vo.getExperDevVos().get(i);
|
||||
experDevVo.setIsHg(setHgData(experDevVo.getDevData()));
|
||||
// 添加试验样品数据
|
||||
BigDecimal amount= new BigDecimal(experDevVo.getAmount());
|
||||
allMony=allMony.add(bigDecimal).add(amount);
|
||||
experDevVo.setExperAmount(bigDecimal.toString());
|
||||
mapper.addExperDev(experDevVo, vo.getId());
|
||||
List<ExperDevItemsVo> experDevItemsVos = setExperDevItemsList(vo.getExperDevVos().get(i), vo);
|
||||
for (ExperDevItemsVo experDevItemsVo : experDevItemsVos) {
|
||||
// 添加设备试验项信息
|
||||
|
||||
mapper.addExperDevItems(experDevItemsVo);
|
||||
List<ExperDevItemVo> experDevItemVos = setExperDevItemList(vo.getExperDevVos().get(i), vo, experDevItemsVo);
|
||||
// 添加设备试验项数据
|
||||
mapper.addExperDevItem(experDevItemVos);
|
||||
}
|
||||
}
|
||||
vo.setAllMoney(allMony.toString());
|
||||
mapper.updateExperMony(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@
|
|||
<if test="params.devId != null">dev_id,</if>
|
||||
<if test="params.isHg != null and params.isHg != ''">is_hg,</if>
|
||||
<if test="params.departmentId != null">department_id,</if>
|
||||
<if test="params.experAmount != null">exper_amount,</if>
|
||||
id
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -138,6 +139,7 @@
|
|||
<if test="params.devId != null">#{params.devId},</if>
|
||||
<if test="params.isHg != null and params.isHg != ''">#{params.isHg},</if>
|
||||
<if test="params.departmentId != null">#{params.departmentId},</if>
|
||||
<if test="params.experAmount != null">#{params.experAmount},</if>
|
||||
null
|
||||
</trim>
|
||||
</insert>
|
||||
|
|
@ -205,6 +207,9 @@
|
|||
<update id="editSampleStatus">
|
||||
UPDATE tb_sample SET process_status = 0 WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateExperMony">
|
||||
UPDATE tb_exper SET amount = #{allMoney} WHERE id = #{id}
|
||||
</update>
|
||||
<!--删除试验依据-->
|
||||
<delete id="delConfigBasis">
|
||||
DELETE FROM tb_config_basis WHERE exper_id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue