Browse Source

Merge branch 'dev_ic_platform' into develop

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
efe3f1908a
  1. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java
  2. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  3. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java
  4. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  5. 37
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java
  6. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java
  7. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java
  8. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  9. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  10. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java
  11. 3
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml
  12. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java
  13. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserEditFormDTO.java
  14. 22
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserFormDTO.java
  15. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  16. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  17. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
  18. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  19. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  20. 21
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerPartyBranchController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@ -129,4 +130,16 @@ public class CustomerPartyBranchController {
customerPartyBranchService.decrPartyBranchMember(partyBranchId);
return new Result();
}
/**
* 获取网格下支部小组
* @Param formDTO
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/27 9:58
*/
@PostMapping("branchoption")
public Result<List<OptionResultDTO>> getBranchOption(@RequestBody CustomerPartyBranchDTO formDTO){
return new Result<List<OptionResultDTO>>().ok(customerPartyBranchService.getBranchOption(formDTO.getGridId()));
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -92,7 +92,7 @@ public class IcNeighborHoodController {
*/
@PostMapping("neighborhoodoption")
public Result<List<OptionResultDTO>> getNeighborHoodOptions(IcNeighborHoodDTO dto) {
return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getGridId()));
return new Result<List<OptionResultDTO>>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId()));
}
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerPartyBranchService.java

@ -18,6 +18,7 @@
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.dto.CustomerPartyBranchDTO;
import com.epmet.dto.form.ListPartyBranchFormDTO;
@ -112,4 +113,13 @@ public interface CustomerPartyBranchService extends BaseService<CustomerPartyBra
* @Date 2020/6/18 18:31
**/
void decrPartyBranchMember(String partyBranchId);
/**
* 获取网格下支部小组
* @Param gridId
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/27 9:57
*/
List<OptionResultDTO> getBranchOption(String gridId);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -96,10 +96,11 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
/**
* @Description 获取网格下小区列表
* @Param agencyId
* @Param gridId
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:32
*/
List<OptionResultDTO> getNeighborHoodOptions(String gridId);
List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId);
}

37
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerPartyBranchServiceImpl.java

@ -17,10 +17,12 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.CustomerPartyBranchDao;
@ -34,14 +36,18 @@ import com.epmet.redis.CustomerPartyBranchRedis;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.service.CustomerPartyBranchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 党支部信息
@ -49,6 +55,7 @@ import java.util.Map;
* @author yinzuomei yinzuomei@elink-cn.com
* @since v1.0.0 2020-06-17
*/
@Slf4j
@Service
public class CustomerPartyBranchServiceImpl extends BaseServiceImpl<CustomerPartyBranchDao, CustomerPartyBranchEntity> implements CustomerPartyBranchService {
@ -134,4 +141,34 @@ public class CustomerPartyBranchServiceImpl extends BaseServiceImpl<CustomerPart
baseDao.decrPartyBranchMember(partyBranchId);
}
/**
* 获取网格下支部小组
*
* @param gridId
* @Param gridId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/27 9:57
*/
@Override
public List<OptionResultDTO> getBranchOption(String gridId) {
if (StringUtils.isBlank(gridId)) {
log.error("网格ID为空");
return Collections.emptyList();
}
LambdaQueryWrapper<CustomerPartyBranchEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CustomerPartyBranchEntity::getGridId, gridId);
wrapper.last("ORDER BY CONVERT ( PARTY_BRANCH_NAME USING gbk ) ASC");
List<CustomerPartyBranchEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
OptionResultDTO dto = new OptionResultDTO();
dto.setValue(item.getId());
dto.setLabel(item.getPartyBranchName());
return dto;
}).collect(Collectors.toList());
}
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.dao.IcBuildingDao;
import com.epmet.dto.IcBuildingDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.service.IcBuildingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -46,6 +47,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@Service
public class IcBuildingServiceImpl extends BaseServiceImpl<IcBuildingDao, IcBuildingEntity> implements IcBuildingService {
@ -113,6 +115,7 @@ public class IcBuildingServiceImpl extends BaseServiceImpl<IcBuildingDao, IcBuil
@Override
public List<OptionResultDTO> getBuildingOptions(String neighborHoodId) {
if (StringUtils.isBlank(neighborHoodId)) {
log.error("小区ID为空");
return Collections.emptyList();
}
LambdaQueryWrapper<IcBuildingEntity> wrapper = new LambdaQueryWrapper<>();

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcBuildingUnitServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.dao.IcBuildingUnitDao;
import com.epmet.dto.IcBuildingUnitDTO;
import com.epmet.entity.IcBuildingUnitEntity;
import com.epmet.service.IcBuildingUnitService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -46,6 +47,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@Service
public class IcBuildingUnitServiceImpl extends BaseServiceImpl<IcBuildingUnitDao, IcBuildingUnitEntity> implements IcBuildingUnitService {
@ -113,6 +115,7 @@ public class IcBuildingUnitServiceImpl extends BaseServiceImpl<IcBuildingUnitDao
@Override
public List<OptionResultDTO> getUnitOptions(String buildingId) {
if (StringUtils.isBlank(buildingId)) {
log.error("楼栋ID为空");
return Collections.emptyList();
}
LambdaQueryWrapper<IcBuildingUnitEntity> wrapper = new LambdaQueryWrapper<>();

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.dto.IcHouseDTO;
import com.epmet.dto.form.HouseFormDTO;
import com.epmet.entity.IcHouseEntity;
import com.epmet.service.IcHouseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -47,6 +48,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@Service
public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntity> implements IcHouseService {
@ -114,6 +116,7 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
@Override
public List<OptionResultDTO> getHouseOption(HouseFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getBuildingId()) && StringUtils.isBlank(formDTO.getUnitId())) {
log.error("楼栋ID为空");
return Collections.emptyList();
}
LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>();

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.dao.IcNeighborHoodDao;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.service.IcNeighborHoodService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -46,6 +47,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-10-25
*/
@Slf4j
@Service
public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao, IcNeighborHoodEntity> implements IcNeighborHoodService {
@ -103,20 +105,22 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
}
/**
* @param gridId
* @Description 获取网格下小区列表
* @param agencyId
* @Param gridId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 14:32
*/
@Override
public List<OptionResultDTO> getNeighborHoodOptions(String gridId) {
if (StringUtils.isBlank(gridId)) {
public List<OptionResultDTO> getNeighborHoodOptions(String agencyId, String gridId) {
if (StringUtils.isBlank(agencyId)) {
log.error("组织ID为空");
return Collections.emptyList();
}
LambdaQueryWrapper<IcNeighborHoodEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNeighborHoodEntity::getGridId, gridId);
wrapper.eq(IcNeighborHoodEntity::getAgencyId, agencyId);
wrapper.eq(StringUtils.isNotBlank(gridId), IcNeighborHoodEntity::getGridId, gridId);
wrapper.last("ORDER BY CONVERT ( NEIGHBOR_HOOD_NAME USING gbk ) ASC");
List<IcNeighborHoodEntity> list = baseDao.selectList(wrapper);
if(CollectionUtils.isEmpty(list)) {

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

@ -83,6 +83,11 @@ public class ConditionResultDTO implements Serializable {
*/
private String columnName;
/**
* 查询类型: equal, like,daterange....
*/
private String queryType;
private List<OptionDTO> options;
}

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

@ -41,7 +41,8 @@
IFNULL(i.OPTION_SOURCE_VALUE,'') as OPTION_SOURCE_VALUE,
b.SORT,
IFNULL(i.PLACEHOLDER,'') as PLACEHOLDER,
IFNULL(i.COLUMN_NAME,'')as COLUMN_NAME
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 )

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java

@ -68,6 +68,11 @@ public class IcResiUserDTO implements Serializable {
*/
private String buildId;
/**
* 单元id
*/
private String unitId;
/**
* 所属家庭Id
*/

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

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

@ -20,6 +20,7 @@ package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -35,7 +36,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.CustomerFormQueryDTO;
import com.epmet.dto.form.IcResiUserFormDTO;
import com.epmet.dto.result.CheckFloatFootBarResultDTO;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.excel.IcResiUserExcel;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserService;
@ -110,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();
}
@ -131,12 +132,22 @@ public class IcResiUserController {
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<CheckFloatFootBarResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
Result<CustomerFormResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
System.out.println(JSON.toJSONString(resultForm.getData()));
List<ExcelExportEntity> colList = new ArrayList<>();
resultForm.getData().getItemList().forEach(item->{
});
ExcelExportEntity desginGroup = new ExcelExportEntity("表头名称","键");
desginGroup.setNeedMerge(true);
List<ExcelExportEntity> paramCols = new ArrayList<>();

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

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java

@ -68,6 +68,11 @@ public class IcResiUserEntity extends BaseEpmetEntity {
*/
private String buildId;
/**
* 单元id
*/
private String unitId;
/**
* 所属家庭Id
*/

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