From bf2f1ffb99634b8350539b28bd9d1f20b30a5aa1 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期五, 09 五月 2025 17:29:13 +0800 Subject: [PATCH] 小bug修改 --- src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java | 8 src/main/java/com/cl/service/impl/DataServiceImpl.java | 19 ++ src/main/java/com/cl/pojo/vo/screen/DrillVO.java | 12 src/main/java/com/cl/controller/UserController.java | 21 ++ src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java | 6 src/main/java/com/cl/pojo/vo/screen/SalvationVO.java | 12 src/main/java/com/cl/pojo/dto/PasswordBeforeLoginDTO.java | 16 ++ src/main/java/com/cl/interceptor/JwtTokenInterceptor.java | 5 src/main/java/com/cl/config/WebMvcConfiguration.java | 3 src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java | 10 src/main/java/com/cl/service/DataService.java | 5 src/main/java/com/cl/service/impl/UserServiceImpl.java | 37 +++++ src/main/java/com/cl/pojo/vo/DataVO.java | 2 src/main/java/com/cl/service/UserService.java | 4 src/main/resources/mapper/DataMapper.xml | 44 ++++++ src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java | 4 src/main/java/com/cl/pojo/vo/screen/CertificateVO.java | 14 +- src/main/java/com/cl/pojo/vo/screen/WorkerVO.java | 12 src/main/java/com/cl/pojo/vo/screen/EmployedVO.java | 10 src/main/java/com/cl/pojo/vo/screen/EducationVO.java | 18 +- src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java | 8 src/main/java/com/cl/pojo/vo/screen/ScreenVO.java | 34 ++-- src/main/java/com/cl/mapper/DataMapper.java | 6 src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java | 8 src/main/java/com/cl/pojo/vo/screen/RightDownVO.java | 20 +- src/main/java/com/cl/controller/DataController.java | 20 ++ src/main/java/com/cl/util/BCryptPasswordEncoder.java | 10 27 files changed, 261 insertions(+), 107 deletions(-) diff --git a/src/main/java/com/cl/config/WebMvcConfiguration.java b/src/main/java/com/cl/config/WebMvcConfiguration.java index 2bb5780..ac1d3bd 100644 --- a/src/main/java/com/cl/config/WebMvcConfiguration.java +++ b/src/main/java/com/cl/config/WebMvcConfiguration.java @@ -48,7 +48,8 @@ log.info("开始注册自定义拦截器..."); registry.addInterceptor(jwtTokenInterceptor) .addPathPatterns("/user/**","/data/**","/institution/**") - .excludePathPatterns("/user/login","user/loginOut"); + .excludePathPatterns("/user/login","user/loginOut","/user/passwordBeforeLogin","/data/screen", + "/institution/getAll/**","/data/getYearList","/data/getAssistiveDeviceTotal"); } /** diff --git a/src/main/java/com/cl/controller/DataController.java b/src/main/java/com/cl/controller/DataController.java index 409aac4..cc98f0a 100644 --- a/src/main/java/com/cl/controller/DataController.java +++ b/src/main/java/com/cl/controller/DataController.java @@ -23,6 +23,9 @@ import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; @RestController @@ -101,6 +104,23 @@ public Result<ScreenVO> screen(@RequestParam(value = "county",required = false)Integer county) { return Result.success( dataService.screen(county==null?0:county)); } + /** + * 补贴总人数 + */ + @GetMapping("/getAssistiveDeviceTotal") + @ApiOperation("补贴总人数") + public Result<Integer> getAssistiveDeviceTotal(@RequestParam(value = "county",required = false)Integer county,@RequestParam("year") Integer year) { + return Result.success( dataService.getAssistiveDeviceTotal(county==null?0:county,year)); + } + + /** + * 可选择年份列表 + */ + @GetMapping("/getYearList") + @ApiOperation("可选择年份列表") + public Result<List<Integer>> getYearList(@RequestParam(value = "county",required = false)Integer county) { + return Result.success( dataService.getYearList( county)); + } } diff --git a/src/main/java/com/cl/controller/UserController.java b/src/main/java/com/cl/controller/UserController.java index 5633681..4512823 100644 --- a/src/main/java/com/cl/controller/UserController.java +++ b/src/main/java/com/cl/controller/UserController.java @@ -9,10 +9,7 @@ import com.cl.common.exception.user.LoginErrorException; import com.cl.common.exception.user.UserException; import com.cl.common.result.Result; -import com.cl.pojo.dto.AddUserDTO; -import com.cl.pojo.dto.EditUserDTO; -import com.cl.pojo.dto.LoginDTO; -import com.cl.pojo.dto.PasswordDTO; +import com.cl.pojo.dto.*; import com.cl.pojo.entity.User; import com.cl.pojo.vo.UserVO; @@ -72,7 +69,7 @@ } if (!Objects.equals(user.getStatus(), StatusConstant.ENABLE)){ - throw new LoginErrorException("该账号已被冻结"); + throw new LoginErrorException("登录失败,当前账号已被冻结"); } //校验密码是否正确 if (!BCryptPasswordEncoder.matches(dto.getPassword(), user.getPassword())) { @@ -91,6 +88,9 @@ Map<String,String> map=new HashMap<>(); map.put("token", token); map.put("is_first",user.getIsFirst().toString()); + map.put("name",user.getName()); + map.put("phone",user.getPhone()); + map.put("id", String.valueOf(user.getId())); if (1==user.getIsFirst()){ User user1 = new User(); user1.setId(user.getId()); @@ -120,6 +120,17 @@ return Result.success("修改成功"); } /** + * 修改密码 + */ + @PutMapping("/passwordBeforeLogin") + @ApiOperation("修改密码(登录前)") + public Result<String> passwordBeforeLogin(@RequestBody @Valid PasswordBeforeLoginDTO passwordDTO) { + if (passwordDTO.getPhone().equals("admin")) { + return Result.error("管理员账号,不可操作"); + } + return userService.passwordBeforeLogin(passwordDTO); + } + /** * 添加 */ @PostMapping("/addUser") diff --git a/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java b/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java index e24cae3..9b75be0 100644 --- a/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java +++ b/src/main/java/com/cl/interceptor/JwtTokenInterceptor.java @@ -60,12 +60,11 @@ String token = request.getHeader(jwtUtil.getTokenName()); if (token == null || token.isEmpty()) { log.warn("JWT令牌为空,访问URI: {}", request.getRequestURI()); - throw new LoginErrorException(MessageConstant.USER_NOT_LOGIN); + throw new InterceptorException(MessageConstant.USER_NOT_LOGIN); } // 检查令牌是否在黑名单中 if (blacklistService.isBlacklisted(token)) { - response.sendError(HttpStatus.UNAUTHORIZED.value(), "令牌已失效"); - throw new LoginErrorException("您已退出登录"); + throw new InterceptorException("您已退出登录"); } //2、校验令牌 try { diff --git a/src/main/java/com/cl/mapper/DataMapper.java b/src/main/java/com/cl/mapper/DataMapper.java index 80b04f2..2fefd4f 100644 --- a/src/main/java/com/cl/mapper/DataMapper.java +++ b/src/main/java/com/cl/mapper/DataMapper.java @@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.time.LocalDateTime; +import java.util.Date; import java.util.List; @Mapper @@ -18,4 +20,8 @@ DataEntity beforeOne(@Param("id") Integer id); DataEntity getAddDetail(Integer county); + + List<Integer> getYearList(Integer county); + + Integer getAssistiveDeviceTotal(Integer county, LocalDateTime createTime); } diff --git a/src/main/java/com/cl/pojo/dto/PasswordBeforeLoginDTO.java b/src/main/java/com/cl/pojo/dto/PasswordBeforeLoginDTO.java new file mode 100644 index 0000000..0cb824e --- /dev/null +++ b/src/main/java/com/cl/pojo/dto/PasswordBeforeLoginDTO.java @@ -0,0 +1,16 @@ +package com.cl.pojo.dto; + + +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotEmpty; + +@Getter +@Setter +public class PasswordBeforeLoginDTO extends PasswordDTO { + @NotEmpty(message = "手机号不能为空") + private String phone; + + +} diff --git a/src/main/java/com/cl/pojo/vo/DataVO.java b/src/main/java/com/cl/pojo/vo/DataVO.java index 8e010a5..24e1c4e 100644 --- a/src/main/java/com/cl/pojo/vo/DataVO.java +++ b/src/main/java/com/cl/pojo/vo/DataVO.java @@ -16,7 +16,7 @@ private Integer county; @ApiModelProperty(value = "调研时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime investigateTime; @ApiModelProperty(value = "上报时间") diff --git a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java index 2b70d90..9cabfdb 100644 --- a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java @@ -8,14 +8,14 @@ @Data public class AssistiveDeviceGradeVO { @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级一") - private Integer assistiveDeviceGradeOne; + private Integer assistiveDeviceGradeOne = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级二") - private Integer assistiveDeviceGradeTwo; + private Integer assistiveDeviceGradeTwo = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级三") - private Integer assistiveDeviceGradeThree; + private Integer assistiveDeviceGradeThree = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级四") - private Integer assistiveDeviceGradeFour; + private Integer assistiveDeviceGradeFour = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java index 8ba90e2..ce9a328 100644 --- a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java @@ -8,14 +8,14 @@ @Data public class AssistiveDeviceTypeVO { @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别一") - private Integer assistiveDeviceTypeOne; + private Integer assistiveDeviceTypeOne = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别二") - private Integer assistiveDeviceTypeTwo; + private Integer assistiveDeviceTypeTwo = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别三") - private Integer assistiveDeviceTypeThree; + private Integer assistiveDeviceTypeThree = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别四") - private Integer assistiveDeviceTypeFour; + private Integer assistiveDeviceTypeFour = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java index a06f59a..ea7f639 100644 --- a/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java @@ -8,15 +8,15 @@ @Data public class AssistiveDeviceVO { @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具一") - private Integer assistiveDeviceOne; + private Integer assistiveDeviceOne = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具二") - private Integer assistiveDeviceTwo; + private Integer assistiveDeviceTwo = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具三") - private Integer assistiveDeviceThree; + private Integer assistiveDeviceThree = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-其他") - private Integer assistiveDeviceOther; + private Integer assistiveDeviceOther = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/CertificateVO.java b/src/main/java/com/cl/pojo/vo/screen/CertificateVO.java index f61d68f..8820555 100644 --- a/src/main/java/com/cl/pojo/vo/screen/CertificateVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/CertificateVO.java @@ -8,23 +8,23 @@ @Data public class CertificateVO { @ApiModelProperty(value = "持证残疾人数-视力") - private Integer certificateEyesight; + private Integer certificateEyesight = 0; @ApiModelProperty(value = "持证残疾人数-智力") - private Integer certificateIntellect; + private Integer certificateIntellect = 0; @ApiModelProperty(value = "持证残疾人数-肢体") - private Integer certificateLimb; + private Integer certificateLimb = 0; @ApiModelProperty(value = "持证残疾人数-言语") - private Integer certificateSpeech; + private Integer certificateSpeech = 0; @ApiModelProperty(value = "持证残疾人数-听力") - private Integer certificateHearing; + private Integer certificateHearing = 0; @ApiModelProperty(value = "持证残疾人数-精神") - private Integer certificateSpirit; + private Integer certificateSpirit = 0; @ApiModelProperty(value = "持证残疾人数-多重") - private Integer certificateMultiple; + private Integer certificateMultiple = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java b/src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java index 4c1dd2f..896634d 100644 --- a/src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java @@ -8,8 +8,8 @@ @Data public class DifficultyVO { @ApiModelProperty(value = "困难精神残疾人医疗救助人数-门诊服药") - private Integer difficultyMedication; + private Integer difficultyMedication = 0; @ApiModelProperty(value = "困难精神残疾人医疗救助人数-住院治疗") - private Integer difficultyHospitalisation; + private Integer difficultyHospitalisation = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/DrillVO.java b/src/main/java/com/cl/pojo/vo/screen/DrillVO.java index ee60f50..7b53c17 100644 --- a/src/main/java/com/cl/pojo/vo/screen/DrillVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/DrillVO.java @@ -8,20 +8,20 @@ @Data public class DrillVO { @ApiModelProperty(value = "残疾儿童康复训练人数-孤独症") - private Integer drillAutism; + private Integer drillAutism = 0; @ApiModelProperty(value = "残疾儿童康复训练人数-智力") - private Integer drillIntellect; + private Integer drillIntellect = 0; @ApiModelProperty(value = "残疾儿童康复训练人数-肢体") - private Integer drillLimb; + private Integer drillLimb = 0; @ApiModelProperty(value = "残疾儿童康复训练人数-言语") - private Integer drillSpeech; + private Integer drillSpeech = 0; @ApiModelProperty(value = "残疾儿童康复训练人数-听力") - private Integer drillHearing; + private Integer drillHearing = 0; @ApiModelProperty(value = "残疾儿童康复训练人数-精神") - private Integer drillSpirit; + private Integer drillSpirit = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/EducationVO.java b/src/main/java/com/cl/pojo/vo/screen/EducationVO.java index 88ae009..02d6902 100644 --- a/src/main/java/com/cl/pojo/vo/screen/EducationVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/EducationVO.java @@ -8,29 +8,29 @@ @Data public class EducationVO { @ApiModelProperty(value = "适龄残疾儿童少年义务教育-一年级") - private Integer educationOne; + private Integer educationOne = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-二年级") - private Integer educationTwo; + private Integer educationTwo = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-三年级") - private Integer educationThree; + private Integer educationThree = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-四年级") - private Integer educationFour; + private Integer educationFour = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-五年级") - private Integer educationFive; + private Integer educationFive = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-六年级") - private Integer educationSix; + private Integer educationSix = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-七年级") - private Integer educationSeven; + private Integer educationSeven = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-八年级") - private Integer educationEight; + private Integer educationEight = 0; @ApiModelProperty(value = "适龄残疾儿童少年义务教育-九年级") - private Integer educationNine; + private Integer educationNine = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/EmployedVO.java b/src/main/java/com/cl/pojo/vo/screen/EmployedVO.java index 3873485..2ca9128 100644 --- a/src/main/java/com/cl/pojo/vo/screen/EmployedVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/EmployedVO.java @@ -8,17 +8,17 @@ @Data public class EmployedVO { @ApiModelProperty(value = "已就业残疾人数-就业") - private Integer employedEmployment; + private Integer employedEmployment = 0; @ApiModelProperty(value = "已就业残疾人数-集中就业") - private Integer employedConcentrated; + private Integer employedConcentrated = 0; @ApiModelProperty(value = "已就业残疾人数-公益性岗位") - private Integer employedPublicWelfare; + private Integer employedPublicWelfare = 0; @ApiModelProperty(value = "已就业残疾人数-辅助性就业") - private Integer employedAuxiliary; + private Integer employedAuxiliary = 0; @ApiModelProperty(value = "已就业残疾人数-个体就业") - private Integer employedIndividual; + private Integer employedIndividual = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java b/src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java index abbb634..a3babc1 100644 --- a/src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java @@ -8,11 +8,11 @@ @Data public class HighSchoolVO { @ApiModelProperty(value = "应届高校残疾毕业生数-就业") - private Integer highSchoolEmployment; + private Integer highSchoolEmployment = 0; @ApiModelProperty(value = "应届高校残疾毕业生数-个体就业") - private Integer highSchoolIndividual; + private Integer highSchoolIndividual = 0; @ApiModelProperty(value = "应届高校残疾毕业生数-灵活就业") - private Integer highSchoolFlexible; + private Integer highSchoolFlexible = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/RightDownVO.java b/src/main/java/com/cl/pojo/vo/screen/RightDownVO.java index a0ec9cd..46edd23 100644 --- a/src/main/java/com/cl/pojo/vo/screen/RightDownVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/RightDownVO.java @@ -4,33 +4,33 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; -@ApiModel("大屏数据") +@ApiModel("右下角数据") @Data public class RightDownVO { @ApiModelProperty(value = "公益文体活动-开展次数") - private Integer activityFrequency; + private Integer activityFrequency = 0; @ApiModelProperty(value = "公益文体活动-参加人数") - private Integer educationNumber; + private Integer educationNumber = 0; @ApiModelProperty(value = "服务”一件事“办件数") - private Integer matter; + private Integer matter = 0; @ApiModelProperty(value = "家庭医生签约增值服务数") - private Integer doctorApprecitation; + private Integer doctorApprecitation = 0; @ApiModelProperty(value = "困难重度残疾人家庭无障碍改造实施改造户数") - private Integer remould; + private Integer remould = 0; @ApiModelProperty(value = "残疾人接访情况-办公室接访") - private Integer interviewsOffice; + private Integer interviewsOffice = 0; @ApiModelProperty(value = "残疾人接访情况-电话接访") - private Integer interviewsPhone; + private Integer interviewsPhone = 0; @ApiModelProperty(value = "残疾人接访情况-上级交办") - private Integer interviewsSuperior; + private Integer interviewsSuperior = 0; @ApiModelProperty(value = "残疾人接访情况-12345交办") - private Integer interviewsHotline; + private Integer interviewsHotline = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/SalvationVO.java b/src/main/java/com/cl/pojo/vo/screen/SalvationVO.java index f8b5db4..c04bf85 100644 --- a/src/main/java/com/cl/pojo/vo/screen/SalvationVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/SalvationVO.java @@ -8,20 +8,20 @@ @Data public class SalvationVO { @ApiModelProperty(value = "残疾儿童康复救助人数-0-6岁") - private Integer salvationBeforeSeven; + private Integer salvationBeforeSeven = 0; @ApiModelProperty(value = "残疾儿童康复救助人数-7岁之后") - private Integer salvationAfterSeven; + private Integer salvationAfterSeven = 0; @ApiModelProperty(value = "残疾儿童康复救助人数-孤独症") - private Integer salvationAutism; + private Integer salvationAutism = 0; @ApiModelProperty(value = "残疾儿童康复救助人数-智力") - private Integer salvationIntellect; + private Integer salvationIntellect = 0; @ApiModelProperty(value = "残疾儿童康复救助人数-肢体") - private Integer salvationLimb; + private Integer salvationLimb = 0; @ApiModelProperty(value = "残疾儿童康复救助人数-言语") - private Integer salvationSpeech; + private Integer salvationSpeech = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/ScreenVO.java b/src/main/java/com/cl/pojo/vo/screen/ScreenVO.java index 6850d73..5f9c32c 100644 --- a/src/main/java/com/cl/pojo/vo/screen/ScreenVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/ScreenVO.java @@ -12,49 +12,49 @@ @Data public class ScreenVO { @ApiModelProperty("持证残疾人数") - private CertificateVO certificateVO; + private CertificateVO certificateVO = new CertificateVO(); @ApiModelProperty("残疾人工作者队伍人数") - private WorkerVO workerVO; + private WorkerVO workerVO = new WorkerVO(); @ApiModelProperty("残疾儿童康复训练人数") - private DrillVO drillVO; + private DrillVO drillVO = new DrillVO(); @ApiModelProperty("残疾儿童康复救助人数") - private SalvationVO salvationVO; + private SalvationVO salvationVO = new SalvationVO(); @ApiModelProperty("困难精神残疾人医疗救助人数") - private DifficultyVO difficultyVO; + private DifficultyVO difficultyVO = new DifficultyVO(); @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-补贴总人数") - private Integer assistiveDeviceTotal; + private Integer assistiveDeviceTotal = 0; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-旁边时间") @JsonFormat(pattern = "yyyy") private LocalDateTime createTime; @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各辅具") - private AssistiveDeviceVO assistiveDeviceVO; + private AssistiveDeviceVO assistiveDeviceVO = new AssistiveDeviceVO(); @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各残疾类别") - private AssistiveDeviceTypeVO assistiveDeviceTypeVO; + private AssistiveDeviceTypeVO assistiveDeviceTypeVO = new AssistiveDeviceTypeVO(); @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各残疾等级") - private AssistiveDeviceGradeVO assistiveDeviceGradeVO; + private AssistiveDeviceGradeVO assistiveDeviceGradeVO = new AssistiveDeviceGradeVO(); @ApiModelProperty(value = "职业技能和实用技术培训人数") - private Integer technicalTraining; + private Integer technicalTraining = 0; @ApiModelProperty(value = "居家灵活就业及一次性创业补贴发放数") - private Integer homeAllowance; + private Integer homeAllowance = 0; @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比") - private StatutoryCertificateVO statutoryCertificateVO; + private StatutoryCertificateVO statutoryCertificateVO = new StatutoryCertificateVO(); @ApiModelProperty(value = "已就业残疾人数") - private EmployedVO employedVO; + private EmployedVO employedVO = new EmployedVO(); @ApiModelProperty(value = "应届高校残疾毕业生数") - private HighSchoolVO highSchoolVO; + private HighSchoolVO highSchoolVO = new HighSchoolVO(); @ApiModelProperty(value = "适龄残疾儿童少年义务教育") - private EducationVO educationVO; + private EducationVO educationVO = new EducationVO(); @ApiModelProperty(value = "九年义务教育在读残疾儿童生活补贴发放数") - private Integer educationSubsidy; + private Integer educationSubsidy = 0; @ApiModelProperty(value = "右下角模块数据") - private RightDownVO rightDownVO; + private RightDownVO rightDownVO = new RightDownVO(); diff --git a/src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java b/src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java index 14d5677..3ded4a2 100644 --- a/src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java @@ -8,17 +8,17 @@ @Data public class StatutoryCertificateVO { @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-视力") - private Integer statutoryCertificateEyesight; + private Integer statutoryCertificateEyesight = 0; @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-智力") - private Integer statutoryCertificateIntellect; + private Integer statutoryCertificateIntellect = 0; @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-肢体") - private Integer statutoryCertificateLimb; + private Integer statutoryCertificateLimb = 0; @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-言语") - private Integer statutoryCertificateSpeech; + private Integer statutoryCertificateSpeech = 0; @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-听力") - private Integer statutoryCertificateHearing; + private Integer statutoryCertificateHearing = 0; } diff --git a/src/main/java/com/cl/pojo/vo/screen/WorkerVO.java b/src/main/java/com/cl/pojo/vo/screen/WorkerVO.java index d167b1d..12be1c3 100644 --- a/src/main/java/com/cl/pojo/vo/screen/WorkerVO.java +++ b/src/main/java/com/cl/pojo/vo/screen/WorkerVO.java @@ -8,20 +8,20 @@ @Data public class WorkerVO { @ApiModelProperty(value = "残疾人工作者队伍人数-市残联") - private Integer workerCity; + private Integer workerCity = 0; @ApiModelProperty(value = "残疾人工作者队伍人数-五大专门协会") - private Integer workerAssociation; + private Integer workerAssociation = 0; @ApiModelProperty(value = "残疾人工作者队伍人数-攀狮服务队") - private Integer workerServiceCorps; + private Integer workerServiceCorps = 0; @ApiModelProperty(value = "残疾人工作者队伍人数-县区残联") - private Integer workerCounty; + private Integer workerCounty = 0; @ApiModelProperty(value = "残疾人工作者队伍人数-乡镇残联") - private Integer workerTownship; + private Integer workerTownship = 0; @ApiModelProperty(value = "残疾人工作者队伍人数-村社区残联") - private Integer workerVillage; + private Integer workerVillage = 0; } diff --git a/src/main/java/com/cl/service/DataService.java b/src/main/java/com/cl/service/DataService.java index bde639a..23323e4 100644 --- a/src/main/java/com/cl/service/DataService.java +++ b/src/main/java/com/cl/service/DataService.java @@ -10,6 +10,7 @@ import com.cl.pojo.vo.EditDataDTO; import com.cl.pojo.vo.screen.ScreenVO; +import java.util.Date; import java.util.List; public interface DataService extends IService<DataEntity> { @@ -26,4 +27,8 @@ DataDetailVO detail(Integer id); DataDetailVO addDetail(Integer county); + + List<Integer> getYearList(Integer county); + + Integer getAssistiveDeviceTotal(Integer county, Integer year); } diff --git a/src/main/java/com/cl/service/UserService.java b/src/main/java/com/cl/service/UserService.java index addf3d7..fb1f4d3 100644 --- a/src/main/java/com/cl/service/UserService.java +++ b/src/main/java/com/cl/service/UserService.java @@ -2,8 +2,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; +import com.cl.common.result.Result; import com.cl.pojo.dto.AddUserDTO; import com.cl.pojo.dto.EditUserDTO; +import com.cl.pojo.dto.PasswordBeforeLoginDTO; import com.cl.pojo.dto.PasswordDTO; import com.cl.pojo.entity.User; import com.cl.pojo.vo.UserVO; @@ -24,4 +26,6 @@ void resetPassword(Integer id); void frozen(Integer id); + + Result<String> passwordBeforeLogin( PasswordBeforeLoginDTO passwordDTO); } diff --git a/src/main/java/com/cl/service/impl/DataServiceImpl.java b/src/main/java/com/cl/service/impl/DataServiceImpl.java index c2e9201..8a21d05 100644 --- a/src/main/java/com/cl/service/impl/DataServiceImpl.java +++ b/src/main/java/com/cl/service/impl/DataServiceImpl.java @@ -16,10 +16,13 @@ import com.cl.pojo.vo.screen.*; import com.cl.service.DataService; import io.swagger.models.auth.In; +import net.bytebuddy.asm.Advice; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.text.DecimalFormat; import java.time.LocalDateTime; +import java.util.Collections; +import java.util.Date; import java.util.List; @Service @@ -33,8 +36,12 @@ @Override public ScreenVO screen(Integer county) { + ScreenVO screenVO = new ScreenVO(); DataEntity data =dataMapper.screen(county); + if (null== data) { + return screenVO; + } screenVO.setAssistiveDeviceTotal(data.getAssistiveDeviceTotal()); screenVO.setCreateTime(data.getCreateTime()); screenVO.setTechnicalTraining(data.getTechnicalTraining()); @@ -188,6 +195,18 @@ return dataDetailVO; } + @Override + public List<Integer> getYearList(Integer county) { + return dataMapper.getYearList( county); + + } + + @Override + public Integer getAssistiveDeviceTotal(Integer county, Integer year) { + LocalDateTime createTime = LocalDateTime.of(year, 12, 31, 23, 59, 59); + return dataMapper.getAssistiveDeviceTotal(county,createTime); + } + private DataRateVO getRateVO(EditDataDTO data, EditDataDTO beforeData) { if (beforeData == null || beforeData.equals(new EditDataDTO())) { return null; diff --git a/src/main/java/com/cl/service/impl/UserServiceImpl.java b/src/main/java/com/cl/service/impl/UserServiceImpl.java index 588a43e..c231a47 100644 --- a/src/main/java/com/cl/service/impl/UserServiceImpl.java +++ b/src/main/java/com/cl/service/impl/UserServiceImpl.java @@ -9,9 +9,11 @@ import com.cl.common.context.BaseContext; import com.cl.common.exception.user.AddUserException; import com.cl.common.exception.user.UserException; +import com.cl.common.result.Result; import com.cl.mapper.UserMapper; import com.cl.pojo.dto.AddUserDTO; import com.cl.pojo.dto.EditUserDTO; +import com.cl.pojo.dto.PasswordBeforeLoginDTO; import com.cl.pojo.dto.PasswordDTO; import com.cl.pojo.entity.User; import com.cl.pojo.vo.UserVO; @@ -99,7 +101,11 @@ //校验原密码 if (!BCryptPasswordEncoder.matches(passwordDTO.getPassword(), user.getPassword())) { //不通过 - throw new UserException("原密码错误"); + throw new UserException("修改失败,旧密码错误"); + } + if (passwordDTO.getPassword().equals(passwordDTO.getNewPassword())){ + //不通过 + throw new UserException("修改失败,旧密码与新密码不能一样"); } //修改密码 user.setPassword(BCryptPasswordEncoder.encode(passwordDTO.getNewPassword())); @@ -112,7 +118,32 @@ //将令牌加入黑名单 tokenBlacklistService.addToBlacklist(token); } - + @Override + public Result<String> passwordBeforeLogin(PasswordBeforeLoginDTO passwordDTO) { + //检查手机号是否存在 + LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(User::getPhone, passwordDTO.getPhone()); + queryWrapper.eq(User::getDelFlag, DelFlagConstant.UNDELETE); + User user = userMapper.selectOne(queryWrapper); + if (user == null) { + return Result.error("手机号不存在"); + } + if (user.getStatus().equals(DelFlagConstant.DELETE)) { + return Result.error("该用户已被冻结"); + } + if (!BCryptPasswordEncoder.matches(passwordDTO.getPassword(), user.getPassword())) { + return Result.error("原密码错误"); + } + //修改密码 + user.setPassword(BCryptPasswordEncoder.encode(passwordDTO.getNewPassword())); + user.setUpdateBy(user.getId()); + user.setUpdateTime(LocalDateTime.now()); + boolean save = this.updateById(user); + if (!save) { + throw new UserException("修改密码失败"); + } + return Result.success("修改成功"); + } @Override public void resetPassword(Integer id) { User user = userMapper.selectById(id); @@ -143,4 +174,6 @@ throw new UserException("冻结/解冻用户失败"); } } + + } diff --git a/src/main/java/com/cl/util/BCryptPasswordEncoder.java b/src/main/java/com/cl/util/BCryptPasswordEncoder.java index 1373ec0..f3afc17 100644 --- a/src/main/java/com/cl/util/BCryptPasswordEncoder.java +++ b/src/main/java/com/cl/util/BCryptPasswordEncoder.java @@ -17,11 +17,11 @@ public static void main(String[] args) { BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); - String phone="19987654321"; - System.out.println(encoder.encode(DigestUtils.md5Hex(phone.substring(phone.length() - 6)))); + String phone="19923261698"; + String encodePassword =encoder.encode(DigestUtils.md5Hex(phone.substring(phone.length() - 6))); + System.out.println(encodePassword); + System.out.println(DigestUtils.md5Hex("12345aA!")); - System.out.println(DigestUtils.md5Hex("358736")); - - System.out.println(encoder.matches(DigestUtils.md5Hex("358736"), "$2a$10$lChcCpt1hN77IFSavrsXHe39hox4ggGlJZxuf7AHZ3y2qRbiJjPUy")); + System.out.println(encoder.matches(DigestUtils.md5Hex("261698"), encodePassword)); } } \ No newline at end of file diff --git a/src/main/resources/mapper/DataMapper.xml b/src/main/resources/mapper/DataMapper.xml index 1d78b2c..41011ac 100644 --- a/src/main/resources/mapper/DataMapper.xml +++ b/src/main/resources/mapper/DataMapper.xml @@ -9,7 +9,10 @@ *, ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn FROM t_data - WHERE county=#{county} or #{county}=0 AND del_flag = 0 + WHERE del_flag = 0 + <if test="county!=null and county !=0"> + and county=#{county} + </if> ) SELECT create_time, @@ -116,6 +119,7 @@ <if test="name!=null and ''!=name"> and creator.name like concat('%',#{name},'%') </if> + order by d.create_time desc </select> <select id="beforeOne" resultType="com.cl.pojo.entity.DataEntity"> @@ -137,7 +141,12 @@ *, ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn FROM t_data - WHERE county=#{county} or #{county}=0 AND del_flag = 0 + WHERE + del_flag = 0 + <if test="county!=null and county!=0"> + and county=#{county} + </if> + ) SELECT create_time, @@ -218,4 +227,35 @@ FROM latest_records WHERE rn = 1; </select> + <select id="getYearList" resultType="java.lang.Integer"> + SELECT + DISTINCT YEAR(create_time) AS year + FROM + t_data + where + del_flag=0 + <if test="county!=null and county!=0"> + and county=#{county} + </if> + ORDER BY + year ASC; + </select> + <select id="getAssistiveDeviceTotal" resultType="java.lang.Integer"> + WITH latest_records AS ( + SELECT + assistive_device_total, + ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn + FROM t_data + WHERE + del_flag = 0 + AND create_time < #{createTime} + <if test="county != null and county != 0"> + AND county = #{county} + </if> + ) + SELECT + COALESCE(SUM(assistive_device_total), 0) AS total_sum + FROM latest_records + WHERE rn = 1 + </select> </mapper> \ No newline at end of file -- Gitblit v1.7.1