Browse Source

Merge branch 'dev_costumer_init' into dev

master
zhaoqifeng 3 years ago
parent
commit
6f7fc3ce5c
  1. 11
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  2. 14
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  3. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java
  5. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java
  6. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  7. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java
  8. 6
      epmet-module/oper-customize/oper-customize-server/pom.xml
  9. 16
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormListItemDao.java
  10. 10
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java
  11. 46
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormListItemEntity.java
  12. 42
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  13. 22
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormListItemDao.xml

11
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);
}

14
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);
}
}

23
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<List<OptionDTO>>().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();
}
}

10
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<IcResiDemandDictEnt
* @return
*/
List<DemandCategoryResDTO> queryLatestOrder(String userId, String customerId);
/**
* 客户初始化
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2022/4/14 14:31
*/
void customerInit(String customerId);
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java

@ -70,4 +70,13 @@ public interface IcServiceItemDictService extends BaseService<IcServiceItemDictE
* @return
*/
List<OptionDTO> queryDictListForSelect(ServiceItemSelectFormDTO formDTO);
/**
* 客户初始化
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2022/4/14 14:31
*/
void customerInit(String customerId);
}

29
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<IcResiDemandDic
return new ArrayList<>();
}
/**
* 客户初始化
*
* @param customerId
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2022/4/14 14:31
*/
@Override
public void customerInit(String customerId) {
String defaultCustomerId = "default";
LambdaQueryWrapper<IcResiDemandDictEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiDemandDictEntity::getCustomerId, defaultCustomerId);
List<IcResiDemandDictEntity> 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);
});
}
}
}

30
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<IcServiceItemD
return resultList;
}
/**
* 客户初始化
*
* @param customerId
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2022/4/14 14:31
*/
@Override
public void customerInit(String customerId) {
String defaultCustomerId = "default";
LambdaQueryWrapper<IcServiceItemDictEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcServiceItemDictEntity::getCustomerId, defaultCustomerId);
List<IcServiceItemDictEntity> 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);
});
}
}
}

6
epmet-module/oper-customize/oper-customize-server/pom.xml

@ -83,6 +83,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-heart-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

16
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<IcFormListItemEntity> {
}

10
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java

@ -135,4 +135,14 @@ public class IcFormItemEntity extends BaseEpmetEntity {
*/
private Integer columnNum;
/**
* 是否为固定列 1动态0固定
*/
private Integer dynamic;
/**
* 是否为多选 1可以多选0单选
*/
private Integer multiSelect;
}

46
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;
}

42
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<IcFormDao, IcFormEntity>
private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao;
@Autowired
private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao;
@Resource
private IcFormListItemDao icFormListItemDao;
@Resource
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
/**
* 获取居民信息表单
@ -131,7 +139,9 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
@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<IcFormDao, IcFormEntity>
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<IcFormDao, IcFormEntity>
icFormItemDao.insert(item);
});
//设置ic_form_item_options
LambdaQueryWrapper<IcFormItemOptionsEntity> wrapperOptions = new LambdaQueryWrapper<>();
wrapperOptions.eq(IcFormItemOptionsEntity::getCustomerId, defaultCustomerId);
wrapperOptions.eq(IcFormItemOptionsEntity::getFormCode, formCode);
@ -209,6 +220,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemOptionsDao.insert(item);
});
//设置ic_form_item_group
LambdaQueryWrapper<IcFormItemGroupEntity> wrapperGroup = new LambdaQueryWrapper<>();
wrapperGroup.eq(IcFormItemGroupEntity::getCustomerId, defaultCustomerId);
wrapperGroup.eq(IcFormItemGroupEntity::getFormCode, formCode);
@ -225,6 +237,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemGroupDao.insert(item);
});
//设置ic_form_query_builder
LambdaQueryWrapper<IcFormQueryBuilderEntity> wrapperQuery = new LambdaQueryWrapper<>();
wrapperQuery.eq(IcFormQueryBuilderEntity::getCustomerId, defaultCustomerId);
wrapperQuery.eq(IcFormQueryBuilderEntity::getFormCode, formCode);
@ -241,6 +254,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormQueryBuilderDao.insert(item);
});
//设置ic_resi_category_stats_config
LambdaQueryWrapper<IcResiCategoryStatsConfigEntity> wrapperStats = new LambdaQueryWrapper<>();
wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId);
List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(wrapperStats);
@ -255,6 +269,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icResiCategoryStatsConfigDao.insert(item);
});
//设置ic_resi_category_warn_config
LambdaQueryWrapper<IcResiCategoryWarnConfigEntity> wrapperWarn = new LambdaQueryWrapper<>();
wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, defaultCustomerId);
List<IcResiCategoryWarnConfigEntity> warnConfigList = icResiCategoryWarnConfigDao.selectList(wrapperWarn);
@ -269,6 +284,31 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icResiCategoryWarnConfigDao.insert(item);
});
//设置ic_form_list_item
LambdaQueryWrapper<IcFormListItemEntity> listItemWapper = new LambdaQueryWrapper<>();
listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId);
listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode);
List<IcFormListItemEntity> 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;
}
}

22
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormListItemDao.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcFormListItemDao">
<resultMap type="com.epmet.entity.IcFormListItemEntity" id="icFormListItemMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="formItemId" column="FORM_ITEM_ID"/>
<result property="formCode" column="FORM_CODE"/>
<result property="width" column="WIDTH"/>
<result property="sort" column="SORT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>
Loading…
Cancel
Save