Commit cd913b80 authored by hezhuozhi's avatar hezhuozhi

检验结果录入

parent 8dcedf37
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.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -165,8 +166,8 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrUpdateDetectionInfoBatch")
@ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息")
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(detectionInfos);
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody JSONObject jsonObject) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(jsonObject);
return ResponseHelper.buildResponse("更新成功");
}
......
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.date.DatePattern;
import cn.hutool.core.date.DateUtil;
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.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -35,6 +38,7 @@ import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -311,18 +315,35 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
return page;
}
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateDetectionInfo(IdxBizJgInspectionDetectionInfo detectionInfo) {
detectionInfo.setRecDate(new Date());
detectionInfoService.saveOrUpdateData(detectionInfo);
}
public void saveOrUpdateDetectionInfoBatch(List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
if(CollectionUtil.isNotEmpty(detectionInfos)){
for (IdxBizJgInspectionDetectionInfo detectionInfo : detectionInfos) {
detectionInfo.setRecDate(new Date());
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateDetectionInfoBatch(JSONObject jsonObject) {
if(Objects.nonNull(jsonObject)){
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) {
......
......@@ -260,8 +260,8 @@
ibjui.project_contraption_id = #{sequenceNbr}
) A
WHERE
A.inspectOrgName != NULL AND A.inspectOrgName != '' AND A.inspectConclusion!=NULL and A.inspectConclusion!=''
and A.nextInspectDate != NULL
A.inspectOrgName IS NOT NULL AND A.inspectOrgName != '' AND A.inspectConclusion IS NOT NULL and A.inspectConclusion!=''
and A.nextInspectDate IS NOT NULL
</select>
<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