diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java index c3b2805d9c..3d453ea38c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java @@ -68,6 +68,10 @@ public class IcFormServiceImpl extends BaseServiceImpl private IcFormItemGroupDao icFormItemGroupDao; @Autowired private IcFormQueryBuilderDao icFormQueryBuilderDao; + @Autowired + private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao; + @Autowired + private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao; /** * 获取居民信息表单 @@ -145,6 +149,10 @@ public class IcFormServiceImpl extends BaseServiceImpl defaultIcForm.setId(newFormId); defaultIcForm.setCustomerId(customerId); defaultIcForm.setAreaCode(areaCode); + defaultIcForm.setCreatedBy("init_user"); + defaultIcForm.setCreatedTime(new Date()); + defaultIcForm.setUpdatedBy("init_user"); + defaultIcForm.setUpdatedTime(new Date()); int insert = baseDao.insert(defaultIcForm); log.info("insert icForm:" + insert); @@ -163,7 +171,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setFormId(newFormId); item.setAreaCode(areaCode); item.setParentItemId(newPrefixed + item.getParentItemId()); - item.setItemGroupId(newPrefixed + item.getItemGroupId()); + //分组Id 为0 说明不村子分组 则直接不设置 仍然为0 + if (!NumConstant.ZERO_STR.equals(item.getItemGroupId())){ + item.setItemGroupId(newPrefixed + item.getItemGroupId()); + } String optionSourceValue = item.getOptionSourceValue(); if (StringUtils.isNotBlank(optionSourceValue) && optionSourceValue.contains(StrConstant.QUESTION_MARK)){ //多个参数 @@ -173,6 +184,10 @@ public class IcFormServiceImpl extends BaseServiceImpl } item.setOptionSourceValue(optionSourceValue); } + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("item:"+ JSON.toJSONString(item)); icFormItemDao.insert(item); }); @@ -186,6 +201,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setCustomerId(customerId); item.setFormId(newFormId); item.setItemId(newPrefixed + item.getItemId()); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("option:"+ JSON.toJSONString(item)); icFormItemOptionsDao.insert(item); }); @@ -198,6 +217,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setId(newPrefixed + item.getId()); item.setCustomerId(customerId); item.setFormId(newFormId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("group:"+ JSON.toJSONString(item)); icFormItemGroupDao.insert(item); }); @@ -210,10 +233,42 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setId(newPrefixed + item.getId()); item.setCustomerId(customerId); item.setFormItemId(newPrefixed + item.getFormItemId()); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("query:"+ JSON.toJSONString(item)); icFormQueryBuilderDao.insert(item); }); + LambdaQueryWrapper wrapperStats = new LambdaQueryWrapper<>(); + wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId); + List statsConfigList = icResiCategoryStatsConfigDao.selectList(wrapperStats); + statsConfigList.forEach(item -> { + item.setId(newPrefixed + item.getId()); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + log.debug("stats:"+ JSON.toJSONString(item)); + icResiCategoryStatsConfigDao.insert(item); + }); + + LambdaQueryWrapper wrapperWarn = new LambdaQueryWrapper<>(); + wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, defaultCustomerId); + List warnConfigList = icResiCategoryWarnConfigDao.selectList(wrapperWarn); + warnConfigList.forEach(item -> { + item.setId(newPrefixed + item.getId()); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + log.debug("stats:"+ JSON.toJSONString(item)); + icResiCategoryWarnConfigDao.insert(item); + }); + return "初始化成功!客户ID:" + customerId + " formCode:" + formCode; } }