Commit 9c184b81 authored by xixinzhao's avatar xixinzhao

提交

parent 1623ef0a
......@@ -13,4 +13,7 @@ import java.util.List;
@Mapper
public interface ModelItemMapper extends BaseMapper<ModelItem> {
List<ModelItem> getListByName(@Param("modelName") String modelName, @Param("orgCode") String orgCode);
void itemSaveBatch(@Param("list") List<ModelItem> collect);
}
......@@ -29,4 +29,7 @@ public interface ModelItemService extends IService<ModelItem> {
Map<String, Object> getModelItem(Long sequenceNbr);
void deleteModelItem(String sequenceNbr);
void itemSaveBatch(List<ModelItem> collect);
}
......@@ -23,4 +23,25 @@
AND model_name = #{modelName}
</if>
</select>
<insert id="itemSaveBatch" useGeneratedKeys="true" keyColumn="SEQUENCE_NBR" keyProperty="sequenceNbr">
INSERT INTO tdc_model_item (
CHECK_ITEM_LABEL,
CHECK_ITEM_VALUE,
SUBMIT_RECORD_ID,
MODEL_NAME,
TYPE,
TAG_NAME
) VALUES
<foreach item="data" collection="list" separator=",">
(
#{data.checkItemLabel},
#{data.checkItemValue},
#{data.submitRecordId},
#{data.modelName},
#{data.type},
#{data.tagName}
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.component.rule.MethodParam;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -37,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
@Component
@Slf4j
@RuleActionBean(beanLabel = "动态预案")
public class CheckModelAction {
......@@ -79,6 +81,7 @@ public class CheckModelAction {
// 获取模型
CheckModel checkModel = checkModelService.selectCheckModelByNameCode(itemName, orgCode);
if (ObjectUtils.isEmpty(checkModel)) {
log.error("空");
return;
}
......@@ -100,6 +103,7 @@ public class CheckModelAction {
checkResult.setAmosOrgName(checkModel.getAmosOrgName());
checkResult.setSubmitRecordId(submitRecordId);
checkResult.setCheckDate(new Date());
log.error("=>>{}", checkItem);
// checkResult.setCheckType(ObjectUtils.isNotEmpty(checkType) ? checkType : 1);
checkResult.setModelName(checkModel.getModelName());
checkResultService.save(checkResult);
......
......@@ -64,12 +64,12 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
}
SubmitRecord submitRecord = new SubmitRecord();
// 开启工作流并执行一步
try {
String processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, "1");
submitRecord.setProcessInstanceId(processInstanceId);
} catch (Exception e) {
log.error("工作流启动失败" + e.getMessage());
}
// try {
// String processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, "1");
// submitRecord.setProcessInstanceId(processInstanceId);
// } catch (Exception e) {
// log.error("工作流启动失败" + e.getMessage());
// }
userInfo.getUserName();
List<CompanyModel> company = userInfo.getCompanys();
......@@ -97,6 +97,12 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItem modelItem = new ModelItem();
String key = e.getKey();
String[] s = key.split("_");
if (s.length == 0 ) {
return null;
}
if ("tag".equals(s[0])) {
return null;
}
if (s.length == 2) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
......@@ -125,7 +131,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
long e1 = System.currentTimeMillis();
log.error("=====参数解析用时:"+(e1-end)+"======");
this.saveBatch(collect);
modelItemMapper.itemSaveBatch(collect);
long e2 = System.currentTimeMillis();
log.error("=====入库用时:"+(e2-e1)+"======");
......@@ -142,11 +148,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
String batchNo = UUID.randomUUID().toString();
Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr;
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft, examine);
try {
workflowExcuteService.CompleteTask(submitRecord.getProcessInstanceId(), String.valueOf(examine), reginParams);
} catch (Exception e) {
throw new RuntimeException("没有执行权限");
}
// try {
// workflowExcuteService.CompleteTask(submitRecord.getProcessInstanceId(), String.valueOf(examine), reginParams);
// } catch (Exception e) {
// throw new RuntimeException("没有执行权限");
// }
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId);
......@@ -156,6 +162,12 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItem modelItem = new ModelItem();
String key = e.getKey();
String[] s = key.split("_");
if (s.length == 0 ) {
return null;
}
if ("tag".equals(s[0])) {
return null;
}
if (s.length == 2) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
......@@ -179,7 +191,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
}).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList());
this.saveOrUpdateBatch(collect);
modelItemMapper.itemSaveBatch(collect);
// 异步请求规则校验
if (draft == 1) {
......@@ -227,4 +239,9 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
checkResultMapper.delete(resultWrapper);
}
}
@Override
public void itemSaveBatch(List<ModelItem> collect) {
modelItemMapper.itemSaveBatch(collect);
}
}
......@@ -40,7 +40,7 @@ public class SyncMethodServiceImpl implements SyncMethodService {
// 调用规则校验模型
try {
// 没有配决策流,processIds传null即可
Thread.sleep(1000);
Thread.sleep(2000);
String packageId = "数据填报/" + key;
ruleTrigger.publish(idxProjectModel, packageId, null);
} catch (Exception e) {
......
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