diff --git a/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/NationDTO.java b/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/NationDTO.java new file mode 100644 index 00000000..ee61c528 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/NationDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +public class NationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 罗马字母拼音写法 + */ + private String nationPinyin; + + /** + * 字母代码 + */ + private String letterCode; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NationResultDTO.java b/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NationResultDTO.java new file mode 100644 index 00000000..8fd8b528 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NationResultDTO.java @@ -0,0 +1,35 @@ +package com.elink.esua.epdc.dto.epdc.result; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class NationResultDTO implements Serializable { + private static final long serialVersionUID = 5420334516537600071L; + + /** + * ID + */ + private String id; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 罗马字母拼音写法 + */ + private String nationPinyin; + + /** + * 字母代码 + */ + private String letterCode; +} diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/NationController.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/NationController.java new file mode 100644 index 00000000..f2f98733 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/NationController.java @@ -0,0 +1,99 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +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.NationDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; +import com.elink.esua.epdc.service.NationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@RestController +@RequestMapping("nation") +public class NationController { + + @Autowired + private NationService nationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = nationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + NationDTO data = nationService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody NationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + nationService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody NationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + nationService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + nationService.delete(ids); + return new Result(); + } + + /** + * 民族列表接口 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:45 + */ + @GetMapping("list") + public Result> nationList() { + List data = nationService.listOfNation(); + return new Result>().ok(data); + } + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/NationDao.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/NationDao.java new file mode 100644 index 00000000..395a6224 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/NationDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; +import com.elink.esua.epdc.entity.NationEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Mapper +public interface NationDao extends BaseDao { + + /** + * 民族列表 + * + * @return java.util.List + * @author lc + * @since 2021/11/5 10:47 + */ + List selectNationList(); +} diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/NationEntity.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/NationEntity.java new file mode 100644 index 00000000..0ced4958 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/NationEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("nation") +public class NationEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 罗马字母拼音写法 + */ + private String nationPinyin; + + /** + * 字母代码 + */ + private String letterCode; + + /** + * 排序 + */ + private Integer sort; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/NationService.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/NationService.java new file mode 100644 index 00000000..edd0a48b --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/NationService.java @@ -0,0 +1,105 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.NationDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; +import com.elink.esua.epdc.entity.NationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +public interface NationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-11-05 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-11-05 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return NationDTO + * @author generator + * @date 2021-11-05 + */ + NationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void save(NationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void update(NationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-11-05 + */ + void delete(String[] ids); + + /** + * 民族列表接口 + * + * @return java.util.List + * @author lc + * @since 2021/11/5 10:46 + */ + List listOfNation(); +} diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/NationServiceImpl.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/NationServiceImpl.java new file mode 100644 index 00000000..fc2a6d72 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/NationServiceImpl.java @@ -0,0 +1,105 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.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.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.dao.NationDao; +import com.elink.esua.epdc.dto.NationDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; +import com.elink.esua.epdc.entity.NationEntity; +import com.elink.esua.epdc.service.NationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 民族表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Service +public class NationServiceImpl extends BaseServiceImpl implements NationService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, NationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, NationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public NationDTO get(String id) { + NationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, NationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(NationDTO dto) { + NationEntity entity = ConvertUtils.sourceToTarget(dto, NationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(NationDTO dto) { + NationEntity entity = ConvertUtils.sourceToTarget(dto, NationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List listOfNation() { + return baseDao.selectNationList(); + } + +} diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/NationDao.xml b/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/NationDao.xml new file mode 100644 index 00000000..6c21f7a8 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/NationDao.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAdminController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAdminController.java index e1522510..babd39b1 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAdminController.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAdminController.java @@ -6,6 +6,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; import com.elink.esua.epdc.dto.DeptOption; import com.elink.esua.epdc.dto.epdc.form.WorkUserEventTagRelationFormDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; import com.elink.esua.epdc.dto.epdc.result.WorkUserEventTagRelationResultDTO; import com.elink.esua.epdc.service.AdminService; import com.elink.esua.epdc.service.AppUserService; @@ -84,5 +85,16 @@ public class ApiAdminController { return appUserService.getDeptTreeWithTypeKey(); } + /** + * 民族列表接口 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:41 + */ + @GetMapping("nation/list") + public Result> nationList() { + return adminService.listOfNation(); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiVoterController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiVoterController.java new file mode 100644 index 00000000..7716bdf3 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiVoterController.java @@ -0,0 +1,65 @@ +package com.elink.esua.epdc.controller; + + +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +import com.elink.esua.epdc.service.ApiVoterService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("voter") +public class ApiVoterController { + + @Autowired + private ApiVoterService apiVoterService; + + /** + * 选民登记配置列表接口 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:57 + */ + @GetMapping("config/list") + public Result> voterConfigList(VoterRegistrationConfigFormDTO formDto) { + return apiVoterService.listOfVoterConfig(formDto); + } + + /** + * 选民登记 + * + * @param userDetail + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 13:40 + */ + @PostMapping("registration/submit") + public Result registration(@LoginUser TokenDto userDetail, @RequestBody VoterRegistrationFormDTO formDto) { + ValidatorUtils.validateEntity(formDto); + return apiVoterService.registration(userDetail, formDto); + } + + /** + * 选民登记详情 + * + * @param userDetail + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 14:11 + */ + @GetMapping("registration/detail") + public Result registrationDetail(@LoginUser TokenDto userDetail) { + return apiVoterService.registrationDetail(userDetail); + } +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java index 8b4aff6a..36116bd1 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java @@ -8,6 +8,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcScripUserInfoFormDTO; import com.elink.esua.epdc.dto.epdc.form.WorkUserEventTagRelationFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppSysDictResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; import com.elink.esua.epdc.dto.epdc.result.WorkUserEventTagRelationResultDTO; import com.elink.esua.epdc.feign.fallback.AdminFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -221,4 +222,14 @@ public interface AdminFeignClient { */ @GetMapping("sys/roleeventstag/eventtagworkuser") Result> eventTagWorkUser(WorkUserEventTagRelationFormDTO formDto); + + /** + * 民族列表接口 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:44 + */ + @GetMapping("sys/nation/list") + Result> nationList(); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java index 3ada374a..0a0cc102 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/CustomFeignClient.java @@ -409,4 +409,37 @@ public interface CustomFeignClient { @PostMapping(value = "custom/screencompany/screenCompanyList", consumes = MediaType.APPLICATION_JSON_VALUE) Result> listOfCompanyListForScreen(EpdcScreenCompanyListFormDTO formDto); + /** + * 选民登记配置列表 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 11:00 + */ + @GetMapping(value = "custom/epdc-app/voter/config/list", consumes = MediaType.APPLICATION_JSON_VALUE) + Result> voterConfigList(VoterRegistrationConfigFormDTO formDto); + + /** + * 选民登记 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 13:42 + */ + @PostMapping(value = "custom/epdc-app/voter/registration/submit", consumes = MediaType.APPLICATION_JSON_VALUE) + Result registration(VoterRegistrationFormDTO formDto); + + /** + * 选民登记详情 + * + * @param userId + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 14:15 + */ + @GetMapping(value = "custom/epdc-app/voter/registration/detail/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE) + Result registrationDetail(@PathVariable String userId); + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java index a051bf3c..553b39a9 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java @@ -9,6 +9,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcScripUserInfoFormDTO; import com.elink.esua.epdc.dto.epdc.form.WorkUserEventTagRelationFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppSysDictResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; import com.elink.esua.epdc.dto.epdc.result.WorkUserEventTagRelationResultDTO; import com.elink.esua.epdc.feign.AdminFeignClient; import org.springframework.stereotype.Component; @@ -112,4 +113,9 @@ public class AdminFeignClientFallback implements AdminFeignClient { public Result> eventTagWorkUser(WorkUserEventTagRelationFormDTO formDto) { return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "eventTagWorkUser", formDto); } + + @Override + public Result> nationList() { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "nationList"); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java index 639b342e..a2f48f91 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/CustomFeignClientFallback.java @@ -220,4 +220,19 @@ public class CustomFeignClientFallback implements CustomFeignClient { public Result> listOfCompanyListForScreen(EpdcScreenCompanyListFormDTO formDto) { return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "listOfCompanyListForScreen", formDto); } + + @Override + public Result> voterConfigList(VoterRegistrationConfigFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "voterConfigList", formDto); + } + + @Override + public Result registration(VoterRegistrationFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "registration", formDto); + } + + @Override + public Result registrationDetail(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "registrationDetail", userId); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AdminService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AdminService.java index df6ff3b1..b81d3256 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AdminService.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AdminService.java @@ -4,6 +4,7 @@ import com.elink.esua.epdc.common.token.dto.TokenDto; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.epdc.form.WorkUserEventTagRelationFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppSysDictResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; import com.elink.esua.epdc.dto.epdc.result.WorkUserEventTagRelationResultDTO; import com.elink.esua.epdc.dto.result.EpdcAppWorkLogUserResult; import com.elink.esua.epdc.dto.result.EpdcWorkLogUserDetailDTO; @@ -97,4 +98,13 @@ public interface AdminService { * @since 2021/7/21 13:44 */ Result> eventTagWorkUser(WorkUserEventTagRelationFormDTO formDto); + + /** + * 民族列表接口 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:42 + */ + Result> listOfNation(); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ApiVoterService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ApiVoterService.java new file mode 100644 index 00000000..38a484cc --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ApiVoterService.java @@ -0,0 +1,44 @@ +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; + +import java.util.List; + +public interface ApiVoterService { + + /** + * 选民登记配置列表接口 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 10:58 + */ + Result> listOfVoterConfig(VoterRegistrationConfigFormDTO formDto); + + /** + * 选民登记 + * + * @param userDetail + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 13:42 + */ + Result registration(TokenDto userDetail, VoterRegistrationFormDTO formDto); + + /** + * 选民登记详情 + * + * @param userDetail + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 14:12 + */ + Result registrationDetail(TokenDto userDetail); +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AdminServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AdminServiceImpl.java index bb531ba0..cbfbd85d 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AdminServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AdminServiceImpl.java @@ -13,6 +13,7 @@ import com.elink.esua.epdc.dto.SysSimpleDictDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcScripUserInfoFormDTO; import com.elink.esua.epdc.dto.epdc.form.WorkUserEventTagRelationFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppSysDictResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NationResultDTO; import com.elink.esua.epdc.dto.epdc.result.WorkUserEventTagRelationResultDTO; import com.elink.esua.epdc.dto.result.EpdcAppWorkLogUserResult; import com.elink.esua.epdc.dto.result.EpdcWorkLogUserDetailDTO; @@ -151,4 +152,9 @@ public class AdminServiceImpl implements AdminService { public Result> eventTagWorkUser(WorkUserEventTagRelationFormDTO formDto) { return adminFeignClient.eventTagWorkUser(formDto); } + + @Override + public Result> listOfNation() { + return adminFeignClient.nationList(); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ApiVoterServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ApiVoterServiceImpl.java new file mode 100644 index 00000000..0b56889b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ApiVoterServiceImpl.java @@ -0,0 +1,100 @@ +package com.elink.esua.epdc.service.impl; + +import com.elink.esua.epdc.common.token.dto.TokenDto; +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; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +import com.elink.esua.epdc.feign.AdminFeignClient; +import com.elink.esua.epdc.feign.CustomFeignClient; +import com.elink.esua.epdc.redis.AppUserRedis; +import com.elink.esua.epdc.service.ApiVoterService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ApiVoterServiceImpl implements ApiVoterService { + + @Autowired + private CustomFeignClient customFeignClient; + + @Autowired + private AppUserRedis appUserRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Override + public Result> listOfVoterConfig(VoterRegistrationConfigFormDTO formDto) { + return customFeignClient.voterConfigList(formDto); + } + + @Override + public Result registration(TokenDto userDetail, VoterRegistrationFormDTO formDto) { + // 验证码校验 + this.checkSmsCode(formDto.getMobile(), formDto.getSmsCode()); + // 身份证号校验 + String verification = IdentityNoUtils.IdentityNoVerification(formDto.getIdNumber()); + if (StringUtils.isNotBlank(verification)) { + throw new RenException(verification); + } + + try { + // 解析出生日期、性别 + String birthday = IdentityNoUtils.getBirthday(formDto.getIdNumber()); + String sex = IdentityNoUtils.getSex(formDto.getIdNumber()); + formDto.setBirthday(DateUtils.parse(birthday, DateUtils.DATE_PATTERN)); + formDto.setSex(sex); + } catch (Exception e) { + e.printStackTrace(); + throw new RenException("解析出生日期、性别失败,请检查身份证号码是否正确"); + } + + // 获取提交用户组织信息 + Result dtoResult = adminFeignClient.getParentAndAllDept(userDetail.getGridId()); + if (!dtoResult.success()) { + throw new RenException("获取当前用户网格信息失败,请稍后重试"); + } + ParentAndAllDeptDTO deptDTO = dtoResult.getData(); + formDto.setParentDeptIds(deptDTO.getParentDeptIds()); + formDto.setParentDeptNames(deptDTO.getParentDeptNames()); + formDto.setAllDeptIds(deptDTO.getAllDeptIds()); + formDto.setAllDeptNames(deptDTO.getAllDeptNames()); + formDto.setGrid(deptDTO.getGrid()); + formDto.setGridId(deptDTO.getGridId()); + + formDto.setUserId(userDetail.getUserId()); + + return customFeignClient.registration(formDto); + } + + @Override + public Result registrationDetail(TokenDto userDetail) { + return customFeignClient.registrationDetail(userDetail.getUserId()); + } + + /** + * 校验手机验证码 + * + * @param mobile 手机号 + * @param smsCode 用户输入的验证码 + * @return void + * @author yujintao + * @date 2019/9/11 09:20 + */ + private void checkSmsCode(String mobile, String smsCode) { + String redisSmsCode = appUserRedis.getSmsCode(mobile); + if (StringUtils.isBlank(redisSmsCode) || !redisSmsCode.equals(smsCode)) { + throw new RenException("手机验证码错误"); + } + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationConfigDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationConfigDTO.java new file mode 100644 index 00000000..569ed1b1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationConfigDTO.java @@ -0,0 +1,98 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +public class VoterRegistrationConfigDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + private String pid; + + /** + * 配置类型 0-所在选区,1-所在小组,2-参选规则 + */ + private String configType; + + /** + * 配置名称 + */ + private String configName; + + /** + * 配置代码 + */ + private String configCode; + + /** + * 启用标识 0-否,1-是 + */ + private String enableFlag; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationDTO.java new file mode 100644 index 00000000..23a74c10 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/VoterRegistrationDTO.java @@ -0,0 +1,166 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +public class VoterRegistrationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证号 + */ + private String idNumber; + + /** + * 性别 + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 户籍地 + */ + private String domicile; + + /** + * 所在选区代码 + */ + private String constituencyCode; + + /** + * 所在小组代码 + */ + private String groupCode; + + /** + * 参选原则代码 + */ + private String participationPrincipleCode; + + /** + * 备注 + */ + private String remark; + + /** + * 用户ID + */ + private String userId; + + /** + * 网格名称 + */ + private String grid; + + /** + * 网格ID + */ + private Long gridId; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 父部门ID + */ + private String parentDeptIds; + + /** + * 父部门名称 + */ + private String parentDeptNames; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationConfigFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationConfigFormDTO.java new file mode 100644 index 00000000..8c0612d1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationConfigFormDTO.java @@ -0,0 +1,20 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class VoterRegistrationConfigFormDTO implements Serializable { + private static final long serialVersionUID = -5891914643877055311L; + + /** + * 为空时返回所有,0-所在选区,1-所在小组,2-参选规则 + */ + private String configType; + + /** + * 上级ID,用于获取选区下小组 + */ + private String pid; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationFormDTO.java new file mode 100644 index 00000000..85400eae --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/VoterRegistrationFormDTO.java @@ -0,0 +1,127 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + +@Data +public class VoterRegistrationFormDTO implements Serializable { + private static final long serialVersionUID = -9007714499246432681L; + + /** + * 登记记录ID + */ + private String id; + + /** + * 所在选区代码 + */ + @NotBlank(message = "所在选区不能为空") + private String constituencyCode; + + /** + * 所在小组代码 + */ + @NotBlank(message = "所在小组不能为空") + private String groupCode; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空") + private String name; + + /** + * 民族名称 + */ + @NotBlank(message = "民族不能为空") + private String nationName; + + /** + * 民族数字代码 + */ + @NotBlank(message = "民族代码不能为空") + private String nationNumericalCode; + + /** + * 身份证号 + */ + @NotBlank(message = "身份证号不能为空") + private String idNumber; + + /** + * 户籍地 + */ + @NotBlank(message = "户籍地不能为空") + private String domicile; + + /** + * 参选原则代码 + */ + @NotBlank(message = "参选原则不能为空") + private String participationPrincipleCode; + + /** + * 备注 + */ + private String remark; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + private String mobile; + + /** + * 验证码 + */ + @NotBlank(message = "验证码不能为空") + private String smsCode; + + /** + * 性别 + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 用户ID + */ + private String userId; + + /** + * 网格名称 + */ + private String grid; + + /** + * 网格ID + */ + private Long gridId; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 父部门ID + */ + private String parentDeptIds; + + /** + * 父部门名称 + */ + private String parentDeptNames; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationConfigResultDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationConfigResultDTO.java new file mode 100644 index 00000000..bf76891e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationConfigResultDTO.java @@ -0,0 +1,30 @@ +package com.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class VoterRegistrationConfigResultDTO implements Serializable { + private static final long serialVersionUID = -6780191246880508309L; + + /** + * ID + */ + private String id; + + /** + * 配置类型 0-所在选区,1-所在小组,2-参选规则 + */ + private String configType; + + /** + * 配置名称 + */ + private String configName; + + /** + * 配置代码 + */ + private String configCode; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationDetailResultDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationDetailResultDTO.java new file mode 100644 index 00000000..a4c1b8e8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/VoterRegistrationDetailResultDTO.java @@ -0,0 +1,65 @@ +package com.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class VoterRegistrationDetailResultDTO implements Serializable { + private static final long serialVersionUID = 8808828526160513422L; + + /** + * 登记记录ID + */ + private String id; + + /** + * 所在选区代码 + */ + private String constituencyCode; + + /** + * 所在小组代码 + */ + private String groupCode; + + /** + * 姓名 + */ + private String name; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 身份证号 + */ + private String idNumber; + + /** + * 户籍地 + */ + private String domicile; + + /** + * 参选原则代码 + */ + private String participationPrincipleCode; + + /** + * 备注 + */ + private String remark; + + /** + * 手机号 + */ + private String mobile; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/EpdcAppVoterRegistrationController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/EpdcAppVoterRegistrationController.java new file mode 100644 index 00000000..75c7d2b1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/EpdcAppVoterRegistrationController.java @@ -0,0 +1,77 @@ +package com.elink.esua.epdc.modules.voter.controller; + +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.dto.form.VoterRegistrationConfigFormDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +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.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 选民登记移动端接口 + * + * @author lc + * @since 2021/11/5 11:05 + */ +@RestController +@RequestMapping(Constant.EPDC_APP + "voter") +public class EpdcAppVoterRegistrationController { + + @Autowired + private VoterRegistrationConfigService voterRegistrationConfigService; + + @Autowired + private VoterRegistrationService voterRegistrationService; + + /** + * 选民登记配置列表 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/11/5 11:05 + */ + @GetMapping("config/list") + public Result> voterConfigList(@RequestBody VoterRegistrationConfigFormDTO formDto) { + List data = voterRegistrationConfigService.listOfVoterConfig(formDto); + return new Result>().ok(data); + } + + /** + * 选民登记 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 13:40 + */ + @PostMapping("registration/submit") + public Result registration(@RequestBody VoterRegistrationFormDTO formDto) { + ValidatorUtils.validateEntity(formDto); + return voterRegistrationService.registration(formDto); + } + + /** + * 选民登记详情 + * + * @param userId + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 14:15 + */ + @GetMapping("registration/detail/{userId}") + Result registrationDetail(@PathVariable String userId) { + VoterRegistrationDetailResultDTO data = voterRegistrationService.registrationDetail(userId); + return new Result().ok(data); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationConfigController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationConfigController.java new file mode 100644 index 00000000..7c4cadad --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationConfigController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +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.modules.voter.excel.VoterRegistrationConfigExcel; +import com.elink.esua.epdc.modules.voter.service.VoterRegistrationConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@RestController +@RequestMapping("voterregistrationconfig") +public class VoterRegistrationConfigController { + + @Autowired + private VoterRegistrationConfigService voterRegistrationConfigService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = voterRegistrationConfigService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + VoterRegistrationConfigDTO data = voterRegistrationConfigService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody VoterRegistrationConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + voterRegistrationConfigService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody VoterRegistrationConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + voterRegistrationConfigService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + voterRegistrationConfigService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = voterRegistrationConfigService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationConfigExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationController.java new file mode 100644 index 00000000..a6a7f6c7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/controller/VoterRegistrationController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +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.VoterRegistrationDTO; +import com.elink.esua.epdc.modules.voter.excel.VoterRegistrationExcel; +import com.elink.esua.epdc.modules.voter.service.VoterRegistrationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@RestController +@RequestMapping("voterregistration") +public class VoterRegistrationController { + + @Autowired + private VoterRegistrationService voterRegistrationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = voterRegistrationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + VoterRegistrationDTO data = voterRegistrationService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody VoterRegistrationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + voterRegistrationService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody VoterRegistrationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + voterRegistrationService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + voterRegistrationService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = voterRegistrationService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationConfigDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationConfigDao.java new file mode 100644 index 00000000..6ea76b58 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationConfigDao.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +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 java.util.List; + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Mapper +public interface VoterRegistrationConfigDao extends BaseDao { + + /** + * 选民登记配置列表 + * + * @param formDto + * @return java.util.List + * @author lc + * @since 2021/11/5 11:07 + */ + List selectListOfVoterConfig(VoterRegistrationConfigFormDTO formDto); + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationDao.java new file mode 100644 index 00000000..abb04b9c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/dao/VoterRegistrationDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Mapper +public interface VoterRegistrationDao extends BaseDao { + + /** + * 选民登记详情 + * + * @param userId + * @return com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO + * @author lc + * @since 2021/11/5 14:19 + */ + VoterRegistrationDetailResultDTO registrationDetail(String userId); + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationConfigEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationConfigEntity.java new file mode 100644 index 00000000..3748b7de --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationConfigEntity.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_voter_registration_config") +public class VoterRegistrationConfigEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + private String pid; + + /** + * 配置类型 0-所在选区,1-所在小组,2-参选规则 + */ + private String configType; + + /** + * 配置名称 + */ + private String configName; + + /** + * 配置代码 + */ + private String configCode; + + /** + * 启用标识 0-否,1-是 + */ + private String enableFlag; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationEntity.java new file mode 100644 index 00000000..f9a68e50 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/entity/VoterRegistrationEntity.java @@ -0,0 +1,136 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_voter_registration") +public class VoterRegistrationEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证号 + */ + private String idNumber; + + /** + * 性别 + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 民族数字代码 + */ + private String nationNumericalCode; + + /** + * 民族名称 + */ + private String nationName; + + /** + * 户籍地 + */ + private String domicile; + + /** + * 所在选区代码 + */ + private String constituencyCode; + + /** + * 所在小组代码 + */ + private String groupCode; + + /** + * 参选原则代码 + */ + private String participationPrincipleCode; + + /** + * 备注 + */ + private String remark; + + /** + * 用户ID + */ + private String userId; + + /** + * 网格名称 + */ + private String grid; + + /** + * 网格ID + */ + private Long gridId; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 父部门ID + */ + private String parentDeptIds; + + /** + * 父部门名称 + */ + private String parentDeptNames; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationConfigExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationConfigExcel.java new file mode 100644 index 00000000..2b3cd93a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationConfigExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +public class VoterRegistrationConfigExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "配置类型 0-所在选区,1-所在小组,2-参选规则") + private String configType; + + @Excel(name = "配置名称") + private String configName; + + @Excel(name = "配置代码") + private String configCode; + + @Excel(name = "启用标识 0-否,1-是") + private String enableFlag; + + @Excel(name = "排序") + private Integer sort; + + @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 = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationExcel.java new file mode 100644 index 00000000..94312455 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/excel/VoterRegistrationExcel.java @@ -0,0 +1,113 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Data +public class VoterRegistrationExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "身份证号") + private String idNumber; + + @Excel(name = "性别") + private String sex; + + @Excel(name = "出生日期") + 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 = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationConfigService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationConfigService.java new file mode 100644 index 00000000..facfcfde --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationConfigService.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +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.entity.VoterRegistrationConfigEntity; + +import java.util.List; +import java.util.Map; + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +public interface VoterRegistrationConfigService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-11-05 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-11-05 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return VoterRegistrationConfigDTO + * @author generator + * @date 2021-11-05 + */ + VoterRegistrationConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void save(VoterRegistrationConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void update(VoterRegistrationConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-11-05 + */ + void delete(String[] ids); + + /** + * 选民登记配置列表 + * + * @param formDto + * @return java.util.List + * @author lc + * @since 2021/11/5 11:06 + */ + List listOfVoterConfig(VoterRegistrationConfigFormDTO formDto); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationService.java new file mode 100644 index 00000000..781a0f26 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/VoterRegistrationService.java @@ -0,0 +1,118 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.voter.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.VoterRegistrationDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +public interface VoterRegistrationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-11-05 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-11-05 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return VoterRegistrationDTO + * @author generator + * @date 2021-11-05 + */ + VoterRegistrationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void save(VoterRegistrationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-05 + */ + void update(VoterRegistrationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-11-05 + */ + void delete(String[] ids); + + /** + * 选民登记 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/11/5 14:06 + */ + Result registration(VoterRegistrationFormDTO formDto); + + /** + * 选民登记详情 + * + * @param userId + * @return com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO + * @author lc + * @since 2021/11/5 14:18 + */ + VoterRegistrationDetailResultDTO registrationDetail(String userId); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationConfigServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationConfigServiceImpl.java new file mode 100644 index 00000000..6bc68ec2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationConfigServiceImpl.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.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.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.dao.VoterRegistrationConfigDao; +import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationConfigEntity; +import com.elink.esua.epdc.modules.voter.service.VoterRegistrationConfigService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 选民登记配置表 选民登记配置表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Service +public class VoterRegistrationConfigServiceImpl extends BaseServiceImpl implements VoterRegistrationConfigService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, VoterRegistrationConfigDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VoterRegistrationConfigDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public VoterRegistrationConfigDTO get(String id) { + VoterRegistrationConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, VoterRegistrationConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(VoterRegistrationConfigDTO dto) { + VoterRegistrationConfigEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(VoterRegistrationConfigDTO dto) { + VoterRegistrationConfigEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List listOfVoterConfig(VoterRegistrationConfigFormDTO formDto) { + return baseDao.selectListOfVoterConfig(formDto); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationServiceImpl.java new file mode 100644 index 00000000..e7b511a2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/voter/service/impl/VoterRegistrationServiceImpl.java @@ -0,0 +1,120 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.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.VoterRegistrationDTO; +import com.elink.esua.epdc.dto.form.VoterRegistrationFormDTO; +import com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO; +import com.elink.esua.epdc.modules.voter.dao.VoterRegistrationDao; +import com.elink.esua.epdc.modules.voter.entity.VoterRegistrationEntity; +import com.elink.esua.epdc.modules.voter.service.VoterRegistrationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 选民登记表 选民登记表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-11-05 + */ +@Service +public class VoterRegistrationServiceImpl extends BaseServiceImpl implements VoterRegistrationService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, VoterRegistrationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VoterRegistrationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public VoterRegistrationDTO get(String id) { + VoterRegistrationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, VoterRegistrationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(VoterRegistrationDTO dto) { + VoterRegistrationEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(VoterRegistrationDTO dto) { + VoterRegistrationEntity entity = ConvertUtils.sourceToTarget(dto, VoterRegistrationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result registration(VoterRegistrationFormDTO formDto) { + VoterRegistrationEntity entity = ConvertUtils.sourceToTarget(formDto, VoterRegistrationEntity.class); + if (StringUtils.isNotEmpty(formDto.getId())) { + updateById(entity); + } else { + insert(entity); + } + + return new Result(); + } + + @Override + public VoterRegistrationDetailResultDTO registrationDetail(String userId) { + return baseDao.registrationDetail(userId); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationConfigDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationConfigDao.xml new file mode 100644 index 00000000..f4147c08 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationConfigDao.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationDao.xml new file mode 100644 index 00000000..6cb8a5b7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/voter/VoterRegistrationDao.xml @@ -0,0 +1,26 @@ + + + + + + + +