diff --git a/pom.xml b/pom.xml index e24541e..134163c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,11 +9,11 @@ 1.5.6.RELEASE - gas.service - gas_service + fkzy.operation + fkzy_operation 1.0-SNAPSHOT - gas_service - gas_service + fkzy_operation + fkzy_operation UTF-8 UTF-8 @@ -280,6 +280,17 @@ 5.3.2 compile + + + com.aliyun + aliyun-java-sdk-core + 4.5.16 + + + com.aliyun + aliyun-java-sdk-dysmsapi + 2.1.0 + diff --git a/src/main/java/com/fxzy/warn/common/conf/Swagger.java b/src/main/java/com/fxzy/warn/common/conf/Swagger.java index a9e64d6..2982606 100644 --- a/src/main/java/com/fxzy/warn/common/conf/Swagger.java +++ b/src/main/java/com/fxzy/warn/common/conf/Swagger.java @@ -30,14 +30,14 @@ public class Swagger { @Bean public Docket createSwaggerApi() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(myApi()).select().apis( - RequestHandlerSelectors.basePackage("com.lzrq.wx")).paths( + RequestHandlerSelectors.basePackage("com.fxzy.warn")).paths( PathSelectors.any()) .build().pathMapping(servletPath); } public ApiInfo myApi() { - return new ApiInfoBuilder().title("泸州燃气-模板填报系统-rest接口") - .contact(new Contact("yuyantian", "http", "@qq.com")).description("demo rest接口") + return new ApiInfoBuilder().title("风控之眼-运营管理平台-接口") + .contact(new Contact("", "http", "@qq.com")).description("demo rest接口") .version("1.0") .build(); } diff --git a/src/main/java/com/fxzy/warn/common/constants/LawResearchUrlConstants.java b/src/main/java/com/fxzy/warn/common/constants/LawResearchUrlConstants.java index 9b04633..d609e1d 100644 --- a/src/main/java/com/fxzy/warn/common/constants/LawResearchUrlConstants.java +++ b/src/main/java/com/fxzy/warn/common/constants/LawResearchUrlConstants.java @@ -8,23 +8,23 @@ package com.fxzy.warn.common.constants; public class LawResearchUrlConstants { //----------------正式------------ -// static final String BASE_URL = "https://qyss.cjbdi.com/qyss"; - //加密密钥 -// String key = "QOczcxT@EtdGsoqc"; - //接口调用凭证 -// String ticket = "sWLi80ouoxiK9jYJFti2j43Cgzpxf2CSmE5/8qj5jsTpVmXwH4sjsrlpwh882FR9vjXFDOzWS2s5+P72GwY0Xg=="; + public final static String BASE_URL = "https://qyss.cjbdi.com/qyss"; + // 加密密钥 + public final static String KEY = "QOczcxT@EtdGsoqc"; + // 接口调用凭证 + public final static String TICKET = "sWLi80ouoxiK9jYJFti2j43Cgzpxf2CSmE5/8qj5jsTpVmXwH4sjsrlpwh882FR9vjXFDOzWS2s5+P72GwY0Xg=="; //-----------------测试------------- - public final static String BASE_URL = "http://123.124.130.19/qysstest"; - //加密密钥 - public final static String KEY = "COtP3DH$Pcw2ccs1"; - //接口调用凭证 - public final static String TICKET = "sWLi80ouoxiK9jYJFti2jz9KWnUtRvdepXf4jOWAwgyfSy4Kkf+n6yux/IuhFrL/"; +// public final static String BASE_URL = "http://123.124.130.19/qysstest"; +// //加密密钥 +// public final static String KEY = "COtP3DH$Pcw2ccs1"; +// //接口调用凭证 +// public final static String TICKET = "sWLi80ouoxiK9jYJFti2jz9KWnUtRvdepXf4jOWAwgyfSy4Kkf+n6yux/IuhFrL/"; //司法 - public final static String QUERY_SSSXXG ="/qyss/sfss/querySssxxg"; + public final static String QUERY_SSSXXG = "/qyss/sfss/querySssxxg"; //工商 public final static String QUERY_ENT_INFO = "/qyss/cr/queryEntInfo"; //工商工商基础信 @@ -40,39 +40,39 @@ public class LawResearchUrlConstants { //企业司法画像-债权债务趋势图接口 public final static String CASE_TREND_MAP = "/qyss/sf/esbasicdata/company/caseTrendMap"; //企业司法画像-审理程序分布接口 - public final static String GET_CASE_TREND_MAP = "/qyss/sf/esbasicdata/investigate/getCaseAnalysisInfo"; + public final static String GET_CASE_TREND_MAP = "/qyss/sf/esbasicdata/investigate/getCaseAnalysisInfo"; //企业司法画像-诉讼地位分布接口 - public final static String GET_CASE_SSDW_INFO = "/qyss/sf/esbasicdata/investigate/getCaseSsdwInfo"; + public final static String GET_CASE_SSDW_INFO = "/qyss/sf/esbasicdata/investigate/getCaseSsdwInfo"; //企业司法画像-主诉/被诉诉讼结果接口 - public final static String GET_CASE_SSJG_INFO = "/qyss/sf/esbasicdata/investigate/getCaseSsjgInfo"; + public final static String GET_CASE_SSJG_INFO = "/qyss/sf/esbasicdata/investigate/getCaseSsjgInfo"; //企业司法画像-案件走势图接口 - public final static String COUNT_ALL_CASE_NUMBER = "/qyss/sf/esbasicdata/investigate/company/getCountAllCaseNumber"; + public final static String COUNT_ALL_CASE_NUMBER = "/qyss/sf/esbasicdata/investigate/company/getCountAllCaseNumber"; //企业司法画像-涉诉关系图接口 - public final static String LITIGATION_RELATIONSHIP = "/qyss/sf/esbasicdata/investigate/litigationRelationship"; + public final static String LITIGATION_RELATIONSHIP = "/qyss/sf/esbasicdata/investigate/litigationRelationship"; //企业司法画像-涉诉标的额接口 - public final static String COUNT_CASE_LITIGATION = "/qyss/sf/esbasicdata/investigate/company/countCaseLitigationAmountAll"; + public final static String COUNT_CASE_LITIGATION = "/qyss/sf/esbasicdata/investigate/company/countCaseLitigationAmountAll"; //企业司法画像-地域分布图接口 - public final static String COUNT_CASE_PROVINCE = "/qyss/sf/esbasicdata/company/countCaseProvince"; + public final static String COUNT_CASE_PROVINCE = "/qyss/sf/esbasicdata/company/countCaseProvince"; //企业司法画像-案由分布图接口 - public final static String COUNT_SUMMARY = "/qyss/sf/esbasicdata/company/countSummary"; + public final static String COUNT_SUMMARY = "/qyss/sf/esbasicdata/company/countSummary"; //投融资风险审查接口 - public final static String RISK_REVIEW = "/qyss/sf/investFinance/riskReview"; + public final static String RISK_REVIEW = "/qyss/sf/investFinance/riskReview"; //投融资风险详情接口 - public final static String RISK_REVIEW_PAGE_INFO = "/qyss/sf/investFinance/riskReview/pageInfo"; + public final static String RISK_REVIEW_PAGE_INFO = "/qyss/sf/investFinance/riskReview/pageInfo"; //投融资风险详情接口 - public final static String OVERVIEW = "/qyss/sf/contractRisk/overview"; + public final static String OVERVIEW = "/qyss/sf/contractRisk/overview"; //合同履约风险列表接口 - public final static String OVERVIEW_PAGE_INFO = "/qyss/sf/contractRisk/overview/pageInfo"; + public final static String OVERVIEW_PAGE_INFO = "/qyss/sf/contractRisk/overview/pageInfo"; //监控名单添加接口 - public final static String ADD_PUBLIC = "/qyss/monitor/addpublic"; + public final static String ADD_PUBLIC = "/qyss/monitor/addpublic"; //监控名单删除接口 - public final static String DEL_COMPANY = "/qyss/monitor/delcompany"; + public final static String DEL_COMPANY = "/qyss/monitor/delcompany"; //监控名单查询接口 - public final static String MONITOR_QUERY = "/qyss/monitor/query"; + public final static String MONITOR_QUERY = "/qyss/monitor/query"; //监控信息获取 - public final static String QUERY_MONITOR_CASES = "/qyss/dsk/queryMonitorCases"; + public final static String QUERY_MONITOR_CASES = "/qyss/dsk/queryMonitorCases"; //不良记录审查结果接口 - public final static String BADRECORD = "/qyss/risk/badrecord"; + public final static String BADRECORD = "/qyss/risk/badrecord"; //类案诉讼实体接口 public final static String LIST_BY_ENTERPRISE = "/wenshu/queryws/listByEnterprise"; //类案详情查询接口 diff --git a/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java b/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java index c6ae15d..a85c2a3 100644 --- a/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java +++ b/src/main/java/com/fxzy/warn/common/constants/ResponseMsgConstants.java @@ -29,17 +29,16 @@ public class ResponseMsgConstants { public final static String OPERATE_FAIL = "操作失败"; - + public final static String CODE_SENT_SUCCESSFULLY = "验证码已发送"; + public final static String CODE_EXPIRED_PLEASE_RESEND = "验证码已失效,请重新发送"; + public final static String USER_PHONE_EXIST = "该手机号已存在"; public final static String OPERATE_SYS_ERROR = "系统异常"; public final static String OPERATE_NAME_REPEAT = "名称不能重复"; + public final static String USER_NOT_FOUND = "用户不存在"; + public final static String PASSWORD_ERROR = "密码错误"; - public final static String OPERATE_UNDELETE = "不能删除该类型"; - - public final static String OPEARTE_DICT_DICTCODE_REPEAT = "数据字典编码不能重复"; - public final static String OPEARTE_DICTITEM_DICTCODE_REPEAT = "数据字典项编码不能重复"; - public final static String UN_ERROR = "未知"; } diff --git a/src/main/java/com/fxzy/warn/common/constants/UserConstants.java b/src/main/java/com/fxzy/warn/common/constants/UserConstants.java new file mode 100644 index 0000000..8c14d6b --- /dev/null +++ b/src/main/java/com/fxzy/warn/common/constants/UserConstants.java @@ -0,0 +1,53 @@ +package com.fxzy.warn.common.constants; + +/** + * + * 用户常量 + * @param + * @return + * @author zhangjing + * @create 2024/12/4 + **/ +public class UserConstants { + + /** + * 登录类型 + * PASSWORD_LOGIN:账户密码登录 + * SMS_CAPTCHA_LOGIN:短信验证码登录 + */ + public final static Integer PASSWORD_LOGIN = 1; + public final static Integer SMS_CAPTCHA_LOGIN = 2; + + + /** + * 用户是否被锁定 + * LOCKED:是 + * UN_LOCK:否 + */ + public final static Integer LOCKED = 1; + public final static Integer UN_LOCK = 0; + + /** + * 用户密码错误默认次数 + */ + public final static Integer PASSWORD_WRONG_DEF = 0; + /** + * 用户密码错误上限次数 + */ + public final static Integer PASSWORD_WRONG_LIMIT = 5; + /** + * 锁定时间5分钟 + */ + public final static Integer LOCK_TIME = 300; + + + /** + * 登录验证码类型 + */ + public final static Integer RANDOM_CAPTCHA = 1; + + + + + +} diff --git a/src/main/java/com/fxzy/warn/common/response/ApiResponse.java b/src/main/java/com/fxzy/warn/common/response/ApiResponse.java index e86316e..d94bef5 100644 --- a/src/main/java/com/fxzy/warn/common/response/ApiResponse.java +++ b/src/main/java/com/fxzy/warn/common/response/ApiResponse.java @@ -51,7 +51,7 @@ public class ApiResponse implements Serializable { } public void recordError(String error) { - this.code = 500; + this.code = 999; this.message = error; } diff --git a/src/main/java/com/fxzy/warn/common/util/LawResearchUtil.java b/src/main/java/com/fxzy/warn/common/util/LawResearchUtil.java index 7da4827..75483b3 100644 --- a/src/main/java/com/fxzy/warn/common/util/LawResearchUtil.java +++ b/src/main/java/com/fxzy/warn/common/util/LawResearchUtil.java @@ -38,8 +38,10 @@ public class LawResearchUtil { //默认测试数据 if (name == null) { - name = "四川无声信息技术有限公司"; - creditCode = "915101007234134581"; +// name = "四川无声信息技术有限公司"; +// creditCode = "915101007234134581"; + name = "徐州协能建材科技有限公司"; + creditCode = "91320301MA20TF8T84"; } JSONArray array = new JSONArray(); diff --git a/src/main/java/com/fxzy/warn/common/util/SMSUtils.java b/src/main/java/com/fxzy/warn/common/util/SMSUtils.java new file mode 100644 index 0000000..d7606cc --- /dev/null +++ b/src/main/java/com/fxzy/warn/common/util/SMSUtils.java @@ -0,0 +1,43 @@ +package com.fxzy.warn.common.util; + +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.profile.DefaultProfile; + +/** + * @author zhangjing + * @date 2024/11/22 13:57 + * @description + */ +public class SMSUtils { + /** + * 发送短信 + * @param signName 签名 + * @param templateCode 模板 + * @param phoneNumbers 手机号 + * @param param 参数 + */ + public static void sendMessage(String signName, String templateCode,String phoneNumbers,String param,String accessKeyId,String secret){ + //TODO 改成自己的 + DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, secret); + IAcsClient client = new DefaultAcsClient(profile); + + SendSmsRequest request = new SendSmsRequest(); + request.setSysRegionId("cn-hangzhou"); + request.setPhoneNumbers(phoneNumbers); + request.setSignName(signName); + request.setTemplateCode(templateCode); + request.setTemplateParam("{\"code\":\""+param+"\"}"); + try { + SendSmsResponse response = client.getAcsResponse(request); + System.out.println("短信发送成功"); + }catch (ClientException e) { + e.printStackTrace(); + } + } + + +} diff --git a/src/main/java/com/fxzy/warn/controller/AccountController.java b/src/main/java/com/fxzy/warn/controller/AccountController.java new file mode 100644 index 0000000..80714f9 --- /dev/null +++ b/src/main/java/com/fxzy/warn/controller/AccountController.java @@ -0,0 +1,122 @@ +package com.fxzy.warn.controller; + +import com.alibaba.fastjson.JSONObject; +import com.fxzy.warn.common.request.RequestParameter; +import com.fxzy.warn.model.User; +import com.fxzy.warn.service.UserService; +import com.fxzy.warn.common.constants.ResponseMsgConstants; +import com.fxzy.warn.common.response.ApiResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Objects; + +/** + * @author zhangjing + * @date 2024/05/21 11:22 + * @description + */ +@Api(tags = "登录与账号相关") +@RestController +@RequestMapping("account/") +@Slf4j +public class AccountController { + @Resource + private UserService userService ; + + @RequestMapping(value = "sendCode", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "发送验证码") + public ApiResponse sendCode(@ApiParam("{\n" + + "\"phoneNumber\":\"电话号码\",\n" + + "}") @RequestBody JSONObject jsonObject) { + ApiResponse response = new ApiResponse(); + try { + return userService.sendCode(jsonObject); + } catch (Exception e) { + response.recordError(ResponseMsgConstants.OPERATE_FAIL); + } + return response; + } + @RequestMapping(value = "login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "登录") + public ApiResponse login(@ApiParam("{\n" + + "\"loginType\":\"登录类型:1.账户密码登录,2:手机短信验证码登录\",\n" + + "\"phoneNumber\":\"电话号码\",\n" + + "\"password\":\"密码密文\",\n" + + "\"code\":\"随机验证码\"\n" + + "}") @RequestBody JSONObject jsonObject) { + ApiResponse response = new ApiResponse(); + try { + return userService.login(jsonObject); + } catch (Exception e) { + response.recordError(ResponseMsgConstants.OPERATE_FAIL); + } + return response; + } + + @RequestMapping(value = "createUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @ApiOperation(value = "创建用户") + public ApiResponse createUser(@ApiParam("{\n" + + "\"companyName\":\"企业名称\",\n" + + "\"creditCode\":\"统一社会信用代码\",\n" + + "\"phoneNumber\":\"手机号\",\n" + + "\"email\":\"邮箱\"\n" + + "\"province\":\"所在省\"\n" + + "\"city\":\"所在市\"\n" + + "\"district\":\"所在区\"\n" + + "\"detailedAddress\":\"详细地址\"\n" + + "\"businessPerson\":\"商务负责人\"\n" + + "\"remarks\":\"备注\"\n" + + "}") @RequestBody User entity, String ticket) { + ApiResponse response = new ApiResponse(); + try { + return userService.createUser(entity,ticket); + } catch (Exception e) { + response.recordError(ResponseMsgConstants.OPERATE_FAIL); + } + return response; + } + @RequestMapping(value = "queryPage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ApiOperation(value = "分页查询") + public ApiResponse queryPage(@ApiParam() @RequestBody RequestParameter parameter) { + log.info("分页查询 ==== 参数{" + parameter.toString() + "}"); + ApiResponse apiResponse = new ApiResponse(); + if (!Objects.isNull(parameter) && !Objects.isNull(parameter.getParameter())) { + try { + apiResponse.setData(userService.queryPage(parameter)); + apiResponse.setMessage(ResponseMsgConstants.OPERATE_SUCCESS); + } catch (Exception e) { + log.error("查询错误,errMsg==={}", e.getMessage()); + e.printStackTrace(); + apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL); + } + } else { + apiResponse.recordError(ResponseMsgConstants.OPERATE_FAIL); + } + return apiResponse; + } +// @RequestMapping(value = "loginOut", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) +// @ApiOperation(value = "退出系统") +// public ApiResponse logOut(@ApiParam("{\n" +// + " \"ticket\":\"ticket\",\n" +// + "}") @RequestBody JSONObject object) { +// ApiResponse response = new ApiResponse(); +// String ticket = object.getString("ticket"); +// if (StringUtils.isBlank(ticket)) { +// response.recordError("ticket不能为空"); +// return response; +// } +// //调用全局登出 +// response = accountService.logout(ticket); +// return response; +// } +} diff --git a/src/main/java/com/fxzy/warn/mapper/UserMapper.java b/src/main/java/com/fxzy/warn/mapper/UserMapper.java new file mode 100644 index 0000000..3895046 --- /dev/null +++ b/src/main/java/com/fxzy/warn/mapper/UserMapper.java @@ -0,0 +1,14 @@ +package com.fxzy.warn.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fxzy.warn.model.User; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author zhangjing + * @date 2024/12/04 14:48 + * @description + */ +@Mapper +public interface UserMapper extends BaseMapper { +} diff --git a/src/main/java/com/fxzy/warn/model/Authorization.java b/src/main/java/com/fxzy/warn/model/Authorization.java new file mode 100644 index 0000000..74e2011 --- /dev/null +++ b/src/main/java/com/fxzy/warn/model/Authorization.java @@ -0,0 +1,35 @@ +package com.fxzy.warn.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhangjing + * @date 2024/12/04 20:09 + * @description + */ +@Data +@TableName("t_authorization") +public class Authorization extends BaseField{ + /** + * id + */ + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("授权开始日期") + private String startDate; + + @ApiModelProperty("授权截止日期") + private String endDate; + + @ApiModelProperty("授权书id") + private String fileId; + + @ApiModelProperty("风险查询次数") + private Integer queryCount; +} diff --git a/src/main/java/com/fxzy/warn/model/BaseField.java b/src/main/java/com/fxzy/warn/model/BaseField.java new file mode 100644 index 0000000..b833252 --- /dev/null +++ b/src/main/java/com/fxzy/warn/model/BaseField.java @@ -0,0 +1,52 @@ +package com.fxzy.warn.model; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhangjing + * @date 2024/04/14 10:05 + * @description + */ +@Data +public class BaseField extends Model { + /** + * 创建时间 + */ + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + @TableField(value = "update_time", fill = FieldFill.UPDATE) + private Date updateTime; + /** + * 创建人 + */ + @ApiModelProperty("创建人") + @TableField(value = "creator_id", fill = FieldFill.INSERT) + private Integer creatorId; + /** + * 修改人 + */ + @ApiModelProperty("修改人") + @TableField(value = "updater_id", fill = FieldFill.UPDATE) + private Integer updaterId; + /** + * 是否删除 + */ + @ApiModelProperty("是否删除") + @TableField(value = "is_del") + private Integer isDel; +} diff --git a/src/main/java/com/fxzy/warn/model/User.java b/src/main/java/com/fxzy/warn/model/User.java new file mode 100644 index 0000000..2aa4123 --- /dev/null +++ b/src/main/java/com/fxzy/warn/model/User.java @@ -0,0 +1,65 @@ +package com.fxzy.warn.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhangjing + * @date 2024/12/04 14:27 + * @description + */ +@Data +@TableName("t_user") +public class User extends BaseField{ + /** + * id + */ + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("统一社会信用代码") + private String creditCode; + + @ApiModelProperty("手机号") + private String phoneNumber; + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("所在省") + private String province; + + @ApiModelProperty("所在市") + private String city; + + @ApiModelProperty("所在区") + private String district; + + @ApiModelProperty("详细地址") + private String detailedAddress; + + @ApiModelProperty("商务负责人") + private String businessPerson; + + @ApiModelProperty("备注") + private String remarks; + + @ApiModelProperty("授权id") + private int authorizationId; + + @ApiModelProperty("是否为正式账号") + private int isOfficialAccount; + + @ApiModelProperty("密码") + private String password; +} diff --git a/src/main/java/com/fxzy/warn/service/TestService.java b/src/main/java/com/fxzy/warn/service/TestService.java index 35bd5be..0e36d15 100644 --- a/src/main/java/com/fxzy/warn/service/TestService.java +++ b/src/main/java/com/fxzy/warn/service/TestService.java @@ -6,7 +6,7 @@ import com.fxzy.warn.common.request.RequestParameter; import com.fxzy.warn.model.Test; /** - * @author yuyantian + * @author zhangjing * @date 2023/10/16 18:17 * @description */ diff --git a/src/main/java/com/fxzy/warn/service/UserService.java b/src/main/java/com/fxzy/warn/service/UserService.java new file mode 100644 index 0000000..458bb0a --- /dev/null +++ b/src/main/java/com/fxzy/warn/service/UserService.java @@ -0,0 +1,76 @@ +package com.fxzy.warn.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fxzy.warn.common.request.RequestParameter; +import com.fxzy.warn.common.response.ApiResponse; +import com.fxzy.warn.model.Test; +import com.fxzy.warn.model.User; + +/** + * @author zhangjing + * @date 2024/12/04 14:49 + * @description + */ +public interface UserService extends IService { + + + + + /** + * + * 登录 + * @param jsonObject + * @return com.fxzy.warn.common.response.ApiResponse + * @author zhangjing + * @create 2024/12/4 + **/ + ApiResponse sendCode(JSONObject jsonObject); + /** + * + * 登录 + * @param jsonObject + * @return com.fxzy.warn.common.response.ApiResponse + * @author zhangjing + * @create 2024/12/4 + **/ + ApiResponse login(JSONObject jsonObject); + + /** + * + * 创建用户 + * @param entity + * @return com.fxzy.warn.common.response.ApiResponse + * @author zhangjing + * @create 2024/12/4 + **/ + ApiResponse createUser(User entity,String ticket); + + /** + * 保存 + * @param entity + * @return + */ + boolean saveModel(User entity); + + /** + * 修改 + * @param entity + * @return + */ + boolean updateModel(User entity); + + /** + * 删除 + * @param entity + * @return + */ + boolean deleteModel(User entity); + /** + * 分页查询 + * @param parameter + * @return + */ + Page queryPage(RequestParameter parameter); +} diff --git a/src/main/java/com/fxzy/warn/service/impl/TestServiceImpl.java b/src/main/java/com/fxzy/warn/service/impl/TestServiceImpl.java index 402b284..cd692f9 100644 --- a/src/main/java/com/fxzy/warn/service/impl/TestServiceImpl.java +++ b/src/main/java/com/fxzy/warn/service/impl/TestServiceImpl.java @@ -10,7 +10,7 @@ import com.fxzy.warn.service.TestService; import org.springframework.stereotype.Service; /** - * @author yuyantian + * @author zhangjing * @date 2023/10/16 18:17 * @description */ diff --git a/src/main/java/com/fxzy/warn/service/impl/UserServiceImpl.java b/src/main/java/com/fxzy/warn/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..4c73756 --- /dev/null +++ b/src/main/java/com/fxzy/warn/service/impl/UserServiceImpl.java @@ -0,0 +1,161 @@ +package com.fxzy.warn.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fxzy.warn.common.constants.ResponseMsgConstants; +import com.fxzy.warn.common.constants.UserConstants; +import com.fxzy.warn.common.request.RequestParameter; +import com.fxzy.warn.common.response.ApiResponse; +import com.fxzy.warn.common.util.RedisUtil; +import com.fxzy.warn.common.util.SMSUtils; +import com.fxzy.warn.mapper.UserMapper; +import com.fxzy.warn.model.User; +import com.fxzy.warn.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.Random; + +/** + * @author zhangjing + * @date 2024/12/04 14:51 + * @description + */ +@Service +public class UserServiceImpl extends ServiceImpl implements + UserService { + @Autowired + private RedisUtil redisUtil; + + @Value("${ali.accessKeyId}") + private String accessKeyId; + + @Value("${ali.secret}") + private String secret; + @Override + public ApiResponse sendCode(JSONObject jsonObject) { + ApiResponse response = new ApiResponse(); + //账户名:手机号 + String phoneNumber = jsonObject.getString("phoneNumber"); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("phone_number", phoneNumber); + //用户是否存在 + User user = getOne(queryWrapper); + if (user == null) { + response.recordError(ResponseMsgConstants.USER_NOT_FOUND); + return response; + } + String number = redisUtil.getString("code:"+phoneNumber); + if (number != null) { + response.recordError(ResponseMsgConstants.CODE_SENT_SUCCESSFULLY); + return response; + } + //生成6为随机验证码 + number = String.format("%06d", new Random().nextInt(1000000)); + //存Redis + redisUtil.setString("code:"+phoneNumber,number,60*5); + SMSUtils.sendMessage("","","","",accessKeyId,secret); + return response; + } + + @Override + public ApiResponse login(JSONObject jsonObject) { + ApiResponse response = new ApiResponse(); + //登录类型:1账户密码登录,2:手机短信验证码登录 + Integer loginType = jsonObject.getInteger("loginType"); + //账户名:手机号 + String phoneNumber = jsonObject.getString("phoneNumber"); + //密码 + String password = jsonObject.getString("password"); + //验证码 + String code = jsonObject.getString("code"); + if (loginType.equals(UserConstants.SMS_CAPTCHA_LOGIN)){ + //验证码登录 + String number = redisUtil.getString("code:"+phoneNumber); + if (number == null) { + response.recordError(ResponseMsgConstants.CODE_EXPIRED_PLEASE_RESEND); + return response; + } + //登录成功 + if (number.equals(code)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("phone_number", phoneNumber); + User user = getOne(queryWrapper); + response.setData(user); + } + }else { + //密码登录 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("phone_number", phoneNumber); + User user = getOne(queryWrapper); + if (user == null) { + response.recordError(ResponseMsgConstants.USER_NOT_FOUND); + return response; + } + if (!user.getPassword().equals(password)){ + response.recordError(ResponseMsgConstants.PASSWORD_ERROR); + return response; + } + response.setData(user); + } + + return response; + } + + @Override + public ApiResponse createUser(User entity, String ticket) { + ApiResponse response = new ApiResponse(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("phone_number", entity.getPhoneNumber()); + //用户是否存在 + User user = getOne(queryWrapper); + if (user!=null){ + response.recordError(ResponseMsgConstants.USER_PHONE_EXIST); + return response; + } + save(entity); + return response; + } + + @Override + public boolean saveModel(User entity) { + boolean result = this.save(entity); + return result; + } + + @Override + public boolean updateModel(User entity) { + boolean result = this.updateById(entity); + return result; + } + + @Override + public boolean deleteModel(User entity) { + boolean result = this.removeById(entity); + + return result; + } + + @Override + public Page queryPage(RequestParameter parameter) { + User entity = parameter.getParameter().toJavaObject(User.class); + Page page = new Page(parameter.getCurrent(), parameter.getSize()); + page.setSearchCount(true); + page.setOptimizeCountSql(true); + QueryWrapper eWrapper = new QueryWrapper(entity); + Page result = this.page(page, eWrapper); + setInfo(result); + return result; + } + + private void setInfo(Page result) { + for (User user : result.getRecords()) { + // 这里可以添加需要返回的字段的填充 + + } + } +} + diff --git a/src/main/resources/bootstrap-dev.yml b/src/main/resources/bootstrap-dev.yml index 708ffb1..a0a9e69 100644 --- a/src/main/resources/bootstrap-dev.yml +++ b/src/main/resources/bootstrap-dev.yml @@ -1,12 +1,13 @@ server: - port: 12104 + port: 12000 spring: datasource: - driver-class-name: com.kingbase8.Driver - url: jdbc:kingbase8://47.109.88.209:54321/gas?currentSchema=gas_service_db - username: root - password: zjtc321! + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://182.151.8.209:3306/fkzy_operation?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2b8&allowMultiQueries=true + username: gitea + password: Zjtc!@#0804 druid: #配置初始化连接数大小 initial-size: 50 @@ -19,7 +20,7 @@ spring: #Redis redis: - host: 47.109.88.209 + host: 182.151.63.212 port: 63799 password: zjtc321! pool: @@ -43,12 +44,17 @@ mybatis-plus: call-setters-on-nulls: true minio: - host: http://47.109.88.209:9000 + host: http://182.151.8.209:9000 url: ${minio.host}/${minio.bucket}/ access-key: zjtc secret-key: zjtc321! bucket: cert +ali: + accessKeyId: http://182.151.8.209:8081/gas_apportal/publicApi/auth/logout + secret: http://182.151.8.209:8081/gas_apportal/menu/getMenuByUserId + + file: #附件上传盘符,liunx服务器需要切换 fileUploadRootPath: D:/