Commit cd913b80 authored by hezhuozhi's avatar hezhuozhi

检验结果录入

parent 8dcedf37
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -165,8 +166,8 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -165,8 +166,8 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrUpdateDetectionInfoBatch") @PostMapping(value = "/saveOrUpdateDetectionInfoBatch")
@ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息") @ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息")
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody List<IdxBizJgInspectionDetectionInfo> detectionInfos) { public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody JSONObject jsonObject) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(detectionInfos); idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(jsonObject);
return ResponseHelper.buildResponse("更新成功"); return ResponseHelper.buildResponse("更新成功");
} }
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -35,6 +38,7 @@ import org.apache.commons.io.IOUtils; ...@@ -35,6 +38,7 @@ import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -311,18 +315,35 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -311,18 +315,35 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
return page; return page;
} }
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateDetectionInfo(IdxBizJgInspectionDetectionInfo detectionInfo) { public void saveOrUpdateDetectionInfo(IdxBizJgInspectionDetectionInfo detectionInfo) {
detectionInfo.setRecDate(new Date()); detectionInfo.setRecDate(new Date());
detectionInfoService.saveOrUpdateData(detectionInfo); detectionInfoService.saveOrUpdateData(detectionInfo);
} }
public void saveOrUpdateDetectionInfoBatch(List<IdxBizJgInspectionDetectionInfo> detectionInfos) { @Transactional(rollbackFor = Exception.class)
if(CollectionUtil.isNotEmpty(detectionInfos)){ public void saveOrUpdateDetectionInfoBatch(JSONObject jsonObject) {
for (IdxBizJgInspectionDetectionInfo detectionInfo : detectionInfos) { if(Objects.nonNull(jsonObject)){
detectionInfo.setRecDate(new Date()); JSONArray records = jsonObject.getJSONArray("records");
if(CollectionUtil.isNotEmpty(records)){
List<IdxBizJgInspectionDetectionInfo> jgInspectionDetectionInfos= new ArrayList<>();
for (Object record : records) {
IdxBizJgInspectionDetectionInfo detectionInfo = JSON.parseObject(JSONObject.toJSONString(record), IdxBizJgInspectionDetectionInfo.class);
if(Objects.nonNull(detectionInfo)){
if (record instanceof LinkedHashMap){
Map map = (LinkedHashMap)record;
detectionInfo.setRecDate(new Date());
detectionInfo.setSequenceNbr((String) map.get("detectionInfoSequenceNbr"));
jgInspectionDetectionInfos.add(detectionInfo);
}
}
}
if(CollUtil.isNotEmpty(jgInspectionDetectionInfos)){
detectionInfoService.saveOrUpdateBatch(jgInspectionDetectionInfos);
}
} }
detectionInfoService.saveOrUpdateBatch(detectionInfos);
} }
} }
public IdxBizJgInspectionDetectionInfo getDetectionInfoDetail(String sequenceNbr) { public IdxBizJgInspectionDetectionInfo getDetectionInfoDetail(String sequenceNbr) {
......
...@@ -260,8 +260,8 @@ ...@@ -260,8 +260,8 @@
ibjui.project_contraption_id = #{sequenceNbr} ibjui.project_contraption_id = #{sequenceNbr}
) A ) A
WHERE WHERE
A.inspectOrgName != NULL AND A.inspectOrgName != '' AND A.inspectConclusion!=NULL and A.inspectConclusion!='' A.inspectOrgName IS NOT NULL AND A.inspectOrgName != '' AND A.inspectConclusion IS NOT NULL and A.inspectConclusion!=''
and A.nextInspectDate != NULL and A.nextInspectDate IS NOT NULL
</select> </select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer"> <select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment