Browse Source

选民登记管理功能 init

feature/screenDataPush
liuchuang 4 years ago
parent
commit
04a80e0bff
  1. 1
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java
  2. 4
      esua-epdc/epdc-gateway/pom.xml
  3. 2
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java
  4. 6
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ApiVoterServiceImpl.java
  5. 5
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationDTO.java
  6. 20
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationConfigController.java
  7. 2
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationController.java
  8. 12
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationConfigDao.java
  9. 23
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationDao.java
  10. 62
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationExcel.java
  11. 16
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationConfigServiceImpl.java
  12. 17
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationServiceImpl.java
  13. 13
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationConfigDao.xml
  14. 76
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationDao.xml

1
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java

@ -22,6 +22,7 @@ public interface NumConstant {
int TEN = 10;
int FIFTEEN = 15;
int EIGHTEEN = 18;
int TWENTY = 20;
int THIRTY = 30;
int FORTY = 40;

4
esua-epdc/epdc-gateway/pom.xml

@ -105,8 +105,8 @@
<!--<gateway.routes.epdc-admin-server.uri>http://127.0.0.1:9092</gateway.routes.epdc-admin-server.uri>-->
<gateway.routes.epdc-activiti-server.uri>lb://epdc-activiti-server
</gateway.routes.epdc-activiti-server.uri>
<!--<gateway.routes.epdc-api-server.uri>lb://epdc-api-server</gateway.routes.epdc-api-server.uri>-->
<gateway.routes.epdc-api-server.uri>http://127.0.0.1:9040</gateway.routes.epdc-api-server.uri>
<gateway.routes.epdc-api-server.uri>lb://epdc-api-server</gateway.routes.epdc-api-server.uri>
<!-- <gateway.routes.epdc-api-server.uri>http://127.0.0.1:9040</gateway.routes.epdc-api-server.uri>-->
<gateway.routes.epdc-app-server.uri>lb://epdc-app-server</gateway.routes.epdc-app-server.uri>
<!-- <gateway.routes.epdc-app-server.uri>http://127.0.0.1:9058</gateway.routes.epdc-app-server.uri>-->
<!-- <gateway.routes.epdc-heart-server.uri>lb://epdc-heart-server</gateway.routes.epdc-heart-server.uri>-->

2
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java

@ -21,7 +21,7 @@ import java.util.List;
* @Date: 2020/1/28 13:24
* @Description: 定制化功能模块fegin
*/
@FeignClient(name = ServiceConstant.EPDC_CUSTOM_SERVER, fallback = CustomFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPDC_CUSTOM_SERVER, fallback = CustomFeignClientFallback.class, url = "http://127.0.0.1:9076")
public interface CustomFeignClient {
/**
* @param formDTO

6
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ApiVoterServiceImpl.java

@ -1,6 +1,7 @@
package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.IdentityNoUtils;
@ -46,6 +47,11 @@ public class ApiVoterServiceImpl implements ApiVoterService {
if (StringUtils.isNotBlank(verification)) {
throw new RenException(verification);
}
// 校验年龄
Integer age = IdentityNoUtils.getAge(formDto.getIdNumber());
if (age < NumConstant.EIGHTEEN) {
throw new RenException("您的年龄小于18周岁,不符合选民登记资格");
}
try {
// 解析出生日期、性别

5
esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationDTO.java

@ -82,16 +82,19 @@ public class VoterRegistrationDTO implements Serializable {
* 所在选区代码
*/
private String constituencyCode;
private String constituencyName;
/**
* 所在小组代码
*/
private String groupCode;
private String groupName;
/**
* 参选原则代码
*/
private String participationPrincipleCode;
private String participationPrincipleName;
/**
* 备注
@ -163,4 +166,4 @@ public class VoterRegistrationDTO implements Serializable {
*/
private Date updatedTime;
}
}

20
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationConfigController.java

@ -26,8 +26,11 @@ import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.VoterRegistrationConfigDTO;
import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO;
import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO;
import com.elink.esua.epdc.modules.voter.excel.VoterRegistrationConfigExcel;
import com.elink.esua.epdc.modules.voter.service.VoterRegistrationConfigService;
import com.elink.esua.epdc.modules.voter.service.VoterRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -91,4 +94,21 @@ public class VoterRegistrationConfigController {
ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationConfigExcel.class);
}
/**
* 获取配置类型
*
* @param configType
* @return void
* @author lc
* @since 2021/11/5 15:50
*/
@GetMapping("getConfigByType/{configType}")
public Result<List<VoterRegistrationConfigResultDTO>> getConfigByType(@PathVariable String configType) {
VoterRegistrationConfigFormDTO formDto = new VoterRegistrationConfigFormDTO();
formDto.setConfigType(configType);
List<VoterRegistrationConfigResultDTO> data = voterRegistrationConfigService.listOfVoterConfig(formDto);
return new Result<List<VoterRegistrationConfigResultDTO>>().ok(data);
}
}

2
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationController.java

@ -88,7 +88,7 @@ public class VoterRegistrationController {
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<VoterRegistrationDTO> list = voterRegistrationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationExcel.class);
ExcelUtils.exportExcelToTarget(response, "选民登记记录", list, VoterRegistrationExcel.class);
}
}

12
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationConfigDao.java

@ -22,6 +22,7 @@ import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO;
import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO;
import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -44,4 +45,15 @@ public interface VoterRegistrationConfigDao extends BaseDao<VoterRegistrationCon
*/
List<VoterRegistrationConfigResultDTO> selectListOfVoterConfig(VoterRegistrationConfigFormDTO formDto);
/**
* 获取配置数量
*
* @param configCode
* @param id
* @return java.lang.Integer
* @author lc
* @since 2021/11/5 16:18
*/
Integer selectCountByConfigCodeOrId(@Param("configCode") String configCode, @Param("id") String id);
}

23
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationDao.java

@ -18,10 +18,14 @@
package com.elink.esua.epdc.modules.voter.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.VoterRegistrationDTO;
import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO;
import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 选民登记表 选民登记表
*
@ -41,4 +45,23 @@ public interface VoterRegistrationDao extends BaseDao<VoterRegistrationEntity> {
*/
VoterRegistrationDetailResultDTO registrationDetail(String userId);
/**
* 选民登记列表
*
* @return java.util.List<com.elink.esua.epdc.dto.VoterRegistrationDTO>
* @author lc
* @since 2021/11/5 17:45
*/
List<VoterRegistrationDTO> getVoterRegistrationList(Map<String, Object> params);
/**
* 选民登记信息
*
* @param id
* @return com.elink.esua.epdc.dto.VoterRegistrationDTO
* @author lc
* @since 2021/11/8 15:42
*/
VoterRegistrationDTO selectVoterRegistrationById(String id);
}

62
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationExcel.java

@ -31,8 +31,14 @@ import java.util.Date;
@Data
public class VoterRegistrationExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "所在选区")
private String constituencyName;
@Excel(name = "所在小组")
private String groupName;
@Excel(name = "参选原则")
private String participationPrincipleName;
@Excel(name = "姓名")
private String name;
@ -43,70 +49,22 @@ public class VoterRegistrationExcel {
@Excel(name = "性别")
private String sex;
@Excel(name = "出生日期")
@Excel(name = "出生日期", format = "yyyy-MM-dd")
private Date birthday;
@Excel(name = "手机号")
private String mobile;
@Excel(name = "民族数字代码")
private String nationNumericalCode;
@Excel(name = "民族名称")
private String nationName;
@Excel(name = "户籍地")
private String domicile;
@Excel(name = "所在选区代码")
private String constituencyCode;
@Excel(name = "所在小组代码")
private String groupCode;
@Excel(name = "参选原则代码")
private String participationPrincipleCode;
@Excel(name = "备注")
private String remark;
@Excel(name = "用户ID")
private String userId;
@Excel(name = "网格名称")
private String grid;
@Excel(name = "网格ID")
private Long gridId;
@Excel(name = "所有部门ID")
private String allDeptIds;
@Excel(name = "所有部门名称")
private String allDeptNames;
@Excel(name = "父部门ID")
private String parentDeptIds;
@Excel(name = "父部门名称")
private String parentDeptNames;
@Excel(name = "删除标识 0-否,1-是")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
@Excel(name = "提交时间", format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;

16
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationConfigServiceImpl.java

@ -20,6 +20,8 @@ package com.elink.esua.epdc.modules.voter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
@ -63,10 +65,10 @@ public class VoterRegistrationConfigServiceImpl extends BaseServiceImpl<VoterReg
}
private QueryWrapper<VoterRegistrationConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
String configType = (String)params.get("configType");
QueryWrapper<VoterRegistrationConfigEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(configType), "CONFIG_TYPE", configType);
return wrapper;
}
@ -80,6 +82,11 @@ public class VoterRegistrationConfigServiceImpl extends BaseServiceImpl<VoterReg
@Override
@Transactional(rollbackFor = Exception.class)
public void save(VoterRegistrationConfigDTO dto) {
// 判断编码是否重复
Integer num = baseDao.selectCountByConfigCodeOrId(dto.getConfigCode(), "");
if (num > NumConstant.ZERO) {
throw new RenException("配置编码已存在,请修改后重新提交");
}
VoterRegistrationConfigEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationConfigEntity.class);
insert(entity);
}
@ -87,6 +94,11 @@ public class VoterRegistrationConfigServiceImpl extends BaseServiceImpl<VoterReg
@Override
@Transactional(rollbackFor = Exception.class)
public void update(VoterRegistrationConfigDTO dto) {
// 判断编码是否重复
Integer num = baseDao.selectCountByConfigCodeOrId(dto.getConfigCode(), dto.getId());
if (num > NumConstant.ZERO) {
throw new RenException("配置编码已存在,请修改后重新提交");
}
VoterRegistrationConfigEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationConfigEntity.class);
updateById(entity);
}

17
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationServiceImpl.java

@ -24,6 +24,7 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.ArchivesDTO;
import com.elink.esua.epdc.dto.VoterRegistrationDTO;
import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO;
import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO;
@ -49,18 +50,14 @@ public class VoterRegistrationServiceImpl extends BaseServiceImpl<VoterRegistrat
@Override
public PageData<VoterRegistrationDTO> page(Map<String, Object> params) {
IPage<VoterRegistrationEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, VoterRegistrationDTO.class);
IPage<VoterRegistrationDTO> page = getPage(params);
List<VoterRegistrationDTO> list = baseDao.getVoterRegistrationList(params);
return new PageData<>(list, page.getTotal());
}
@Override
public List<VoterRegistrationDTO> list(Map<String, Object> params) {
List<VoterRegistrationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VoterRegistrationDTO.class);
return baseDao.getVoterRegistrationList(params);
}
private QueryWrapper<VoterRegistrationEntity> getWrapper(Map<String, Object> params){
@ -74,8 +71,8 @@ public class VoterRegistrationServiceImpl extends BaseServiceImpl<VoterRegistrat
@Override
public VoterRegistrationDTO get(String id) {
VoterRegistrationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, VoterRegistrationDTO.class);
VoterRegistrationDTO dto = baseDao.selectVoterRegistrationById(id);
return dto;
}
@Override

13
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationConfigDao.xml

@ -24,4 +24,17 @@
SORT
</select>
<select id="selectCountByConfigCodeOrId" resultType="Integer">
SELECT
COUNT( ID )
FROM
`epdc_voter_registration_config`
WHERE
DEL_FLAG = '0'
AND CONFIG_CODE = #{configCode}
<if test="id != null and id.trim() != ''">
AND ID <![CDATA[ <> ]]> #{id}
</if>
</select>
</mapper>

76
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationDao.xml

@ -23,4 +23,80 @@
AND USER_ID = #{userId}
</select>
<select id="getVoterRegistrationList" resultType="com.elink.esua.epdc.dto.VoterRegistrationDTO">
SELECT
r.ID,
r.`NAME`,
r.ID_NUMBER,
case r.SEX when '0' then '女' when '1' then '男' else '未知' end as sex,
r.BIRTHDAY,
r.MOBILE,
r.NATION_NAME,
r.DOMICILE,
r.UPDATED_TIME,
c1.CONFIG_NAME AS constituencyName,
c2.CONFIG_NAME AS groupName,
c3.CONFIG_NAME AS participationPrincipleName,
r.REMARK
FROM
epdc_voter_registration r
LEFT JOIN epdc_voter_registration_config c1 ON c1.CONFIG_CODE = r.CONSTITUENCY_CODE AND c1.DEL_FLAG = '0'
LEFT JOIN epdc_voter_registration_config c2 ON c2.CONFIG_CODE = r.GROUP_CODE AND c2.DEL_FLAG = '0'
LEFT JOIN epdc_voter_registration_config c3 ON c3.CONFIG_CODE = r.PARTICIPATION_PRINCIPLE_CODE AND c3.DEL_FLAG = '0'
WHERE
r.DEL_FLAG = '0'
<if test="constituencyCode != '' and constituencyCode != null">
and c1.CONFIG_CODE = #{constituencyCode}
</if>
<if test="groupCode != '' and groupCode != null">
and c2.CONFIG_CODE = #{groupCode}
</if>
<if test="participationPrincipleCode != '' and participationPrincipleCode != null">
and c3.CONFIG_CODE = #{participationPrincipleCode}
</if>
<if test="domicile != '' and domicile != null">
and r.DOMICILE like concat('%', #{domicile}, '%')
</if>
<if test="sex != '' and sex != null">
and r.SEX = #{sex}
</if>
<if test="name != '' and name != null">
and r.NAME like concat('%', #{name}, '%')
</if>
<if test="mobile != '' and mobile != null">
and r.MOBILE like concat('%', #{mobile}, '%')
</if>
<if test="startTime != null and startTime != ''">
and DATE_FORMAT(r.BIRTHDAY,'%Y-%m-%d') <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT(r.BIRTHDAY,'%Y-%m-%d') <![CDATA[ <= ]]> #{endTime}
</if>
</select>
<select id="selectVoterRegistrationById" resultType="com.elink.esua.epdc.dto.VoterRegistrationDTO">
SELECT
r.ID,
r.`NAME`,
r.ID_NUMBER,
case r.SEX when '0' then '女' when '1' then '男' else '未知' end as sex,
r.BIRTHDAY,
r.MOBILE,
r.NATION_NAME,
r.DOMICILE,
r.UPDATED_TIME,
c1.CONFIG_NAME AS constituencyName,
c2.CONFIG_NAME AS groupName,
c3.CONFIG_NAME AS participationPrincipleName,
r.REMARK
FROM
epdc_voter_registration r
LEFT JOIN epdc_voter_registration_config c1 ON c1.CONFIG_CODE = r.CONSTITUENCY_CODE AND c1.DEL_FLAG = '0'
LEFT JOIN epdc_voter_registration_config c2 ON c2.CONFIG_CODE = r.GROUP_CODE AND c2.DEL_FLAG = '0'
LEFT JOIN epdc_voter_registration_config c3 ON c3.CONFIG_CODE = r.PARTICIPATION_PRINCIPLE_CODE AND c3.DEL_FLAG = '0'
WHERE
r.DEL_FLAG = '0'
and r.ID = #{id}
</select>
</mapper>

Loading…
Cancel
Save