Browse Source

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

master
jianjun 4 years ago
parent
commit
4935211c6c
  1. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemDTO.java
  2. 93
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java
  3. 22
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  4. 7
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java
  5. 5
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemEntity.java
  6. 12
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java
  7. 16
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java
  8. 2
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  9. 47
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml
  10. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserEditFormDTO.java
  11. 22
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserFormDTO.java
  12. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  13. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  14. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  15. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  16. 21
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

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

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -74,7 +75,7 @@ public class IcFormItemDTO implements Serializable {
private String itemType;
/**
* 分组ID,'默认NONE'
* 分组ID,'默认0'
*/
private String itemGroupId;

93
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java

@ -0,0 +1,93 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 查询条件
* @Author yinzuomei
* @Date 2021/10/27 9:09 上午
*/
@Data
public class ConditionResultDTO implements Serializable {
private static final long serialVersionUID = -2021200288758478252L;
/**
* 父项ID
*/
private String itemId;
/**
* 默认ic_resi_user
*/
private String tableName;
/**
* 父项ID
*/
private String parentItemId;
/**
* 项标签
*/
private String label;
/**
* 控件类型,EG:INPUT;从字典获取
*/
private String itemType;
/**
* 分组ID,'默认NONE'
*/
private String itemGroupId;
/**
* 是否必填,1必填0不必填
*/
private Integer required;
/**
* 手机号mobile; 身份证id_card
*/
private String validType;
/**
* 默认值
*/
private String defaultValue;
/**
* 选项来源,REMOTE;LOCAL;如果是动态加载的下拉框或者CHECKBOX等的情况下使用URL:接口获取(LABEL,VALUE)JSON:直接从JSON中取
*/
private String optionSourceType;
/**
* 来源地址,REMOTE才有固定格式;如果OPTIONS_SOURCE是URL则此处填写要调用的接口的URL相对路径例如/API/GOV/ORG/XXXX此处不应设置参数若需要参数应当完全由后端通过TOKEN信息来获取
*/
private String optionSourceValue;
/**
* 排序
*/
private Integer sort;
/**
* 占位提示语
*/
private String placeholder;
/**
* 列名
*/
private String columnName;
/**
* 查询类型: equal, like,daterange....
*/
private String queryType;
private List<OptionDTO> options;
}

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

@ -17,7 +17,9 @@
package com.epmet.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.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -27,8 +29,10 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcFormDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.excel.IcFormExcel;
import com.epmet.service.IcFormItemService;
import com.epmet.service.IcFormService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -51,6 +55,8 @@ public class IcFormController {
@Autowired
private IcFormService icFormService;
@Autowired
private IcFormItemService icFormItemService;
@GetMapping("page")
public Result<PageData<IcFormDTO>> page(@RequestParam Map<String, Object> params){
@ -110,6 +116,22 @@ public class IcFormController {
}
ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<CustomerFormResultDTO>().ok(icFormService.getCustomerForm(formDto));
}
/**
* 获取居民信息的查询条件组件列表
*
* @param tokenDto
* @param formDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.ConditionResultDTO>>
* @author yinzuomei
* @date 2021/10/27 9:18 上午
*/
@PostMapping("conditionlist")
public Result<List<ConditionResultDTO>> queryConditionList(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto){
formDto.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<List<ConditionResultDTO>>().ok(icFormItemService.queryConditionList(formDto));
}
}

7
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.entity.IcFormItemEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 表单项
@ -29,5 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcFormItemDao extends BaseDao<IcFormItemEntity> {
List<ConditionResultDTO> selectConditionList(@Param("customerId") String customerId, @Param("formCode") String formCode);
}

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

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 表单项
*
@ -74,7 +71,7 @@ public class IcFormItemEntity extends BaseEpmetEntity {
private String itemType;
/**
* 分组ID,'默认NONE'
* 分组ID,'默认0'
*/
private String itemGroupId;

12
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemService.java

@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcFormItemDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.entity.IcFormItemEntity;
import java.util.List;
@ -92,4 +94,14 @@ public interface IcFormItemService extends BaseService<IcFormItemEntity> {
* @date 2021-10-26
*/
void delete(String[] ids);
/**
* 获取居民信息的查询条件组件列表
*
* @param formDto
* @return java.util.List<com.epmet.dto.result.ConditionResultDTO>
* @author yinzuomei
* @date 2021/10/27 9:19 上午
*/
List<ConditionResultDTO> queryConditionList(CustomerFormQueryDTO formDto);
}

16
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemServiceImpl.java

@ -25,6 +25,8 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcFormItemDao;
import com.epmet.dto.IcFormItemDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.result.ConditionResultDTO;
import com.epmet.entity.IcFormItemEntity;
import com.epmet.service.IcFormItemService;
import org.apache.commons.lang3.StringUtils;
@ -97,4 +99,18 @@ public class IcFormItemServiceImpl extends BaseServiceImpl<IcFormItemDao, IcForm
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 获取居民信息的查询条件组件列表
*
* @param formDto
* @return java.util.List<com.epmet.dto.result.ConditionResultDTO>
* @author yinzuomei
* @date 2021/10/27 9:19 上午
*/
@Override
public List<ConditionResultDTO> queryConditionList(CustomerFormQueryDTO formDto) {
List<ConditionResultDTO> list=baseDao.selectConditionList(formDto.getCustomerId(),formDto.getFormCode());
return list;
}
}

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

@ -106,7 +106,7 @@
WHERE
fi.DEL_FLAG = '0'
AND fi.FORM_ID = #{formId}
AND fi.ITEM_GROUP_ID = 'none'
AND fi.ITEM_GROUP_ID = '0'
ORDER BY
fi.SORT ASC
</select>

47
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml

@ -4,5 +4,52 @@
<mapper namespace="com.epmet.dao.IcFormItemDao">
<resultMap id="ConditionResultDTOMap" type="com.epmet.dto.result.ConditionResultDTO">
<id property="itemId" column="item_id" ></id>
<result property="tableName" column="table_name"/>
<result property="parentItemId" column="PARENT_ITEM_ID"/>
<result property="label" column="LABEL"/>
<result property="itemType" column="ITEM_TYPE"/>
<result property="itemGroupId" column="ITEM_GROUP_ID"/>
<result property="required" column="REQUIRED"/>
<result property="validType" column="VALID_TYPE"/>
<result property="defaultValue" column="DEFAULT_VALUE"/>
<result property="optionSourceType" column="OPTION_SOURCE_TYPE"/>
<result property="optionSourceValue" column="OPTION_SOURCE_VALUE"/>
<result property="sort" column="SORT"/>
<result property="placeholder" column="PLACEHOLDER"/>
<result property="columnName" column="COLUMN_NAME"/>
<collection property="options" ofType="com.epmet.dto.result.OptionDTO"
column="item_id" select="com.epmet.dao.IcFormDao.selectListOption">
<result property="label" column=""/>
<result property="value" column="url"/>
</collection>
</resultMap>
<select id="selectConditionList" parameterType="map" resultMap="ConditionResultDTOMap">
SELECT
b.FORM_ITEM_ID AS item_id,
IFNULL(g.TABLE_NAME,'')AS TABLE_NAME,
i.PARENT_ITEM_ID,
i.LABEL,
i.ITEM_TYPE,
i.ITEM_GROUP_ID,
i.REQUIRED,
IFNULL(i.VALID_TYPE,'')as VALID_TYPE,
IFNULL(i.DEFAULT_VALUE,'') as DEFAULT_VALUE,
IFNULL(i.OPTION_SOURCE_TYPE,'') as OPTION_SOURCE_TYPE,
IFNULL(i.OPTION_SOURCE_VALUE,'') as OPTION_SOURCE_VALUE,
b.SORT,
IFNULL(i.PLACEHOLDER,'') as PLACEHOLDER,
IFNULL(i.COLUMN_NAME,'')as COLUMN_NAME,
b.QUERY_TYPE
FROM ic_form_query_builder b
inner join ic_form_item i on(i.id=b.FORM_ITEM_ID and i.DEL_FLAG='0')
LEFT JOIN ic_form_item_group g ON ( i.ITEM_GROUP_ID = g.id )
WHERE
b.DEL_FLAG = '0'
AND b.CUSTOMER_ID = #{customerId}
AND b.FORM_CODE = #{formCode}
ORDER BY b.SORT asc
</select>
</mapper>

27
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserEditFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 党建互联平台--保存/修改居民信息
* @Author sun
*/
@Data
public class IcResiUserEditFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
/**
* 字段对应表名
*/
private String tableName;
/**
* 字段key值
*/
private String columnName;
/**
* 字段值
*/
private String columnValue;
}

22
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserFormDTO.java

@ -2,24 +2,24 @@ package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Description 居民注册信息查询入参DTO
* @Author yinzuomei
* @Date 2020/3/30 10:26
* @Description 党建互联平台--保存/修改居民信息
* @Author sun
*/
@Data
public class IcResiUserFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
@NotBlank(message = "徽章id不能为空", groups = {ManageGroup.class})
private String badgeId;
/**
* 字段对应表名
*/
private String tableName;
/**
* 网格Id
* 表对应的字段及值
*/
@NotBlank(message = "网格id不能为空", groups = {AuditGroup.class})
private String gridId;
public interface ManageGroup {}
public interface AuditGroup {}
private List<Map<String,String>> list;
}

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

@ -111,8 +111,8 @@ public class IcResiUserController {
* @Description 党建互联平台--保存居民信息
**/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserFormDTO formDTO) {
icResiUserService.add(formDTO);
public Result add(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) {
icResiUserService.add(tokenDto, formDTO);
return new Result();
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -20,6 +20,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcResiUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* 用户基础信息
@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
void add(@Param("tableName") String tableName, @Param("map") Map<String, String> map);
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -19,7 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcResiUserFormDTO;
import com.epmet.entity.IcResiUserEntity;
@ -99,7 +99,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Author sun
* @Description 党建互联平台--保存居民信息
**/
void add(IcResiUserFormDTO formDTO);
void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO);
/**
* @Author sun

53
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -20,16 +20,23 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcResiUserFormDTO;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.IcResiUserRedis;
import com.epmet.service.IcResiUserService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -37,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* 用户基础信息
@ -46,9 +54,11 @@ import java.util.Map;
*/
@Service
public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResiUserEntity> implements IcResiUserService {
private Logger logger = LogManager.getLogger(IcResiUserServiceImpl.class);
@Autowired
private IcResiUserRedis icResiUserRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<IcResiUserDTO> page(Map<String, Object> params) {
@ -107,7 +117,44 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @Description 党建互联平台--保存居民信息
**/
@Override
public void add(IcResiUserFormDTO formDTO) {
public void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) {
//循环自动拼接sql语句,往多个表新增数据
//1.先往主表新增数据
//主表Id
String resiUserId = UUID.randomUUID().toString().replaceAll("-", "");
formDTO.forEach(d -> {
if ("ic_resi_user".equals(d.getTableName())) {
Map<String, String> map = d.getList().get(0);
map.put("id", resiUserId);
map.put("customer_id", tokenDto.getCustomerId());
map.put("created_by", tokenDto.getUserId());
map.put("updated_by", tokenDto.getUserId());
//查询组织信息
String agencyId = (null == map.get("AGENCY_ID") ? map.get("agency_id") : map.get("AGENCY_ID"));
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyById(agencyId);
if (result.success() && null != result.getData()) {
map.put("pids", result.getData().getPids());
} else {
throw new RenException(String.format("新增居民信息-根据agencyId查询组织信息失败,agencyId->%s", agencyId));
}
//新增主表数据
baseDao.add(d.getTableName(), map);
}
});
//2.循环字表新增数据
formDTO.forEach(d -> {
if (!"ic_resi_user".equals(d.getTableName())) {
d.getList().forEach(map -> {
map.put("id", UUID.randomUUID().toString().replaceAll("-", ""));
map.put("ic_resi_user", resiUserId);
map.put("customer_id", tokenDto.getCustomerId());
map.put("created_by", tokenDto.getUserId());
map.put("updated_by", tokenDto.getUserId());
//字表新增数据
baseDao.add(d.getTableName(), map);
});
}
});
}

21
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -3,6 +3,27 @@
<mapper namespace="com.epmet.dao.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>
</mapper>
Loading…
Cancel
Save