chunping пре 3 година
родитељ
комит
b519adc89c

+ 12 - 1
mp-admin/src/main/java/com/qs/mp/web/controller/api/common/UserController.java

@@ -4,6 +4,8 @@ import cn.jsms.api.ValidSMSResult;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.qs.mp.channel.domain.Channel;
+import com.qs.mp.channel.service.IChannelService;
 import com.qs.mp.common.constant.Constants;
 import com.qs.mp.common.core.domain.AjaxResult;
 import com.qs.mp.common.enums.UserIdentityEnum;
@@ -64,6 +66,9 @@ public class UserController extends BaseApiController {
   @Autowired
   private IWxAccountService wxAccountService;
 
+  @Autowired
+  private IChannelService channelService;
+
   @Value("${wx-channel.appId}")
   private String channelAppId;
   @Value("${wx-channel.appSecret}")
@@ -229,10 +234,16 @@ public class UserController extends BaseApiController {
   @RequestMapping(value = "/user/getLoginUserinfo", method = RequestMethod.POST)
   public AjaxResult getLoginUserinfo(@RequestBody JSONObject params) {
     LoginUser loginUser = hostHolder.getUser();
+
     JSONObject jsonObject = new JSONObject();
     jsonObject.put("userName", loginUser.getUsername());
     jsonObject.put("avatar", loginUser.getUser().getAvatar());
-    jsonObject.put("nickName", loginUser.getUser().getNickName());
+    if(loginUser.getIdentity() == UserIdentityEnum.CHANNEL) {
+      Channel channel = channelService.getById(loginUser.getChannelId());
+      jsonObject.put("nickName", channel.getName());
+    } else {
+      jsonObject.put("nickName", loginUser.getUser().getNickName());
+    }
     jsonObject.put("openId", loginUser.getUser().getOpenId());
     jsonObject.put("channelOpenId", loginUser.getUser().getChannelOpenId());
     JSONArray roleKeys = new JSONArray();

+ 4 - 4
mp-service/src/main/java/com/qs/mp/channel/service/impl/ChannelServiceImpl.java

@@ -68,7 +68,7 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 			SysUser sysUser = new SysUser();
 			sysUser.setUserName(channel.getMobile());
 		    sysUser.setPhonenumber(channel.getMobile());
-		    sysUser.setNickName(channel.getName());
+		    sysUser.setNickName(channel.getMobile());
 //		    sysUser.setDeptId(SecurityUtils.getDeptId());
 //			sysUser.setCreateBy(SecurityUtils.getUsername());
 			Long[] roleIds = new Long[1];
@@ -126,7 +126,7 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 	public int getChannelSiteCnt(String channelNo) {
 		return getBaseMapper().getChannelSiteCnt(channelNo);
 	}
-	
+
 	@Override
 	public ChannelVO getChannelVoById(Long channelId) {
 		return getBaseMapper().getChannelVoById(channelId);
@@ -158,6 +158,6 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 		// channelOperData.setNewUserCnt(newUserCnt);
 		return channelOperData;
 	}
-	
-	
+
+
 }