From 21f45258cfcdc79127f85ad6e45736cff5acd345 Mon Sep 17 00:00:00 2001 From: liyj <15602261488@163.com> Date: Mon, 21 Oct 2024 20:58:05 +0800 Subject: [PATCH] 1、数据割接程序,白云区矛盾纠纷多元化解平台 2、纠纷态势报错修改 --- dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java | 208 +++++++++++++++------------------------------------ 1 files changed, 61 insertions(+), 147 deletions(-) diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java index e483601..760db38 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java @@ -1,9 +1,17 @@ -package cn.huge.module.ctuser.controller; +package cn.huge.module.ctuser.controller.web; +import cn.huge.base.common.bo.ReturnBO; import cn.huge.base.common.utils.ReturnFailUtils; import cn.huge.base.common.utils.ReturnSucUtils; +import cn.huge.base.config.CurrentUser; +import cn.huge.module.constant.BaseConsts; import cn.huge.module.ctuser.domain.po.CtAccount; +import cn.huge.module.ctuser.domain.po.CtUnit; +import cn.huge.module.ctuser.dto.CtAccountLoginDTO; +import cn.huge.module.ctuser.dto.CtCipherDTO; import cn.huge.module.ctuser.service.CtAccountService; +import cn.huge.module.sys.dto.GridTokenBaseDTO; +import cn.huge.module.utils.JwtUtils; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -14,16 +22,18 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; /** - * @title: 客户用户账号表接口api - * @description: 客户用户账号表接口api + * @title: 客户用户账号表接口api-web端-web端 + * @description: 客户用户账号表接口api-web端-web端 * @company: hugeinfo * @author: liyj - * @time: 2024-08-17 15:30:56 + * @time: 2024-08-19 20:04:18 * @version: 1.0.0 */ @Slf4j @@ -38,167 +48,71 @@ private CtAccountService service; /** - * 获取请求URL参数 - * @return Map<String, Object> - */ - private Map<String, Object> getParameter(){ - Map<String, Object> terms = Maps.newHashMap(); - // 账号编号 - String id = request.getParameter("id"); - if (StringUtils.isNotBlank(id)){ - terms.put("id", id); - } - // 用户编号 - String userId = request.getParameter("userId"); - if (StringUtils.isNotBlank(userId)){ - terms.put("userId", userId); - } - // 帐号类型,1:平台web端,2:平台小程序 - String accType = request.getParameter("accType"); - if (StringUtils.isNotBlank(accType)){ - terms.put("accType", accType); - } - // 身份唯一标识(存储唯一标识,比如账号、邮箱、手机号、第三方获取的唯一标识等) - String acc = request.getParameter("acc"); - if (StringUtils.isNotBlank(acc)){ - terms.put("acc", acc); - } - // 授权凭证(比如密码 第三方登录的token等) - String cipher = request.getParameter("cipher"); - if (StringUtils.isNotBlank(cipher)){ - terms.put("cipher", cipher); - } - // 授权凭证明文 - String cipherOpen = request.getParameter("cipherOpen"); - if (StringUtils.isNotBlank(cipherOpen)){ - terms.put("cipherOpen", cipherOpen); - } - // 密码最新更新时间 - String cipherTime = request.getParameter("cipherTime"); - if (StringUtils.isNotBlank(cipherTime)){ - terms.put("cipherTime", cipherTime); - } - // 最新登录时间 - String loginTime = request.getParameter("loginTime"); - if (StringUtils.isNotBlank(loginTime)){ - terms.put("loginTime", loginTime); - } - // 限制登录时间(密码错误次数超过限制,默认30分钟) - String limitTime = request.getParameter("limitTime"); - if (StringUtils.isNotBlank(limitTime)){ - terms.put("limitTime", limitTime); - } - // 删除状态,0:已删除,1:未删除 - String deleteStatus = request.getParameter("deleteStatus"); - if (StringUtils.isNotBlank(deleteStatus)){ - terms.put("deleteStatus", deleteStatus); - } - // 顾客编号 - String custId = request.getParameter("custId"); - if (StringUtils.isNotBlank(custId)){ - terms.put("custId", custId); - } - // 创建时间区间 - String createStart = request.getParameter("createStart"); - String createEnd = request.getParameter("createEnd"); - if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { - terms.put("createStart", createStart); - terms.put("createEnd", createEnd); - } - // 更新时间区间 - String updateStart = request.getParameter("updateStart"); - String updateEnd = request.getParameter("updateEnd"); - if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { - terms.put("updateStart", updateStart); - terms.put("updateEnd", updateEnd); - } - return terms; - } - - /** - * 条件查询多个 - * @url {ctx}/api/web/ctAccount/listQuery - * @return Object - */ - @GetMapping("/listQuery") - public Object listQuery() { + * web端-工作人员-用户登录 + * @url {ctx}/api/web/ctAccount/login + * @param ctAccountLoginDTO 登录对象 + * @return Object + */ + @PostMapping(value = "login") + public Object login(@RequestBody CtAccountLoginDTO ctAccountLoginDTO) { try { - Map<String, Object> terms = getParameter(); - return ReturnSucUtils.getRepInfo(service.listTerms(terms)); + ReturnBO returnBO = service.webLogin(ctAccountLoginDTO); + return returnBO; } catch (Exception e) { - return ReturnFailUtils.getRepInfo(); + return ReturnFailUtils.getRepInfo(e.getMessage()); } } /** - * 条件分页查询 - * @url {ctx}/api/web/ctAccount/pageQuery - * @param page 页码 - * @param size 每页数量 - * @return Object - */ - @GetMapping("/pageQuery") - public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { + * web端-工作人员-用户选择/切换角色 + * @url {ctx}/api/web/ctAccount/switchRole + * @return Object + */ + @GetMapping(value = "switchRole") + public Object switchRole(@RequestParam(value = "roleCode") String roleCode, @CurrentUser String userId) { try { - Map<String, Object> terms = getParameter(); - Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); - PageRequest pageRequest = PageRequest.of(page-1, size, sort); - Page<CtAccount> ctAccountPage = service.pageQuery(pageRequest, terms); - return ReturnSucUtils.getRepInfo( "处理成功", ctAccountPage); - } catch (Exception e) { - return ReturnFailUtils.getRepInfo(); - } - } - - /** - * 根据编号查询单个 - * @url {ctx}/api/web/ctAccount/getById - * @param id 主键编号 - * @return Object - */ - @GetMapping("/getById") - public Object getById(@RequestParam(value = "id") String id) { - try { - return ReturnSucUtils.getRepInfo(service.getById(id)); - } catch (Exception e) { - return ReturnFailUtils.getRepInfo(); - } - } - - /** - * 根据主键单个/批量删除 - * @url {ctx}/api/web/ctAccount/deleteByIds - * @param ids 主键编号 - * @return Object - */ - @GetMapping("/deleteByIds") - public Object deleteByIds(@RequestParam(value = "ids") String ids) { - try { - if (ids.indexOf(",") != -1) { - service.removeByIds(Stream.of(ids.split(",")).collect(Collectors.toList())); - }else{ - service.removeById(ids); + StringBuffer result = new StringBuffer(); + if (userId.indexOf(BaseConsts.AND) != -1){ + String[] userIds = userId.split(BaseConsts.AND); + result.append(userIds[0]).append(BaseConsts.AND).append(roleCode); + }else { + result.append(userId).append(BaseConsts.AND).append(roleCode); } - return ReturnSucUtils.getRepInfo(); + return ReturnSucUtils.getRepInfo(JwtUtils.buildJWT(result.toString())); } catch (Exception e) { return ReturnFailUtils.getRepInfo(); } } /** - * 新增或更新对象 - * @url {ctx}/api/web/ctAccount/saveCtAccount - * @param ctAccount 实体对象 - * @return Object - */ - @PostMapping("/saveCtAccount") - public Object saveCtAccount(@RequestBody CtAccount ctAccount) { + * web端-工作人员-修改密码 + * @url {ctx}/api/web/ctAccount/changeCipher + * @param ctCipherDTO 修改密码对象 + * @return Object + */ + @PostMapping(value = "changeCipher") + public Object changeCipher(@CurrentUser String userId, @RequestBody CtCipherDTO ctCipherDTO) { try { - service.saveCtAccount(ctAccount); - return ReturnSucUtils.getRepInfo(); + return service.webChangeCipher(userId, ctCipherDTO); } catch (Exception e) { return ReturnFailUtils.getRepInfo(); } } + /** + * web端-网格系统单点登录 + * @url {ctx}/api/web/ctAccount/gridLogin + * @param gridTokenBaseDTO 网格系统token + * @return Object + */ + @PostMapping(value = "gridLogin") + public Object gridLogin(@RequestBody GridTokenBaseDTO gridTokenBaseDTO) { + try { + ReturnBO returnBO = service.webGridLogin(gridTokenBaseDTO); + return returnBO; + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(e.getMessage()); + } + } + } -- Gitblit v1.8.0