| | |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>3.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.idev.excel</groupId> |
| | | <artifactId>fastexcel</artifactId> |
| | | <version>1.0.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.annotation; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/12/30 |
| | | */ |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 指定枚举自定义类的注解 |
| | | */ |
| | | @Target({ElementType.FIELD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface FastExcel { |
| | | /** |
| | | * 控件类型 |
| | | * |
| | | * @return |
| | | */ |
| | | Class<? extends Enum> type(); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.api; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/3/14 |
| | | */ |
| | | @Api(tags = {"三个身边后台-诉求管理"}) |
| | | @RequestMapping("/complaint") |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class MgtComplaintController { |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.service.IPartyMemberService; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * <p> |
| | | * 党员 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2025-03-13 |
| | | */ |
| | | @Api(tags = {"三个身边后台-党员管理"}) |
| | | @Validated |
| | | @RestController |
| | | @RequestMapping("/party-member") |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class PartyMemberController extends BaseController { |
| | | private final IPartyMemberService partyMemberService; |
| | | @ApiOperation("查询党员列表") |
| | | @PostMapping("/list") |
| | | public R<Page<PartyMember>> pageList(@Valid @RequestBody PartyMemberQuery query) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | return R.ok(partyMemberService.pageList(query,loginUserInfo)); |
| | | } |
| | | @ApiOperation("添加/编辑党员") |
| | | @PostMapping("/save") |
| | | public R<?> save(@Valid @RequestBody PartyMemberDTO dto) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | partyMemberService.save(dto,loginUserInfo); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation("查看详情") |
| | | @GetMapping("/{id}") |
| | | public R<PartyMember> getById(@ApiParam(name = "id", value = "党员id", required = true) @PathVariable("id") Long id) { |
| | | return R.ok(partyMemberService.getById(id)); |
| | | } |
| | | @ApiOperation("删除党员") |
| | | @DeleteMapping("/{id}") |
| | | public R<?> deleteById(@ApiParam(name = "id", value = "党员id", required = true) @PathVariable("id") Long id) { |
| | | partyMemberService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation("冻结/解冻") |
| | | @GetMapping("/freeze/{id}") |
| | | public R<?> freeze(@ApiParam(name = "id", value = "党员id", required = true) @PathVariable("id") Long id) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | partyMemberService.freeze(id, loginUserInfo); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation("下载导入模板") |
| | | @GetMapping("/download") |
| | | public void download() { |
| | | try { |
| | | partyMemberService.download(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | @ApiOperation("导出") |
| | | @PostMapping("/export") |
| | | public void export(@RequestBody PartyMemberQuery query) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | try { |
| | | partyMemberService.export(query,loginUserInfo); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | @ApiOperation("导入") |
| | | @PostMapping("/import") |
| | | public R<?> importExcel(@RequestPart("file") MultipartFile file) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | partyMemberService.importExcel(loginUserInfo); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation("审核") |
| | | @GetMapping("/audit/{id}") |
| | | public R<?> audit(@RequestBody PartyMemberDTO dto) { |
| | | SystemUserVo loginUserInfo = getLoginUserInfoSanGeShenBian(); |
| | | partyMemberService.audit(dto,loginUserInfo); |
| | | return R.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.conveter; |
| | | |
| | | import cn.idev.excel.converters.Converter; |
| | | import cn.idev.excel.enums.CellDataTypeEnum; |
| | | import cn.idev.excel.metadata.GlobalConfiguration; |
| | | import cn.idev.excel.metadata.data.WriteCellData; |
| | | import cn.idev.excel.metadata.property.ExcelContentProperty; |
| | | import com.panzhihua.sangeshenbian.annotation.FastExcel; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 通用枚举转换器 |
| | | */ |
| | | public class EConverter implements Converter<Integer> { |
| | | @Override |
| | | public Class supportJavaTypeKey() { |
| | | //指定转换器接收参数类型 |
| | | return Integer.class; |
| | | } |
| | | |
| | | @Override |
| | | public CellDataTypeEnum supportExcelTypeKey() { |
| | | //指定返回的参数类型 |
| | | return CellDataTypeEnum.STRING; |
| | | } |
| | | |
| | | @Override |
| | | public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { |
| | | //value:状态码 contentProperty:字段属性 globalConfiguration:全局配置 |
| | | //获取字段属性中的注解 |
| | | Field field = contentProperty.getField(); |
| | | //获取该字段所属枚举 |
| | | FastExcel fastExcel = field.getAnnotation(FastExcel.class); |
| | | //获取注解中的枚举信息 |
| | | Class<? extends Enum> type = fastExcel.type(); |
| | | //获取枚举类的方法名 “getEnumByCode”就是自己编写的函数,Integer.class 指定入参类型 |
| | | Method codeOf = type.getMethod("getEnumByCode", Integer.class); |
| | | //反射执行方法,此方法得到的是一个枚举实例(具体得到什么,结合自身项目) |
| | | Object invoke = codeOf.invoke(type, value); |
| | | //枚举实例调用getname方法,得到name的值 |
| | | Method getDesc = invoke.getClass().getMethod("getDesc"); |
| | | String name = String.valueOf(getDesc.invoke(invoke)); |
| | | //将转换的值进行返回 |
| | | return new WriteCellData(name); |
| | | } |
| | | } |
| | |
| | | package com.panzhihua.sangeshenbian.dao; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2025-03-13 |
| | | */ |
| | | public interface PartyMemberMapper extends BaseMapper<PartyMember> { |
| | | /** |
| | | * 查询党员分页列表 |
| | | * @param partyMemberPage |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | Page<PartyMember> pageList(Page<PartyMember> partyMemberPage, @Param("query") PartyMemberQuery query, @Param("loginUserInfo") SystemUserVo loginUserInfo); |
| | | |
| | | /** |
| | | * 党员列表 |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | List<PartyMember> queryList( @Param("query") PartyMemberQuery query, @Param("loginUserInfo") SystemUserVo loginUserInfo); |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.enums; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.AllArgsConstructor; |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum FreezeStatusEnum { |
| | | FREEZE(1, "已冻结"), |
| | | NORMAL(0, "正常中"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | public static FreezeStatusEnum getEnumByCode(Integer code) { |
| | | for (FreezeStatusEnum e : FreezeStatusEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.enums; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.AllArgsConstructor; |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum GenderEnum { |
| | | MALE(1, "男"), |
| | | FEMALE(0, "女"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | public static GenderEnum getEnumByCode(Integer code) { |
| | | for (GenderEnum e : GenderEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户id(sys_user)") |
| | |
| | | package com.panzhihua.sangeshenbian.model.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.time.LocalDateTime; |
| | |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | |
| | | |
| | | @ApiModelProperty(value = "性别 1:男 0:女") |
| | | private Integer gender; |
| | | |
| | | @ApiModelProperty(value = "身份证号") |
| | | private String idNumber; |
| | | |
| | | @ApiModelProperty(value = "电话") |
| | | private String phone; |
| | |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "服务对象") |
| | | private String serviceObject; |
| | | private String serviceTarget; |
| | | |
| | | @ApiModelProperty(value = "所在党组织") |
| | | private String partyOrganization; |
| | |
| | | private Long updateBy; |
| | | |
| | | @ApiModelProperty(value = "删除标志 1:是 0:否") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | |
| | | |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.excel; |
| | | |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import com.panzhihua.sangeshenbian.annotation.FastExcel; |
| | | import com.panzhihua.sangeshenbian.conveter.EConverter; |
| | | import com.panzhihua.sangeshenbian.enums.FreezeStatusEnum; |
| | | import com.panzhihua.sangeshenbian.enums.GenderEnum; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/3/14 |
| | | */ |
| | | @Data |
| | | public class PartyMemberExcel { |
| | | |
| | | @ExcelProperty(value = {"姓名"}, index = 0) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = {"性别"}, index = 1,converter = EConverter.class) |
| | | @FastExcel(type = GenderEnum.class) |
| | | private Integer gender; |
| | | |
| | | @ExcelProperty(value = {"所在社区"}, index = 2) |
| | | private String community; |
| | | |
| | | @ExcelProperty(value = {"服务对象"}, index = 3) |
| | | private String serviceTarget; |
| | | |
| | | @ExcelProperty(value = {"所在党组织"}, index = 4) |
| | | private String partyOrganization; |
| | | |
| | | @ExcelProperty(value = {"审核状态"}, index = 5,converter = EConverter.class) |
| | | @FastExcel(type = FreezeStatusEnum.class) |
| | | private Integer freezeStatus; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.model.excel; |
| | | |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import com.panzhihua.sangeshenbian.annotation.FastExcel; |
| | | import com.panzhihua.sangeshenbian.conveter.EConverter; |
| | | import com.panzhihua.sangeshenbian.enums.FreezeStatusEnum; |
| | | import com.panzhihua.sangeshenbian.enums.GenderEnum; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/3/14 |
| | | */ |
| | | @Data |
| | | public class PartyMemberTemplate { |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","姓名"}) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","联系电话"}) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","身份证号"}) |
| | | private String idNumber; |
| | | |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","所在社区"}) |
| | | private String community; |
| | | |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","服务对象"}) |
| | | private String serviceTarget; |
| | | |
| | | @ExcelProperty(value = {"说明:所在社区请按照规定格式填写:区县-街道-社区","所在党组织"}) |
| | | private String partyOrganization; |
| | | |
| | | } |
| | |
| | | package com.panzhihua.sangeshenbian.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2025-03-13 |
| | | */ |
| | | public interface IPartyMemberService extends IService<PartyMember> { |
| | | /** |
| | | * 分页查询党员 |
| | | * |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | Page<PartyMember> pageList(PartyMemberQuery query, SystemUserVo loginUserInfo); |
| | | |
| | | /** |
| | | * 添加党员 |
| | | * @param dto |
| | | * @param loginUserInfo |
| | | */ |
| | | void save(PartyMemberDTO dto, SystemUserVo loginUserInfo); |
| | | |
| | | /** |
| | | * 冻结/解冻 |
| | | * @param id |
| | | * @param loginUserInfo |
| | | */ |
| | | void freeze(Long id, SystemUserVo loginUserInfo); |
| | | |
| | | /** |
| | | * 下载导入模板 |
| | | */ |
| | | void download() throws IOException; |
| | | |
| | | /** |
| | | * 导出党员数据 |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @throws IOException |
| | | */ |
| | | void export(PartyMemberQuery query, SystemUserVo loginUserInfo) throws IOException; |
| | | |
| | | /** |
| | | *导入 |
| | | * @param loginUserInfo |
| | | */ |
| | | void importExcel(SystemUserVo loginUserInfo); |
| | | |
| | | /** |
| | | * 审核 |
| | | * |
| | | * @param dto |
| | | * @param loginUserInfo |
| | | */ |
| | | void audit(PartyMemberDTO dto, SystemUserVo loginUserInfo); |
| | | } |
| | |
| | | package com.panzhihua.sangeshenbian.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.idev.excel.FastExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.dao.PartyMemberMapper; |
| | | import com.panzhihua.sangeshenbian.model.excel.PartyMemberExcel; |
| | | import com.panzhihua.sangeshenbian.model.excel.PartyMemberTemplate; |
| | | import com.panzhihua.sangeshenbian.service.IPartyMemberService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberDTO; |
| | | import com.panzhihua.sangeshenbian.warpper.PartyMemberQuery; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2025-03-13 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class PartyMemberServiceImpl extends ServiceImpl<PartyMemberMapper, PartyMember> implements IPartyMemberService { |
| | | private final HttpServletResponse response; |
| | | /** |
| | | * 党员分页查询列表 |
| | | * |
| | | * @param query |
| | | * @param loginUserInfo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Page<PartyMember> pageList(PartyMemberQuery query, SystemUserVo loginUserInfo) { |
| | | return baseMapper.pageList(new Page<>(query.getPageNum(), query.getPageSize()),query,loginUserInfo); |
| | | } |
| | | /** |
| | | * 添加党员 |
| | | * @param dto |
| | | * @param loginUserInfo |
| | | */ |
| | | @Override |
| | | public void save(PartyMemberDTO dto, SystemUserVo loginUserInfo) { |
| | | PartyMember partyMember = BeanUtil.copyProperties(dto, PartyMember.class); |
| | | String idNumber = dto.getIdNumber(); |
| | | partyMember.setGender(getGender(idNumber)); |
| | | if (Objects.isNull(dto.getId())) { |
| | | //添加 |
| | | partyMember.setCreateBy(Long.parseLong(loginUserInfo.getId().toString())); |
| | | save(partyMember); |
| | | } else { |
| | | partyMember.setUpdateBy(Long.parseLong(loginUserInfo.getId().toString())); |
| | | updateById(partyMember); |
| | | } |
| | | } |
| | | /** |
| | | * 冻结/解冻 |
| | | * @param id |
| | | * @param loginUserInfo |
| | | */ |
| | | @Override |
| | | public void freeze(Long id, SystemUserVo loginUserInfo) { |
| | | PartyMember partyMember = getById(id); |
| | | partyMember.setFreezeStatus(partyMember.getFreezeStatus() == 1 ? 0 : 1); |
| | | partyMember.setUpdateBy(Long.parseLong(loginUserInfo.getId().toString())); |
| | | updateById(partyMember); |
| | | } |
| | | |
| | | @Override |
| | | public void download() throws IOException { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("党员导入模板", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | FastExcel.write(response.getOutputStream(), PartyMemberTemplate.class) |
| | | .sheet("党员导入模板") |
| | | .doWrite(Collections.emptyList()); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | * @param query |
| | | * @param loginUserInfo |
| | | */ |
| | | @Override |
| | | public void export(PartyMemberQuery query, SystemUserVo loginUserInfo) throws IOException { |
| | | List<PartyMember> list = baseMapper.queryList(query,loginUserInfo); |
| | | List<PartyMemberExcel> partyMemberExcels = BeanUtil.copyToList(list, PartyMemberExcel.class); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("党员数据", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | FastExcel.write(response.getOutputStream(), PartyMemberExcel.class) |
| | | .sheet("党员数据") |
| | | .doWrite(partyMemberExcels); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param loginUserInfo |
| | | */ |
| | | @Override |
| | | public void importExcel(SystemUserVo loginUserInfo) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 审核 |
| | | * |
| | | * @param dto |
| | | * @param loginUserInfo |
| | | */ |
| | | @Override |
| | | public void audit(PartyMemberDTO dto, SystemUserVo loginUserInfo) { |
| | | PartyMember partyMember = BeanUtil.copyProperties(dto, PartyMember.class); |
| | | partyMember.setUpdateBy(Long.parseLong(loginUserInfo.getId().toString())); |
| | | updateById(partyMember); |
| | | } |
| | | |
| | | /** |
| | | * 根据身份证号获取性别 |
| | | * @param idNumber |
| | | * @return |
| | | */ |
| | | public static Integer getGender(String idNumber) { |
| | | char genderChar = idNumber.charAt(16); |
| | | int genderDigit = Character.getNumericValue(genderChar); |
| | | return (genderDigit % 2 == 0) ? 0 : 1; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.warpper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/3/14 |
| | | */ |
| | | @Data |
| | | @ApiModel("党员数据传输对象") |
| | | public class PartyMemberDTO { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | @NotBlank(message = "姓名不能空") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "身份证号") |
| | | @NotBlank(message = "身份证号不能空") |
| | | private String idNumber; |
| | | |
| | | @ApiModelProperty(value = "电话") |
| | | @NotBlank(message = "电话不能空") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "所属区县") |
| | | @NotBlank(message = "区县不能空") |
| | | private String districts; |
| | | |
| | | @ApiModelProperty(value = "区县编号") |
| | | @NotBlank(message = "区县编号不能空") |
| | | private String districtsCode; |
| | | |
| | | @ApiModelProperty(value = "街道") |
| | | @NotBlank(message = "街道不能空") |
| | | private String street; |
| | | |
| | | @ApiModelProperty(value = "街道ID") |
| | | @NotBlank(message = "街道ID不能空") |
| | | private String streetId; |
| | | |
| | | @ApiModelProperty(value = "社区") |
| | | @NotBlank(message = "社区不能空") |
| | | private String community; |
| | | |
| | | @ApiModelProperty(value = "社区ID") |
| | | @NotBlank(message = "社区ID不能空") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "服务对象") |
| | | private String serviceTarget; |
| | | |
| | | @ApiModelProperty(value = "所在党组织") |
| | | private String partyOrganization; |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | @NotBlank(message = "头像不能空") |
| | | private String avatar; |
| | | } |
New file |
| | |
| | | package com.panzhihua.sangeshenbian.warpper; |
| | | |
| | | import com.panzhihua.sangeshenbian.model.query.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2025/3/14 |
| | | */ |
| | | @Data |
| | | @ApiModel("党员管理查询数据 ") |
| | | public class PartyMemberQuery extends BasePage { |
| | | @ApiModelProperty(value = "姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "所在社区") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "服务对象") |
| | | private String serviceObject; |
| | | |
| | | @ApiModelProperty(value = "所在党组织") |
| | | private String partyOrganization; |
| | | |
| | | @ApiModelProperty(value = "冻结状态 1:已冻结 0:正常中") |
| | | private Integer freezeStatus; |
| | | |
| | | @ApiModelProperty(value = "审核状态 0:待审核 1:审核通过 党员管理列表传1,审核列表传0") |
| | | @NotNull(message = "审核状态不能为空") |
| | | private Integer auditStatus; |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.sangeshenbian.dao.PartyMemberMapper"> |
| | | |
| | | <select id="pageList" resultType="com.panzhihua.sangeshenbian.model.entity.PartyMember"> |
| | | select id, |
| | | name, |
| | | gender, |
| | | phone, |
| | | districts, |
| | | districts_code, |
| | | street, |
| | | street_id, |
| | | community, |
| | | community_id, |
| | | service_target, |
| | | party_organization, |
| | | avatar, |
| | | audit_status, |
| | | freeze_status, |
| | | refuse_reason, |
| | | create_time, |
| | | update_time, |
| | | create_by, |
| | | update_by, |
| | | del_flag |
| | | from sgsb_party_member |
| | | <where> |
| | | del_flag = 0 |
| | | <if test="query.auditStatus !=null"> |
| | | and audit_status = #{query.auditStatus} |
| | | </if> |
| | | <if test="loginUserInfo.accountLevel==2"> |
| | | and districts_code = #{loginUserInfo.districtsCode} |
| | | </if> |
| | | <if test="loginUserInfo.accountLevel==3"> |
| | | and street_id = #{loginUserInfo.streetId} |
| | | </if> |
| | | <if test="loginUserInfo.accountLevel==4"> |
| | | and street_id = #{loginUserInfo.streetId} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and name like concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.communityId != null and query.communityId != ''"> |
| | | and community_id = #{query.communityId} |
| | | </if> |
| | | <if test="query.serviceObject != null and query.serviceObject != ''"> |
| | | and service_target like concat('%',#{query.serviceTarget},'%') |
| | | </if> |
| | | <if test="query.partyOrganization != null and query.partyOrganization != ''"> |
| | | and party_organization like concat('%',#{query.partyOrganization},'%') |
| | | </if> |
| | | <if test="query.freezeStatus != null and query.freezeStatus != ''"> |
| | | and freeze_status = #{query.freezeStatus} |
| | | </if> |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | <select id="queryList" resultType="com.panzhihua.sangeshenbian.model.entity.PartyMember"> |
| | | select id, |
| | | name, |
| | | gender, |
| | | phone, |
| | | districts, |
| | | districts_code, |
| | | street, |
| | | street_id, |
| | | CONCAT(districts,"-",street,"-",community) AS community, |
| | | community_id, |
| | | service_target, |
| | | party_organization, |
| | | avatar, |
| | | audit_status, |
| | | freeze_status, |
| | | refuse_reason, |
| | | create_time, |
| | | update_time, |
| | | create_by, |
| | | update_by, |
| | | del_flag |
| | | from sgsb_party_member |
| | | <where> |
| | | del_flag = 0 |
| | | <if test="loginUserInfo.accountLevel==2"> |
| | | and districts_code = #{loginUserInfo.districtsCode} |
| | | </if> |
| | | <if test="loginUserInfo.accountLevel==3"> |
| | | and street_id = #{loginUserInfo.streetId} |
| | | </if> |
| | | <if test="loginUserInfo.accountLevel==4"> |
| | | and street_id = #{loginUserInfo.streetId} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and name like concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.communityId != null and query.communityId != ''"> |
| | | and community_id = #{query.communityId} |
| | | </if> |
| | | <if test="query.serviceObject != null and query.serviceObject != ''"> |
| | | and service_target like concat('%',#{query.serviceTarget},'%') |
| | | </if> |
| | | <if test="query.partyOrganization != null and query.partyOrganization != ''"> |
| | | and party_organization like concat('%',#{query.partyOrganization},'%') |
| | | </if> |
| | | <if test="query.freezeStatus != null and query.freezeStatus != ''"> |
| | | and freeze_status = #{query.freezeStatus} |
| | | </if> |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | </mapper> |