diff --git a/hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java b/hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java index 096f3fe6..616cb572 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java @@ -93,9 +93,6 @@ public class ApiMerchantsController { public ResponseData getListApiMerchantByAll(HttpServletRequest request) { try { - SessionObject sessionObject = userCenter.getSessionObject(request); - UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - Map map = new HashMap<>(); map.put("status", 100); @@ -162,7 +159,6 @@ public class ApiMerchantsController { ApiMerchants merchants = apiMerchantsService.findById(apiMerchants.getId()); if (StringUtils.isBlank(apiMerchants.getMerchantName()) - || StringUtils.isBlank(apiMerchants.getPhone()) || StringUtils.isBlank(apiMerchants.getUserName()) || apiMerchants.getId() == null ) { @@ -174,7 +170,7 @@ public class ApiMerchantsController { merchants.setOperatorName(userInfoModel.getSecUser().getUserName()); merchants.setUpdateTime(new Date()); merchants.setMerchantName(apiMerchants.getMerchantName()); - merchants.setPhone(apiMerchants.getPhone()); + merchants.setPhone(merchants.getPhone()); merchants.setUserName(apiMerchants.getUserName()); apiMerchantsService.updateApiMerchants(merchants); diff --git a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java index af6de63d..571c006d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java @@ -71,6 +71,9 @@ public class LoginController { @Resource private HighGasStaffService gasStaffService; + @Resource + private ApiMerchantsService apiMerchantsService; + @RequestMapping(value="/userLogin",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "机构用户登录({'loginName':'','password':''})") @@ -232,6 +235,19 @@ public class LoginController { throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_STORE_NOF_FOUND, ""); } userInfoModel.setMerchantStore(merchantStore); + } else if (secUser.getObjectType() == 21) { + // 查询APi + ApiMerchants apiMerchants = apiMerchantsService.findById(secUser.getObjectId()); + if(apiMerchants == null){ + log.error("login error!","当前账户不存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前账户不存在"); + } + if(apiMerchants.getStatus() != 100) { + log.error("login error!","账户状态异常,请联系管理员"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "账户状态异常,请联系管理员"); + } + userInfoModel.setApiMerchants(apiMerchants); + } else { log.error("login error!","用户信息错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); diff --git a/hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java b/hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java index dc45a1ad..d126df87 100644 --- a/hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java +++ b/hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java @@ -13,6 +13,7 @@ public enum UserObjectTypeEnum { type6(6, "团油代理商"), type7(7, "团油业务员"), type8(8, "加油站员工"), + type21(21, "API商户角色"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/model/UserInfoModel.java b/hai-service/src/main/java/com/hai/model/UserInfoModel.java index ab991381..b150ad97 100644 --- a/hai-service/src/main/java/com/hai/model/UserInfoModel.java +++ b/hai-service/src/main/java/com/hai/model/UserInfoModel.java @@ -36,6 +36,8 @@ public class UserInfoModel { private HighTySalesman highTySalesman; // 加油站员工 private HighGasStaff gasStaff; + // APi商户角色 + private ApiMerchants apiMerchants; // 权限列表 private List permissionList; // 菜单权限列表 @@ -133,7 +135,16 @@ public class UserInfoModel { this.highAgent = highAgent; } - public HighTyAgent getHighTyAgent() { + + public ApiMerchants getApiMerchants() { + return apiMerchants; + } + + public void setApiMerchants(ApiMerchants apiMerchants) { + this.apiMerchants = apiMerchants; + } + + public HighTyAgent getHighTyAgent() { return highTyAgent; } diff --git a/hai-service/src/main/java/com/hai/service/ApiMerchantsService.java b/hai-service/src/main/java/com/hai/service/ApiMerchantsService.java index 0ba4971a..0db8576e 100644 --- a/hai-service/src/main/java/com/hai/service/ApiMerchantsService.java +++ b/hai-service/src/main/java/com/hai/service/ApiMerchantsService.java @@ -27,7 +27,7 @@ public interface ApiMerchantsService { * @Param [com.alibaba.fastjson.JSONObject] * @return void */ - void insertApiMerchants(ApiMerchants apiMerchants); + void insertApiMerchants(ApiMerchants apiMerchants) throws Exception ; /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java index 2f7a7b34..77f43d7b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java @@ -4,14 +4,17 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.UserCenter; +import com.hai.common.utils.MD5Util; import com.hai.common.utils.RedisUtil; import com.hai.dao.ApiAmountRecordMapper; import com.hai.dao.ApiMerchantsMapper; import com.hai.dao.ApiProductConfigMapper; import com.hai.entity.*; +import com.hai.enum_type.UserObjectTypeEnum; import com.hai.model.ApiProductConfigModel; import com.hai.model.UserInfoModel; import com.hai.service.ApiMerchantsService; +import com.hai.service.SecUserService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; @@ -42,9 +45,31 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService { @Resource private ApiProductConfigMapper apiProductConfigMapper; + @Resource + private SecUserService secUserService; + @Override - public void insertApiMerchants(ApiMerchants apiMerchants) { + @Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW) + public void insertApiMerchants(ApiMerchants apiMerchants) throws Exception { + + if (secUserService.findByLoginName(apiMerchants.getPhone()) != null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换"); + } + apiMerchantsMapper.insert(apiMerchants); + + SecUser secUser = new SecUser(); + secUser.setUserName(apiMerchants.getUserName()); + secUser.setLoginName(apiMerchants.getPhone()); + secUser.setPassword(MD5Util.encode("123456".getBytes())); + secUser.setAdminFlag(1); + secUser.setStatus(1); + secUser.setRoleId(103L); + secUser.setObjectType(UserObjectTypeEnum.type21.getType()); + secUser.setObjectId(apiMerchants.getId()); + secUser.setCreateTime(new Date()); + secUser.setUpdateTime(new Date()); + secUserService.addUser(secUser); } @Override diff --git a/hai-user/target/classes/application.yml b/hai-user/target/classes/application.yml new file mode 100644 index 00000000..b57983f1 --- /dev/null +++ b/hai-user/target/classes/application.yml @@ -0,0 +1,102 @@ +server: + port: 9305 + servlet: + context-path: /user + +#配置是否为debug模式,debug模式下,不开启权限校验 +debug: false + +#datasource数据源设置 +spring: + datasource: + url: jdbc:mysql://139.159.177.244:3306/hsg_order?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: root + password: HF123456. + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.jdbc.Driver + filters: stat + maxActive: 10 + initialSize: 5 + maxWait: 60000 + minIdle: 5 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + redis: + database: 0 + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + timeout: 1000 + jedis: + pool: + max-active: 20 + max-wait: -1 + max-idle: 10 + min-idle: 0 + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://139.159.177.244:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: 123654 + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic +rocketmq: + name-server: 139.159.177.244:9876 + producer: + #必须指定group + group: default-group + + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true +mybatis: + mapperLocations: + - classpath*:sqlmap*/*.xml + type-aliases-package: + org.springboot.sample.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #开启MyBatis的二级缓存 + cache-enabled: true + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/hai-user/target/classes/com/UserApplication.class b/hai-user/target/classes/com/UserApplication.class new file mode 100644 index 00000000..de55c451 Binary files /dev/null and b/hai-user/target/classes/com/UserApplication.class differ diff --git a/hai-user/target/classes/com/web/config/AuthConfig$1.class b/hai-user/target/classes/com/web/config/AuthConfig$1.class new file mode 100644 index 00000000..11fb76d4 Binary files /dev/null and b/hai-user/target/classes/com/web/config/AuthConfig$1.class differ diff --git a/hai-user/target/classes/com/web/config/AuthConfig.class b/hai-user/target/classes/com/web/config/AuthConfig.class new file mode 100644 index 00000000..ef3f953b Binary files /dev/null and b/hai-user/target/classes/com/web/config/AuthConfig.class differ diff --git a/hai-user/target/classes/com/web/config/ConfigListener.class b/hai-user/target/classes/com/web/config/ConfigListener.class new file mode 100644 index 00000000..95f422b6 Binary files /dev/null and b/hai-user/target/classes/com/web/config/ConfigListener.class differ diff --git a/hai-user/target/classes/com/web/config/CorsConfig.class b/hai-user/target/classes/com/web/config/CorsConfig.class new file mode 100644 index 00000000..c0c440d8 Binary files /dev/null and b/hai-user/target/classes/com/web/config/CorsConfig.class differ diff --git a/hai-user/target/classes/com/web/config/MultipartConfig.class b/hai-user/target/classes/com/web/config/MultipartConfig.class new file mode 100644 index 00000000..67aaa89d Binary files /dev/null and b/hai-user/target/classes/com/web/config/MultipartConfig.class differ diff --git a/hai-user/target/classes/com/web/config/RedisConfig.class b/hai-user/target/classes/com/web/config/RedisConfig.class new file mode 100644 index 00000000..2062df51 Binary files /dev/null and b/hai-user/target/classes/com/web/config/RedisConfig.class differ diff --git a/hai-user/target/classes/com/web/config/SentinelFilterConfig.class b/hai-user/target/classes/com/web/config/SentinelFilterConfig.class new file mode 100644 index 00000000..ee4c9c71 Binary files /dev/null and b/hai-user/target/classes/com/web/config/SentinelFilterConfig.class differ diff --git a/hai-user/target/classes/com/web/config/SwaggerConfig.class b/hai-user/target/classes/com/web/config/SwaggerConfig.class new file mode 100644 index 00000000..1825d5f6 Binary files /dev/null and b/hai-user/target/classes/com/web/config/SwaggerConfig.class differ diff --git a/hai-user/target/classes/com/web/config/SysConfig.class b/hai-user/target/classes/com/web/config/SysConfig.class new file mode 100644 index 00000000..ff9e4abc Binary files /dev/null and b/hai-user/target/classes/com/web/config/SysConfig.class differ diff --git a/hai-user/target/classes/com/web/config/SysConst.class b/hai-user/target/classes/com/web/config/SysConst.class new file mode 100644 index 00000000..ee6e3112 Binary files /dev/null and b/hai-user/target/classes/com/web/config/SysConst.class differ diff --git a/hai-user/target/classes/com/web/config/WxMaConfiguration.class b/hai-user/target/classes/com/web/config/WxMaConfiguration.class new file mode 100644 index 00000000..57bd17a6 Binary files /dev/null and b/hai-user/target/classes/com/web/config/WxMaConfiguration.class differ diff --git a/hai-user/target/classes/com/web/controller/DiscountController.class b/hai-user/target/classes/com/web/controller/DiscountController.class new file mode 100644 index 00000000..71fc34f2 Binary files /dev/null and b/hai-user/target/classes/com/web/controller/DiscountController.class differ diff --git a/hai-user/target/classes/com/web/controller/LoginController.class b/hai-user/target/classes/com/web/controller/LoginController.class new file mode 100644 index 00000000..e1045fba Binary files /dev/null and b/hai-user/target/classes/com/web/controller/LoginController.class differ diff --git a/hai-user/target/classes/com/web/controller/LoginLogController.class b/hai-user/target/classes/com/web/controller/LoginLogController.class new file mode 100644 index 00000000..0b1c980f Binary files /dev/null and b/hai-user/target/classes/com/web/controller/LoginLogController.class differ diff --git a/hai-user/target/classes/com/web/controller/SmsController.class b/hai-user/target/classes/com/web/controller/SmsController.class new file mode 100644 index 00000000..5445c7c0 Binary files /dev/null and b/hai-user/target/classes/com/web/controller/SmsController.class differ diff --git a/hai-user/target/classes/com/web/controller/TestController.class b/hai-user/target/classes/com/web/controller/TestController.class new file mode 100644 index 00000000..831bb6d8 Binary files /dev/null and b/hai-user/target/classes/com/web/controller/TestController.class differ diff --git a/hai-user/target/classes/com/web/controller/UserController.class b/hai-user/target/classes/com/web/controller/UserController.class new file mode 100644 index 00000000..fbcd8c02 Binary files /dev/null and b/hai-user/target/classes/com/web/controller/UserController.class differ diff --git a/hai-user/target/classes/com/web/type/LoginType.class b/hai-user/target/classes/com/web/type/LoginType.class new file mode 100644 index 00000000..71e562bb Binary files /dev/null and b/hai-user/target/classes/com/web/type/LoginType.class differ diff --git a/hai-user/target/classes/config.properties b/hai-user/target/classes/config.properties new file mode 100644 index 00000000..78e36477 --- /dev/null +++ b/hai-user/target/classes/config.properties @@ -0,0 +1,5 @@ + +wxMiniAppId=wx8d49e2f83025229d +wxMiniAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +fileUrl=/home/project/hsg/filesystem diff --git a/hai-user/target/classes/logback.xml b/hai-user/target/classes/logback.xml new file mode 100644 index 00000000..8d23e06c --- /dev/null +++ b/hai-user/target/classes/logback.xml @@ -0,0 +1,93 @@ + + + + + %d %p (%file:%line\)- %m%n + UTF-8 + + + + log/base.log + + log/base.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/dao.log + + log/dao.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/error.log + + log/error.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + + + + + + + + + + log/ChongQingCNPCService.log + + log/ChongQingCNPCService.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/hai-user/target/hai-user-1.0-SNAPSHOT.jar b/hai-user/target/hai-user-1.0-SNAPSHOT.jar new file mode 100644 index 00000000..f97a08fc Binary files /dev/null and b/hai-user/target/hai-user-1.0-SNAPSHOT.jar differ diff --git a/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original b/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original new file mode 100644 index 00000000..3397a7a9 Binary files /dev/null and b/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original differ diff --git a/hai-user/target/maven-archiver/pom.properties b/hai-user/target/maven-archiver/pom.properties new file mode 100644 index 00000000..dd7478c0 --- /dev/null +++ b/hai-user/target/maven-archiver/pom.properties @@ -0,0 +1,4 @@ +#Created by Apache Maven 3.8.2 +version=1.0-SNAPSHOT +groupId=com.hsg +artifactId=hai-user diff --git a/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 00000000..5463c603 --- /dev/null +++ b/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,19 @@ +com/web/config/ConfigListener.class +com/web/config/SysConfig.class +com/web/type/LoginType.class +com/web/controller/LoginController.class +com/web/controller/UserController.class +com/web/config/AuthConfig$1.class +com/web/controller/TestController.class +com/web/config/SentinelFilterConfig.class +com/web/config/WxMaConfiguration.class +com/web/config/RedisConfig.class +com/web/controller/SmsController.class +com/web/config/SysConst.class +com/web/controller/DiscountController.class +com/web/config/CorsConfig.class +com/UserApplication.class +com/web/controller/LoginLogController.class +com/web/config/MultipartConfig.class +com/web/config/SwaggerConfig.class +com/web/config/AuthConfig.class diff --git a/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 00000000..f9c06f43 --- /dev/null +++ b/hai-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,18 @@ +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/RedisConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/LoginController.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/WxMaConfiguration.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/SentinelFilterConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/SwaggerConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/AuthConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/ConfigListener.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/SysConst.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/TestController.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/UserApplication.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/SmsController.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/UserController.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/MultipartConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/LoginLogController.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/type/LoginType.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/CorsConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/config/SysConfig.java +/Volumes/work/code/high-work/high-service/hai-user/src/main/java/com/web/controller/DiscountController.java