Browse Source

Merge remote-tracking branch 'origin/dev_ic_platform' into dev_ic_platform

dev_shibei_match
sunyuchao 4 years ago
parent
commit
52c71cdebb
  1. 17
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/IcFormResColumnDTO.java
  2. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java
  3. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java
  4. 20
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java
  5. 172
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java
  6. 45
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java
  7. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java
  8. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java
  9. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java
  10. 85
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/IcResiUserServiceImpl.java
  11. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java
  12. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java
  13. 65
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml
  14. 40
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml
  15. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFormQueryDTO.java
  16. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  17. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java
  18. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  19. 5
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  20. 60
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  21. 64
      epmet-user/epmet-user-server/src/main/java/com/epmet/handler/ExcelDiceAddressListHandlerImpl.java

17
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/IcFormResColumnDTO.java

@ -0,0 +1,17 @@
package com.epmet.dataaggre.dto.epmetuser;
import lombok.Data;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 4:26 下午
*/
@Data
public class IcFormResColumnDTO {
private String tableName;
private String columnName;
private String label;
private String link;
}

20
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiDetailFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 查看详情回显表单
* @Author yinzuomei
* @Date 2021/10/27 10:22 下午
*/
@Data
public class IcResiDetailFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotBlank(message = "icResiUserId不能为空",groups = AddUserInternalGroup.class)
private String icResiUserId;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/IcResiUserPageFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Description 居民信息分页查询入参
* @Author yinzuomei
* @Date 2021/10/27 2:06 下午
*/
@Data
public class IcResiUserPageFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
@NotNull(message = "pageNo不能为空", groups = AddUserInternalGroup.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class)
private Integer pageSize;
@NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class)
private String formCode;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* 表对应的字段及值
*/
private List<ResiUserQueryValueDTO> conditions;
}

20
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ResiUserQueryValueDTO.java

@ -0,0 +1,20 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 6:02 下午
*/
@Data
public class ResiUserQueryValueDTO implements Serializable {
private String queryType;
private List<String> columnValue;
private String columnName;
private String tableName;
}

172
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/IcResiUserPageResultDTO.java

@ -0,0 +1,172 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 居民信息分页查询表单返参
* @Author yinzuomei
* @Date 2021/10/27 2:07 下午
*/
@Data
public class IcResiUserPageResultDTO implements Serializable {
private String icResiUserId;
private String gridId;
private String gridName;
/**
* 所属小区ID
*/
private String villageId;
private String vallageName;
/**
* 所属楼宇Id
*/
private String buildId;
private String buildName;
/**
* 单元id
*/
private String unitId;
private String unitName;
/**
* 所属家庭Id
*/
private String homeId;
private String homeName;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 性别
*/
private String gender;
/**
* 身份证号
*/
private String idCard;
/**
* 出生日期
*/
private String birthday;
/**
* 备注
*/
private String remarks;
/**
* 是否党员
*/
private Boolean isParty;
/**
* 是否低保户
*/
private Boolean isDbh;
/**
* 是否保障房
*/
private Boolean isEnsureHouse;
/**
* 是否失业
*/
private Boolean isUnemployed;
/**
* 是否育龄妇女
*/
private Boolean isYlfn;
/**
* 是否退役军人
*/
private Boolean isVeterans;
/**
* 是否统战人员
*/
private Boolean isUnitedFront;
/**
* 是否信访人员
*/
private Boolean isXfry;
/**
* 是否志愿者
*/
private Boolean isVolunteer;
/**
* 是否老年人
*/
private Boolean isOldPeople;
/**
* 是否空巢
*/
private Boolean isKc;
/**
* 是否失独
*/
private Boolean isSd;
/**
* 是否失能
*/
private Boolean isSn;
/**
* 是否失智
*/
private Boolean isSz;
/**
* 是否残疾
*/
private Boolean isCj;
/**
* 是否大病
*/
private Boolean isDb;
/**
* 是否慢病
*/
private Boolean isMb;
/**
* 是否特殊人群
*/
private Boolean isSpecial;
private List<String> demandCategoryIds;
private String demandName;
/**
* 房屋类型1楼房2平房3别墅
*/
private String houseType;
}

45
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/IcResiUserController.java

@ -0,0 +1,45 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
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;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:03 下午
*/
@RestController
@RequestMapping("icresiuser")
public class IcResiUserController {
@Autowired
private IcResiUserService icResiUserService;
@PostMapping("listresi")
public Result<PageData<IcResiUserPageResultDTO>> queryListResi(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO){
//pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
ValidatorUtils.validateEntity(pageFormDTO,IcResiUserPageFormDTO.AddUserInternalGroup.class);
return new Result<PageData<IcResiUserPageResultDTO>>().ok(icResiUserService.pageResi(pageFormDTO));
}
@PostMapping("detail")
public Result queryIcResiDetail(@RequestBody IcResiDetailFormDTO pageFormDTO){
ValidatorUtils.validateEntity(pageFormDTO,IcResiDetailFormDTO.AddUserInternalGroup.class);
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO));
}
}

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcResiUserDao.java

@ -0,0 +1,18 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.ResiUserQueryValueDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface IcResiUserDao {
List<IcResiUserPageResultDTO> selectListResi(@Param("customerId") String customerId,
@Param("formCode") String formCode,
@Param("conditions") List<ResiUserQueryValueDTO> conditions,
@Param("resultColumns") List<IcFormResColumnDTO> resultColumns,
@Param("subTables") List<String> subTables);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/opercustomize/CustomerFootBarDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.opercustomize;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -56,4 +57,8 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
* @date 2021/7/28 10:56
*/
CustomerFootBarEntity selectDefaultIcon(@Param("customerId") String customerId, @Param("appType")String appType, @Param("barKey")String barKey);
List<IcFormResColumnDTO> queryConditions(@Param("customerId") String customerId, @Param("formCode")String formCode);
List<String> querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode);
}

14
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/IcResiUserService.java

@ -0,0 +1,14 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import java.util.Map;
public interface IcResiUserService {
PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO pageFormDTO);
Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO);
}

85
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/IcResiUserServiceImpl.java

@ -0,0 +1,85 @@
package com.epmet.dataaggre.service.epmetuser.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.IcResiUserDao;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO;
import com.epmet.dataaggre.service.epmetuser.IcResiUserService;
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description TODO
* @Author yinzuomei
* @Date 2021/10/27 2:04 下午
*/
@Service
@DataSource(DataSourceConstant.EPMET_USER)
@Slf4j
public class IcResiUserServiceImpl implements IcResiUserService {
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private CustomerFootBarService customerFootBarService;
@Override
public PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
List<IcFormResColumnDTO> resultColumns=customerFootBarService.queryConditions(formDTO.getCustomerId(),formDTO.getFormCode());
if(CollectionUtils.isEmpty(resultColumns)){
log.warn("没有配置列表展示列");
return new PageData(new ArrayList(), NumConstant.ZERO);
}
// 查询列表展示项需要用到哪些子表
List<String> subTables=customerFootBarService.querySubTables(formDTO.getCustomerId(),formDTO.getFormCode());
/* Set<String> subTableList=resultColumns.stream().filter(item->!item.getTableName().equals("ic_resi_user")
&& StringUtils.isNotBlank(item.getLink()))
.map(IcFormResColumnDTO :: getTableName).collect(Collectors.toSet());
List<String> subTables=new ArrayList<>();
subTableList.forEach(tableName->{
//'left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )'
String joinSql=String.format("% join %s on ( ic_resi_user.ID=%s.IC_RESI_USER and %s.del_flag=\"0\" ");
subTables.add(joinSql);
});*/
PageInfo<IcResiUserPageResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResi(formDTO.getCustomerId(),
formDTO.getFormCode(),
formDTO.getConditions(),
resultColumns,
subTables));
List<IcResiUserPageResultDTO> list = pageInfo.getList();
//todo 还早着呢
pageInfo.setList(list);
return new PageData<>(pageInfo.getList(),pageInfo.getTotal());
}
@Override
public Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO) {
return null;
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/CustomerFootBarService.java

@ -20,8 +20,11 @@ package com.epmet.dataaggre.service.opercustomize;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import java.util.List;
/**
* APP底部菜单栏信息
*
@ -39,4 +42,8 @@ public interface CustomerFootBarService extends BaseService<CustomerFootBarEntit
* @date 2021/7/27 18:59
*/
AppFootBarResultDTO queryAppFootBars(AppFootBarFormDTO footBarFormDTO);
List<IcFormResColumnDTO> queryConditions(String customerId, String formCode);
List<String> querySubTables(String customerId, String formCode);
}

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercustomize/impl/CustomerFootBarServiceImpl.java

@ -27,6 +27,7 @@ import com.epmet.dataaggre.dao.opercustomize.CustomerFootBarDao;
import com.epmet.dataaggre.dto.app.form.AppFootBarFormDTO;
import com.epmet.dataaggre.dto.app.result.AppFootBarResultDTO;
import com.epmet.dataaggre.dto.app.result.CustomerFootBarDTO;
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO;
import com.epmet.dataaggre.entity.opercrm.CustomerParameterEntity;
import com.epmet.dataaggre.entity.opercustomize.CustomerFootBarEntity;
import com.epmet.dataaggre.service.opercrm.CustomerParameterService;
@ -112,4 +113,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
return resultDTO;
}
@Override
public List<IcFormResColumnDTO> queryConditions(String customerId, String formCode) {
return baseDao.queryConditions(customerId,formCode);
}
@Override
public List<String> querySubTables(String customerId, String formCode) {
return baseDao.querySubTables(customerId,formCode);
}
}

65
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/IcResiUserDao.xml

@ -0,0 +1,65 @@
<?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.dataaggre.dao.epmetuser.IcResiUserDao">
<!-- <insert id="add">-->
<!-- insert into ${tableName}-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- ${key}-->
<!-- </foreach>-->
<!-- ,DEL_FLAG-->
<!-- ,REVISION-->
<!-- ,CREATED_TIME-->
<!-- ,UPDATED_TIME-->
<!-- ) values-->
<!-- (-->
<!-- <foreach collection="map.entrySet()" index="key" item="value" separator=",">-->
<!-- #{value}-->
<!-- </foreach>-->
<!-- ,'0'-->
<!-- ,'0'-->
<!-- ,NOW()-->
<!-- ,NOW()-->
<!-- )-->
<!-- </insert>-->
<select id="selectListResi" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO">
select
ic_resi_user.id as icResiUserId,
<foreach item="column" collection="resultColumns" open="" separator="," close="">
${column.columnName}
</foreach>
FROM
ic_resi_user
<if test="null != subTables and subTables.size() > 0">
<foreach item="subTableName" collection="subTables" open="" separator="" close="">
${subTableName}
</foreach>
</if>
WHERE
ic_resi_user.DEL_FLAG = '0'
and ic_resi_user.customer_id=#{customerId}
<if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">
<if test="subCondition.queryType!= null and subCondition.queryType == 'equal' ">
and ${subCondition.columnName} = #{subCondition.columnValue[0]}
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'like' ">
and ${subCondition.columnName} like concat('%',#{subCondition.columnValue[0]},'%')
</if>
<if test="subCondition.queryType!= null and subCondition.queryType == 'daterange' ">
and ${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]}
</if>
</if>
</foreach>
</if>
order by ic_resi_user.CREATED_TIME desc
</select>
</mapper>

40
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercustomize/CustomerFootBarDao.xml

@ -38,4 +38,44 @@
and c.BAR_KEY=#{barKey}
AND C.DISPLAY='1'
</select>
<select id="queryConditions" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO">
select
temp.table_name,
concat(temp.table_name,'.',temp.columnName) as columnName,
temp.LABEL,
temp.link
from (
SELECT
( CASE WHEN M.ITEM_GROUP_ID = '0' THEN 'ic_resi_user' ELSE g.TABLE_NAME END ) AS table_name,
m.COLUMN_NAME AS columnName,
m.LABEL,
g.link
FROM
ic_form_item m
LEFT JOIN ic_form_item_group g ON ( m.ITEM_GROUP_ID = g.id )
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
and m.FORM_CODE=#{formCode}
AND m.LIST_DISPLAY = '1'
)temp
</select>
<select id="querySubTables" parameterType="map" resultType="java.lang.String">
select
CONCAT('left join ',temp.TABLE_NAME, ' on ( ic_resi_user.ID=',temp.TABLE_NAME,'.IC_RESI_USER and ',temp.TABLE_NAME,'.del_flag="0" )') as subTables
from (
SELECT DISTINCT
m.TABLE_NAME
FROM
ic_form_item_group m
WHERE
m.DEL_FLAG = '0'
AND m.TABLE_NAME IS NOT NULL
AND m.TABLE_NAME != ''
AND m.CUSTOMER_ID = #{customerId}
AND m.FORM_CODE = #{formCode}
)temp
</select>
</mapper>

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFormQueryDTO.java

@ -19,5 +19,10 @@ public class CustomerFormQueryDTO implements Serializable {
@NotBlank(message = "tokenDto获取customerId不能为空",groups =AddUserInternalGroup.class )
private String customerId;
/**
* 是否动态
*/
private Boolean dynamic;
}

6
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java

@ -114,6 +114,9 @@ public class IcFormController {
if (StringUtils.isBlank(formDto.getCustomerId())){
formDto.setCustomerId(customerId);
}
if (formDto.getDynamic() == null){
formDto.setDynamic(true);
}
ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<CustomerFormResultDTO>().ok(icFormService.getCustomerForm(formDto));
}
@ -131,6 +134,9 @@ public class IcFormController {
@PostMapping("conditionlist")
public Result<List<ConditionResultDTO>> queryConditionList(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto){
formDto.setCustomerId(tokenDto.getCustomerId());
if (formDto.getDynamic() == null){
formDto.setDynamic(true);
}
ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<List<ConditionResultDTO>>().ok(icFormItemService.queryConditionList(formDto));
}

4
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java

@ -47,7 +47,7 @@ public interface IcFormDao extends BaseDao<IcFormEntity> {
*/
CustomerFormResultDTO selectByCode(@Param("customerId") String customerId, @Param("formCode") String formCode);
List<FormItem> selectItemList(String formId);
List<FormItem> selectItemList(String formId, Boolean dynamic);
List<FormItem> selectItemListByGroupId(String groupId);
List<OptionDTO> selectListOption(String itemId);
@ -55,4 +55,4 @@ public interface IcFormDao extends BaseDao<IcFormEntity> {
List<FormGroupDTO> selectListGroup(String formId);
FormGroupDTO selectChildGroup(String itemId);
}
}

4
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java

@ -118,7 +118,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
if (null == resultDTO) {
throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(),EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg());
}
List<FormItem> itemList=baseDao.selectItemList(resultDTO.getFormId());
List<FormItem> itemList=baseDao.selectItemList(resultDTO.getFormId(),formDto.getDynamic());
List<FormGroupDTO> groupList=baseDao.selectListGroup(resultDTO.getFormId());
resultDTO.setItemList(itemList);
@ -126,4 +126,4 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
return resultDTO;
}
}
}

5
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml

@ -106,6 +106,9 @@
WHERE
fi.DEL_FLAG = '0'
AND fi.FORM_ID = #{formId}
<if test="dynamic != null">
AND fi.DYNAMIC = #{dynamic}
</if>
AND fi.ITEM_GROUP_ID = '0'
ORDER BY
fi.SORT ASC
@ -196,4 +199,4 @@
g.SORT ASC
</select>
</mapper>
</mapper>

60
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -39,14 +39,19 @@ import com.epmet.dto.form.IcResiUserFormDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.excel.IcResiUserExcel;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.handler.ExcelDiceAddressListHandlerImpl;
import com.epmet.service.IcResiUserService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -137,18 +142,52 @@ public class IcResiUserController {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
List<ExcelExportEntity> colList = new ArrayList<>();
List<ExcelExportEntity> firstHeaderList = new ArrayList<>();
resultForm.getData().getItemList().forEach(item->{
ExcelExportEntity header = new ExcelExportEntity(item.getLabel(),item.getColumnName().concat(String.valueOf(item.getColumnNum())));
header.setNeedMerge(true);
firstHeaderList.add(header);
String baseTableName = "resi_base_info";
if (item.getChildGroup() != null){
//baseTableName单独的一个sheet
if (baseTableName.equals(item.getTableName())){
header = new ExcelExportEntity(item.getChildGroup().getLabel(),item.getChildGroup().getTableName());
header.setNeedMerge(true);
}else{
header = new ExcelExportEntity(item.getChildGroup().getLabel(),item.getChildGroup().getTableName());
header.setNeedMerge(true);
}
if (item.getColumnName().equals("GENDER")){
header.setReplace(new String[]{"男_1","女_2"});
}
List<ExcelExportEntity> secondHeaderList = new ArrayList<>();
item.getChildGroup().getItemList().forEach(item2->{
ExcelExportEntity secondHeader = new ExcelExportEntity(item2.getLabel(),item2.getColumnName().concat(String.valueOf(item2.getColumnNum())));
secondHeader.setNeedMerge(true);
secondHeaderList.add(secondHeader);
if (CollectionUtils.isNotEmpty(item2.getOptions())){
List<ExcelExportEntity> thirdHeaderList = new ArrayList<>();
item2.getOptions().forEach(child->{
ExcelExportEntity thirdHeader = new ExcelExportEntity(child.getLabel());
thirdHeader.setNeedMerge(true);
thirdHeaderList.add(thirdHeader);
});
secondHeader.setList(thirdHeaderList);
}
});
header.setList(secondHeaderList);
firstHeaderList.add(header);
}
});
ExcelExportEntity desginGroup = new ExcelExportEntity("表头名称","键");
/* ExcelExportEntity desginGroup = new ExcelExportEntity("表头名称","键");
desginGroup.setNeedMerge(true);
List<ExcelExportEntity> paramCols = new ArrayList<>();
List<String> headerList = Arrays.asList("头1","头2","头3");
@ -157,15 +196,16 @@ public class IcResiUserController {
});
desginGroup.setList(paramCols);
colList.add(desginGroup);
colList.add(desginGroup);*/
List<Map<String, String>> dataList =new ArrayList<>();
Map<String,String> dataMap = new HashMap<>();
dataMap.put("头1","1");
dataMap.put("头2","2");
dataMap.put("头3","3");
dataMap.put("GENDER0","1");
dataMap.put("ID_CARD0","371888991");
dataList.add(dataMap);
ExportParams entity = new ExportParams();
Workbook workbook = ExcelExportUtil.exportExcel(entity, colList, dataList);
ExportParams exportParams = new ExportParams();
exportParams.setDictHandler(new ExcelDiceAddressListHandlerImpl());
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, firstHeaderList, dataList);
//ExcelExportUtil.exportExcel
FileOutputStream fos = new FileOutputStream("//Users/liujianjun/Downloads/基础信息表/Dow.tt.xls");
workbook.write(fos);

64
epmet-user/epmet-user-server/src/main/java/com/epmet/handler/ExcelDiceAddressListHandlerImpl.java

@ -0,0 +1,64 @@
package com.epmet.handler;
import cn.afterturn.easypoi.handler.inter.IExcelDictHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 模拟使用,生产请用真实字典
*
* @author jueyue on 20-4-26.
*/
public class ExcelDiceAddressListHandlerImpl implements IExcelDictHandler {
/**
* 返回字典所有值
* key: dictKey
*
* @param dict 字典Key
* @return
*/
public List<Map> getList(String dict) {
List<Map> list = new ArrayList<>();
Map<String, String> dictMap = new HashMap<>();
dictMap.put("dictKey", "1");
dictMap.put("dictValue", "男");
list.add(dictMap);
dictMap = new HashMap<>();
dictMap.put("dictKey", "2");
dictMap.put("dictValue", "女");
list.add(dictMap);
return list;
}
@Override
public String toName(String dict, Object obj, String name, Object value) {
if ("level".equals(dict)) {
int level = Integer.parseInt(value.toString());
switch (level) {
case 1:
return "男";
case 2:
return "女";
}
}
return null;
}
@Override
public String toValue(String dict, Object obj, String name, Object value) {
if ("level".equals(dict)) {
int level = Integer.parseInt(value.toString());
switch (level) {
case 1:
return "男";
case 2:
return "女";
}
}
return null;
}
}
Loading…
Cancel
Save