Commit 03b40294 authored by xixinzhao's avatar xixinzhao

三维校验

parent cfa58c07
...@@ -34,5 +34,10 @@ public class ModelItem { ...@@ -34,5 +34,10 @@ public class ModelItem {
@ApiModelProperty(value = "提交记录id") @ApiModelProperty(value = "提交记录id")
private long submitRecordId; private long submitRecordId;
@ApiModelProperty(value = "标签名称")
private String tagName;
@ApiModelProperty(value = "类型")
private int type = -1;
} }
package com.yeejoin.amos.boot.module.tdc.api.entity; package com.yeejoin.amos.boot.module.tdc.api.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -44,4 +45,10 @@ public class SubmitRecord { ...@@ -44,4 +45,10 @@ public class SubmitRecord {
@ApiModelProperty(value = "文件id") @ApiModelProperty(value = "文件id")
private Long fileId; private Long fileId;
@ApiModelProperty(value = "审核状态 0: 未审核 1:已审核")
private int examine;
@TableField(exist = false)
private String examineName;
} }
...@@ -12,5 +12,7 @@ import org.mapstruct.Mapper; ...@@ -12,5 +12,7 @@ import org.mapstruct.Mapper;
@Mapper @Mapper
public interface SubmitRecordMapper extends BaseMapper<SubmitRecord> { public interface SubmitRecordMapper extends BaseMapper<SubmitRecord> {
IPage<SubmitRecord> selectByOrgCode(Page page); IPage<SubmitRecord> selectByOrgCode(Page page);
}
IPage<SubmitRecord> selectByOrgCodes(Page page);
}
package com.yeejoin.amos.boot.module.tdc.api.service; package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
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.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -13,11 +14,11 @@ import java.util.Map; ...@@ -13,11 +14,11 @@ import java.util.Map;
* @author xxz * @author xxz
*/ */
@Service @Service
public interface ModelItemService { public interface ModelItemService extends IService<ModelItem> {
SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft); SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft);
SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id); SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id, int examine);
/** /**
* 获取详情接口 * 获取详情接口
......
package com.yeejoin.amos.boot.module.tdc.api.service; package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
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 com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
...@@ -12,14 +13,16 @@ import java.util.List; ...@@ -12,14 +13,16 @@ import java.util.List;
* @author xxz * @author xxz
*/ */
@Service @Service
public interface SubmitRecordService { public interface SubmitRecordService extends IService<SubmitRecord> {
IPage<SubmitRecord> selectByOrgCode(int current, int size); IPage<SubmitRecord> selectByOrgCode(int current, int size);
int saveSubmitRecord(SubmitRecord submitRecord); int saveSubmitRecord(SubmitRecord submitRecord);
SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft); SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft, int examine);
List<SubmitRecord> selectRecord(); List<SubmitRecord> selectRecord();
void saveFileId(Long id, Long fileId); void saveFileId(Long id, Long fileId);
SubmitRecord getFileId(Long id);
} }
...@@ -3,6 +3,25 @@ ...@@ -3,6 +3,25 @@
<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` order by submit_time desc SELECT
sequence_nbr,submit_people,submit_time,amos_org_name,file_id,
case examine when 0 then "未审核" when 1 then "已审核" end examineName
FROM
`tdc_submit_record` order by submit_time desc
</select>
<select id="selectByOrgCodes" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord">
SELECT
sequence_nbr,submit_people,submit_time,amos_org_name,file_id,examine,
case examine when 0 then "未审核" when 1 then "已审核" end examineName
FROM
`tdc_submit_record` order by submit_time desc
</select> </select>
</mapper> </mapper>
...@@ -104,6 +104,14 @@ public class CheckModelAction { ...@@ -104,6 +104,14 @@ public class CheckModelAction {
checkResult.setModelName(checkModel.getModelName()); checkResult.setModelName(checkModel.getModelName());
checkResultService.save(checkResult); checkResultService.save(checkResult);
List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
int sum = checkModels.stream().mapToInt(CheckModel::getCheckItemAmount).sum();
Integer itemCount = checkResultService.selectItemCount(batchNo);
if (sum == itemCount) {
checkResultService.saveSql(orgCode, checkPeopleName, batchNo);
}
// // 2. 判断是否检验结束 // // 2. 判断是否检验结束
// if (ObjectUtils.isNotEmpty(checkType)) { // if (ObjectUtils.isNotEmpty(checkType)) {
// if (checkType == 1) { // if (checkType == 1) {
...@@ -111,8 +119,8 @@ public class CheckModelAction { ...@@ -111,8 +119,8 @@ public class CheckModelAction {
// sendWebMessage(batchNo, checkModel.getCheckItemAmount(), orgCode, checkPeopleName, checkType, itemName); // sendWebMessage(batchNo, checkModel.getCheckItemAmount(), orgCode, checkPeopleName, checkType, itemName);
// } else if (checkType == 0) { // } else if (checkType == 0) {
// // 2.1 全站校验 // // 2.1 全站校验
// List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
// int sum = checkModels.stream().mapToInt(CheckModel::getCheckItemAmount).sum();
// sendWebMessage(batchNo, sum, orgCode, checkPeopleName, checkType, itemName); // sendWebMessage(batchNo, sum, orgCode, checkPeopleName, checkType, itemName);
// } // }
// } // }
......
...@@ -33,7 +33,8 @@ public class ModelItemController extends BaseController { ...@@ -33,7 +33,8 @@ 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<SubmitRecord> saveModelItem(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "draft") int draft, @RequestBody JSONObject jsonObject){ public ResponseModel<SubmitRecord> saveModelItem(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "draft") int draft, @RequestBody JSONObject jsonObject,
@RequestParam(value = "examine") int examine){
AgencyUserModel userInfo = getUserInfo(); AgencyUserModel userInfo = getUserInfo();
if (ObjectUtils.isEmpty(jsonObject)) { if (ObjectUtils.isEmpty(jsonObject)) {
return null; return null;
...@@ -42,7 +43,7 @@ public class ModelItemController extends BaseController { ...@@ -42,7 +43,7 @@ public class ModelItemController extends BaseController {
if (ObjectUtils.isEmpty(sequenceNbr) && ObjectUtils.isEmpty(id)) { if (ObjectUtils.isEmpty(sequenceNbr) && ObjectUtils.isEmpty(id)) {
return ResponseHelper.buildResponse(modelItemService.saveModelItem(jsonObject, userInfo, draft)); return ResponseHelper.buildResponse(modelItemService.saveModelItem(jsonObject, userInfo, draft));
} }
return ResponseHelper.buildResponse(modelItemService.editModelItem(jsonObject, userInfo, draft, id)); return ResponseHelper.buildResponse(modelItemService.editModelItem(jsonObject, userInfo, draft, id, examine));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
...@@ -47,4 +47,11 @@ public class SubmitRecordController { ...@@ -47,4 +47,11 @@ public class SubmitRecordController {
submitRecordService.saveFileId(id, fileId); submitRecordService.saveFileId(id, fileId);
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "getFileId")
@ApiOperation(httpMethod = "GET",value = "根据主键id获取文件id", notes = "根据主键id获取文件id")
public ResponseModel<SubmitRecord> getFileId(@RequestParam(value = "id") Long id){
return ResponseHelper.buildResponse(submitRecordService.getFileId(id));
}
} }
\ No newline at end of file
...@@ -80,19 +80,29 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -80,19 +80,29 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItem modelItem = new ModelItem(); ModelItem modelItem = new ModelItem();
String key = e.getKey(); String key = e.getKey();
String[] s = key.split("_"); String[] s = key.split("_");
if (s.length > 0) { if (s.length == 2) {
modelItem.setModelName(s[0]); modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]); modelItem.setCheckItemLabel(s[1]);
} else if (s.length == 3) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
modelItem.setType(1);
modelItem.setTagName(s[2]);
} else {
return null;
} }
String value = String.valueOf(e.getValue()); String value = String.valueOf(e.getValue());
if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length > 1) { if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length == 2) {
modelItem.setCheckItemValue(value.split("_")[2]); modelItem.setCheckItemValue(value.split("_")[1]);
modelItem.setTagName(value.split("_")[0]);
modelItem.setType(0);
} else { } else {
modelItem.setCheckItemValue(value); modelItem.setCheckItemValue(value);
} }
// modelItem.setCheckItemValue(value);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr()); modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem; return modelItem;
}).collect(Collectors.toList()); }).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList());
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName)); Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
...@@ -110,12 +120,19 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -110,12 +120,19 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
} }
@Override @Override
public SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id) { public SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id, int examine) {
Long sequenceNbr = ObjectUtils.isEmpty(jsonObject.get("sequenceNbr")) ? null : 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();
Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr; Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr;
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft);
// SubmitRecord submitRecord = new SubmitRecord();
// submitRecord.setSequenceNbr(sequenceNbr);
// submitRecord.setBatchNo(batchNo);
// submitRecord.setDraft(draft);
// submitRecord.setExamine(examine);
// submitRecordService.updateById(submitRecord);
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft, examine);
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId); wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId);
this.baseMapper.delete(wrapper); this.baseMapper.delete(wrapper);
...@@ -124,16 +141,28 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -124,16 +141,28 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItem modelItem = new ModelItem(); ModelItem modelItem = new ModelItem();
String key = e.getKey(); String key = e.getKey();
String[] s = key.split("_"); String[] s = key.split("_");
if (s.length > 1) { if (s.length == 2) {
modelItem.setModelName(s[0]); modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]); modelItem.setCheckItemLabel(s[1]);
String value = String.valueOf(e.getValue()); } else if (s.length == 3) {
modelItem.setCheckItemValue(value); modelItem.setModelName(s[0]);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr()); modelItem.setCheckItemLabel(s[1]);
return modelItem; modelItem.setType(1);
modelItem.setTagName(s[2]);
} else { } else {
return null; return null;
} }
String value = String.valueOf(e.getValue());
if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length == 2) {
modelItem.setCheckItemValue(value.split("_")[1]);
modelItem.setTagName(value.split("_")[0]);
modelItem.setType(0);
} else {
modelItem.setCheckItemValue(value);
}
// modelItem.setCheckItemValue(value);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
}).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList()); }).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList());
this.saveOrUpdateBatch(collect); this.saveOrUpdateBatch(collect);
...@@ -151,7 +180,16 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -151,7 +180,16 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr); wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr);
List<ModelItem> list = this.list(wrapper); List<ModelItem> list = this.list(wrapper);
Map<String, Object> map = list.stream().collect(Collectors.toMap(e -> e.getModelName() + "_" + e.getCheckItemLabel(), ModelItem::getCheckItemValue)); Map<String, Object> map = new HashMap<>();
list.forEach(item -> {
if (item.getType() == 1 ) {
map.put(item.getModelName() + "_" + item.getCheckItemLabel() + "_" + item.getTagName(), item.getCheckItemValue());
} else if (item.getType() == 0) {
map.put(item.getModelName() + "_" + item.getCheckItemLabel(), item.getTagName() + "_" + item.getCheckItemValue());
} else {
map.put(item.getModelName() + "_" + item.getCheckItemLabel(), item.getCheckItemValue());
}
});
map.put("sequenceNbr", sequenceNbr); map.put("sequenceNbr", sequenceNbr);
return map; return map;
} }
......
...@@ -10,7 +10,6 @@ import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper; ...@@ -10,7 +10,6 @@ import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService; import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService;
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.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -26,9 +25,12 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub ...@@ -26,9 +25,12 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
SubmitRecordMapper submitRecordMapper; SubmitRecordMapper submitRecordMapper;
@Override @Override
public IPage<SubmitRecord> selectByOrgCode(int current, int size) { public IPage selectByOrgCode(int current, int size) {
Page page = new Page(current,size); Page page = new Page(current,size);
return submitRecordMapper.selectByOrgCode(page); LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.orderByDesc(SubmitRecord::getSubmitTime);
// List<SubmitRecord> list = this.baseMapper.selectPage(page, wrapper);
return submitRecordMapper.selectByOrgCodes(page);
} }
@Override @Override
...@@ -37,11 +39,12 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub ...@@ -37,11 +39,12 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
} }
@Override @Override
public SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft) { public SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft, int examine) {
SubmitRecord submitRecord = this.getById(sequenceNbr); SubmitRecord submitRecord = this.getById(sequenceNbr);
submitRecord.setBatchNo(batchNo); submitRecord.setBatchNo(batchNo);
submitRecord.setDraft(draft); submitRecord.setDraft(draft);
submitRecord.setSubmitTime(new Date()); submitRecord.setSubmitTime(new Date());
submitRecord.setExamine(examine);
this.updateById(submitRecord); this.updateById(submitRecord);
return submitRecord; return submitRecord;
} }
...@@ -57,9 +60,17 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub ...@@ -57,9 +60,17 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
@Override @Override
public void saveFileId(Long id, Long fileId) { public void saveFileId(Long id, Long fileId) {
LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>(); SubmitRecord submitRecord = this.getById(id);
wrapper.set(SubmitRecord::getFileId, fileId); submitRecord.setFileId(fileId);
wrapper.set(SubmitRecord::getSequenceNbr, id); // LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
this.update(wrapper); // wrapper.set(SubmitRecord::getFileId, fileId);
// wrapper.set(SubmitRecord::getSequenceNbr, id);
// this.update(wrapper);
this.updateById(submitRecord);
}
@Override
public SubmitRecord getFileId(Long id) {
return this.getById(id);
} }
} }
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