39 changed files with 2616 additions and 0 deletions
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -0,0 +1,99 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<PageData<NationDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<NationDTO> page = nationService.page(params); |
|||
return new Result<PageData<NationDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<NationDTO> get(@PathVariable("id") String id){ |
|||
NationDTO data = nationService.get(id); |
|||
return new Result<NationDTO>().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<java.util.List<com.elink.esua.epdc.dto.epdc.result.NationResultDTO>> |
|||
* @author lc |
|||
* @since 2021/11/5 10:45 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<List<NationResultDTO>> nationList() { |
|||
List<NationResultDTO> data = nationService.listOfNation(); |
|||
return new Result<List<NationResultDTO>>().ok(data); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<NationEntity> { |
|||
|
|||
/** |
|||
* 民族列表 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.NationResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 10:47 |
|||
*/ |
|||
List<NationResultDTO> selectNationList(); |
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<NationEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<NationDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
PageData<NationDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<NationDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
List<NationDTO> list(Map<String, Object> 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<com.elink.esua.epdc.dto.epdc.result.NationResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 10:46 |
|||
*/ |
|||
List<NationResultDTO> listOfNation(); |
|||
} |
@ -0,0 +1,105 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<NationDao, NationEntity> implements NationService { |
|||
|
|||
@Override |
|||
public PageData<NationDTO> page(Map<String, Object> params) { |
|||
IPage<NationEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, NationDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<NationDTO> list(Map<String, Object> params) { |
|||
List<NationEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, NationDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<NationEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<NationEntity> 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<NationResultDTO> listOfNation() { |
|||
return baseDao.selectNationList(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.NationDao"> |
|||
|
|||
<select id="selectNationList" resultType="com.elink.esua.epdc.dto.epdc.result.NationResultDTO"> |
|||
SELECT ID, NATION_NAME, NATION_PINYIN, NATION_NUMERICAL_CODE, LETTER_CODE FROM nation WHERE DEL_FLAG = '0' |
|||
</select> |
|||
|
|||
</mapper> |
@ -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<java.util.List<com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO>> |
|||
* @author lc |
|||
* @since 2021/11/5 10:57 |
|||
*/ |
|||
@GetMapping("config/list") |
|||
public Result<List<VoterRegistrationConfigResultDTO>> 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<com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 14:11 |
|||
*/ |
|||
@GetMapping("registration/detail") |
|||
public Result<VoterRegistrationDetailResultDTO> registrationDetail(@LoginUser TokenDto userDetail) { |
|||
return apiVoterService.registrationDetail(userDetail); |
|||
} |
|||
} |
@ -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<java.util.List<com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO>> |
|||
* @author lc |
|||
* @since 2021/11/5 10:58 |
|||
*/ |
|||
Result<List<VoterRegistrationConfigResultDTO>> 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<com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 14:12 |
|||
*/ |
|||
Result<VoterRegistrationDetailResultDTO> registrationDetail(TokenDto userDetail); |
|||
} |
@ -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<List<VoterRegistrationConfigResultDTO>> 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<ParentAndAllDeptDTO> 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<VoterRegistrationDetailResultDTO> 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("手机验证码错误"); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,98 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -0,0 +1,166 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -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<java.util.List<com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO>> |
|||
* @author lc |
|||
* @since 2021/11/5 11:05 |
|||
*/ |
|||
@GetMapping("config/list") |
|||
public Result<List<VoterRegistrationConfigResultDTO>> voterConfigList(@RequestBody VoterRegistrationConfigFormDTO formDto) { |
|||
List<VoterRegistrationConfigResultDTO> data = voterRegistrationConfigService.listOfVoterConfig(formDto); |
|||
return new Result<List<VoterRegistrationConfigResultDTO>>().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<com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 14:15 |
|||
*/ |
|||
@GetMapping("registration/detail/{userId}") |
|||
Result<VoterRegistrationDetailResultDTO> registrationDetail(@PathVariable String userId) { |
|||
VoterRegistrationDetailResultDTO data = voterRegistrationService.registrationDetail(userId); |
|||
return new Result<VoterRegistrationDetailResultDTO>().ok(data); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<PageData<VoterRegistrationConfigDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<VoterRegistrationConfigDTO> page = voterRegistrationConfigService.page(params); |
|||
return new Result<PageData<VoterRegistrationConfigDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<VoterRegistrationConfigDTO> get(@PathVariable("id") String id){ |
|||
VoterRegistrationConfigDTO data = voterRegistrationConfigService.get(id); |
|||
return new Result<VoterRegistrationConfigDTO>().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<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<VoterRegistrationConfigDTO> list = voterRegistrationConfigService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationConfigExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<PageData<VoterRegistrationDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<VoterRegistrationDTO> page = voterRegistrationService.page(params); |
|||
return new Result<PageData<VoterRegistrationDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<VoterRegistrationDTO> get(@PathVariable("id") String id){ |
|||
VoterRegistrationDTO data = voterRegistrationService.get(id); |
|||
return new Result<VoterRegistrationDTO>().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<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<VoterRegistrationDTO> list = voterRegistrationService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, VoterRegistrationExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationConfigEntity> { |
|||
|
|||
/** |
|||
* 选民登记配置列表 |
|||
* |
|||
* @param formDto |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 11:07 |
|||
*/ |
|||
List<VoterRegistrationConfigResultDTO> selectListOfVoterConfig(VoterRegistrationConfigFormDTO formDto); |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationEntity> { |
|||
|
|||
/** |
|||
* 选民登记详情 |
|||
* |
|||
* @param userId |
|||
* @return com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO |
|||
* @author lc |
|||
* @since 2021/11/5 14:19 |
|||
*/ |
|||
VoterRegistrationDetailResultDTO registrationDetail(String userId); |
|||
|
|||
} |
@ -0,0 +1,68 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -0,0 +1,136 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
|
|||
} |
@ -0,0 +1,113 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
|
|||
|
|||
} |
@ -0,0 +1,107 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationConfigEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<VoterRegistrationConfigDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
PageData<VoterRegistrationConfigDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<VoterRegistrationConfigDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
List<VoterRegistrationConfigDTO> list(Map<String, Object> 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<com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO> |
|||
* @author lc |
|||
* @since 2021/11/5 11:06 |
|||
*/ |
|||
List<VoterRegistrationConfigResultDTO> listOfVoterConfig(VoterRegistrationConfigFormDTO formDto); |
|||
} |
@ -0,0 +1,118 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<VoterRegistrationDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
PageData<VoterRegistrationDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<VoterRegistrationDTO> |
|||
* @author generator |
|||
* @date 2021-11-05 |
|||
*/ |
|||
List<VoterRegistrationDTO> list(Map<String, Object> 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); |
|||
} |
@ -0,0 +1,106 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationConfigDao, VoterRegistrationConfigEntity> implements VoterRegistrationConfigService { |
|||
|
|||
@Override |
|||
public PageData<VoterRegistrationConfigDTO> page(Map<String, Object> params) { |
|||
IPage<VoterRegistrationConfigEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, VoterRegistrationConfigDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<VoterRegistrationConfigDTO> list(Map<String, Object> params) { |
|||
List<VoterRegistrationConfigEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, VoterRegistrationConfigDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<VoterRegistrationConfigEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<VoterRegistrationConfigEntity> 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<VoterRegistrationConfigResultDTO> listOfVoterConfig(VoterRegistrationConfigFormDTO formDto) { |
|||
return baseDao.selectListOfVoterConfig(formDto); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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<VoterRegistrationDao, VoterRegistrationEntity> implements VoterRegistrationService { |
|||
|
|||
@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); |
|||
} |
|||
|
|||
@Override |
|||
public List<VoterRegistrationDTO> list(Map<String, Object> params) { |
|||
List<VoterRegistrationEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, VoterRegistrationDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<VoterRegistrationEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<VoterRegistrationEntity> 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); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.modules.voter.dao.VoterRegistrationConfigDao"> |
|||
|
|||
<select id="selectListOfVoterConfig" resultType="com.elink.esua.epdc.dto.result.VoterRegistrationConfigResultDTO"> |
|||
SELECT |
|||
ID, |
|||
CONFIG_TYPE, |
|||
CONFIG_NAME, |
|||
CONFIG_CODE |
|||
FROM |
|||
epdc_voter_registration_config |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND ENABLE_FLAG = '1' |
|||
<if test="configType != null and configType.trim() != ''"> |
|||
AND CONFIG_TYPE = #{configType} |
|||
</if> |
|||
<if test="pid != null and pid.trim() != ''"> |
|||
AND PID = #{pid} |
|||
</if> |
|||
ORDER BY |
|||
SORT |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.modules.voter.dao.VoterRegistrationDao"> |
|||
|
|||
<select id="registrationDetail" resultType="com.elink.esua.epdc.dto.result.VoterRegistrationDetailResultDTO"> |
|||
SELECT |
|||
ID, |
|||
`NAME`, |
|||
ID_NUMBER, |
|||
MOBILE, |
|||
NATION_NUMERICAL_CODE, |
|||
NATION_NAME, |
|||
DOMICILE, |
|||
CONSTITUENCY_CODE, |
|||
GROUP_CODE, |
|||
PARTICIPATION_PRINCIPLE_CODE, |
|||
REMARK |
|||
FROM |
|||
epdc_voter_registration |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND USER_ID = #{userId} |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue