25 changed files with 639 additions and 64 deletions
@ -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; |
||||
|
} |
||||
|
|
@ -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; |
||||
|
} |
||||
|
|
@ -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; |
||||
|
} |
||||
|
|
@ -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; |
||||
|
} |
||||
|
|
@ -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; |
||||
|
} |
||||
|
|
@ -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)); |
||||
|
} |
||||
|
} |
||||
|
|
@ -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); |
||||
|
} |
@ -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); |
||||
|
} |
@ -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; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
@ -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> |
Loading…
Reference in new issue