| @@ -58,15 +58,15 @@ public class WxCUserController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "用户管理-删除") | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCUserController::delete"); | |||||
| wxCUserService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| // @ApiOperation("根据id删除接口") | |||||
| // @GetMapping("/del") | |||||
| // @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| // @SystemControllerLog(description = "用户管理-删除") | |||||
| // public ResultData delete(Long id) { | |||||
| // logger.debug("[" + getIpAddr() + "] WxCUserController::delete"); | |||||
| // wxCUserService.deleteById(id); | |||||
| // return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| // } | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @@ -74,7 +74,7 @@ public class WxCUserController extends BaseController { | |||||
| @SystemControllerLog(description = "用户管理-查询") | @SystemControllerLog(description = "用户管理-查询") | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserController::findById"); | logger.debug("[" + getIpAddr() + "] WxCUserController::findById"); | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserService.getById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -20,6 +20,8 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||||
| WxCUser findByToken(@Param("token")String token,@Param("tenantId")String tenantId); | WxCUser findByToken(@Param("token")String token,@Param("tenantId")String tenantId); | ||||
| WxCUser selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| long findCount(WxCUserBasicInfoDto dto); | long findCount(WxCUserBasicInfoDto dto); | ||||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | ||||
| @@ -30,7 +30,7 @@ public interface WxCUserService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCUser getById(Long id); | |||||
| WxCUser getById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 根据openId获得实体 | * 根据openId获得实体 | ||||
| @@ -89,7 +89,7 @@ public interface WxCUserService { | |||||
| * | * | ||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | |||||
| //void deleteById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 统计数量 | * 统计数量 | ||||
| @@ -62,8 +62,8 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCUser getById(Long id) { | |||||
| return wxCUserMapper.selectById(id); | |||||
| public WxCUser getById(Long id,String tenantId) { | |||||
| return wxCUserMapper.selectById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -215,10 +215,10 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCUserMapper.deleteById(id); | |||||
| } | |||||
| // @Override | |||||
| // public void deleteById(Long id,String tenantId) { | |||||
| // wxCUserMapper.deleteById(id,tenantId); | |||||
| // } | |||||
| @Override | @Override | ||||
| public long findCount(WxCUserBasicInfoDto dto) { | public long findCount(WxCUserBasicInfoDto dto) { | ||||
| @@ -288,7 +288,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| basicInfo.setLoginCount(loingcount+1); | basicInfo.setLoginCount(loingcount+1); | ||||
| wxCUserBasicInfoService.update(basicInfo); | wxCUserBasicInfoService.update(basicInfo); | ||||
| } | } | ||||
| WxCUser wxCUser = getById(user.getId()); | |||||
| WxCUser wxCUser = getById(user.getId(),user.getTenantId()); | |||||
| if (wxCUser != null) { | if (wxCUser != null) { | ||||
| WxCUser cUser = new WxCUser(); | WxCUser cUser = new WxCUser(); | ||||
| cUser.setId(user.getId()); | cUser.setId(user.getId()); | ||||
| @@ -298,22 +298,22 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, wxCUser); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_LOGIN, wxCUser); | ||||
| } | } | ||||
| // 用户从unionId来的,可能会有重复 | // 用户从unionId来的,可能会有重复 | ||||
| if(findByUnionId != null) { | |||||
| if(findByUnionId) { | |||||
| WxCUser userQ = new WxCUser(); | |||||
| userQ.setOpenAppId(user.getAppId()); | |||||
| userQ.setOpenId(user.getOpenId()); | |||||
| List<WxCUser> userList = wxCUserMapper.findList(userQ); | |||||
| if(userList.size() > 1) { | |||||
| for(WxCUser tempUser: userList) { | |||||
| if(tempUser.getUnionId() == null) { | |||||
| // 删除 无unionId的用户 | |||||
| wxCUserMapper.deleteById(tempUser.getId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // if(findByUnionId != null) { | |||||
| // if(findByUnionId) { | |||||
| // WxCUser userQ = new WxCUser(); | |||||
| // userQ.setOpenAppId(user.getAppId()); | |||||
| // userQ.setOpenId(user.getOpenId()); | |||||
| // List<WxCUser> userList = wxCUserMapper.findList(userQ); | |||||
| // if(userList.size() > 1) { | |||||
| // for(WxCUser tempUser: userList) { | |||||
| // if(tempUser.getUnionId() == null) { | |||||
| // // 删除 无unionId的用户 | |||||
| // wxCUserMapper.deleteById(tempUser.getId()); | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| String key = Constant.tokenPrev + user.getToken(); | String key = Constant.tokenPrev + user.getToken(); | ||||
| if(baseCUserTokenRedisTemplate.hasKey(key)){ | if(baseCUserTokenRedisTemplate.hasKey(key)){ | ||||
| baseCUserTokenRedisTemplate.delete(key); | baseCUserTokenRedisTemplate.delete(key); | ||||
| @@ -35,7 +35,7 @@ public class FmInsideCLoginMsgServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception { | public void send(BaseMsg baseMsg) throws Exception { | ||||
| FmInsideCLoginMsg msg = (FmInsideCLoginMsg)baseMsg; | FmInsideCLoginMsg msg = (FmInsideCLoginMsg)baseMsg; | ||||
| WxCUser user = userService.getById(msg.getCUserId()); | |||||
| WxCUser user = userService.getById(msg.getCUserId(),msg.getTenantId()); | |||||
| if(user == null) { | if(user == null) { | ||||
| logger.error("用户ID未找到: " + msg.getCUserId()); | logger.error("用户ID未找到: " + msg.getCUserId()); | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户ID未找到" + msg.getCUserId()); | throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户ID未找到" + msg.getCUserId()); | ||||
| @@ -240,10 +240,14 @@ | |||||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | ||||
| </select> | </select> | ||||
| <select id="findByToken" resultMap="BaseResultMap"> | |||||
| <select id="findByToken" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from wx_c_user | select <include refid="allColumns"/> from wx_c_user | ||||
| where `token` = #{token} and `tenant_id` = #{tenantId} | where `token` = #{token} and `tenant_id` = #{tenantId} | ||||
| </select> | </select> | ||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from wx_c_user where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| select count(id) from wx_c_user where 1=1 | select count(id) from wx_c_user where 1=1 | ||||