|
@@ -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();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|