Commit de447b8b authored by xixinzhao's avatar xixinzhao

三维校验

parent ed5a85ad
...@@ -38,4 +38,10 @@ public class SubmitRecord { ...@@ -38,4 +38,10 @@ public class SubmitRecord {
@ApiModelProperty(value = "校验批次号") @ApiModelProperty(value = "校验批次号")
private String batchNo; private String batchNo;
@ApiModelProperty(value = "是否草稿 0: 草稿 1:提交")
private int draft;
@ApiModelProperty(value = "文件id")
private Long fileId;
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem; import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,9 +15,9 @@ import java.util.Map; ...@@ -14,9 +15,9 @@ import java.util.Map;
@Service @Service
public interface ModelItemService { public interface ModelItemService {
void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo); SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft);
void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo); SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id);
/** /**
* 获取详情接口 * 获取详情接口
......
...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord; ...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord; import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author xxz * @author xxz
*/ */
...@@ -15,6 +17,9 @@ public interface SubmitRecordService { ...@@ -15,6 +17,9 @@ public interface SubmitRecordService {
int saveSubmitRecord(SubmitRecord submitRecord); int saveSubmitRecord(SubmitRecord submitRecord);
SubmitRecord updateById(Long sequenceNbr, String batchNo); SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft);
List<SubmitRecord> selectRecord();
void saveFileId(Long id, Long fileId);
} }
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
batch_no batch_no
FROM FROM
tdc_submit_record tdc_submit_record
WHERE
draft = 1
ORDER BY ORDER BY
submit_time DESC submit_time DESC
LIMIT 1 LIMIT 1
...@@ -68,8 +70,8 @@ ...@@ -68,8 +70,8 @@
batch_no batch_no
FROM FROM
tdc_submit_record tdc_submit_record
-- WHERE WHERE
-- amos_org_code = '50*110' draft = 1
ORDER BY ORDER BY
submit_time DESC submit_time DESC
LIMIT 1 LIMIT 1
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
tdc_submit_record tdc_submit_record
WHERE WHERE
amos_org_code = #{orgCode} amos_org_code = #{orgCode}
AND draft = 1
ORDER BY ORDER BY
submit_time DESC submit_time DESC
LIMIT 1 LIMIT 1
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper">
<select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord"> <select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord">
SELECT sequence_nbr,submit_people,submit_time,amos_org_name FROM `tdc_submit_record` SELECT sequence_nbr,submit_people,submit_time,amos_org_name FROM `tdc_submit_record` order by submit_time desc
</select> </select>
</mapper> </mapper>
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.service.ModelItemService; import com.yeejoin.amos.boot.module.tdc.api.service.ModelItemService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -32,18 +33,16 @@ public class ModelItemController extends BaseController { ...@@ -32,18 +33,16 @@ public class ModelItemController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/saveModelItem") @PostMapping(value = "/saveModelItem")
@ApiOperation(httpMethod = "POST", value = "保存模型项", notes = "保存模型项") @ApiOperation(httpMethod = "POST", value = "保存模型项", notes = "保存模型项")
public ResponseModel saveModelItem(@RequestBody JSONObject jsonObject){ public ResponseModel<SubmitRecord> saveModelItem(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "draft") int draft, @RequestBody JSONObject jsonObject){
AgencyUserModel userInfo = getUserInfo(); AgencyUserModel userInfo = getUserInfo();
if (ObjectUtils.isEmpty(jsonObject)) { if (ObjectUtils.isEmpty(jsonObject)) {
return null; return null;
} }
Object sequenceNbr = jsonObject.get("sequenceNbr"); Object sequenceNbr = jsonObject.get("sequenceNbr");
if (ObjectUtils.isEmpty(sequenceNbr)) { if (ObjectUtils.isEmpty(sequenceNbr) && ObjectUtils.isEmpty(id)) {
modelItemService.saveModelItem(jsonObject, userInfo); return ResponseHelper.buildResponse(modelItemService.saveModelItem(jsonObject, userInfo, draft));
return ResponseHelper.buildResponse(true);
} }
modelItemService.editModelItem(jsonObject, userInfo); return ResponseHelper.buildResponse(modelItemService.editModelItem(jsonObject, userInfo, draft, id));
return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
...@@ -13,6 +13,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -13,6 +13,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/** /**
* 校验记录 * 校验记录
* @author xxz * @author xxz
...@@ -30,4 +32,19 @@ public class SubmitRecordController { ...@@ -30,4 +32,19 @@ public class SubmitRecordController {
public ResponseModel<IPage<SubmitRecord>> selectByOrgCode(int current,int size){ public ResponseModel<IPage<SubmitRecord>> selectByOrgCode(int current,int size){
return ResponseHelper.buildResponse(submitRecordService.selectByOrgCode(current, size)); return ResponseHelper.buildResponse(submitRecordService.selectByOrgCode(current, size));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectRecord")
@ApiOperation(httpMethod = "GET",value = "查询记录top20", notes = "查询记录top20")
public ResponseModel<List<SubmitRecord>> selectRecord(){
return ResponseHelper.buildResponse(submitRecordService.selectRecord());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "saveFileId")
@ApiOperation(httpMethod = "GET",value = "保存文件id", notes = "保存文件id")
public ResponseModel saveFileId(@RequestParam(value = "id") Long id, @RequestParam(value = "fileId") Long fileId){
submitRecordService.saveFileId(id, fileId);
return ResponseHelper.buildResponse(true);
}
} }
\ No newline at end of file
...@@ -47,10 +47,10 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -47,10 +47,10 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItemMapper modelItemMapper; ModelItemMapper modelItemMapper;
@Override @Override
public void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo) { public SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
if (ObjectUtils.isEmpty(jsonObject)) { if (ObjectUtils.isEmpty(jsonObject)) {
return; return null;
} }
SubmitRecord submitRecord = new SubmitRecord(); SubmitRecord submitRecord = new SubmitRecord();
userInfo.getUserName(); userInfo.getUserName();
...@@ -62,6 +62,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -62,6 +62,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
submitRecord.setAmosOrgCode(orgCode); submitRecord.setAmosOrgCode(orgCode);
submitRecord.setAmosOrgName(companyName); submitRecord.setAmosOrgName(companyName);
} }
submitRecord.setDraft(draft);
submitRecord.setSubmitPeople(userInfo.getRealName()); submitRecord.setSubmitPeople(userInfo.getRealName());
submitRecord.setSubmitTime(new Date()); submitRecord.setSubmitTime(new Date());
String batchNo = UUID.randomUUID().toString(); String batchNo = UUID.randomUUID().toString();
...@@ -72,7 +73,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -72,7 +73,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
log.error("=====记录入库用时:"+(end-start1)+"======"); log.error("=====记录入库用时:"+(end-start1)+"======");
if (StringUtils.isEmpty(submitRecord.getSequenceNbr())) { if (StringUtils.isEmpty(submitRecord.getSequenceNbr())) {
return; return null;
} }
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> { List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
...@@ -84,7 +85,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -84,7 +85,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
modelItem.setCheckItemLabel(s[1]); modelItem.setCheckItemLabel(s[1]);
} }
String value = String.valueOf(e.getValue()); String value = String.valueOf(e.getValue());
modelItem.setCheckItemValue(value); if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length > 1) {
modelItem.setCheckItemValue(value.split("_")[2]);
} else {
modelItem.setCheckItemValue(value);
}
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr()); modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem; return modelItem;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -98,18 +103,21 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -98,18 +103,21 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
log.error("=====入库用时:"+(e2-e1)+"======"); log.error("=====入库用时:"+(e2-e1)+"======");
// 异步请求规则校验 // 异步请求规则校验
syncMethodService.checkItem(itemValue, submitRecord); if (draft == 1) {
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
} }
@Override @Override
public void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo) { public SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id) {
Long sequenceNbr = Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr"))); Long sequenceNbr = ObjectUtils.isEmpty(jsonObject.get("sequenceNbr")) ? null : Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr")));
String batchNo = UUID.randomUUID().toString(); String batchNo = UUID.randomUUID().toString();
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbr, batchNo); Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr;
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft);
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr); wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId);
this.baseMapper.delete(wrapper); this.baseMapper.delete(wrapper);
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> { List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
...@@ -130,8 +138,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -130,8 +138,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
this.saveOrUpdateBatch(collect); this.saveOrUpdateBatch(collect);
// 异步请求规则校验 // 异步请求规则校验
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName)); if (draft == 1) {
syncMethodService.checkItem(itemValue, submitRecord); Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
} }
......
package com.yeejoin.amos.boot.module.tdc.biz.service.impl; package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -10,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
/** /**
* @author DELL * @author DELL
...@@ -32,10 +37,29 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub ...@@ -32,10 +37,29 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
} }
@Override @Override
public SubmitRecord updateById(Long sequenceNbr, String batchNo) { public SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft) {
SubmitRecord submitRecord = this.getById(sequenceNbr); SubmitRecord submitRecord = this.getById(sequenceNbr);
submitRecord.setBatchNo(batchNo); submitRecord.setBatchNo(batchNo);
submitRecord.setDraft(draft);
submitRecord.setSubmitTime(new Date());
this.updateById(submitRecord); this.updateById(submitRecord);
return submitRecord; return submitRecord;
} }
@Override
public List<SubmitRecord> selectRecord() {
LambdaQueryWrapper<SubmitRecord> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SubmitRecord::getDraft,1);
wrapper.orderByDesc(SubmitRecord::getSubmitTime);
wrapper.last(" limit 20");
return this.baseMapper.selectList(wrapper);
}
@Override
public void saveFileId(Long id, Long fileId) {
LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(SubmitRecord::getFileId, fileId);
wrapper.set(SubmitRecord::getSequenceNbr, id);
this.update(wrapper);
}
} }
...@@ -40,7 +40,7 @@ public class SyncMethodServiceImpl implements SyncMethodService { ...@@ -40,7 +40,7 @@ public class SyncMethodServiceImpl implements SyncMethodService {
// 调用规则校验模型 // 调用规则校验模型
try { try {
// 没有配决策流,processIds传null即可 // 没有配决策流,processIds传null即可
String packageId = "三维校验/" + key; String packageId = "数据填报/" + key;
ruleTrigger.publish(idxProjectModel, packageId, null); ruleTrigger.publish(idxProjectModel, packageId, null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
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