|
@@ -124,6 +124,7 @@ public class KlRuleFacade extends KlRuleServiceImpl {
|
|
|
klRule.setMsg(klRuleInfoSaveVO.getParMsg());
|
|
|
klRule.setStatus(klRuleInfoSaveVO.getParStatus());
|
|
|
klRule.setGmtCreate(now);
|
|
|
+ klRule.setGmtModified(now);
|
|
|
res = this.save(klRule);
|
|
|
if (res) {
|
|
|
//再保存附表
|
|
@@ -174,41 +175,47 @@ public class KlRuleFacade extends KlRuleServiceImpl {
|
|
|
* 保存数据
|
|
|
*/
|
|
|
public boolean saveCommon(KlRuleInfoSaveVO klRuleInfoSaveVO) {
|
|
|
+ Date now = DateUtil.now();
|
|
|
boolean res = false;
|
|
|
List<KlRuleInfoSaveSubVO> klRuleInfoSaveSub = klRuleInfoSaveVO.getKlRuleInfoSaveSub();
|
|
|
- //先保存数据到kl_rule_base表里
|
|
|
- List<KlRuleBase> klRuleBaseList = new ArrayList<>();
|
|
|
- for (KlRuleInfoSaveSubVO list : klRuleInfoSaveSub) {
|
|
|
- KlRuleBase klRuleBase = new KlRuleBase();
|
|
|
- klRuleBase.setConceptId(list.getSubConceptId());
|
|
|
- klRuleBase.setType(list.getSubType());
|
|
|
- klRuleBase.setDescription(list.getSubDescription());
|
|
|
- klRuleBase.setMaxOperator(list.getSubMaxOperator());
|
|
|
- klRuleBase.setMaxValue(list.getSubMaxValue());
|
|
|
- klRuleBase.setMaxUnit(list.getSubMaxUnit());
|
|
|
- klRuleBase.setMinOperator(list.getSubMinOperator());
|
|
|
- klRuleBase.setMinValue(list.getSubMinValue());
|
|
|
- klRuleBase.setMinUnit(list.getSubMinUnit());
|
|
|
- klRuleBase.setStatus(1);
|
|
|
- klRuleBase.setEqValue(list.getSubEqValue());
|
|
|
- klRuleBase.setEqOperator(list.getSubEqOperator());
|
|
|
- klRuleBase.setEqUnit(list.getSubEqUnit());
|
|
|
- klRuleBaseList.add(klRuleBase);
|
|
|
- }
|
|
|
- res = klRuleBaseFacade.saveBatchAll(klRuleBaseList);
|
|
|
- List<KlRuleCondition> klRuleConditionList = new ArrayList<>();
|
|
|
- for (KlRuleBase data1 : klRuleBaseList) {
|
|
|
- for (KlRuleInfoSaveSubVO data2 : klRuleInfoSaveSub) {
|
|
|
- KlRuleCondition klRuleCondition = new KlRuleCondition();
|
|
|
- if (data1.getDescription().equals(data2.getSubDescription())) {
|
|
|
- klRuleCondition.setGroupType(data2.getGroupType());
|
|
|
- klRuleCondition.setRuleBaseId(data1.getId());
|
|
|
- klRuleCondition.setRuleId(klRuleInfoSaveVO.getId());
|
|
|
- klRuleConditionList.add(klRuleCondition);
|
|
|
+ if (ListUtil.isNotEmpty(klRuleInfoSaveSub)) {
|
|
|
+ //先保存数据到kl_rule_base表里
|
|
|
+ List<KlRuleBase> klRuleBaseList = new ArrayList<>();
|
|
|
+ for (KlRuleInfoSaveSubVO list : klRuleInfoSaveSub) {
|
|
|
+ KlRuleBase klRuleBase = new KlRuleBase();
|
|
|
+ klRuleBase.setGmtModified(now);
|
|
|
+ klRuleBase.setConceptId(list.getSubConceptId());
|
|
|
+ klRuleBase.setType(list.getSubType());
|
|
|
+ klRuleBase.setDescription(list.getSubDescription());
|
|
|
+ klRuleBase.setMaxOperator(list.getSubMaxOperator());
|
|
|
+ klRuleBase.setMaxValue(list.getSubMaxValue());
|
|
|
+ klRuleBase.setMaxUnit(list.getSubMaxUnit());
|
|
|
+ klRuleBase.setMinOperator(list.getSubMinOperator());
|
|
|
+ klRuleBase.setMinValue(list.getSubMinValue());
|
|
|
+ klRuleBase.setMinUnit(list.getSubMinUnit());
|
|
|
+ klRuleBase.setStatus(1);
|
|
|
+ klRuleBase.setEqValue(list.getSubEqValue());
|
|
|
+ klRuleBase.setEqOperator(list.getSubEqOperator());
|
|
|
+ klRuleBase.setEqUnit(list.getSubEqUnit());
|
|
|
+ klRuleBaseList.add(klRuleBase);
|
|
|
+ }
|
|
|
+ res = klRuleBaseFacade.saveBatchAll(klRuleBaseList);
|
|
|
+ List<KlRuleCondition> klRuleConditionList = new ArrayList<>();
|
|
|
+ for (KlRuleBase data1 : klRuleBaseList) {
|
|
|
+ for (KlRuleInfoSaveSubVO data2 : klRuleInfoSaveSub) {
|
|
|
+ KlRuleCondition klRuleCondition = new KlRuleCondition();
|
|
|
+ if (data1.getDescription().equals(data2.getSubDescription())) {
|
|
|
+ klRuleCondition.setGmtCreate(now);
|
|
|
+ klRuleCondition.setGroupType(data2.getGroupType());
|
|
|
+ klRuleCondition.setRuleBaseId(data1.getId());
|
|
|
+ klRuleCondition.setRuleId(klRuleInfoSaveVO.getId());
|
|
|
+ klRuleConditionList.add(klRuleCondition);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ res = klRuleConditionFacade.saveBatchAll(klRuleConditionList);
|
|
|
}
|
|
|
- res = klRuleConditionFacade.saveBatchAll(klRuleConditionList);
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|