提交 ba67911a 作者: zhenjie

Merge branch 'develop'

...@@ -22,4 +22,6 @@ public class WebsiteRangeDTO implements Serializable { ...@@ -22,4 +22,6 @@ public class WebsiteRangeDTO implements Serializable {
private Double lon; private Double lon;
private Double lat; private Double lat;
private Double distance; private Double distance;
private String content;
private Integer score;
} }
package com.mmc.iuav.user.model.qo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/15 11:03
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserRcdQO implements Serializable {
private static final long serialVersionUID = 1561616165L;
@ApiModelProperty(value = "用户id不能为空", required = true, example = "1")
@NotNull(message = "用户id不能为空", groups = Page.class)
private Integer userAccountId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -20,6 +20,8 @@ import java.io.Serializable; ...@@ -20,6 +20,8 @@ import java.io.Serializable;
public class ApplyTagEditVO implements Serializable { public class ApplyTagEditVO implements Serializable {
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ApiModelProperty(value = "网点id")
private Integer websiteId;
@ApiModelProperty(value = "标签id") @ApiModelProperty(value = "标签id")
private Integer cooperationTagId; private Integer cooperationTagId;
@ApiModelProperty(value = "网点名称") @ApiModelProperty(value = "网点名称")
......
package com.mmc.iuav.user.model.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/7/17 10:00
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TopInviteVO implements Serializable {
private static final long serialVersionUID = 9208361817264837853L;
private Integer id;
private String uid;
private String phoneNum;
private String userName;
private String nickName;
private String userImg;
private Integer inviteCount;
}
...@@ -55,14 +55,14 @@ public class UserAccountVO implements Serializable { ...@@ -55,14 +55,14 @@ public class UserAccountVO implements Serializable {
private Date createTime; private Date createTime;
@ApiModelProperty(value = "企业认证状态, 0未通过,1通过") @ApiModelProperty(value = "企业认证状态, 0未通过,1通过")
private Integer companyAuthStatus; private Integer companyAuthStatus;
@ApiModelProperty(value = "合作标签id")
private Integer cooperationTagId;
@ApiModelProperty(value = "企业名称") @ApiModelProperty(value = "企业名称")
private String companyName; private String companyName;
@ApiModelProperty(value = "合作标签名称")
private String tagName;
@ApiModelProperty(value = "是否删除") @ApiModelProperty(value = "是否删除")
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "推荐伙伴个数")
private Integer inviteCount;
@ApiModelProperty(value = "用户合作标签") @ApiModelProperty(value = "用户合作标签")
private List<CooperationTagVO> cooperationTagVOS; private List<CooperationTagVO> cooperationTagVOS;
@ApiModelProperty(value = "上级推荐人")
private UserRcdVO userRcdVO;
} }
package com.mmc.iuav.user.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author: zj
* @Date: 2023/7/17 10:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserRcdVO implements Serializable {
private static final long serialVersionUID = 445983687443393839L;
private Integer id;
@ApiModelProperty(value = "用户id(推荐接受人)")
private Integer userAccountId;
@ApiModelProperty(value = "邀请人id")
private Integer rcdUserId;
@ApiModelProperty(value = "邀请人昵称")
private String rcdNickname;
@ApiModelProperty(value = "邀请人姓名")
private String rcdUserName;
private String remark;
private Date createTime;
}
...@@ -6,6 +6,7 @@ package com.mmc.iuav.response; ...@@ -6,6 +6,7 @@ package com.mmc.iuav.response;
*/ */
public enum ResultEnum implements BaseErrorInfoInterface { public enum ResultEnum implements BaseErrorInfoInterface {
SUCCESS("200", "success"), SUCCESS("200", "success"),
BODY_NOT_MATCH("400", "请求的数据格式不符"),
FAIL("500", "fail"), FAIL("500", "fail"),
PARAM_ERROR("400", "参数错误"), PARAM_ERROR("400", "参数错误"),
......
package com.mmc.iuav.user.auth; package com.mmc.iuav.user.auth;
import com.alibaba.fastjson2.JSONObject;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum; import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.util.PathUtil; import com.mmc.iuav.user.util.PathUtil;
...@@ -34,16 +33,16 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor { ...@@ -34,16 +33,16 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String requestURI = request.getRequestURI(); String requestURI = request.getRequestURI();
// //根据uri确认是否要拦截 // //根据uri确认是否要拦截
if (!shouldFilter(requestURI)){ if (!shouldFilter(requestURI)) {
return true; return true;
} }
String token = request.getHeader("token"); String token = request.getHeader("token");
if (StringUtils.isBlank(token)){ if (StringUtils.isBlank(token)) {
exceptionProcess(response); exceptionProcess(response);
return false; return false;
} }
String tokenJson = stringRedisTemplate.opsForValue().get(token); String tokenJson = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(tokenJson)){ if (StringUtils.isBlank(tokenJson)) {
exceptionProcess(response); exceptionProcess(response);
return false; return false;
} }
...@@ -80,9 +79,9 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor { ...@@ -80,9 +79,9 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor {
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
} }
public void exceptionProcess(HttpServletResponse response) throws Exception{ public void exceptionProcess(HttpServletResponse response) throws Exception {
response.setContentType("application/json;charset=utf-8"); response.setContentType("application/json;charset=utf-8");
PrintWriter writer=response.getWriter(); PrintWriter writer = response.getWriter();
writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString()); writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString());
writer.close(); writer.close();
} }
......
...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.controller; ...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.controller;
import com.mmc.iuav.group.Insert; import com.mmc.iuav.group.Insert;
import com.mmc.iuav.group.Update; import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.WebsiteRangeDTO;
import com.mmc.iuav.user.model.qo.ApplyQO; import com.mmc.iuav.user.model.qo.ApplyQO;
import com.mmc.iuav.user.model.vo.*; import com.mmc.iuav.user.model.vo.*;
import com.mmc.iuav.user.service.CooperationService; import com.mmc.iuav.user.service.CooperationService;
...@@ -71,13 +72,13 @@ public class CooperationController extends BaseController { ...@@ -71,13 +72,13 @@ public class CooperationController extends BaseController {
} }
@ApiOperation(value = "服务商网点数据") @ApiOperation(value = "服务商网点数据")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WebsiteRangeDTO.class)})
@GetMapping("service/bitmap") @GetMapping("service/bitmap")
public ResultBody listServiceBitmapData(@ApiParam(value = "类型 注:按照渠道标签的id传入即可") @RequestParam Integer type, public ResultBody<WebsiteRangeDTO> listServiceBitmapData(@ApiParam(value = "类型 注:按照渠道标签的id传入即可") @RequestParam Integer type,
@RequestParam Integer pageNo, @RequestParam Integer pageNo,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam Double lon, @RequestParam Double lon,
@RequestParam Double lat) { @RequestParam Double lat) {
return ResultBody.success(cooperationService.listServiceBitmapData(type, pageNo, pageSize, lon, lat)); return ResultBody.success(cooperationService.listServiceBitmapData(type, pageNo, pageSize, lon, lat));
} }
......
...@@ -5,6 +5,7 @@ import com.mmc.iuav.group.Update; ...@@ -5,6 +5,7 @@ import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO; import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.UserAccountQO; import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.qo.UserRcdQO;
import com.mmc.iuav.user.model.vo.UserAccountVO; import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.service.UserAccountService; import com.mmc.iuav.user.service.UserAccountService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -62,12 +63,13 @@ public class UserAccountController extends BaseController { ...@@ -62,12 +63,13 @@ public class UserAccountController extends BaseController {
return userAccountService.feignListUserAccountIds(provinceCode, cityCode, districtCode); return userAccountService.feignListUserAccountIds(provinceCode, cityCode, districtCode);
} }
@ApiOperation(value = "授权手机号") @ApiOperation(value = "授权手机号-裂变邀请")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("getUserPhoneNumber") @GetMapping("getUserPhoneNumber")
public ResultBody getUserPhoneNumber(HttpServletRequest request, public ResultBody getUserPhoneNumber(HttpServletRequest request,
@ApiParam(value = "授权手机号code", required = true) @RequestParam String code) { @ApiParam(value = "授权手机号code", required = true) @RequestParam String code,
return userAccountService.getUserPhoneNumber(this.getUserLoginInfoFromRedis(request).getUserAccountId(), code); @ApiParam(value = "邀请人id", required = false) @RequestParam(required = false) Integer rcdUserId) {
return userAccountService.getUserPhoneNumber(this.getUserLoginInfoFromRedis(request).getUserAccountId(), code, rcdUserId);
} }
@ApiOperation(value = "根据用户id查询用户信息", hidden = true) @ApiOperation(value = "根据用户id查询用户信息", hidden = true)
...@@ -112,4 +114,25 @@ public class UserAccountController extends BaseController { ...@@ -112,4 +114,25 @@ public class UserAccountController extends BaseController {
return userAccountService.disableAppAccount(userAccountId); return userAccountService.disableAppAccount(userAccountId);
} }
@ApiOperation(value = "裂变-邀请人数")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("countRcd")
public ResultBody countRcd(@RequestParam Integer userAccountId) {
return userAccountService.countRcd(userAccountId);
}
@ApiOperation(value = "裂变-邀请列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("listUserRcd")
public ResultBody listUserRcd(@RequestBody UserRcdQO userRcdQO) {
return userAccountService.listUserRcd(userRcdQO);
}
@ApiOperation(value = "裂变-邀请排行榜")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("topRcd")
public ResultBody topRcd(@RequestParam(required = false, defaultValue = "10") Integer topNum) {
return userAccountService.topRcd(topNum);
}
} }
...@@ -120,4 +120,8 @@ public interface CooperationDao { ...@@ -120,4 +120,8 @@ public interface CooperationDao {
int countServiceBitmapData(Integer type); int countServiceBitmapData(Integer type);
List<WebsiteInfoDO> listServiceBitmapData(Integer type, Double lon, Double lat, int pageNo, Integer pageSize); List<WebsiteInfoDO> listServiceBitmapData(Integer type, Double lon, Double lat, int pageNo, Integer pageSize);
void updateWebsiteInfo(ApplyTagEditVO applyTagEditVO);
WebsiteInfoDO getWebsiteInfoByUserApplyId(Integer id);
} }
...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.dao; ...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.UserAccountDO; import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserRcdDO; import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.qo.UserAccountQO; import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.qo.UserRcdQO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -118,4 +119,42 @@ public interface UserServiceDao { ...@@ -118,4 +119,42 @@ public interface UserServiceDao {
*/ */
List<UserAccountDO> listAppUser(UserAccountQO param); List<UserAccountDO> listAppUser(UserAccountQO param);
/**
* 添加邀请信息
*
* @param userRcd
*/
void insertUserRcd(UserRcdDO userRcd);
/**
* 邀请人数
*
* @param userAccountId
* @return
*/
int countRcd(Integer userAccountId);
/**
* 邀请列表
*
* @param userRcdQO
* @return
*/
List<UserAccountDO> listUserRcd(UserRcdQO userRcdQO);
/**
* 邀请排行榜
*
* @param topNum
* @return
*/
List<UserAccountDO> topRcd(Integer topNum);
/**
* 查询用户推荐个数
*
* @param uIds
* @return
*/
List<UserAccountDO> getInviteCount(@Param("uIds") List<Integer> uIds);
} }
...@@ -2,13 +2,17 @@ package com.mmc.iuav.user.entity; ...@@ -2,13 +2,17 @@ package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO; import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.vo.BUserAccountVO; import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.TopInviteVO;
import com.mmc.iuav.user.model.vo.UserAccountVO; import com.mmc.iuav.user.model.vo.UserAccountVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author: zj * @author: zj
...@@ -40,10 +44,20 @@ public class UserAccountDO implements Serializable { ...@@ -40,10 +44,20 @@ public class UserAccountDO implements Serializable {
private Integer cityCode; private Integer cityCode;
private Integer districtCode; private Integer districtCode;
private Integer cooperationTagId;
private Integer companyAuthStatus; private Integer companyAuthStatus;
private String companyName; private String companyName;
private String tagName; /**
* 邀请人数
*/
private Integer inviteCount;
/**
* 上级推荐人
*/
private UserRcdDO userRcdDO;
/**
* 用户加盟标签
*/
private List<CooperationTagDO> cooperationTagDOS;
public UserAccountDO(UserAccountVO userAccountVO) { public UserAccountDO(UserAccountVO userAccountVO) {
this.id = userAccountVO.getId(); this.id = userAccountVO.getId();
...@@ -71,16 +85,24 @@ public class UserAccountDO implements Serializable { ...@@ -71,16 +85,24 @@ public class UserAccountDO implements Serializable {
} }
public UserAccountVO buildUserAccountVO() { public UserAccountVO buildUserAccountVO() {
return UserAccountVO.builder().id(this.id).uid(this.uid).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName) return UserAccountVO.builder().id(this.id).uid(this.id + "").phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName).userImg(this.userImg)
.userImg(this.userImg).userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).remark(this.remark).portType(this.portType) .userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).remark(this.remark).portType(this.portType).createTime(this.createTime)
.createTime(this.createTime).companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).cooperationTagId(this.cooperationTagId).companyName(this.companyName) .companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).companyName(this.companyName)
.tagName(this.tagName).build(); .inviteCount(this.inviteCount)
.cooperationTagVOS(CollectionUtils.isEmpty(this.cooperationTagDOS) ? null : this.cooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList()))
.userRcdVO(this.userRcdDO == null ? null : this.userRcdDO.buildUserRcdVO())
.build();
} }
public UserAccountSimpleDTO buildUserAccountSimpleDTO() { public UserAccountSimpleDTO buildUserAccountSimpleDTO() {
return UserAccountSimpleDTO.builder().id(this.id).uid(this.uid).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName) return UserAccountSimpleDTO.builder().id(this.id).uid(this.id + "").phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName)
.userImg(this.userImg).openid(this.openId).userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).portType(this.portType) .userImg(this.userImg).openid(this.openId).userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).portType(this.portType)
.companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).cooperationTagId(this.cooperationTagId).companyName(this.companyName) .companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).companyName(this.companyName)
.build(); .build();
} }
public TopInviteVO buildTopInviteVO() {
return TopInviteVO.builder().id(this.id).uid(this.id + "").nickName(this.nickName).userName(this.userName).phoneNum(this.phoneNum)
.inviteCount(this.inviteCount).build();
}
} }
package com.mmc.iuav.user.entity; package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.model.vo.UserRcdVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -17,8 +18,27 @@ import java.util.Date; ...@@ -17,8 +18,27 @@ import java.util.Date;
public class UserRcdDO implements Serializable { public class UserRcdDO implements Serializable {
private static final long serialVersionUID = 5407029715338119583L; private static final long serialVersionUID = 5407029715338119583L;
private Integer id; private Integer id;
/**
* 用户id(推荐接受人)
*/
private Integer userAccountId; private Integer userAccountId;
/**
* 邀请人id(发起人)
*/
private Integer rcdUserId; private Integer rcdUserId;
/**
* 邀请人昵称(发起人)
*/
private String rcdNickname;
/**
* 邀请人姓名(发起人)
*/
private String rcdUserName;
private String remark; private String remark;
private Date createTime; private Date createTime;
public UserRcdVO buildUserRcdVO() {
return UserRcdVO.builder().id(this.id).userAccountId(this.userAccountId).rcdUserId(this.rcdUserId).rcdNickname(this.rcdNickname)
.rcdUserName(this.rcdUserName).remark(this.remark).createTime(this.createTime).build();
}
} }
...@@ -25,6 +25,9 @@ public class WebsiteInfoDO implements Serializable { ...@@ -25,6 +25,9 @@ public class WebsiteInfoDO implements Serializable {
private Integer type; private Integer type;
private Integer userApplyTag; private Integer userApplyTag;
private String content;
private Integer score;
public WebsiteRangeDTO buildWebsiteRangeDTO() { public WebsiteRangeDTO buildWebsiteRangeDTO() {
this.distance = this.distance == null ? 0 : (BigDecimal.valueOf(this.distance).setScale(2, BigDecimal.ROUND_HALF_DOWN)).doubleValue(); this.distance = this.distance == null ? 0 : (BigDecimal.valueOf(this.distance).setScale(2, BigDecimal.ROUND_HALF_DOWN)).doubleValue();
...@@ -33,6 +36,8 @@ public class WebsiteInfoDO implements Serializable { ...@@ -33,6 +36,8 @@ public class WebsiteInfoDO implements Serializable {
.address(address) .address(address)
.lon(this.lon) .lon(this.lon)
.lat(this.lat) .lat(this.lat)
.content(content)
.score(score)
.distance(this.distance / 1000) .distance(this.distance / 1000)
.build(); .build();
} }
......
package com.mmc.iuav.user.error;
import com.mmc.iuav.http.BizException;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月27日 上午10:15:30
* @explain 类说明
*/
@ControllerAdvice
public class GlobalExceptionHandler {
/**
* 统一处理参数校验错误异常(非Spring接口数据绑定验证)
*
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
@ResponseBody
public ResultBody processValidException(BindException e) {
// 获取校验错误结果信息,并将信息组装
List<String> errorStringList = e.getBindingResult().getAllErrors().stream().map(ObjectError::getDefaultMessage)
.collect(Collectors.toList());
String errorMessage = String.join("; ", errorStringList);
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
/**
* 统一处理参数校验错误异常
*
* @param e
* @return
*/
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public ResultBody processValidException(IllegalArgumentException e) {
String errorMessage = String.join("; ", e.getMessage());
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(ConstraintViolationException.class)
@ResponseBody
public ResultBody processValidException(ConstraintViolationException e) {
String errorMessage = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage)
.collect(Collectors.joining(","));
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public ResultBody processValidException(MethodArgumentNotValidException e) {
String errorMessage = e.getBindingResult().getAllErrors().stream()
.map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining(","));
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseBody
public ResultBody processValidException(MissingServletRequestParameterException e) {
String errorMessage = e.getParameterName() + " 不能为空";
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(MissingPathVariableException.class)
@ResponseBody
public ResultBody processValidException(MissingPathVariableException e) {
String errorMessage = e.getVariableName() + " 不能为空";
return ResultBody.error(ResultEnum.BODY_NOT_MATCH.getResultCode(), errorMessage);
}
@ExceptionHandler(BizException.class)
@ResponseBody
public ResultBody processValidException(BizException e) {
return ResultBody.error(e.getErrorCode(), e.getErrorMsg());
}
}
...@@ -4,6 +4,7 @@ import com.mmc.iuav.response.ResultBody; ...@@ -4,6 +4,7 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.entity.UserAccountDO; import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO; import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.UserAccountQO; import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.qo.UserRcdQO;
import com.mmc.iuav.user.model.vo.UserAccountVO; import com.mmc.iuav.user.model.vo.UserAccountVO;
import java.util.List; import java.util.List;
...@@ -75,9 +76,10 @@ public interface UserAccountService { ...@@ -75,9 +76,10 @@ public interface UserAccountService {
* *
* @param id * @param id
* @param code * @param code
* @param rcdUserId
* @return * @return
*/ */
ResultBody getUserPhoneNumber(Integer id, String code); ResultBody getUserPhoneNumber(Integer id, String code, Integer rcdUserId);
/** /**
* 根据id获取用户信息 * 根据id获取用户信息
...@@ -127,5 +129,27 @@ public interface UserAccountService { ...@@ -127,5 +129,27 @@ public interface UserAccountService {
*/ */
ResultBody disableAppAccount(Integer userAccountId); ResultBody disableAppAccount(Integer userAccountId);
/**
* 用户邀请人数
*
* @param userAccountId
* @return
*/
ResultBody countRcd(Integer userAccountId);
/**
* 用户邀请列表
*
* @param userRcdQO
* @return
*/
ResultBody listUserRcd(UserRcdQO userRcdQO);
/**
* 邀请排行榜
*
* @param topNum
* @return
*/
ResultBody topRcd(Integer topNum);
} }
...@@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.mmc.iuav.auth.JwtConstant; import com.mmc.iuav.auth.JwtConstant;
import com.mmc.iuav.auth.JwtUtil; import com.mmc.iuav.auth.JwtUtil;
import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum; import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.auth.PwdUtil; import com.mmc.iuav.user.auth.PwdUtil;
...@@ -94,21 +93,17 @@ public class AuthServiceImpl implements AuthService { ...@@ -94,21 +93,17 @@ public class AuthServiceImpl implements AuthService {
} }
//数据库查询用户信息 //数据库查询用户信息
UserAccountVO userAccountVO = userAccountService.getUserAccountInfoByUnionId(unionId); UserAccountVO userAccountVO = userAccountService.getUserAccountInfoByUnionId(unionId);
String uid;
Integer companyAuthStatus = 0; Integer companyAuthStatus = 0;
if (userAccountVO == null) { if (userAccountVO == null) {
UserAccountDO userAccountDO = new UserAccountDO(); UserAccountDO userAccountDO = new UserAccountDO();
userAccountDO.setUnionId(unionId); userAccountDO.setUnionId(unionId);
userAccountDO.setOpenId(openId); userAccountDO.setOpenId(openId);
uid = CodeUtil.generateUserUID();
userAccountDO.setUid(uid);
userAccountDO.setPortType(100); userAccountDO.setPortType(100);
userAccountDO.setSource(wxLoginVO.getSource()); userAccountDO.setSource(wxLoginVO.getSource());
userAccountService.insertUserAccount(userAccountDO); userAccountService.insertUserAccount(userAccountDO);
userAccountVO = userAccountDO.buildUserAccountVO(); userAccountVO = userAccountDO.buildUserAccountVO();
payClient.createWallet(userAccountDO.getId()); payClient.createWallet(userAccountDO.getId());
} else { } else {
uid = userAccountVO.getUid();
CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userAccountVO.getId()); CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userAccountVO.getId());
if (companyAuthDO != null) { if (companyAuthDO != null) {
companyAuthStatus = companyAuthDO.getAuthStatus(); companyAuthStatus = companyAuthDO.getAuthStatus();
...@@ -120,7 +115,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -120,7 +115,7 @@ public class AuthServiceImpl implements AuthService {
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN); map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(uid) LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getId() + "")
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build(); .userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
...@@ -181,7 +176,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -181,7 +176,7 @@ public class AuthServiceImpl implements AuthService {
companyAuthStatus = companyAuthDO.getAuthStatus(); companyAuthStatus = companyAuthDO.getAuthStatus();
} }
String token = JwtUtil.createJwt(map); String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getUid()) LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getId() + "")
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build(); .userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO), token, JSONObject.toJSONString(loginSuccessDTO),
......
...@@ -162,8 +162,16 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -162,8 +162,16 @@ public class CooperationServiceImpl implements CooperationService {
userApplyTagDO.setContent(applyTagEditVO.getContent()); userApplyTagDO.setContent(applyTagEditVO.getContent());
userApplyTagDO.setScore(applyTagEditVO.getScore()); userApplyTagDO.setScore(applyTagEditVO.getScore());
cooperationDao.updateUserApplyTag(userApplyTagDO); cooperationDao.updateUserApplyTag(userApplyTagDO);
// 保存网点信息 // 保存网点之前判断该网点是否存在 存在则修改不存在则新增
cooperationDao.addWebsiteInfo(applyTagEditVO); WebsiteInfoDO websiteInfoDO = cooperationDao.getWebsiteInfoByUserApplyId(applyTagEditVO.getId());
if (websiteInfoDO == null) {
// 保存网点信息
cooperationDao.addWebsiteInfo(applyTagEditVO);
} else {
applyTagEditVO.setWebsiteId(websiteInfoDO.getId());
// 修改网点信息
cooperationDao.updateWebsiteInfo(applyTagEditVO);
}
return ResultBody.success(); return ResultBody.success();
} }
......
...@@ -11,8 +11,10 @@ import com.mmc.iuav.user.entity.UserAccountDO; ...@@ -11,8 +11,10 @@ import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserRcdDO; import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO; import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.UserAccountQO; import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.qo.UserRcdQO;
import com.mmc.iuav.user.model.vo.CompanyAuthVO; import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import com.mmc.iuav.user.model.vo.CooperationTagVO; import com.mmc.iuav.user.model.vo.CooperationTagVO;
import com.mmc.iuav.user.model.vo.TopInviteVO;
import com.mmc.iuav.user.model.vo.UserAccountVO; import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.mq.MqProducer; import com.mmc.iuav.user.mq.MqProducer;
import com.mmc.iuav.user.service.CompanyAuthService; import com.mmc.iuav.user.service.CompanyAuthService;
...@@ -21,6 +23,7 @@ import com.mmc.iuav.user.service.WxService; ...@@ -21,6 +23,7 @@ import com.mmc.iuav.user.service.WxService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
...@@ -147,8 +150,9 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -147,8 +150,9 @@ public class UserAccountServiceImpl implements UserAccountService {
} }
} }
@Transactional
@Override @Override
public ResultBody getUserPhoneNumber(Integer id, String code) { public ResultBody getUserPhoneNumber(Integer id, String code, Integer rcdUserId) {
String userPhoneNumber = wxService.getUserPhoneNumber(id, code); String userPhoneNumber = wxService.getUserPhoneNumber(id, code);
if (StringUtils.isBlank(userPhoneNumber)) { if (StringUtils.isBlank(userPhoneNumber)) {
return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR); return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR);
...@@ -157,6 +161,12 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -157,6 +161,12 @@ public class UserAccountServiceImpl implements UserAccountService {
userAccount.setId(id); userAccount.setId(id);
userAccount.setPhoneNum(userPhoneNumber); userAccount.setPhoneNum(userPhoneNumber);
userServiceDao.update(userAccount); userServiceDao.update(userAccount);
if (rcdUserId != null) {
UserRcdDO userRcd = new UserRcdDO();
userRcd.setUserAccountId(id);
userRcd.setRcdUserId(rcdUserId);
userServiceDao.insertUserRcd(userRcd);
}
return ResultBody.success(); return ResultBody.success();
} }
...@@ -218,18 +228,45 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -218,18 +228,45 @@ public class UserAccountServiceImpl implements UserAccountService {
param.buildCurrentPage(); param.buildCurrentPage();
List<UserAccountDO> userAccountDOList = userServiceDao.listAppUser(param); List<UserAccountDO> userAccountDOList = userServiceDao.listAppUser(param);
List<Integer> uIds = userAccountDOList.stream().map(UserAccountDO::getId).collect(Collectors.toList()); List<Integer> uIds = userAccountDOList.stream().map(UserAccountDO::getId).collect(Collectors.toList());
// 设置加盟商标签
buildTagsInfo(uIds, userAccountDOList);
// 设置推荐(邀请)伙伴个数
buildInviteCount(uIds, userAccountDOList);
List<UserAccountVO> userAccountVOS = userAccountDOList.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, userAccountVOS));
}
/**
* 设置推荐伙伴个数
*
* @param uIds
* @param userAccountDOList
*/
private void buildInviteCount(List<Integer> uIds, List<UserAccountDO> userAccountDOList) {
List<UserAccountDO> userInviteList = userServiceDao.getInviteCount(uIds);
if (CollectionUtils.isEmpty(userInviteList)) {
userInviteList.forEach(d -> d.setInviteCount(0));
} else {
Map<Integer, Integer> inviteCount = userInviteList.stream().collect(Collectors.toMap(UserAccountDO::getId, UserAccountDO::getInviteCount));
userAccountDOList.forEach(d -> d.setInviteCount(inviteCount.get(d.getId()) == null ? 0 : inviteCount.get(d.getId())));
}
}
/**
* 设置加盟商标签
*
* @param uIds
* @param userAccountDOList
*/
private void buildTagsInfo(List<Integer> uIds, List<UserAccountDO> userAccountDOList) {
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTagByUIds(uIds); List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTagByUIds(uIds);
Map<Integer, List<CooperationTagDO>> userTagsMap = cooperationTagDOS.stream().collect(Collectors.groupingBy(CooperationTagDO::getUserAccountId)); Map<Integer, List<CooperationTagDO>> userTagsMap = cooperationTagDOS.stream().collect(Collectors.groupingBy(CooperationTagDO::getUserAccountId));
List<UserAccountDO> res = buildTagInfo(userAccountDOList); for (UserAccountDO userAccountDO : userAccountDOList) {
List<UserAccountVO> userAccountVOS = res.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList()); List<CooperationTagDO> userCooperationTagDOS = userTagsMap.get(userAccountDO.getId());
for (UserAccountVO userAccountVO : userAccountVOS) {
List<CooperationTagDO> userCooperationTagDOS = userTagsMap.get(userAccountVO.getId());
if (!CollectionUtils.isEmpty(userCooperationTagDOS)) { if (!CollectionUtils.isEmpty(userCooperationTagDOS)) {
List<CooperationTagVO> cooperationTagVOS = userCooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList()); userAccountDO.setCooperationTagDOS(userCooperationTagDOS);
userAccountVO.setCooperationTagVOS(cooperationTagVOS);
} }
} }
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, userAccountVOS));
} }
@Override @Override
...@@ -242,16 +279,33 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -242,16 +279,33 @@ public class UserAccountServiceImpl implements UserAccountService {
return ResultBody.success(); return ResultBody.success();
} }
private List<UserAccountDO> buildTagInfo(List<UserAccountDO> userAccountDOList) { @Override
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listTags(); public ResultBody countRcd(Integer userAccountId) {
Map<Integer, CooperationTagDO> cooperationTagDOMap = cooperationTagDOS.stream().collect(Collectors.toMap(CooperationTagDO::getId, d -> d, (k1, k2) -> k2)); Integer count = userServiceDao.countRcd(userAccountId);
for (UserAccountDO userAccountDO : userAccountDOList) { return ResultBody.success(count);
CooperationTagDO cooperationTagDO = cooperationTagDOMap.get(userAccountDO.getCooperationTagId()); }
if (cooperationTagDO != null) {
userAccountDO.setTagName(cooperationTagDO.getTagName()); @Override
} public ResultBody listUserRcd(UserRcdQO userRcdQO) {
int count = userServiceDao.countRcd(userRcdQO.getUserAccountId());
if (count == 0) {
return ResultBody.success(PageResult.buildPage(userRcdQO.getPageNo(), userRcdQO.getPageSize(), count));
} }
return userAccountDOList; int pageNo = userRcdQO.getPageNo();
userRcdQO.buildCurrentPage();
List<UserAccountDO> userRcd = userServiceDao.listUserRcd(userRcdQO);
List<UserAccountVO> userAccountVOS = userRcd.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, userRcdQO.getPageSize(), count, userAccountVOS));
}
@Override
public ResultBody topRcd(Integer topNum) {
List<UserAccountDO> topInviteUser = userServiceDao.topRcd(topNum);
if (!CollectionUtils.isEmpty(topInviteUser)) {
List<TopInviteVO> topInviteVOS = topInviteUser.stream().map(UserAccountDO::buildTopInviteVO).collect(Collectors.toList());
return ResultBody.success(topInviteVOS);
}
return ResultBody.success();
} }
......
...@@ -34,6 +34,27 @@ ...@@ -34,6 +34,27 @@
values (#{name}, #{address}, #{lat}, #{lon}, #{cooperationTagId}, #{id}) values (#{name}, #{address}, #{lat}, #{lon}, #{cooperationTagId}, #{id})
</insert> </insert>
<update id="updateWebsiteInfo">
update website_info
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="lat != null">
lat = #{lat},
</if>
<if test="lon != null">
lon = #{lon},
</if>
<if test="cooperationTagId != null">
type = #{cooperationTagId}
</if>
</set>
where id = #{websiteId}
</update>
<update id="updateUserApplyTag" parameterType="com.mmc.iuav.user.entity.UserApplyTagDO"> <update id="updateUserApplyTag" parameterType="com.mmc.iuav.user.entity.UserApplyTagDO">
UPDATE user_apply_tag UPDATE user_apply_tag
<set> <set>
...@@ -226,17 +247,33 @@ ...@@ -226,17 +247,33 @@
where type = #{type} where type = #{type}
</select> </select>
<select id="listServiceBitmapData" resultType="com.mmc.iuav.user.entity.WebsiteInfoDO"> <select id="listServiceBitmapData" resultType="com.mmc.iuav.user.entity.WebsiteInfoDO">
SELECT id, SELECT wi.id,
wi.`name`,
wi.address,
wi.lat,
wi.lon,
wi.type,
wi.user_apply_tag,
st_distance_sphere(
point(wi.lon, wi.lat),
point(${lon}, ${lat})) AS distance,
ua.content,
ua.score
FROM website_info wi
INNER JOIN user_apply_tag ua ON wi.user_apply_tag = ua.id
WHERE wi.type = #{type}
ORDER BY distance ASC
LIMIT #{pageNo}, #{pageSize}
</select>
<select id="getWebsiteInfoByUserApplyId" resultType="com.mmc.iuav.user.entity.WebsiteInfoDO">
select id,
`name`, `name`,
address, address,
lat, lat,
lon, lon,
`type`, `type`,
user_apply_tag, user_apply_tag
st_distance_sphere(point(lon, lat), point(${lon}, ${lat})) as distance from website_info
FROM website_info where user_apply_tag = #{id}
where type = #{type}
ORDER BY distance ASC
LIMIT #{pageNo}, #{pageSize}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
<mapper namespace="com.mmc.iuav.user.dao.UserServiceDao"> <mapper namespace="com.mmc.iuav.user.dao.UserServiceDao">
<resultMap id="userAccountResultMap" type="com.mmc.iuav.user.entity.UserAccountDO"> <resultMap id="userAccountResultMap" type="com.mmc.iuav.user.entity.UserAccountDO">
<id property="id" column="id"/> <id property="id" column="id"/>
<result property="uid" column="uid"/>
<result property="phoneNum" column="phone_num"/> <result property="phoneNum" column="phone_num"/>
<result property="userName" column="user_name"/> <result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/> <result property="nickName" column="nick_name"/>
...@@ -22,18 +21,32 @@ ...@@ -22,18 +21,32 @@
<result property="createTime" column="createTime"/> <result property="createTime" column="createTime"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="companyAuthStatus" column="companyAuthStatus"/>
<result property="companyName" column="companyName"/>
<association property="userRcdDO" javaType="com.mmc.iuav.user.entity.UserRcdDO">
<id property="id" column="user_rcd_id"/>
<result property="rcdUserId" column="rcd_user_id"/>
<result property="rcdNickname" column="rcdNickname"/>
<result property="rcdUserName" column="rcdUsername"/>
</association>
</resultMap> </resultMap>
<insert id="insertUserAccount" parameterType="com.mmc.iuav.user.entity.UserAccountDO" <insert id="insertUserAccount" parameterType="com.mmc.iuav.user.entity.UserAccountDO"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
insert into user_account(uid, phone_num, user_name, nick_name, user_img, open_id, insert into user_account(phone_num, user_name, nick_name, user_img, open_id,
union_id, user_sex, email, source, province_code, city_code, district_code, remark, union_id, user_sex, email, source, province_code, city_code, district_code, remark,
port_type, create_time) port_type, create_time)
values (#{uid}, #{phoneNum}, #{userName}, #{nickName}, #{userImg}, #{openId}, values (#{phoneNum}, #{userName}, #{nickName}, #{userImg}, #{openId},
#{unionId}, #{userSex}, #{email}, #{source}, #{provinceCode}, #{cityCode}, #{districtCode}, #{remark}, #{unionId}, #{userSex}, #{email}, #{source}, #{provinceCode}, #{cityCode}, #{districtCode}, #{remark},
#{portType}, NOW()) #{portType}, NOW())
</insert> </insert>
<insert id="insertUserRcd" parameterType="com.mmc.iuav.user.entity.UserRcdDO">
insert into user_rcd (user_account_id, rcd_user_id, create_time)
values (#{userAccountId}, #{rcdUserId}, NOW());
</insert>
<update id="update" parameterType="com.mmc.iuav.user.entity.UserAccountDO"> <update id="update" parameterType="com.mmc.iuav.user.entity.UserAccountDO">
update user_account update user_account
<set> <set>
...@@ -88,7 +101,6 @@ ...@@ -88,7 +101,6 @@
<select id="getUserAccountInfoByUnionId" resultType="com.mmc.iuav.user.entity.UserAccountDO"> <select id="getUserAccountInfoByUnionId" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select id, select id,
uid,
phone_num, phone_num,
user_name, user_name,
nick_name, nick_name,
...@@ -111,7 +123,6 @@ ...@@ -111,7 +123,6 @@
<select id="getUserAccountById" resultType="com.mmc.iuav.user.entity.UserAccountDO"> <select id="getUserAccountById" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select id, select id,
uid,
phone_num, phone_num,
user_name, user_name,
nick_name, nick_name,
...@@ -147,7 +158,7 @@ ...@@ -147,7 +158,7 @@
<select id="feignListUserAccount" resultType="com.mmc.iuav.user.entity.UserAccountDO" <select id="feignListUserAccount" resultType="com.mmc.iuav.user.entity.UserAccountDO"
parameterType="com.mmc.iuav.user.model.qo.UserAccountQO"> parameterType="com.mmc.iuav.user.model.qo.UserAccountQO">
select ua.id, ua.uid, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id, select ua.id, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id,
ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark, ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark,
ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus
from user_account ua left join company_auth ca on ua.id = ca.user_account_id from user_account ua left join company_auth ca on ua.id = ca.user_account_id
...@@ -162,7 +173,7 @@ ...@@ -162,7 +173,7 @@
user_name like CONCAT("%",#{keyword},"%") or user_name like CONCAT("%",#{keyword},"%") or
nick_name like CONCAT("%",#{keyword},"%") or nick_name like CONCAT("%",#{keyword},"%") or
phone_num like CONCAT("%",#{keyword},"%") or phone_num like CONCAT("%",#{keyword},"%") or
uid like CONCAT("%",#{keyword},"%")) id like CONCAT("%",#{keyword},"%"))
</if> </if>
<if test="provinceCode != null"> <if test="provinceCode != null">
and ua.province_code = #{provinceCode} and ua.province_code = #{provinceCode}
...@@ -176,7 +187,7 @@ ...@@ -176,7 +187,7 @@
</select> </select>
<select id="listUserAccountByIds" resultType="com.mmc.iuav.user.entity.UserAccountDO"> <select id="listUserAccountByIds" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select ua.id, ua.uid, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id, select ua.id, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id,
ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark, ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark,
ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus, ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus,
ca.company_name ca.company_name
...@@ -190,7 +201,7 @@ ...@@ -190,7 +201,7 @@
</select> </select>
<select id="feignListRcdUserInfo" resultType="com.mmc.iuav.user.entity.UserAccountDO"> <select id="feignListRcdUserInfo" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select ua.id, ua.uid, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id, select ua.id, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id,
ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark, ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark,
ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus, ua.port_type, ua.disable, ua.create_time, ua.update_time, ca.auth_status as companyAuthStatus,
ca.company_name ca.company_name
...@@ -206,7 +217,6 @@ ...@@ -206,7 +217,6 @@
<select id="getUserRcdByAccountId" resultType="com.mmc.iuav.user.entity.UserAccountDO"> <select id="getUserRcdByAccountId" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select ua.id, select ua.id,
ua.uid,
ua.phone_num, ua.phone_num,
ua.user_name, ua.user_name,
ua.nick_name, ua.nick_name,
...@@ -264,18 +274,21 @@ ...@@ -264,18 +274,21 @@
and ( and (
ua.user_name like CONCAT("%",#{keyword},"%") ua.user_name like CONCAT("%",#{keyword},"%")
or ua.nick_name like CONCAT("%",#{keyword},"%") or ua.nick_name like CONCAT("%",#{keyword},"%")
or ua.uid like CONCAT("%",#{keyword},"%") or ua.id like CONCAT("%",#{keyword},"%")
) )
</if> </if>
</select> </select>
<select id="listAppUser" resultType="com.mmc.iuav.user.entity.UserAccountDO" <select id="listAppUser" resultMap="userAccountResultMap"
parameterType="com.mmc.iuav.user.model.qo.UserAccountQO"> parameterType="com.mmc.iuav.user.model.qo.UserAccountQO">
select ua.id, ua.uid, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id, select ua.id, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id,
ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark, ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.remark,
ua.port_type, ua.disable, ua.create_time, ua.update_time, IFNULL(ca.auth_status, 0) as ua.port_type, ua.disable, ua.create_time, ua.update_time, IFNULL(ca.auth_status, 0) as
companyAuthStatus, ca.company_name companyAuthStatus, ca.company_name, rcd.id as user_rcd_id, rcd.rcd_user_id, r_user.nick_name as rcdNickname,
r_user.user_name as rcdUserName
from user_account ua left join company_auth ca on ua.id = ca.user_account_id from user_account ua left join company_auth ca on ua.id = ca.user_account_id
left join user_rcd rcd on rcd.user_account_id = ua.id
left join user_account r_user on r_user.id = rcd.rcd_user_id
where where
ua.disable = 0 and ua.port_type = 100 ua.disable = 0 and ua.port_type = 100
<if test="phoneNum != null and phoneNum != '' "> <if test="phoneNum != null and phoneNum != '' ">
...@@ -297,11 +310,56 @@ ...@@ -297,11 +310,56 @@
and ( and (
ua.user_name like CONCAT("%",#{keyword},"%") ua.user_name like CONCAT("%",#{keyword},"%")
or ua.nick_name like CONCAT("%",#{keyword},"%") or ua.nick_name like CONCAT("%",#{keyword},"%")
or ua.uid like CONCAT("%",#{keyword},"%") or ua.id like CONCAT("%",#{keyword},"%")
) )
</if> </if>
order by ua.create_time desc order by ua.create_time desc
limit #{pageNo}, #{pageSize} limit #{pageNo}, #{pageSize}
</select> </select>
<select id="countRcd" resultType="int">
select count(*) from user_rcd where rcd_user_id = #{userAccountId}
</select>
<select id="listUserRcd" resultType="com.mmc.iuav.user.entity.UserAccountDO"
parameterType="com.mmc.iuav.user.model.qo.UserRcdQO">
select ua.id,ua.phone_num, ua.user_name, ua.nick_name, ua.user_img,ur.create_time
from user_account ua inner join user_rcd ur on ua.id = ur.user_account_id
where ur.rcd_user_id = #{userAccountId}
order by ur.create_time desc
limit #{pageNo}, #{pageSize}
</select>
<select id="topRcd" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select ua.id,
ua.nick_name,
ua.user_img,
ua.user_name,
ua.phone_num,
count(*) as invite_count
from user_rcd urd
INNER JOIN user_account ua ON urd.rcd_user_id = ua.id
where ua.disable = 0
GROUP BY urd.rcd_user_id
ORDER BY invite_count DESC limit #{topNum}
</select>
<select id="getInviteCount" resultType="com.mmc.iuav.user.entity.UserAccountDO">
select ua.id,
ua.nick_name,
ua.user_img,
ua.user_name,
ua.phone_num,
count(*) as invite_count
from user_rcd urd
INNER JOIN user_account ua ON urd.rcd_user_id = ua.id
where ua.disable = 0
<if test="uIds != null">
<foreach collection="uIds" separator="," open="and urd.rcd_user_id in (" close=")" item="id">
#{id}
</foreach>
</if>
GROUP BY urd.rcd_user_id
</select>
</mapper> </mapper>
...@@ -17,6 +17,7 @@ data-filter: ...@@ -17,6 +17,7 @@ data-filter:
- /userapp/wx/getAppletQRCode - /userapp/wx/getAppletQRCode
- /userapp/wx/wxSendMessage - /userapp/wx/wxSendMessage
- /userapp/user-account/feignListUserAccountIds - /userapp/user-account/feignListUserAccountIds
- /userapp/user-account/topRcd
- /userapp/back-user/listTest - /userapp/back-user/listTest
- /userapp/company/listCompanyPageBack - /userapp/company/listCompanyPageBack
- /userapp/company/getCompanyInfoById - /userapp/company/getCompanyInfoById
......
...@@ -4,7 +4,7 @@ metadata: ...@@ -4,7 +4,7 @@ metadata:
name: cms-deployment name: cms-deployment
namespace: default namespace: default
spec: spec:
# minReadySeconds: 240 # minReadySeconds: 240
revisionHistoryLimit: 2 revisionHistoryLimit: 2
replicas: 1 replicas: 1
selector: selector:
...@@ -20,11 +20,11 @@ spec: ...@@ -20,11 +20,11 @@ spec:
- name: cms - name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG image: REGISTRY/NAMESPACE/IMAGE:TAG
readinessProbe: readinessProbe:
initialDelaySeconds: 480 initialDelaySeconds: 15
periodSeconds: 10 periodSeconds: 5
#timeoutSeconds: 1 #timeoutSeconds: 1
#successThreshold: 1 #successThreshold: 1
failureThreshold: 20 failureThreshold: 10
httpGet: httpGet:
path: /userapp/actuator/health/readiness path: /userapp/actuator/health/readiness
port: cms-port port: cms-port
...@@ -34,10 +34,10 @@ spec: ...@@ -34,10 +34,10 @@ spec:
- name: localtime - name: localtime
mountPath: /etc/localtime mountPath: /etc/localtime
readOnly: true readOnly: true
resources: resources: { }
limits: # limits:
# memory: 1024Mi # memory: 1024Mi
cpu: 100m # cpu: 100m
ports: ports:
- containerPort: 35150 - containerPort: 35150
name: cms-port name: cms-port
......
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag: 6accac4106c773d7a04f22f7ea1686607acee6b9 newTag: 42bc01e508130cfbe19ad17b27456cadc9aee4ca
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论