ソースを参照

记录分享来源

zsf 1 年間 前
コミット
b04055c3b7

+ 1 - 1
src/main/java/com/rf/psychological/filter/JWTInterceptorPublicConfig.java

@@ -38,7 +38,7 @@ public class JWTInterceptorPublicConfig implements WebMvcConfigurer {
         String[] wxPay = new String[]{"/api/wx-pay/native/notify","/api/wx-pay/refunds/notify",
                 "/api/wx-pay/getPhone/*","/api/wx-pay/code2openid","/api/wx-pay/h5Pay",
                 "/api/wx-pay/code2openid2","/api/wx-pay/queryOrder/**","/api/promotionInfo/queryPromotionDetail/**","/getWeiboRecordById/**"};
-        String[] systemApi = new String[]{"/system/login","/system/loginH5","/system/forgotPassword","/system/registerUser"};
+        String[] systemApi = new String[]{"/system/login","/system/loginH5","/system/forgotPassword","/system/registerUser","/system/temporaryUser"};
         String[] temporarily = new String []{"/category/**","/api/wx-pay/**","/api/wx-pay/code2openid","/api/wx-pay/code2openid2"};
         registry.addInterceptor(jwtInterceptor)
                 .addPathPatterns("/**")

+ 0 - 2
src/main/java/com/rf/psychological/rest/ServerController.java

@@ -907,8 +907,6 @@ public class ServerController extends BaseController {
             });
         }
         ScaleDetailsEntity scaleDetailsEntity = this.scaleDetailsService.getSubjectDetailsByFlag(flag);
-        scaleDetailsEntity.setDescription(subjectEntityList.get(0).getDescription());
-        scaleDetailsEntity.setName(subjectEntityList.get(0).getName());
         scaleDetailsEntity.setTestNum(subjectEntityList.get(0).getTestNum());
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("subjectEntityDto2List", subjectEntityDto2List);

+ 3 - 6
src/main/java/com/rf/psychological/scale/dao/model/ScaleDetailsEntity.java

@@ -28,6 +28,9 @@ public class ScaleDetailsEntity extends BaseEntity {
     @Column(name = "flag", columnDefinition = "varchar(50) comment '标识:所属量表'")
     private String flag;
 
+    @Column(name = "scale_name", columnDefinition = "varchar(50) comment '量表名称'")
+    private String scaleName;
+
     @Column(name = "evaluation_introduction", columnDefinition = "text comment '测评介绍(暂时不用)'")
     private String evaluationIntroduction;
 
@@ -58,12 +61,6 @@ public class ScaleDetailsEntity extends BaseEntity {
     @Column(name = "dimension_introduction", columnDefinition = "text comment '维度介绍'")
     private String dimensionIntroduction;
 
-    @Transient
-    private String description;//测评介绍
-
-    @Transient
-    private String name;//用户名称
-
     @Transient
     private int testNum;//测试次数
 

+ 2 - 0
src/main/java/com/rf/psychological/scale/dao/model/ScaleExternalSourceEntity.java

@@ -32,6 +32,8 @@ public class ScaleExternalSourceEntity extends BaseEntity {
     private String flag;
     @Column(name = "user_id",columnDefinition = "varchar(36) not null comment '关联用户id'")
     private String userId;
+    @Column(name = "result_id",columnDefinition = "varchar(36) not null comment '报告Id'")
+    private String resultId;
     @Column(name = "create_time",columnDefinition = "timestamp default current_timestamp comment '创建时间'")
     private Date createTime;
     @Column(name = "update_time",columnDefinition = "timestamp comment '更新时间'")

+ 28 - 37
src/main/java/com/rf/psychological/scale/rest/ScaleExternalSourceController.java

@@ -1,5 +1,6 @@
 package com.rf.psychological.scale.rest;
 
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.rf.psychological.base.rest.BaseController;
 import com.rf.psychological.enums.UserRole;
@@ -46,6 +47,8 @@ public class ScaleExternalSourceController extends BaseController {
     @Autowired
     private PromotionInfoService promotionInfoService;
 
+
+
     /**
      * 添加量表类别信息
      *
@@ -54,43 +57,31 @@ public class ScaleExternalSourceController extends BaseController {
     @SafetyProcess
     @PostMapping("/save")
     @ApiOperation(value = "量表外部来源信息--保存")
-    public Result saveScaleExternalSource(@RequestBody String json) throws Exception {
-        String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
-        JSONObject jsonObject = JSONObject.parseObject(data);
-        System.out.println("----------------result-------------------");
-        System.out.println(jsonObject);
-        String uid = jsonObject.getString("uid");
-        int source = jsonObject.getInteger("source");
-        String flag = jsonObject.getString("flag");
-        //注册
-        UserEntity userEntity = new UserEntity();
-        userEntity.setPassword("-");
-        userEntity.setGId(this.groupInfoService.findGroupByInstitutionNoAndName(Constant.WEB_INSTITUTION_CODE,Constant.DEFAULT_GROUP_NAME).getId());
-        //userEntity.setGId("8af178858112f400018112f56b220557");
-        userEntity.setInstitutionName(Constant.WEB_INSTITUTION_NAME);
-        userEntity.setInstitutionNo(Constant.WEB_INSTITUTION_CODE);
-        userEntity.setUserStatus(Constant.USER_STATUS_NORMAL);
-        userEntity.setBirthday("-");
-        userEntity.setGender("-");
-        userEntity.setPetName("游离用户");
-        userEntity.setProfession("-");
-        userEntity.setAdditionInfo("游离用户");
-        userEntity.setPhone(SnowFlakeUtil.getNextId());
-        userEntity.setRoleType(UserRole.COMMON.getType());
-        userEntity = this.userService.save(userEntity);
-        ScaleExternalSourceEntity scaleExternalSourceEntity = new ScaleExternalSourceEntity();
-        scaleExternalSourceEntity.setUid(uid);
-        scaleExternalSourceEntity.setSource(source);
-        scaleExternalSourceEntity.setFlag(flag);
-        scaleExternalSourceEntity.setUserId(userEntity.getId());
-        this.scaleExternalSourceService.save(scaleExternalSourceEntity);
-
-        JSONObject resultJson = new JSONObject();
-        resultJson.put("token", JWTUtil.getTokenByUserInfo(userEntity));
-        resultJson.put("user",userEntity);
-        resultJson.put("type",userEntity.getRoleType());
-        log.info("响应消息:"+resultJson.toJSONString());
-        return success(resultJson);
+    public Result saveScaleExternalSource(@RequestBody String json)  {
+        try {
+            String data = AesEncryptUtils.decrypt(JSONObject.parseObject(json).getString("data"));
+            JSONObject jsonObject = JSONObject.parseObject(data);
+            System.out.println("----------------result-------------------");
+            System.out.println(jsonObject);
+            String uid = jsonObject.getString("uid");
+            int source = jsonObject.getInteger("source");
+            String flag = jsonObject.getString("flag");
+            String userId = jsonObject.getString("currentUserId");
+            String resultId = jsonObject.getString("resultId");
+            ScaleExternalSourceEntity scaleExternalSourceEntity = new ScaleExternalSourceEntity();
+            scaleExternalSourceEntity.setUid(uid);
+            scaleExternalSourceEntity.setSource(source);
+            scaleExternalSourceEntity.setFlag(flag);
+            scaleExternalSourceEntity.setUserId(userId);
+            scaleExternalSourceEntity.setResultId(resultId);
+            scaleExternalSourceEntity.setCreateTime(DateUtil.date());
+            this.scaleExternalSourceService.save(scaleExternalSourceEntity);
+            return success();
+        }catch (Exception e){
+            log.debug(e.getMessage());
+            return fail();
+        }
+
     }
 
     /**

+ 2 - 2
src/main/java/com/rf/psychological/security/SSLConfig.java

@@ -54,8 +54,8 @@ public class SSLConfig {
             connector.setRedirectPort(8848);
         } else if ("public".equals(profile)) {
             //101心理照相机公网版正式
-            connector.setPort(8081);
-            connector.setRedirectPort(8443);
+            connector.setPort(8084);
+            connector.setRedirectPort(8445);
         } else {
             //TODO 待定
             //112心理照相机

+ 31 - 13
src/main/java/com/rf/psychological/user/rest/SystemController.java

@@ -27,6 +27,7 @@ import com.rf.psychological.user.service.UserService;
 import com.rf.psychological.utils.Constant;
 import com.rf.psychological.utils.JWTUtil;
 import com.rf.psychological.utils.Result;
+import com.rf.psychological.utils.SnowFlakeUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -101,6 +102,36 @@ public class SystemController extends BaseController {
         String value = env.getActiveProfiles()[0];
         return success(systemService.getSystemVersion(),profileValue);
     }
+    @GetMapping("/temporaryUser")
+    @SafetyProcess
+    public Result temporaryUser(){
+       try {
+           //注册
+           UserEntity userEntity = new UserEntity();
+           userEntity.setPassword("-");
+           userEntity.setGId(this.groupInfoService.findGroupByInstitutionNoAndName(Constant.WEB_INSTITUTION_CODE,Constant.DEFAULT_GROUP_NAME).getId());
+           userEntity.setInstitutionName(Constant.WEB_INSTITUTION_NAME);
+           userEntity.setInstitutionNo(Constant.WEB_INSTITUTION_CODE);
+           userEntity.setUserStatus(Constant.USER_STATUS_NORMAL);
+           userEntity.setBirthday("-");
+           userEntity.setGender("-");
+           userEntity.setPetName("游离用户");
+           userEntity.setProfession("-");
+           userEntity.setAdditionInfo("游离用户");
+           userEntity.setPhone(SnowFlakeUtil.getNextId());
+           userEntity.setRoleType(UserRole.COMMON.getType());
+           userEntity = this.userService.save(userEntity);
+           JSONObject resultJson = new JSONObject();
+           resultJson.put("token", JWTUtil.getTokenByUserInfo(userEntity));
+           resultJson.put("user",userEntity);
+           resultJson.put("type",userEntity.getRoleType());
+           log.info("响应消息:"+resultJson.toJSONString());
+           return success(resultJson);
+       }catch (Exception e){
+           log.error(e.getMessage());
+           return fail();
+       }
+    }
 
 
     /**
@@ -150,19 +181,6 @@ public class SystemController extends BaseController {
                     return fail("","验证码不能为空");
                 }
                 String phone = userEntity.getPhone();
-//                JSONObject jsonVerification = jsonData.getJSONObject("verification");
-//                String jsonPhone = jsonVerification.getString("phone");
-//                String jsonAuthCode = jsonVerification.getString("authCode");
-//                String jsonBeginTime = jsonVerification.getString("beginTime");
-//                if (StringUtils.isEmpty(jsonBeginTime)  || StringUtils.isEmpty(jsonAuthCode) ) {
-//                    return fail("", "请重新获取验证码");
-//                }
-                //计算时间差---分钟
-                //int diff = DateUtil.getDistanceByUnit(DateUtil.parseDate(jsonBeginTime,DateUtil.ACCURACY_PATTERN_MINUTE), DateUtil.getCurrentDate(), 2);
-//                long diff = DateUtil.between(DateUtil.date(), DateUtil.parse(jsonBeginTime,PURE_DATETIME_PATTERN), DateUnit.MINUTE);
-//                if (diff < 0 || diff > 5) {
-//                    return fail("", "验证码已失效");
-//                }
                 String temp = redisTemplate.opsForValue().get("AUTH_CODE_"+phone);
                 if(StringUtils.isBlank(temp)){
                     return fail("请重新获取验证码");

+ 2 - 2
src/main/resources/config/application-public.yml

@@ -1,6 +1,6 @@
 #公网版
 server:
-  port: 8443
+  port: 8445
   address: 0.0.0.0
 
 #  ssl:
@@ -28,7 +28,7 @@ spring:
       repositories:
         enabled: false
   redis:
-    host: 127.0.0.1
+    host: 118.195.171.239
     port: 6379
     password: bjjmtech&jsyx
     database: 1