diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 25cf270549..5c71e7bcf1 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -12,6 +12,7 @@ import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -92,4 +93,14 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/volunteer/modifyVolunteerGrid") Result modifyVolunteerGrid(@RequestBody VolunteerInfoDTO volunteerInfoDTO); + + /** + * 客户初始化数据 + * @Param customerId + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/4/14 14:50 + */ + @GetMapping("/heart/serviceitem/initCustomer/{customerId}") + Result customerInit(@PathVariable(value = "customerId") String customerId); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 06bdc642c9..28e1fc50b8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -88,4 +88,18 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result modifyVolunteerGrid(VolunteerInfoDTO volunteerInfoDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "modifyVolunteerGrid", volunteerInfoDTO); } + + /** + * 客户初始化数据 + * + * @param customerId + * @Param customerId + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/4/14 14:50 + */ + @Override + public Result customerInit(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "customerInit", customerId); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java index 12b617b6bc..7608069b76 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java @@ -12,13 +12,12 @@ import com.epmet.dto.form.demand.ServiceItemSelectFormDTO; import com.epmet.dto.form.demand.StatusFormDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.ServiceItemResultDTO; +import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcServiceItemDictService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.util.List; /** @@ -33,6 +32,8 @@ public class IcServiceItemDictController { @Autowired private IcServiceItemDictService icServiceItemDictService; + @Resource + private IcResiDemandDictService icResiDemandDictService; /** @@ -85,4 +86,18 @@ public class IcServiceItemDictController { ValidatorUtils.validateEntity(formDTO,ServiceItemSelectFormDTO.AddUserInternalGroup.class); return new Result>().ok(icServiceItemDictService.queryDictListForSelect(formDTO)); } + + /** + * 客户初始化数据 + * @Param customerId + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/4/14 14:50 + */ + @GetMapping("initCustomer/{customerId}") + public Result customerInit(@PathVariable(value = "customerId") String customerId) { + icServiceItemDictService.customerInit(customerId); + icResiDemandDictService.customerInit(customerId); + return new Result(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java index ce861497cf..4510a34341 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java @@ -20,7 +20,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandPageResDTO; @@ -147,4 +146,13 @@ public interface IcResiDemandDictService extends BaseService queryLatestOrder(String userId, String customerId); + + /** + * 客户初始化 + * @Param customerId + * @Return + * @Author zhaoqifeng + * @Date 2022/4/14 14:31 + */ + void customerInit(String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java index 4e704aff54..af01c8a4c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java @@ -70,4 +70,13 @@ public interface IcServiceItemDictService extends BaseService queryDictListForSelect(ServiceItemSelectFormDTO formDTO); + + /** + * 客户初始化 + * @Param customerId + * @Return + * @Author zhaoqifeng + * @Date 2022/4/14 14:31 + */ + void customerInit(String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java index c6d0e0946f..5081bfd574 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java @@ -333,5 +333,34 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl(); } + /** + * 客户初始化 + * + * @param customerId + * @Param customerId + * @Return + * @Author zhaoqifeng + * @Date 2022/4/14 14:31 + */ + @Override + public void customerInit(String customerId) { + String defaultCustomerId = "default"; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiDemandDictEntity::getCustomerId, defaultCustomerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + item.setId(uuid); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + baseDao.insert(item); + }); + } + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java index 76e431aa44..3fbda7cd37 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java @@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.UUID; /** * 服务事项分类字典表 @@ -171,5 +172,34 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcServiceItemDictEntity::getCustomerId, defaultCustomerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + item.setId(uuid); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + baseDao.insert(item); + }); + } + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index baa7055c83..71b33b7510 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -83,6 +83,12 @@ 2.0.0 compile + + com.epmet + epmet-heart-client + 2.0.0 + compile + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormListItemDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormListItemDao.java new file mode 100644 index 0000000000..673ff3b2f3 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormListItemDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcFormListItemEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 列表展示项 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-14 + */ +@Mapper +public interface IcFormListItemDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java index c5c509ea25..9727a6276d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java @@ -41,7 +41,7 @@ public class IcFormItemEntity extends BaseEpmetEntity { private String customerId; /** - * + * */ private String areaCode; @@ -135,4 +135,14 @@ public class IcFormItemEntity extends BaseEpmetEntity { */ private Integer columnNum; + /** + * 是否为固定列 1动态,0固定 + */ + private Integer dynamic; + + /** + * 是否为多选 1可以多选,0单选 + */ + private Integer multiSelect; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormListItemEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormListItemEntity.java new file mode 100644 index 0000000000..b5426d37de --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormListItemEntity.java @@ -0,0 +1,46 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 列表展示项 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_form_list_item") +public class IcFormListItemEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * ic_form_item.id + */ + private String formItemId; + + /** + * ic_form.form_code,举例:resi_base_info + */ + private String formCode; + + /** + * 表头宽度 + */ + private Integer width; + + /** + * 排序 + */ + private Integer sort; + +} 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 3d453ea38c..3e88b05f7b 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 @@ -24,16 +24,19 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.*; import com.epmet.dto.form.CustomerFormQueryDTO; import com.epmet.dto.result.CustomerFormResultDTO; import com.epmet.dto.result.FormGroupDTO; import com.epmet.dto.result.FormItemResult; import com.epmet.entity.*; +import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.redis.CustomerFootBarRedis; import com.epmet.service.IcFormService; import lombok.extern.slf4j.Slf4j; @@ -43,6 +46,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; import java.util.Date; import java.util.List; @@ -72,6 +76,10 @@ public class IcFormServiceImpl extends BaseServiceImpl private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao; @Autowired private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao; + @Resource + private IcFormListItemDao icFormListItemDao; + @Resource + private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; /** * 获取居民信息表单 @@ -131,7 +139,9 @@ public class IcFormServiceImpl extends BaseServiceImpl @Override public String initCustomerFormByCode(String customerId, String areaCode, String formCode) { CustomerFormResultDTO formResultDTO = baseDao.selectByCode(customerId, formCode); + //客户已经存在了表单的数据 if (formResultDTO != null) { + return "该客户已经存在了表单的数据"; } String defaultCustomerId = "default"; @@ -164,7 +174,7 @@ public class IcFormServiceImpl extends BaseServiceImpl if (CollectionUtils.isEmpty(itemList)) { return "默认配置错误"; } - //设置item + //设置ic_form_item itemList.forEach(item -> { item.setId(newPrefixed + item.getId()); item.setCustomerId(customerId); @@ -192,6 +202,7 @@ public class IcFormServiceImpl extends BaseServiceImpl icFormItemDao.insert(item); }); + //设置ic_form_item_options LambdaQueryWrapper wrapperOptions = new LambdaQueryWrapper<>(); wrapperOptions.eq(IcFormItemOptionsEntity::getCustomerId, defaultCustomerId); wrapperOptions.eq(IcFormItemOptionsEntity::getFormCode, formCode); @@ -209,6 +220,7 @@ public class IcFormServiceImpl extends BaseServiceImpl icFormItemOptionsDao.insert(item); }); + //设置ic_form_item_group LambdaQueryWrapper wrapperGroup = new LambdaQueryWrapper<>(); wrapperGroup.eq(IcFormItemGroupEntity::getCustomerId, defaultCustomerId); wrapperGroup.eq(IcFormItemGroupEntity::getFormCode, formCode); @@ -225,6 +237,7 @@ public class IcFormServiceImpl extends BaseServiceImpl icFormItemGroupDao.insert(item); }); + //设置ic_form_query_builder LambdaQueryWrapper wrapperQuery = new LambdaQueryWrapper<>(); wrapperQuery.eq(IcFormQueryBuilderEntity::getCustomerId, defaultCustomerId); wrapperQuery.eq(IcFormQueryBuilderEntity::getFormCode, formCode); @@ -241,6 +254,7 @@ public class IcFormServiceImpl extends BaseServiceImpl icFormQueryBuilderDao.insert(item); }); + //设置ic_resi_category_stats_config LambdaQueryWrapper wrapperStats = new LambdaQueryWrapper<>(); wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId); List statsConfigList = icResiCategoryStatsConfigDao.selectList(wrapperStats); @@ -255,6 +269,7 @@ public class IcFormServiceImpl extends BaseServiceImpl icResiCategoryStatsConfigDao.insert(item); }); + //设置ic_resi_category_warn_config LambdaQueryWrapper wrapperWarn = new LambdaQueryWrapper<>(); wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, defaultCustomerId); List warnConfigList = icResiCategoryWarnConfigDao.selectList(wrapperWarn); @@ -269,6 +284,31 @@ public class IcFormServiceImpl extends BaseServiceImpl icResiCategoryWarnConfigDao.insert(item); }); + //设置ic_form_list_item + LambdaQueryWrapper listItemWapper = new LambdaQueryWrapper<>(); + listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId); + listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode); + List listItemList = icFormListItemDao.selectList(listItemWapper); + if (CollectionUtils.isEmpty(listItemList)) { + return "默认配置错误"; + } + listItemList.forEach(item -> { + 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("stats:"+ JSON.toJSONString(item)); + icFormListItemDao.insert(item); + }); + + //设置ic_service_item_dict和ic_resi_demand_dict + Result result = epmetHeartOpenFeignClient.customerInit(customerId); + if (!result.success()) { + throw new EpmetException(result.getCode(), result.getMsg()); + } return "初始化成功!客户ID:" + customerId + " formCode:" + formCode; } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormListItemDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormListItemDao.xml new file mode 100644 index 0000000000..d31304f648 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormListItemDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file