From 525d71d5971d2ab804916ec116917d873e67b1c7 Mon Sep 17 00:00:00 2001 From: ljt <18301674552@163.com> Date: Wed, 13 Mar 2024 17:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=92=8C=E7=99=BB=E5=BD=95=E7=9A=84=EF=BC=88=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=EF=BC=8C=E9=AA=8C=E8=AF=81=E7=A0=81=E4=B8=BB?= =?UTF-8?q?=E9=94=AE=EF=BC=89=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyAuthenticationProvider.java | 32 +- .../ocr/controller/OcrSUserTController.java | 85 +++++ .../xiaoyao/ocr/dataDao/OcrSUserTMapper.java | 19 ++ .../xiaoyao/ocr/dataobject/OcrSUserT.java | 315 ++++++++++++++++++ .../ocr/service/OcrISUserTService.java | 16 + .../service/impl/OcrSUserTServiceImpl.java | 27 ++ .../resources/mapper/oa/OcrSUserTMapper.xml | 34 ++ .../cn/jyjz/xiaoyao/admin/SwaggerAddtion.java | 42 +-- 8 files changed, 534 insertions(+), 36 deletions(-) create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSUserTController.java create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSUserTMapper.java create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSUserT.java create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/OcrISUserTService.java create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSUserTServiceImpl.java create mode 100644 jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSUserTMapper.xml diff --git a/jyjz-framework/jyjz-framework-securityweb/src/main/java/cn/jyjz/xiaoyao/framework/security/authentication/MyAuthenticationProvider.java b/jyjz-framework/jyjz-framework-securityweb/src/main/java/cn/jyjz/xiaoyao/framework/security/authentication/MyAuthenticationProvider.java index d7977224..c1a28bf1 100644 --- a/jyjz-framework/jyjz-framework-securityweb/src/main/java/cn/jyjz/xiaoyao/framework/security/authentication/MyAuthenticationProvider.java +++ b/jyjz-framework/jyjz-framework-securityweb/src/main/java/cn/jyjz/xiaoyao/framework/security/authentication/MyAuthenticationProvider.java @@ -67,7 +67,7 @@ public class MyAuthenticationProvider implements AuthenticationProvider { //获取输入的登录密码 String password = request.getParameter(RequestParameterConstans.LOGIN_PASSWORD); //获取输入的登录验证码 - String logincode = request.getParameter(RequestParameterConstans.LOGIN_LOGINCODE); +// String logincode = request.getParameter(RequestParameterConstans.LOGIN_LOGINCODE); //缓存中的验证码保存的key String codetoken = request.getParameter(RequestParameterConstans.LOGIN_CODETOKEN); @@ -80,27 +80,27 @@ public class MyAuthenticationProvider implements AuthenticationProvider { } //从缓存中获得验证码 - String xitongyanzhengma = iCacheManager.get(CacheConstants.CACHE_CODE,codetoken); - - //获取缓存中的验证码 - String xitongcode = captchUtil.getCode(xitongyanzhengma,cacheProperties.getCacheNamePrix()); - - //从缓存中删除验证码 - iCacheManager.remove(CacheConstants.CACHE_CODE,codetoken); +// String xitongyanzhengma = iCacheManager.get(CacheConstants.CACHE_CODE,codetoken); +// +// //获取缓存中的验证码 +// String xitongcode = captchUtil.getCode(xitongyanzhengma,cacheProperties.getCacheNamePrix()); +// +// //从缓存中删除验证码 +// iCacheManager.remove(CacheConstants.CACHE_CODE,codetoken); if(StringUtils.isBlank(loginname) || StringUtils.isBlank(password)){ throw new AuthenticationServiceException("账号密码不正确"); } //判断验证码不能为空 - if(StringUtils.isBlank(logincode) || StringUtils.isBlank(codetoken)){ - throw new AuthenticationServiceException("验证码错误"); - } - - //验证码判断 - if(null != xitongcode && !xitongcode.equals(logincode)){ - throw new AuthenticationServiceException("验证码错误"); - } +// if(StringUtils.isBlank(logincode) || StringUtils.isBlank(codetoken)){ +// throw new AuthenticationServiceException("验证码错误"); +// } +// +// //验证码判断 +// if(null != xitongcode && !xitongcode.equals(logincode)){ +// throw new AuthenticationServiceException("验证码错误"); +// } //判断手机号与企业编码是否存在 if(!"admin".equals(loginname) && userTokenService.listCount(agentcode,loginname).intValue() <= 0){ diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSUserTController.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSUserTController.java new file mode 100644 index 00000000..9f314a3c --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSUserTController.java @@ -0,0 +1,85 @@ +package cn.jyjz.xiaoyao.ocr.controller; + +import cn.jyjz.xiaoyao.admin.dataobject.User; +import cn.jyjz.xiaoyao.common.base.controller.BaseController; +import cn.jyjz.xiaoyao.common.base.vo.ResultVo; +import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil; +import cn.jyjz.xiaoyao.ocr.dataobject.OcrSUserT; +import cn.jyjz.xiaoyao.ocr.service.OcrISUserTService; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +/** + * ocr控制器 + * + * @author 你的肉 + * @Date 2024-03-12 19:25:17 + */ +@CrossOrigin +@RestController +@RequestMapping("/ocr/sUser") +public class OcrSUserTController { + + @Autowired + private OcrISUserTService sUserTService; + + + /** 忘记密码 + */ + @ApiOperation(value = "重置密码", notes = "重置密码") + @RequestMapping(value = "/updateSUser", method = RequestMethod.POST) + public ResponseEntity updateSUser(@RequestBody Map map) { + +// System.out.println(map); +// Map map=new HashMap(); + if(map.get("newPassword").length()>=8 && map.get("newPassword").length()<=16 && map.get("newPassword").matches("^[0-9a-zA-Z]+$")){ + + if(null !=map.get("newPassword")){ + if(null !=map.get("rePasswrod")){ + + if(map.get("newPassword").equals(map.get("rePasswrod"))){ + BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); + UpdateWrapper updatewrapper = new UpdateWrapper<>(); + updatewrapper.eq("LOGINNAME", map.get("loginname")).set("PASSWORD",bCryptPasswordEncoder.encode(map.get("newPassword"))); + boolean update = sUserTService.update(updatewrapper); + + if(update){ + return new ResponseEntity("密码重设成功!",HttpStatus.OK); + + } + }else{ + + return new ResponseEntity("两次密码输入不一致!",HttpStatus.OK); + } + + }else{ + + return new ResponseEntity("请再次输入新密码!",HttpStatus.OK); + } + }else{ + + return new ResponseEntity("请输入新密码!",HttpStatus.OK); + } + + }else { + + return new ResponseEntity("请输入同时包含英文、数字的8~16位密码!",HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + + +} diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSUserTMapper.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSUserTMapper.java new file mode 100644 index 00000000..651c81be --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSUserTMapper.java @@ -0,0 +1,19 @@ +package cn.jyjz.xiaoyao.ocr.dataDao; + + +import cn.jyjz.xiaoyao.ocr.dataobject.OcrSUserT; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author 你的肉123 + * @since 2024-03-12 + */ +@Mapper +public interface OcrSUserTMapper extends BaseMapper { + +} diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSUserT.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSUserT.java new file mode 100644 index 00000000..062335e0 --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSUserT.java @@ -0,0 +1,315 @@ +package cn.jyjz.xiaoyao.ocr.dataobject; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author 你的肉123 + * @since 2024-03-12 + */ +@TableName("s_user_t") +public class OcrSUserT extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 用户流水号 + */ + @TableId("ID") + private Long id; + /** + * 登陆账号 + */ + @TableField("LOGINNAME") + private String loginname; + /** + * 登录密码 + */ + @TableField("PASSWORD") + private String password; + /** + * 用户名 + */ + @TableField("USERNAME") + private String username; + /** + * 是否是超级用户,0非,1是 + */ + @TableField("ISSYS") + private Integer issys; + /** + * 该字段用于人员排序使用 + */ + @TableField("SORTING") + private Integer sorting; + /** + * 是否被禁用,0禁用,1正常 + */ + @TableField("ENABLED") + private Integer enabled; + /** + * 性别,0:女,1:男 + */ + @TableField("USEX") + private String usex; + /** + * 描述 + */ + @TableField("USERDESC") + private String userdesc; + /** + * 手机号 + */ + @TableField("MOBILE") + private String mobile; + /** + * 电子邮箱 + */ + @TableField("EMAIL") + private String email; + /** + * 用户头像 + */ + @TableField("USERICON") + private String usericon; + /** + * 用户来源,1:系统用户,2:油箱注册用户,3:第三方接入用户,其他待定 + */ + @TableField("USERTYPE") + private Integer usertype; + /** + * 信息是否完善,默认为0:标示完善,1:待完善,2:信息有误(用户提供有误信息),3:用户身份证照片发送错误 + */ + @TableField("PERFECT") + private Integer perfect; + /** + * 注册来源,用于记录用户注册信息是从哪个站点来的 + */ + @TableField("FROMSIT") + private Long fromsit; + /** + * 创建人,记录创建人的帐号 + */ + @TableField("CREATEUSER") + private String createuser; + /** + * 创建时间 + */ + @TableField("CREATEDATE") + private Long createdate; + /** + * 修改人,记录创建人的帐号 + */ + @TableField("UPDATEUSER") + private String updateuser; + /** + * 更新时间 + */ + @TableField("UPDATETIME") + private Long updatetime; + /** + * 密码最后更新时间 + */ + @TableField("PSDUPDATETIME") + private Long psdupdatetime; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLoginname() { + return loginname; + } + + public void setLoginname(String loginname) { + this.loginname = loginname; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Integer getIssys() { + return issys; + } + + public void setIssys(Integer issys) { + this.issys = issys; + } + + public Integer getSorting() { + return sorting; + } + + public void setSorting(Integer sorting) { + this.sorting = sorting; + } + + public Integer getEnabled() { + return enabled; + } + + public void setEnabled(Integer enabled) { + this.enabled = enabled; + } + + public String getUsex() { + return usex; + } + + public void setUsex(String usex) { + this.usex = usex; + } + + public String getUserdesc() { + return userdesc; + } + + public void setUserdesc(String userdesc) { + this.userdesc = userdesc; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getUsericon() { + return usericon; + } + + public void setUsericon(String usericon) { + this.usericon = usericon; + } + + public Integer getUsertype() { + return usertype; + } + + public void setUsertype(Integer usertype) { + this.usertype = usertype; + } + + public Integer getPerfect() { + return perfect; + } + + public void setPerfect(Integer perfect) { + this.perfect = perfect; + } + + public Long getFromsit() { + return fromsit; + } + + public void setFromsit(Long fromsit) { + this.fromsit = fromsit; + } + + public String getCreateuser() { + return createuser; + } + + public void setCreateuser(String createuser) { + this.createuser = createuser; + } + + public Long getCreatedate() { + return createdate; + } + + public void setCreatedate(Long createdate) { + this.createdate = createdate; + } + + public String getUpdateuser() { + return updateuser; + } + + public void setUpdateuser(String updateuser) { + this.updateuser = updateuser; + } + + public Long getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(Long updatetime) { + this.updatetime = updatetime; + } + + public Long getPsdupdatetime() { + return psdupdatetime; + } + + public void setPsdupdatetime(Long psdupdatetime) { + this.psdupdatetime = psdupdatetime; + } + + @Override + public Serializable pkVal() { + return this.id; + } + + @Override + public String toString() { + return "SUserT{" + + "id=" + id + + ", loginname=" + loginname + + ", password=" + password + + ", username=" + username + + ", issys=" + issys + + ", sorting=" + sorting + + ", enabled=" + enabled + + ", usex=" + usex + + ", userdesc=" + userdesc + + ", mobile=" + mobile + + ", email=" + email + + ", usericon=" + usericon + + ", usertype=" + usertype + + ", perfect=" + perfect + + ", fromsit=" + fromsit + + ", createuser=" + createuser + + ", createdate=" + createdate + + ", updateuser=" + updateuser + + ", updatetime=" + updatetime + + ", psdupdatetime=" + psdupdatetime + + "}"; + } +} diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/OcrISUserTService.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/OcrISUserTService.java new file mode 100644 index 00000000..9d1e8f35 --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/OcrISUserTService.java @@ -0,0 +1,16 @@ +package cn.jyjz.xiaoyao.ocr.service; + +import cn.jyjz.xiaoyao.ocr.dataobject.OcrSUserT; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author 你的肉123 + * @since 2024-03-12 + */ +public interface OcrISUserTService extends IService { + +} diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSUserTServiceImpl.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSUserTServiceImpl.java new file mode 100644 index 00000000..7a1774f2 --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSUserTServiceImpl.java @@ -0,0 +1,27 @@ +package cn.jyjz.xiaoyao.ocr.service.impl; + +import cn.jyjz.xiaoyao.ocr.dataDao.OcrSUserTMapper; +import cn.jyjz.xiaoyao.ocr.dataobject.OcrSUserT; +import cn.jyjz.xiaoyao.ocr.service.OcrISUserTService; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.Map; +import java.util.function.Function; + +/** + *

+ * 服务实现类 + *

+ * + * @author 你的肉123 + * @since 2024-03-12 + */ +@Service +public class OcrSUserTServiceImpl extends ServiceImpl implements OcrISUserTService { + + +} diff --git a/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSUserTMapper.xml b/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSUserTMapper.xml new file mode 100644 index 00000000..e627c3a1 --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSUserTMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID AS id, LOGINNAME AS loginname, PASSWORD AS password, USERNAME AS username, ISSYS AS issys, SORTING AS sorting, ENABLED AS enabled, USEX AS usex, USERDESC AS userdesc, MOBILE AS mobile, EMAIL AS email, USERICON AS usericon, USERTYPE AS usertype, PERFECT AS perfect, FROMSIT AS fromsit, CREATEUSER AS createuser, CREATEDATE AS createdate, UPDATEUSER AS updateuser, UPDATETIME AS updatetime, PSDUPDATETIME AS psdupdatetime + + + diff --git a/runstart/src/main/java/cn/jyjz/xiaoyao/admin/SwaggerAddtion.java b/runstart/src/main/java/cn/jyjz/xiaoyao/admin/SwaggerAddtion.java index 6ff51132..bab9fc99 100644 --- a/runstart/src/main/java/cn/jyjz/xiaoyao/admin/SwaggerAddtion.java +++ b/runstart/src/main/java/cn/jyjz/xiaoyao/admin/SwaggerAddtion.java @@ -39,7 +39,8 @@ public class SwaggerAddtion implements ApiListingScannerPlugin { Operation usernamePasswordOperation = new OperationBuilder(new CachingOperationNameGenerator()) .method(HttpMethod.POST) .summary("用户名密码登录") - .notes("username/password/logincode/codetoken--登录") + .notes("username/password--登录") +// .notes("username/password/logincode/codetoken--登录") .consumes(Sets.newHashSet(MediaType.APPLICATION_FORM_URLENCODED_VALUE)) // 接收参数格式 .produces(Sets.newHashSet(MediaType.APPLICATION_JSON_VALUE)) // 返回参数格式 .tags(Sets.newHashSet("登录")) @@ -63,26 +64,27 @@ public class SwaggerAddtion implements ApiListingScannerPlugin { .parameterAccess("access") .required(true) .modelRef(new ModelRef("string")) - .build(), - new ParameterBuilder() - .description("验证码主键") - .type(new TypeResolver().resolve(String.class)) - .name("codetoken") - .defaultValue("666666") - .parameterType("formData") - .parameterAccess("access") - .required(true) - .modelRef(new ModelRef("string")) - .build(), - new ParameterBuilder() - .description("验证码") - .type(new TypeResolver().resolve(String.class)) - .name("logincode") - .parameterType("formData") - .parameterAccess("access") - .required(true) - .modelRef(new ModelRef("string")) .build() +// , +// new ParameterBuilder() +// .description("验证码主键") +// .type(new TypeResolver().resolve(String.class)) +// .name("codetoken") +// .defaultValue("666666") +// .parameterType("formData") +// .parameterAccess("access") +// .required(true) +// .modelRef(new ModelRef("string")) +// .build(), +// new ParameterBuilder() +// .description("验证码") +// .type(new TypeResolver().resolve(String.class)) +// .name("logincode") +// .parameterType("formData") +// .parameterAccess("access") +// .required(true) +// .modelRef(new ModelRef("string")) +// .build() )) .responseMessages(Collections.singleton( new ResponseMessageBuilder().code(200).message("请求成功")