提交 b791ed0e 作者: zhenjie

Merge branch 'develop'

package com.mmc.iuav.user.model.dto.dronepilot;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/8/18 16:01
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PilotCertificationInteriorDTO {
@ApiModelProperty(value = "飞手执照id", example = "1")
@NotNull(message = "飞手执照id不能为空")
private Integer id;
@ApiModelProperty(value = "申请飞手用户的id", example = "1")
private Integer userAccountId;
}
...@@ -47,10 +47,13 @@ public class BUserAccountQO implements Serializable { ...@@ -47,10 +47,13 @@ public class BUserAccountQO implements Serializable {
@ApiModelProperty(value = "用户id集合") @ApiModelProperty(value = "用户id集合")
private List<Integer> userIds; private List<Integer> userIds;
@ApiModelProperty(value = "单位id")
private Integer companyInfoId;
@ApiModelProperty(value = "推荐单位id") @ApiModelProperty(value = "推荐单位id")
private Integer rcdCompanyId; private Integer rcdCompanyId;
@ApiModelProperty(value="单位集合", hidden = true) @ApiModelProperty(value = "单位集合", hidden = true)
private List<Integer> companys; private List<Integer> companys;
@ApiModelProperty(value = "页码", required = true) @ApiModelProperty(value = "页码", required = true)
......
...@@ -50,8 +50,10 @@ public class CompanyInfoVO implements Serializable { ...@@ -50,8 +50,10 @@ public class CompanyInfoVO implements Serializable {
private String phoneNum; private String phoneNum;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "小程序用户id")
private Integer userAccountId; private Integer userAccountId;
@ApiModelProperty(value = "后台用户id")
private Integer backUserAccountId;
@ApiModelProperty(value = "纬度") @ApiModelProperty(value = "纬度")
private Double lat; private Double lat;
@ApiModelProperty(value = "经度") @ApiModelProperty(value = "经度")
...@@ -74,4 +76,6 @@ public class CompanyInfoVO implements Serializable { ...@@ -74,4 +76,6 @@ public class CompanyInfoVO implements Serializable {
private Integer score; private Integer score;
@ApiModelProperty(value = "背景图", example = "http://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/3505c402-cbf9-41a5-9d6f-bdb350625bea.jpg") @ApiModelProperty(value = "背景图", example = "http://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/3505c402-cbf9-41a5-9d6f-bdb350625bea.jpg")
private String backImg; private String backImg;
@ApiModelProperty(value = "当前距离")
private Double distance;
} }
...@@ -34,6 +34,7 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -34,6 +34,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
COOPERATION_CHECK_NOT_PASS_ERROR("5016", "审核失败,请联系管理人员!"), COOPERATION_CHECK_NOT_PASS_ERROR("5016", "审核失败,请联系管理人员!"),
REBINDING_COMPANY_ERROR("5017", "该用户已被企业绑定,请尝试让该用户解绑后再重试!"), REBINDING_COMPANY_ERROR("5017", "该用户已被企业绑定,请尝试让该用户解绑后再重试!"),
MEMBER_APPLY_ERROR("5018", "企业成员暂不能提交加盟申请!"), MEMBER_APPLY_ERROR("5018", "企业成员暂不能提交加盟申请!"),
FORBID_USE_ERROR("5018", "账号禁用"),
//微信相关 //微信相关
PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"), PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"),
...@@ -59,6 +60,7 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -59,6 +60,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
DELETE_ADMIN_ERROR("8011", "禁止删除超级管理员角色账号"), DELETE_ADMIN_ERROR("8011", "禁止删除超级管理员角色账号"),
DELETE_YOURSELF_ERROR("8011", "禁止删除自己的账号"), DELETE_YOURSELF_ERROR("8011", "禁止删除自己的账号"),
FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR("8012", "绑定企业为加盟公司,禁止使用该单位"), FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR("8012", "绑定企业为加盟公司,禁止使用该单位"),
NO_RIGHT_UPDATE_ERROR("8013", "无权限操作"),
ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"), ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"),
INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"), INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"),
...@@ -79,7 +81,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -79,7 +81,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
CAN_NOT_CHANGE_THE_APPLICATION_OF_OTHERS("36776", "不能变更其他人申请的飞手执照及电子认证"), CAN_NOT_CHANGE_THE_APPLICATION_OF_OTHERS("36776", "不能变更其他人申请的飞手执照及电子认证"),
WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"), WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"),
APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"), APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"),
WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败");; WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"),
DELETE_PASS_ERROR("5029", "已通过认证的不可删除");
/** /**
* 错误码 * 错误码
......
package com.mmc.iuav.user.auth;
import com.alibaba.fastjson2.JSONObject;
import com.mmc.iuav.auth.JwtConstant;
import com.mmc.iuav.auth.JwtUtil;
import com.mmc.iuav.user.dao.RoleDao;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.enums.UserTypeEnums;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.vo.AppUserSucVO;
import com.mmc.iuav.user.model.vo.BackUserAccountVO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.service.CompanyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author: zj
* @Date: 2023/8/14 16:48
*/
@Component
public class AuthHandler {
@Autowired
private RoleDao roleDao;
@Autowired
private CompanyService companyService;
@Autowired
private StringRedisTemplate stringRedisTemplate;
public AppUserSucVO addAppLoginCache(UserAccountVO userAccountVO) {
Map<String, Object> map = new HashMap<String, Object>();
map.put(JwtConstant.USER_ACCOUNT_ID, userAccountVO.getId());
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getId() + "")
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(UserTypeEnums.APP.getType()).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
AppUserSucVO appUserSucVO = AppUserSucVO.builder().token(token).uid(userAccountVO.getUid()).phoneNum(userAccountVO.getPhoneNum())
.nickName(userAccountVO.getNickName()).userAccountId(userAccountVO.getId()).portType(UserTypeEnums.APP.getType()).build();
return appUserSucVO;
}
public LoginSuccessDTO addPcLoginCache(BackUserAccountVO user) {
// 查询单位信息
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(user.getId());
companyInfoVO.setLeader(1);
// 角色信息
RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(user.getId());
Map<String, Object> map = new HashMap<String, Object>();
map.put(JwtConstant.USER_ACCOUNT_ID, user.getId());
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).uid(user.getId() + "")
.userName(user.getUserName()).nickName(user.getUserName()).phoneNum(user.getPhoneNum()).portType(UserTypeEnums.PC.getType())
.companyInfoVO(companyInfoVO == null ? null : companyInfoVO)
.roleInfo(roleInfoDO.buildRoleInfoDTO()).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
// 标记
stringRedisTemplate.opsForValue().set(
UserTypeEnums.PC.getTypeCode() + "_TOKEN_" + user.getId(), token,
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
return loginSuccessDTO;
}
/**
* @param userAccountId
* @description 删除小程序用户token
* redis key :APP_TOKEN_{ID}
*/
public void removeAppLoginCache(Integer userAccountId) {
String appUserToken = stringRedisTemplate.opsForValue().get(UserTypeEnums.APP.getTypeCode() + "_TOKEN_" + userAccountId);
if (!StringUtils.isBlank(appUserToken)) {
stringRedisTemplate.delete(appUserToken);
stringRedisTemplate.delete(UserTypeEnums.APP.getTypeCode() + "_TOKEN_" + userAccountId);
}
}
/**
* @param backUserAccountId
* @description 删除PC用户token
* redis key :PC_TOKEN_{ID}
*/
public void removePcLoginCache(Integer backUserAccountId) {
String pcUserToken = stringRedisTemplate.opsForValue().get(UserTypeEnums.PC.getTypeCode() + "_TOKEN_" + backUserAccountId);
if (!StringUtils.isBlank(pcUserToken)) {
stringRedisTemplate.delete(pcUserToken);
stringRedisTemplate.delete(UserTypeEnums.PC.getTypeCode() + "_TOKEN_" + backUserAccountId);
}
}
}
...@@ -37,11 +37,11 @@ public class PmsClient { ...@@ -37,11 +37,11 @@ public class PmsClient {
} }
public Integer removeMallGoods(Integer id, String token) { public Integer removeMallGoods(Integer id, Integer companyInfoId, String token) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("token", token); headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(null, headers); HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri + "/pms/mall/goods/feignRemoveGoodsByBackUserAccountId" + "?id=" + id, HttpMethod.GET, entity, ResultBody.class); ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri + "/pms/mall/goods/feignRemoveGoodsByBackUserAccountId" + "?id=" + id + "&companyInfoId=" + companyInfoId, HttpMethod.GET, entity, ResultBody.class);
ResultBody body = responseEntity.getBody(); ResultBody body = responseEntity.getBody();
if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())) { if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
return 1; return 1;
......
...@@ -32,8 +32,9 @@ public class BackUserAccountController extends BaseController { ...@@ -32,8 +32,9 @@ public class BackUserAccountController extends BaseController {
@ApiOperation(value = "账号-新增") @ApiOperation(value = "账号-新增")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("insertBAccount") @PostMapping("insertBAccount")
public ResultBody insertBAccount(@Validated(value = {Create.class}) @RequestBody BUserAccountVO bUserAccountVO) { public ResultBody insertBAccount(@Validated(value = {Create.class}) @RequestBody BUserAccountVO bUserAccountVO,
return backUserAccountService.insertBAccount(bUserAccountVO); HttpServletRequest request) {
return backUserAccountService.insertBAccount(bUserAccountVO, this.getUserLoginInfoFromRedis(request));
} }
@ApiOperation(value = "账号-修改") @ApiOperation(value = "账号-修改")
...@@ -47,14 +48,15 @@ public class BackUserAccountController extends BaseController { ...@@ -47,14 +48,15 @@ public class BackUserAccountController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("removeBAccount") @GetMapping("removeBAccount")
public ResultBody disableBAccount(@RequestParam Integer userAccountId, HttpServletRequest request) { public ResultBody disableBAccount(@RequestParam Integer userAccountId, HttpServletRequest request) {
return backUserAccountService.disableBAccount(userAccountId, this.getUserLoginInfoFromRedis(request).getUserAccountId()); return backUserAccountService.disableBAccount(userAccountId, this.getUserLoginInfoFromRedis(request));
} }
@ApiOperation(value = "账号-列表") @ApiOperation(value = "账号-列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("listBAccountPage") @PostMapping("listBAccountPage")
public ResultBody<BackUserAccountVO> listBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO) { public ResultBody<BackUserAccountVO> listBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO,
return backUserAccountService.listBAccountPage(bUserAccountQO); HttpServletRequest request) {
return backUserAccountService.listBAccountPage(bUserAccountQO, this.getUserLoginInfoFromRedis(request));
} }
@ApiOperation(value = "账号-后台用户列表-内部调用", hidden = true) @ApiOperation(value = "账号-后台用户列表-内部调用", hidden = true)
...@@ -67,8 +69,8 @@ public class BackUserAccountController extends BaseController { ...@@ -67,8 +69,8 @@ public class BackUserAccountController extends BaseController {
@ApiOperation(value = "账号管理-修改密码") @ApiOperation(value = "账号管理-修改密码")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updatePassword") @PostMapping("updatePassword")
public ResultBody updatePassword(@Validated(value = {UpdatePassword.class}) @RequestBody BUserAccountVO account) { public ResultBody updatePassword(@Validated(value = {UpdatePassword.class}) @RequestBody BUserAccountVO account, HttpServletRequest request) {
return backUserAccountService.updatePassword(account); return backUserAccountService.updatePassword(account, this.getUserLoginInfoFromRedis(request));
} }
@ApiOperation(value = "feign-验证用户密码") @ApiOperation(value = "feign-验证用户密码")
......
...@@ -2,9 +2,7 @@ package com.mmc.iuav.user.controller; ...@@ -2,9 +2,7 @@ package com.mmc.iuav.user.controller;
import com.mmc.iuav.group.Insert; import com.mmc.iuav.group.Insert;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.vo.AppUserSucVO;
import com.mmc.iuav.user.model.vo.CompanyAuthVO; import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import com.mmc.iuav.user.model.vo.WxLoginVO;
import com.mmc.iuav.user.service.CompanyAuthService; import com.mmc.iuav.user.service.CompanyAuthService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,29 +18,29 @@ import javax.servlet.http.HttpServletRequest; ...@@ -20,29 +18,29 @@ import javax.servlet.http.HttpServletRequest;
@Api(tags = "企业认证相关") @Api(tags = "企业认证相关")
@RequestMapping("/company-auth/") @RequestMapping("/company-auth/")
@RestController @RestController
public class CompanyAuthController extends BaseController{ public class CompanyAuthController extends BaseController {
@Autowired @Autowired
private CompanyAuthService companyAuthService; private CompanyAuthService companyAuthService;
@ApiOperation(value = "提交企业认证") @ApiOperation(value = "提交企业认证")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) }) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("add") @PostMapping("add")
public ResultBody add(@Validated(value = {Insert.class})@RequestBody CompanyAuthVO companyAuthVO, HttpServletRequest request){ public ResultBody add(@Validated(value = {Insert.class}) @RequestBody CompanyAuthVO companyAuthVO, HttpServletRequest request) {
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId(); Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
companyAuthVO.setUserAccountId(userAccountId); companyAuthVO.setUserAccountId(userAccountId);
return companyAuthService.add(companyAuthVO); return companyAuthService.add(companyAuthVO);
} }
@ApiOperation(value = "企业工商模糊搜索") @ApiOperation(value = "企业工商模糊搜索")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) }) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("fuzzyQueryCompany") @GetMapping("fuzzyQueryCompany")
public ResultBody fuzzyQueryCompany(@ApiParam(value = "企业名称", required = true) @RequestParam String searchKey) { public ResultBody fuzzyQueryCompany(@ApiParam(value = "企业名称", required = true) @RequestParam String searchKey) {
return companyAuthService.fuzzyQueryCompany(searchKey); return companyAuthService.fuzzyQueryCompany(searchKey);
} }
@ApiOperation(value = "企业认证详情") @ApiOperation(value = "企业认证详情")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = CompanyAuthVO.class) }) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = CompanyAuthVO.class)})
@GetMapping("getCompanyAuthInfo") @GetMapping("getCompanyAuthInfo")
public ResultBody getCompanyAuthInfo(@RequestParam Integer userAccountId) { public ResultBody getCompanyAuthInfo(@RequestParam Integer userAccountId) {
return ResultBody.success(companyAuthService.getCompanyAuthByUId(userAccountId)); return ResultBody.success(companyAuthService.getCompanyAuthByUId(userAccountId));
......
...@@ -124,4 +124,11 @@ public class CompanyController extends BaseController { ...@@ -124,4 +124,11 @@ public class CompanyController extends BaseController {
public List<CompanyInfoVO> listCompanyInfoByIds(@RequestBody List<Integer> ids) { public List<CompanyInfoVO> listCompanyInfoByIds(@RequestBody List<Integer> ids) {
return companyService.listCompanyInfoByIds(ids); return companyService.listCompanyInfoByIds(ids);
} }
@ApiOperation(value = "批量获取单位信息-后台用户id批量获取")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CompanyInfoVO.class)})
@PostMapping("listCompanyInfoByBUIds")
public List<CompanyInfoVO> listCompanyInfoByBUIds(@RequestBody List<Integer> backUserAccountIds) {
return companyService.listCompanyInfoByBUIds(backUserAccountIds);
}
} }
...@@ -135,4 +135,15 @@ public class CooperationController extends BaseController { ...@@ -135,4 +135,15 @@ public class CooperationController extends BaseController {
public List<CooperationTagVO> feignListCooperationTag() { public List<CooperationTagVO> feignListCooperationTag() {
return cooperationService.listTag(); return cooperationService.listTag();
} }
@ApiOperation(value = "合作商家列表-根据合作标签id获取")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CompanyInfoVO.class)})
@GetMapping("listCompanyInfoByCoopId")
public ResultBody<CompanyInfoVO> listCompanyInfoByCoopId(@ApiParam(value = "加盟合作标签id") @RequestParam Integer coopId,
@RequestParam Integer pageNo,
@RequestParam Integer pageSize,
@RequestParam Double lon,
@RequestParam Double lat) {
return ResultBody.success(cooperationService.listCompanyInfoByCoopId(coopId, pageNo, pageSize, lon, lat));
}
} }
...@@ -6,10 +6,7 @@ import com.mmc.iuav.group.Update; ...@@ -6,10 +6,7 @@ import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController; import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.model.dto.RoleInfoDTO; import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotAbilityDTO; import com.mmc.iuav.user.model.dto.dronepilot.*;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationLogDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotReasonDTO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationQO;
...@@ -132,4 +129,11 @@ public class PilotCertificationController extends BaseController { ...@@ -132,4 +129,11 @@ public class PilotCertificationController extends BaseController {
} }
@ApiOperation(value = "后台内部调用——详情————飞手执照及能力认证")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = PilotCertificationDTO.class)})
@GetMapping("/interiorDetailPilot")
public PilotCertificationInteriorDTO interiorDetailPilot(@RequestParam(value = "userAccountId", required = true) Integer userAccountId) {
return certificationService.interiorDetailPilot(userAccountId);
}
} }
...@@ -199,4 +199,6 @@ public interface CompanyDao { ...@@ -199,4 +199,6 @@ public interface CompanyDao {
void unbindingAllPcUsers(Integer id); void unbindingAllPcUsers(Integer id);
List<CompanyInfoDO> listCompanyInfoByIds(@Param("ids") List<Integer> ids); List<CompanyInfoDO> listCompanyInfoByIds(@Param("ids") List<Integer> ids);
void deleteCompanyInfoById(Integer id);
} }
...@@ -137,4 +137,8 @@ public interface CooperationDao { ...@@ -137,4 +137,8 @@ public interface CooperationDao {
int countUserApplyTagByUid(Integer userAccountId); int countUserApplyTagByUid(Integer userAccountId);
UserApplyTagDO appBrandMessage(Integer userAccountId); UserApplyTagDO appBrandMessage(Integer userAccountId);
int countListCompanyInfoByCoopId(Integer coopId);
List<CompanyInfoDO> listCompanyInfoByCoopId(Integer coopId, Double lon, Double lat, Integer pageNo, Integer pageSize);
} }
...@@ -47,6 +47,8 @@ public interface PilotCertificationDao { ...@@ -47,6 +47,8 @@ public interface PilotCertificationDao {
PilotCertificationDO userDetailPilot(Integer userAccountId); PilotCertificationDO userDetailPilot(Integer userAccountId);
PilotCertificationDO interiorDetailPilot(Integer userAccountId);
void updateRemark(PilotRemarkQO param); void updateRemark(PilotRemarkQO param);
void updateAuditStatus(PilotAuditStatusQO param); void updateAuditStatus(PilotAuditStatusQO param);
...@@ -60,4 +62,5 @@ public interface PilotCertificationDao { ...@@ -60,4 +62,5 @@ public interface PilotCertificationDao {
PilotReasonDO selectPilotReason(String reasonId); PilotReasonDO selectPilotReason(String reasonId);
int selectFirstApprove(Integer id); int selectFirstApprove(Integer id);
} }
...@@ -47,6 +47,7 @@ public class BackUserAccountDO implements Serializable { ...@@ -47,6 +47,7 @@ public class BackUserAccountDO implements Serializable {
this.districtCode = bUserAccountVO.getDistrictCode(); this.districtCode = bUserAccountVO.getDistrictCode();
this.remark = bUserAccountVO.getRemark(); this.remark = bUserAccountVO.getRemark();
this.address = bUserAccountVO.getAddress(); this.address = bUserAccountVO.getAddress();
this.accountStatus = bUserAccountVO.getAccountStatus();
} }
public BackUserAccountVO buildBackUserAccountVO() { public BackUserAccountVO buildBackUserAccountVO() {
......
...@@ -50,6 +50,8 @@ public class CompanyInfoDO implements Serializable { ...@@ -50,6 +50,8 @@ public class CompanyInfoDO implements Serializable {
private Integer score; private Integer score;
private Integer leader; private Integer leader;
@ApiModelProperty(value = "当前距离")
private Double distance;
public CompanyInfoDO(ApplyTagEditVO applyTagEditVO) { public CompanyInfoDO(ApplyTagEditVO applyTagEditVO) {
this.address = applyTagEditVO.getAddress(); this.address = applyTagEditVO.getAddress();
...@@ -63,12 +65,14 @@ public class CompanyInfoDO implements Serializable { ...@@ -63,12 +65,14 @@ public class CompanyInfoDO implements Serializable {
return CompanyInfoVO.builder().id(id).companyType(companyType).companyName(companyName).fullName(fullName).province(province) return CompanyInfoVO.builder().id(id).companyType(companyType).companyName(companyName).fullName(fullName).province(province)
.brandName(brandName) .brandName(brandName)
.brandLogo(brandLogo) .brandLogo(brandLogo)
.backUserAccountId(backUserAccountId)
.userAccountId(userAccountId) .userAccountId(userAccountId)
.lon(this.lon).lat(this.lat).creditCode(this.creditCode).licenseImg(this.licenseImg).leader(this.leader) .lon(this.lon).lat(this.lat).creditCode(this.creditCode).licenseImg(this.licenseImg).leader(this.leader)
.city(city).district(district).address(address).companyUserName(companyUserName).phoneNum(phoneNum).remark(remark) .city(city).district(district).address(address).companyUserName(companyUserName).phoneNum(phoneNum).remark(remark)
.content(this.getContent()) .content(this.getContent())
.score(this.getScore()) .score(this.getScore())
.backImg(this.backImg) .backImg(this.backImg)
.distance(this.distance)
.build(); .build();
} }
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.annotation.JSONField; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.annotation.JSONField;
import com.mmc.iuav.group.Create; import com.mmc.iuav.group.Create;
import com.mmc.iuav.group.Update; import com.mmc.iuav.group.Update;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO; import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationInteriorDTO;
import com.mmc.iuav.user.model.vo.dronepilot.PilotAbilityVO; import com.mmc.iuav.user.model.vo.dronepilot.PilotAbilityVO;
import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO; import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -159,4 +160,12 @@ public class PilotCertificationDO { ...@@ -159,4 +160,12 @@ public class PilotCertificationDO {
.build(); .build();
} }
public PilotCertificationInteriorDTO buildInterior() {
return PilotCertificationInteriorDTO.builder()
.id(this.id)
.userAccountId(this.userAccountId)
.build();
}
} }
...@@ -8,8 +8,10 @@ public enum RoleEnums { ...@@ -8,8 +8,10 @@ public enum RoleEnums {
ADMIN(1, "超级管理员"), ADMIN(1, "超级管理员"),
OPERATOR(2, "运营管理员"), OPERATOR(2, "运营管理员"),
FINANCIAL(3, "财务"), FINANCIAL(3, "财务管理员"),
FRANCHISEE(4, "加盟商"); FRANCHISEE(4, "加盟商"),
SERVICE_FRANCHISEE(5, "服务管理员"),
LEASE_FRANCHISEE(6, "租赁供应商");
RoleEnums(Integer id, String roleName) { RoleEnums(Integer id, String roleName) {
this.id = id; this.id = id;
......
package com.mmc.iuav.user.enums;
/**
* @author: zj
* @Date: 2023/8/14 16:52
*/
public enum UserTypeEnums {
PC(0, "后台用户", "PC"), APP(100, "小程序用户", "APP");
UserTypeEnums(Integer type, String typeName, String typeCode) {
this.type = type;
this.typeName = typeName;
this.typeCode = typeCode;
}
public Integer getType() {
return type;
}
public String getTypeName() {
return typeName;
}
public String getTypeCode() {
return typeCode;
}
private Integer type;
private String typeName;
private String typeCode;
}
...@@ -18,9 +18,10 @@ public interface BackUserAccountService { ...@@ -18,9 +18,10 @@ public interface BackUserAccountService {
* 添加后台用户 * 添加后台用户
* *
* @param bUserAccountVO * @param bUserAccountVO
* @param loginSuccessDTO
* @return * @return
*/ */
ResultBody insertBAccount(BUserAccountVO bUserAccountVO); ResultBody insertBAccount(BUserAccountVO bUserAccountVO, LoginSuccessDTO loginSuccessDTO);
/** /**
* 添加后台用户信息 * 添加后台用户信息
...@@ -35,18 +36,19 @@ public interface BackUserAccountService { ...@@ -35,18 +36,19 @@ public interface BackUserAccountService {
* 禁用后台用户 * 禁用后台用户
* *
* @param accountId * @param accountId
* @param backUserAccountId * @param loginSuccessDTO
* @return * @return
*/ */
ResultBody disableBAccount(Integer accountId, Integer backUserAccountId); ResultBody disableBAccount(Integer accountId, LoginSuccessDTO loginSuccessDTO);
/** /**
* 后台用户列表 * 后台用户列表
* *
* @param bUserAccountQO * @param bUserAccountQO
* @param loginSuccessDTO
* @return * @return
*/ */
ResultBody<BackUserAccountVO> listBAccountPage(BUserAccountQO bUserAccountQO); ResultBody<BackUserAccountVO> listBAccountPage(BUserAccountQO bUserAccountQO, LoginSuccessDTO loginSuccessDTO);
/** /**
* 内部远程调用查询用户信息 * 内部远程调用查询用户信息
...@@ -60,9 +62,10 @@ public interface BackUserAccountService { ...@@ -60,9 +62,10 @@ public interface BackUserAccountService {
* 修改用户密码 * 修改用户密码
* *
* @param account * @param account
* @param loginSuccessDTO
* @return * @return
*/ */
ResultBody updatePassword(BUserAccountVO account); ResultBody updatePassword(BUserAccountVO account, LoginSuccessDTO loginSuccessDTO);
/** /**
* 内部确认用户密码 * 内部确认用户密码
......
...@@ -10,6 +10,7 @@ import com.mmc.iuav.user.model.vo.CompanyAuthVO; ...@@ -10,6 +10,7 @@ import com.mmc.iuav.user.model.vo.CompanyAuthVO;
public interface CompanyAuthService { public interface CompanyAuthService {
/** /**
* 添加企业认证 * 添加企业认证
*
* @param companyAuthVO * @param companyAuthVO
* @return * @return
*/ */
...@@ -17,6 +18,7 @@ public interface CompanyAuthService { ...@@ -17,6 +18,7 @@ public interface CompanyAuthService {
/** /**
* 根据企业名称模糊查询 * 根据企业名称模糊查询
*
* @param searchKey * @param searchKey
* @return * @return
*/ */
...@@ -24,6 +26,7 @@ public interface CompanyAuthService { ...@@ -24,6 +26,7 @@ public interface CompanyAuthService {
/** /**
* 根据用户账号查询企业认证 * 根据用户账号查询企业认证
*
* @param userAccountId * @param userAccountId
* @return * @return
*/ */
......
...@@ -164,4 +164,8 @@ public interface CompanyService { ...@@ -164,4 +164,8 @@ public interface CompanyService {
void unbindingAllUsers(Integer id); void unbindingAllUsers(Integer id);
List<CompanyInfoVO> listCompanyInfoByIds(List<Integer> ids); List<CompanyInfoVO> listCompanyInfoByIds(List<Integer> ids);
List<CompanyInfoVO> listCompanyInfoByBUIds(List<Integer> backUserAccountIds);
void deleteCompanyInfoById(Integer id);
} }
...@@ -62,4 +62,6 @@ public interface CooperationService { ...@@ -62,4 +62,6 @@ public interface CooperationService {
ResultBody appBrandList(); ResultBody appBrandList();
ResultBody<UserApplyTagVO> appBrandMessage(Integer userAccountId); ResultBody<UserApplyTagVO> appBrandMessage(Integer userAccountId);
PageResult listCompanyInfoByCoopId(Integer coopId, Integer pageNo, Integer pageSize, Double lon, Double lat);
} }
...@@ -5,6 +5,7 @@ import com.mmc.iuav.response.ResultBody; ...@@ -5,6 +5,7 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotAbilityDTO; import com.mmc.iuav.user.model.dto.dronepilot.PilotAbilityDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO; import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationInteriorDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotReasonDTO; import com.mmc.iuav.user.model.dto.dronepilot.PilotReasonDTO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO;
...@@ -42,4 +43,6 @@ public interface PilotCertificationService { ...@@ -42,4 +43,6 @@ public interface PilotCertificationService {
PageResult backPilotLogList(PilotCertificationLogQO param, LoginSuccessDTO userLoginInfoFromRedis); PageResult backPilotLogList(PilotCertificationLogQO param, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody<PilotReasonDTO> backListReason(); ResultBody<PilotReasonDTO> backListReason();
PilotCertificationInteriorDTO interiorDetailPilot(Integer userAccountId);
} }
...@@ -18,10 +18,7 @@ import com.mmc.iuav.user.entity.dronepilot.*; ...@@ -18,10 +18,7 @@ import com.mmc.iuav.user.entity.dronepilot.*;
import com.mmc.iuav.user.entity.userpoints.UserPointsDO; import com.mmc.iuav.user.entity.userpoints.UserPointsDO;
import com.mmc.iuav.user.entity.userpoints.UserPointsDetails; import com.mmc.iuav.user.entity.userpoints.UserPointsDetails;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotAbilityDTO; import com.mmc.iuav.user.model.dto.dronepilot.*;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotCertificationLogDTO;
import com.mmc.iuav.user.model.dto.dronepilot.PilotReasonDTO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotAuditStatusQO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationLogQO;
import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationQO; import com.mmc.iuav.user.model.qo.dronepilot.PilotCertificationQO;
...@@ -241,9 +238,10 @@ public class PilotCertificationServiceImpl implements PilotCertificationService ...@@ -241,9 +238,10 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
if (param.getAuditStatus() == 1) { if (param.getAuditStatus() == 1) {
param.setIsFirstApprove(1); param.setIsFirstApprove(1);
} }
if (param.getAuditStatus()==2 && i==0){ if (param.getAuditStatus() == 2 && i == 0) {
param.setIsFirstApprove(0); param.setIsFirstApprove(0);
}if(param.getAuditStatus()==2 && i ==1){ }
if (param.getAuditStatus() == 2 && i == 1) {
param.setIsFirstApprove(1); param.setIsFirstApprove(1);
} }
} }
...@@ -474,5 +472,21 @@ public class PilotCertificationServiceImpl implements PilotCertificationService ...@@ -474,5 +472,21 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
return age; return age;
} }
@Override
public PilotCertificationInteriorDTO interiorDetailPilot(Integer userAccountId) {
PilotCertificationDO certificationDO = certificationDao.interiorDetailPilot(userAccountId);
if (certificationDO == null) {
return null;
}
int yearsOfWorking = 0;
yearsOfWorking = getYearsOfWorking(certificationDO.getTimeOfApplication());
Integer Working = certificationDO.getYearsOfWorking();
yearsOfWorking = yearsOfWorking + Working;
certificationDO.setYearsOfWorking(yearsOfWorking);
certificationDO.setAge(getAgeByBirth(certificationDO.getBirthday()));
PilotCertificationInteriorDTO pilotCertificationInteriorDTO = certificationDO.buildInterior();
return pilotCertificationInteriorDTO;
}
} }
...@@ -3,9 +3,9 @@ package com.mmc.iuav.user.service.impl; ...@@ -3,9 +3,9 @@ package com.mmc.iuav.user.service.impl;
import com.alibaba.fastjson2.JSON; 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.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.AuthHandler;
import com.mmc.iuav.user.auth.PwdUtil; import com.mmc.iuav.user.auth.PwdUtil;
import com.mmc.iuav.user.client.PayClient; import com.mmc.iuav.user.client.PayClient;
import com.mmc.iuav.user.constant.WxConstant; import com.mmc.iuav.user.constant.WxConstant;
...@@ -26,8 +26,6 @@ import org.springframework.stereotype.Service; ...@@ -26,8 +26,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -65,6 +63,9 @@ public class AuthServiceImpl implements AuthService { ...@@ -65,6 +63,9 @@ public class AuthServiceImpl implements AuthService {
@Autowired @Autowired
private PayClient payClient; private PayClient payClient;
@Autowired
private AuthHandler authHandler;
@Transactional @Transactional
@Override @Override
public ResultBody appletLogin(WxLoginVO wxLoginVO) { public ResultBody appletLogin(WxLoginVO wxLoginVO) {
...@@ -112,20 +113,10 @@ public class AuthServiceImpl implements AuthService { ...@@ -112,20 +113,10 @@ public class AuthServiceImpl implements AuthService {
CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userAccountVO.getId()); CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userAccountVO.getId());
companyAuthStatus = companyAuthDO == null ? 0 : 1; companyAuthStatus = companyAuthDO == null ? 0 : 1;
} }
AppUserSucVO appUserSucVO = authHandler.addAppLoginCache(userAccountVO);
Map<String, Object> map = new HashMap<String, Object>(); appUserSucVO.setAuthStatus(companyAuthStatus);
map.put(JwtConstant.USER_ACCOUNT_ID, userAccountVO.getId()); appUserSucVO.setSessionKey(sessionKey);
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN); return ResultBody.success(appUserSucVO);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getId() + "")
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
return ResultBody.success(AppUserSucVO.builder().token(token).uid(userAccountVO.getUid()).phoneNum(userAccountVO.getPhoneNum())
.nickName(userAccountVO.getNickName()).userAccountId(userAccountVO.getId()).sessionKey(sessionKey).portType(100).authStatus(companyAuthStatus).build());
} }
@Override @Override
...@@ -136,7 +127,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -136,7 +127,7 @@ public class AuthServiceImpl implements AuthService {
return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_NOT_EXIT_ERROR); return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_NOT_EXIT_ERROR);
} }
if (user.getAccountStatus().equals(UserAccountStatus.DISABLE.getAccountStatus())) { if (user.getAccountStatus().equals(UserAccountStatus.DISABLE.getAccountStatus())) {
return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR); return ResultBody.error(ResultEnum.FORBID_USE_ERROR);
} }
String loginPwd = ""; String loginPwd = "";
try { try {
...@@ -147,22 +138,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -147,22 +138,8 @@ public class AuthServiceImpl implements AuthService {
if (!loginPwd.equals(user.getPassword())) { if (!loginPwd.equals(user.getPassword())) {
return ResultBody.error(ResultEnum.LOGIN_PASSWORD_ERROR); return ResultBody.error(ResultEnum.LOGIN_PASSWORD_ERROR);
} }
// 查询单位信息 BackUserAccountVO backUserAccountVO = user.buildBackUserAccountVO();
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(user.getId()); LoginSuccessDTO loginSuccessDTO = authHandler.addPcLoginCache(backUserAccountVO);
companyInfoVO.setLeader(1);
// 角色信息
RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(user.getId());
Map<String, Object> map = new HashMap<String, Object>();
map.put(JwtConstant.USER_ACCOUNT_ID, user.getId());
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(user.getId()).accountNo(user.getAccountNo()).uid(user.getId() + "")
.userName(user.getUserName()).nickName(user.getUserName()).phoneNum(user.getPhoneNum()).portType(0).companyInfoVO(companyInfoVO == null ? null : companyInfoVO)
.roleInfo(roleInfoDO.buildRoleInfoDTO()).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
loginSuccessDTO.setToken(token);
return ResultBody.success(loginSuccessDTO); return ResultBody.success(loginSuccessDTO);
} }
...@@ -170,20 +147,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -170,20 +147,8 @@ public class AuthServiceImpl implements AuthService {
public ResultBody testAppletLogin(String unionId) { public ResultBody testAppletLogin(String unionId) {
UserAccountVO userAccountVO = userAccountService.getUserAccountInfoByUnionId(unionId); UserAccountVO userAccountVO = userAccountService.getUserAccountInfoByUnionId(unionId);
if (userAccountVO != null) { if (userAccountVO != null) {
Map<String, Object> map = new HashMap<String, Object>(); AppUserSucVO appUserSucVO = authHandler.addAppLoginCache(userAccountVO);
map.put(JwtConstant.USER_ACCOUNT_ID, userAccountVO.getId()); return ResultBody.success(appUserSucVO);
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
CompanyAuthDO companyAuthDO = companyAuthDao.getCompanyAuth(userAccountVO.getId());
Integer companyAuthStatus = companyAuthDO == null ? 0 : 1;
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getId() + "")
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
return ResultBody.success(AppUserSucVO.builder().token(token).uid(userAccountVO.getUid()).phoneNum(userAccountVO.getPhoneNum())
.nickName(userAccountVO.getNickName()).userAccountId(userAccountVO.getId()).portType(100).authStatus(companyAuthStatus).build());
} }
return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR); return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR);
} }
...@@ -206,27 +171,18 @@ public class AuthServiceImpl implements AuthService { ...@@ -206,27 +171,18 @@ public class AuthServiceImpl implements AuthService {
if (backUserAccountVO.getDisable().equals(1)) { if (backUserAccountVO.getDisable().equals(1)) {
return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_NOT_EXIT_ERROR); return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_NOT_EXIT_ERROR);
} }
// 设置用户角色 LoginSuccessDTO backLoginSuccessDTO = authHandler.addPcLoginCache(backUserAccountVO);
RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(companyBackUserDO.getBackUserAccountId()); backLoginSuccessDTO.setAppUserAccountId(loginSuccessDTO.getUserAccountId());
// 设置用户是否是管理员
Map<String, Object> map = new HashMap<String, Object>(); backLoginSuccessDTO.getCompanyInfoVO().setLeader(companyInfoVO.getLeader());
map.put(JwtConstant.USER_ACCOUNT_ID, backUserAccountVO.getId());
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.M_TOKEN);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO backLoginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(backUserAccountVO.getId())
.accountNo(backUserAccountVO.getAccountNo()).uid(backUserAccountVO.getId() + "").userName(backUserAccountVO.getUserName())
.nickName(backUserAccountVO.getUserName()).phoneNum(backUserAccountVO.getPhoneNum()).portType(0).companyInfoVO(companyInfoVO == null ? null : companyInfoVO)
.roleInfo(roleInfoDO.buildRoleInfoDTO()).appUserAccountId(loginSuccessDTO.getUserAccountId()).token(token).build();
// 设置后台账号token,key为randomLoginCode // 设置后台账号token,key为randomLoginCode
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
randomLoginCode, JSONObject.toJSONString(backLoginSuccessDTO), randomLoginCode, JSONObject.toJSONString(backLoginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS); JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
loginSuccessDTO.setToken(token); // 重新设置后台账号token
// 设置后台账号token,key为randomLoginCode
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(backLoginSuccessDTO), backLoginSuccessDTO.getToken(), JSONObject.toJSONString(backLoginSuccessDTO),
JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS); JwtConstant.EXPIRATION, TimeUnit.MILLISECONDS);
loginSuccessDTO.setToken(token);
} else { } else {
stringRedisTemplate.opsForValue().set( stringRedisTemplate.opsForValue().set(
randomLoginCode, JSONObject.toJSONString(loginSuccessDTO), randomLoginCode, JSONObject.toJSONString(loginSuccessDTO),
...@@ -242,6 +198,8 @@ public class AuthServiceImpl implements AuthService { ...@@ -242,6 +198,8 @@ public class AuthServiceImpl implements AuthService {
return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR); return ResultBody.error(ResultEnum.APPLET_LOGIN_ERROR);
} }
LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class); LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class);
// 获取成功后删除
stringRedisTemplate.delete(randomLoginCode);
return ResultBody.success(loginSuccessDTO); return ResultBody.success(loginSuccessDTO);
} }
} }
...@@ -52,7 +52,10 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -52,7 +52,10 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
@Transactional @Transactional
@Override @Override
public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) { public ResultBody insertBAccount(BUserAccountVO bUserAccountVO, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO != null && loginSuccessDTO.getCompanyInfoVO().getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
return ResultBody.error(ResultEnum.NO_RIGHT_UPDATE_ERROR);
}
if (!bUserAccountVO.getPassWord().equals(bUserAccountVO.getAlertPwd())) { if (!bUserAccountVO.getPassWord().equals(bUserAccountVO.getAlertPwd())) {
// 两次密码不一致 // 两次密码不一致
return ResultBody.error(ResultEnum.PWD_ALERT_ERROR); return ResultBody.error(ResultEnum.PWD_ALERT_ERROR);
...@@ -76,7 +79,8 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -76,7 +79,8 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) { if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
// 绑定企业为加盟公司,不能生成多个账号 // 绑定企业为加盟公司,不能生成多个账号
int bindingCount = companyService.countCompanyBackUser(companyInfoVO.getId()); int bindingCount = companyService.countCompanyBackUser(companyInfoVO.getId());
if (bindingCount > 0) { CompanyBackUserDO companyBackDO = companyService.getCompanyBackUserByCompanyId(bUserAccountVO.getCompanyId());
if (bindingCount > 0 && companyBackDO != null && !companyBackDO.getBackUserAccountId().equals(bUserAccountVO.getId())) {
return ResultBody.error(ResultEnum.FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR); return ResultBody.error(ResultEnum.FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR);
} }
} }
...@@ -123,7 +127,8 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -123,7 +127,8 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) { if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
// 绑定企业为加盟公司,不能生成多个账号 // 绑定企业为加盟公司,不能生成多个账号
int bindingCount = companyService.countCompanyBackUser(companyInfoVO.getId()); int bindingCount = companyService.countCompanyBackUser(companyInfoVO.getId());
if (bindingCount > 0) { CompanyBackUserDO companyBackDO = companyService.getCompanyBackUserByCompanyId(bUserAccountVO.getCompanyId());
if (bindingCount > 0 && companyBackDO != null && !companyBackDO.getBackUserAccountId().equals(bUserAccountVO.getId())) {
return ResultBody.error(ResultEnum.FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR); return ResultBody.error(ResultEnum.FRANCHISEE_ACCOUNT_MORE_THAN_ONE_ERROR);
} }
} }
...@@ -141,28 +146,35 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -141,28 +146,35 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
} }
@Override @Override
public ResultBody disableBAccount(Integer accountId, Integer backUserAccountId) { public ResultBody disableBAccount(Integer accountId, LoginSuccessDTO loginSuccessDTO) {
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(accountId);
if (!loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(RoleEnums.ADMIN.getId())) {
return ResultBody.error(ResultEnum.NO_RIGHT_UPDATE_ERROR);
}
BackUserAccountDO backUserAccountDO = backUserAccountDao.getBackUserAccountDO(accountId); BackUserAccountDO backUserAccountDO = backUserAccountDao.getBackUserAccountDO(accountId);
RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(accountId); RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(accountId);
if (roleInfoDO.getSuperAdmin().equals(RoleEnums.ADMIN.getId())) { if (roleInfoDO.getSuperAdmin().equals(RoleEnums.ADMIN.getId())) {
return ResultBody.error(ResultEnum.DELETE_ADMIN_ERROR); return ResultBody.error(ResultEnum.DELETE_ADMIN_ERROR);
} }
if (accountId.toString().equals(backUserAccountId.toString())) { if (accountId.toString().equals(loginSuccessDTO.getUserAccountId().toString())) {
return ResultBody.error(ResultEnum.DELETE_YOURSELF_ERROR); return ResultBody.error(ResultEnum.DELETE_YOURSELF_ERROR);
} }
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(accountId);
if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) { if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
// 加盟企业的账号,需要把对应的成员和后台账号解绑 // 加盟企业的账号,需要把对应的成员和后台账号解绑
companyService.unbindingAllUsers(companyInfoVO.getId()); companyService.unbindingAllUsers(companyInfoVO.getId());
companyService.deleteCompanyInfoById(companyInfoVO.getId());
} }
String accountNo = "DISABLE_" + backUserAccountDO.getAccountNo() + RandomStringUtils.randomAlphanumeric(3); String accountNo = "DISABLE_" + backUserAccountDO.getAccountNo() + RandomStringUtils.randomAlphanumeric(3);
backUserAccountDao.disableBackUserAccountDO(accountId, accountNo); backUserAccountDao.disableBackUserAccountDO(accountId, accountNo);
pmsClient.removeMallGoods(accountId, null); pmsClient.removeMallGoods(accountId, companyInfoVO.getId(), null);
return ResultBody.success(); return ResultBody.success();
} }
@Override @Override
public ResultBody<BackUserAccountVO> listBAccountPage(BUserAccountQO param) { public ResultBody<BackUserAccountVO> listBAccountPage(BUserAccountQO param, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO.getCompanyInfoVO().getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
param.setCompanyInfoId(loginSuccessDTO.getCompanyInfoVO().getId());
}
int count = backUserAccountDao.countListBackUserAccount(param); int count = backUserAccountDao.countListBackUserAccount(param);
if (count == 0) { if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count)); return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
...@@ -197,7 +209,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -197,7 +209,13 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
} }
@Override @Override
public ResultBody updatePassword(BUserAccountVO account) { public ResultBody updatePassword(BUserAccountVO account, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO.getAppUserAccountId() != null) {
CompanyInfoVO appCompanyInfoUId = companyService.getAppCompanyInfoUId(loginSuccessDTO.getAppUserAccountId());
if (!appCompanyInfoUId.getLeader().equals(1)) {
return ResultBody.error(ResultEnum.NO_RIGHT_UPDATE_ERROR);
}
}
if (!account.getPassWord().equals(account.getAlertPwd())) { if (!account.getPassWord().equals(account.getAlertPwd())) {
return ResultBody.error(ResultEnum.PASSWORD_INCONSISTENT); return ResultBody.error(ResultEnum.PASSWORD_INCONSISTENT);
} }
......
...@@ -4,11 +4,9 @@ import com.mmc.iuav.page.PageResult; ...@@ -4,11 +4,9 @@ import com.mmc.iuav.page.PageResult;
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.client.PmsClient; import com.mmc.iuav.user.client.PmsClient;
import com.mmc.iuav.user.dao.BackUserAccountDao;
import com.mmc.iuav.user.dao.CompanyDao; import com.mmc.iuav.user.dao.CompanyDao;
import com.mmc.iuav.user.entity.CompanyBackUserDO; import com.mmc.iuav.user.entity.*;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.entity.CompanyMemberDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.qo.CompanyInfoQO; import com.mmc.iuav.user.model.qo.CompanyInfoQO;
import com.mmc.iuav.user.model.vo.CompanyInfoVO; import com.mmc.iuav.user.model.vo.CompanyInfoVO;
...@@ -35,6 +33,9 @@ public class CompanyServiceImpl implements CompanyService { ...@@ -35,6 +33,9 @@ public class CompanyServiceImpl implements CompanyService {
@Autowired @Autowired
private PmsClient pmsClient; private PmsClient pmsClient;
@Autowired
private BackUserAccountDao backUserAccountDao;
@Override @Override
public ResultBody addCompanyInfo(CompanyInfoVO companyInfo) { public ResultBody addCompanyInfo(CompanyInfoVO companyInfo) {
int count = companyDao.countCompanyNames(companyInfo.getId(), companyInfo.getCompanyName()); int count = companyDao.countCompanyNames(companyInfo.getId(), companyInfo.getCompanyName());
...@@ -82,7 +83,16 @@ public class CompanyServiceImpl implements CompanyService { ...@@ -82,7 +83,16 @@ public class CompanyServiceImpl implements CompanyService {
public ResultBody<CompanyInfoVO> getCompanyInfoById(Integer id) { public ResultBody<CompanyInfoVO> getCompanyInfoById(Integer id) {
CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoById(id); CompanyInfoDO companyInfoDO = companyDao.getCompanyInfoById(id);
if (companyInfoDO != null) { if (companyInfoDO != null) {
return ResultBody.success(companyInfoDO.buildCompanyInfoVO()); CompanyInfoVO companyInfoVO = companyInfoDO.buildCompanyInfoVO();
// 设置手机号
CompanyBackUserDO companyBackUserDO = companyDao.getCompanyBackUserByCompanyId(id);
if (companyBackUserDO != null) {
BackUserAccountDO backUserAccountDO = backUserAccountDao.getBackUserAccountDO(companyBackUserDO.getBackUserAccountId());
if (backUserAccountDO != null) {
companyInfoVO.setPhoneNum(backUserAccountDO.getPhoneNum());
}
}
return ResultBody.success(companyInfoVO);
} }
return ResultBody.success(); return ResultBody.success();
} }
...@@ -237,4 +247,16 @@ public class CompanyServiceImpl implements CompanyService { ...@@ -237,4 +247,16 @@ public class CompanyServiceImpl implements CompanyService {
List<CompanyInfoVO> companyInfoVOS = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList()); List<CompanyInfoVO> companyInfoVOS = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return companyInfoVOS; return companyInfoVOS;
} }
@Override
public List<CompanyInfoVO> listCompanyInfoByBUIds(List<Integer> backUserAccountIds) {
List<CompanyInfoDO> companyInfoDOS = this.listCompanyInfoByUID(backUserAccountIds);
List<CompanyInfoVO> companyInfoVOS = companyInfoDOS.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return companyInfoVOS;
}
@Override
public void deleteCompanyInfoById(Integer id) {
companyDao.deleteCompanyInfoById(id);
}
} }
...@@ -19,14 +19,11 @@ import com.mmc.iuav.user.service.CooperationService; ...@@ -19,14 +19,11 @@ import com.mmc.iuav.user.service.CooperationService;
import com.mmc.iuav.user.service.UserAccountService; import com.mmc.iuav.user.service.UserAccountService;
import com.mmc.iuav.user.util.SmsUtil; import com.mmc.iuav.user.util.SmsUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
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.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -143,6 +140,10 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -143,6 +140,10 @@ public class CooperationServiceImpl implements CooperationService {
@Override @Override
public ResultBody deleteApplyTag(Integer id) { public ResultBody deleteApplyTag(Integer id) {
UserApplyTagDO userApplyTag = cooperationDao.getUserApplyTag(id);
if (userApplyTag.getApplyStatus().equals(1)) {
return ResultBody.error(ResultEnum.DELETE_PASS_ERROR);
}
cooperationDao.deleteApplyTag(id); cooperationDao.deleteApplyTag(id);
return ResultBody.success(); return ResultBody.success();
} }
...@@ -192,14 +193,12 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -192,14 +193,12 @@ public class CooperationServiceImpl implements CooperationService {
// 审批通过生成后台对应的账号 // 审批通过生成后台对应的账号
BUserAccountVO bUserAccountVO = this.generateBackUserAccountVO(userApplyTag); BUserAccountVO bUserAccountVO = this.generateBackUserAccountVO(userApplyTag);
log.info("check apply cooperation tag, bUserAccountVO:{}", JSONObject.toJSONString(bUserAccountVO)); log.info("check apply cooperation tag, bUserAccountVO:{}", JSONObject.toJSONString(bUserAccountVO));
ResultBody resultBody = backUserAccountService.insertBAccount(bUserAccountVO); ResultBody resultBody = backUserAccountService.insertBAccount(bUserAccountVO, null);
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) { if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
// 生成账号失败处理 // 生成账号失败处理
throw new BizException(ResultEnum.COOPERATION_CHECK_NOT_PASS_ERROR); throw new BizException(ResultEnum.COOPERATION_CHECK_NOT_PASS_ERROR);
} }
Map<String, String> param = new HashMap<String, String>(); SmsUtil.sendPassCooperationApply(bUserAccountVO.getPhoneNum());
param.put("password", bUserAccountVO.getPassWord());
SmsUtil.sendPassCooperationApply(JSONObject.toJSONString(param), bUserAccountVO.getPhoneNum());
} else { } else {
SmsUtil.sendNotPassCooperationApply(account.getPhoneNum()); SmsUtil.sendNotPassCooperationApply(account.getPhoneNum());
cooperationDao.updateApplyTagStatus(id, 2); cooperationDao.updateApplyTagStatus(id, 2);
...@@ -213,11 +212,18 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -213,11 +212,18 @@ public class CooperationServiceImpl implements CooperationService {
bUserAccountVO.setAccountNo(userAccountVO.getPhoneNum()); bUserAccountVO.setAccountNo(userAccountVO.getPhoneNum());
bUserAccountVO.setUserName(userApplyTagDO.getApplyName()); bUserAccountVO.setUserName(userApplyTagDO.getApplyName());
bUserAccountVO.setPhoneNum(userAccountVO.getPhoneNum()); bUserAccountVO.setPhoneNum(userAccountVO.getPhoneNum());
String password = RandomStringUtils.randomAlphanumeric(8); // String password = "YXF123456";
bUserAccountVO.setPassWord(password); bUserAccountVO.setPassWord(userAccountVO.getPhoneNum());
bUserAccountVO.setAlertPwd(password); bUserAccountVO.setAlertPwd(userAccountVO.getPhoneNum());
bUserAccountVO.setAccountStatus(1); bUserAccountVO.setAccountStatus(1);
bUserAccountVO.setRoleId(RoleEnums.FRANCHISEE.getId()); // 根据加盟类型分配角色
if (userApplyTagDO.getCooperationTagId().equals(3)) {
bUserAccountVO.setRoleId(RoleEnums.LEASE_FRANCHISEE.getId());
} else if (userApplyTagDO.getCooperationTagId().equals(5)) {
bUserAccountVO.setRoleId(RoleEnums.SERVICE_FRANCHISEE.getId());
} else {
bUserAccountVO.setRoleId(RoleEnums.FRANCHISEE.getId());
}
// 添加单位id // 添加单位id
CompanyInfoDO companyInfo = this.getCompanyInfo(userApplyTagDO); CompanyInfoDO companyInfo = this.getCompanyInfo(userApplyTagDO);
bUserAccountVO.setCompanyId(companyInfo.getId()); bUserAccountVO.setCompanyId(companyInfo.getId());
...@@ -252,7 +258,7 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -252,7 +258,7 @@ public class CooperationServiceImpl implements CooperationService {
if (!userApplyTag.getApplyStatus().equals(1)) { if (!userApplyTag.getApplyStatus().equals(1)) {
return ResultBody.error("当前服务商暂未通过审核!"); return ResultBody.error("当前服务商暂未通过审核!");
} }
//if (StringUtils.isBlank(applyTagEditVO.getRemark())) { //if (StringUtils.isBlank(applyTagEditVO.getRemark())) {
UserApplyTagDO userApplyTagDO = new UserApplyTagDO(); UserApplyTagDO userApplyTagDO = new UserApplyTagDO();
userApplyTagDO.setId(applyTagEditVO.getId()); userApplyTagDO.setId(applyTagEditVO.getId());
...@@ -302,4 +308,15 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -302,4 +308,15 @@ public class CooperationServiceImpl implements CooperationService {
UserApplyTagVO userApplyTagVO = userApplyTagDO.buildUserApplyTagVO(); UserApplyTagVO userApplyTagVO = userApplyTagDO.buildUserApplyTagVO();
return ResultBody.success(userApplyTagVO); return ResultBody.success(userApplyTagVO);
} }
@Override
public PageResult listCompanyInfoByCoopId(Integer coopId, Integer pageNo, Integer pageSize, Double lon, Double lat) {
int count = cooperationDao.countListCompanyInfoByCoopId(coopId);
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count);
}
List<CompanyInfoVO> list = cooperationDao.listCompanyInfoByCoopId(coopId, lon, lat, (pageNo - 1) * pageSize, pageSize)
.stream().map(CompanyInfoDO::buildCompanyInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
}
} }
...@@ -32,6 +32,7 @@ import com.mmc.iuav.user.service.CompanyAuthService; ...@@ -32,6 +32,7 @@ import com.mmc.iuav.user.service.CompanyAuthService;
import com.mmc.iuav.user.service.RealNameAuthService; import com.mmc.iuav.user.service.RealNameAuthService;
import com.mmc.iuav.user.service.UserAccountService; import com.mmc.iuav.user.service.UserAccountService;
import com.mmc.iuav.user.service.WxService; import com.mmc.iuav.user.service.WxService;
import lombok.extern.slf4j.Slf4j;
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;
...@@ -46,6 +47,7 @@ import java.util.stream.Collectors; ...@@ -46,6 +47,7 @@ import java.util.stream.Collectors;
* @author: zj * @author: zj
* @Date: 2023/5/16 13:48 * @Date: 2023/5/16 13:48
*/ */
@Slf4j
@Service @Service
public class UserAccountServiceImpl implements UserAccountService { public class UserAccountServiceImpl implements UserAccountService {
...@@ -183,7 +185,12 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -183,7 +185,12 @@ public class UserAccountServiceImpl implements UserAccountService {
@Transactional @Transactional
@Override @Override
public ResultBody getUserPhoneNumber(Integer id, String code, Integer rcdUserId) { public ResultBody getUserPhoneNumber(Integer id, String code, Integer rcdUserId) {
UserAccountDO userAccountDO = userServiceDao.getUserAccountById(id);
if (userAccountDO.getPhoneNum() != null) {
return ResultBody.success();
}
String userPhoneNumber = wxService.getUserPhoneNumber(id, code); String userPhoneNumber = wxService.getUserPhoneNumber(id, code);
log.info("授权手机号,用户:{},手机号:{}", id, userPhoneNumber);
if (StringUtils.isBlank(userPhoneNumber)) { if (StringUtils.isBlank(userPhoneNumber)) {
return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR); return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR);
} }
...@@ -209,7 +216,6 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -209,7 +216,6 @@ public class UserAccountServiceImpl implements UserAccountService {
return ResultBody.success(); return ResultBody.success();
} }
private void extracted(Integer id) { private void extracted(Integer id) {
UserPointsVO userPointsVO = new UserPointsVO(id, NumberOfUserPoints.match(0).getMessage()); UserPointsVO userPointsVO = new UserPointsVO(id, NumberOfUserPoints.match(0).getMessage());
//积分 //积分
......
...@@ -22,14 +22,17 @@ public class SmsUtil { ...@@ -22,14 +22,17 @@ public class SmsUtil {
*/ */
private static String COOPERATION_TEMPLATE_PASS_CODE_0 = "SMS_461986130"; private static String COOPERATION_TEMPLATE_PASS_CODE_0 = "SMS_461986130";
private static String COOPERATION_TEMPLATE_PASS_CODE_2 = "SMS_462240459"; private static String COOPERATION_TEMPLATE_PASS_CODE_2 = "SMS_462240459";
private static String COOPERATION_TEMPLATE_PASS_CODE_3 = "SMS_462620535";
private static String COOPERATION_TEMPLATE_PASS_CODE_4 = "SMS_462605558";
private static String COOPERATION_TEMPLATE_PASS_CODE_5 = "SMS_462575668";
/** /**
* 加盟审核未通过 * 加盟审核未通过
*/ */
private static String COOPERATION_TEMPLATE_CODE_1 = "SMS_462095054"; private static String COOPERATION_TEMPLATE_CODE_1 = "SMS_462095054";
public static String sendPassCooperationApply(String param, String phone) { public static String sendPassCooperationApply(String phone) {
return send(CLOUD_JOIN_WEBSITE, COOPERATION_TEMPLATE_PASS_CODE_2, param, phone); return send(CLOUD_JOIN_WEBSITE, COOPERATION_TEMPLATE_PASS_CODE_5, null, phone);
} }
public static String sendNotPassCooperationApply(String phone) { public static String sendNotPassCooperationApply(String phone) {
......
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
<select id="countListBackUserAccount" resultType="java.lang.Integer" <select id="countListBackUserAccount" resultType="java.lang.Integer"
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO"> parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select count(*) from back_user_account bua select count(*) from back_user_account bua
inner join company_back_user cbu on cbu.back_user_account_id = bua.id
left join user_role_rel urr on urr.back_user_account_id = bua.id left join user_role_rel urr on urr.back_user_account_id = bua.id
where bua.disable = 0 where bua.disable = 0
<if test=" keyword != null and keyword != '' "> <if test=" keyword != null and keyword != '' ">
...@@ -133,6 +134,9 @@ ...@@ -133,6 +134,9 @@
<if test="roleId != null"> <if test="roleId != null">
and urr.role_id = #{roleId} and urr.role_id = #{roleId}
</if> </if>
<if test="companyInfoId != null">
and cbu.company_info_id = #{companyInfoId}
</if>
</select> </select>
<select id="listBackUserAccount" resultMap="backUserAccountResultMap" <select id="listBackUserAccount" resultMap="backUserAccountResultMap"
...@@ -157,6 +161,8 @@ ...@@ -157,6 +161,8 @@
ri.role_no ri.role_no
FROM FROM
back_user_account bua back_user_account bua
inner join company_back_user cbu on cbu.back_user_account_id = bua.id
inner join company_info ci on ci.id = cbu.company_info_id
left join user_role_rel urr on urr.back_user_account_id = bua.id left join user_role_rel urr on urr.back_user_account_id = bua.id
left join role_info ri on ri.id = urr.role_id left join role_info ri on ri.id = urr.role_id
WHERE WHERE
...@@ -180,6 +186,11 @@ ...@@ -180,6 +186,11 @@
<if test="roleId != null"> <if test="roleId != null">
and urr.role_id = #{roleId} and urr.role_id = #{roleId}
</if> </if>
<if test="companyInfoId != null">
and cbu.company_info_id = #{companyInfoId}
</if>
order by bua.id desc
limit #{pageNo}, #{pageSize}
</select> </select>
<select id="feignListBackUserAccount" resultMap="backUserAccountResultMap" <select id="feignListBackUserAccount" resultMap="backUserAccountResultMap"
......
...@@ -110,6 +110,10 @@ ...@@ -110,6 +110,10 @@
delete from company_back_user where company_info_id = #{companyInfoId} delete from company_back_user where company_info_id = #{companyInfoId}
</delete> </delete>
<delete id="deleteCompanyInfoById">
delete from company_info where id = #{id}
</delete>
<select id="getCompanyInfoById" resultType="com.mmc.iuav.user.entity.CompanyInfoDO"> <select id="getCompanyInfoById" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
select id, company_type, company_name, full_name, province, city, district, address, company_user_name, select id, company_type, company_name, full_name, province, city, district, address, company_user_name,
phone_num, remark, create_time, lon, lat, credit_code, license_img, brand_name, brand_logo,content, score, back_img phone_num, remark, create_time, lon, lat, credit_code, license_img, brand_name, brand_logo,content, score, back_img
...@@ -165,7 +169,7 @@ ...@@ -165,7 +169,7 @@
ci.company_user_name, ci.company_user_name,
ci.phone_num, ci.remark, ci.create_time, cbu.back_user_account_id,ci.content, ci.score, ci.back_img ci.phone_num, ci.remark, ci.create_time, cbu.back_user_account_id,ci.content, ci.score, ci.back_img
FROM company_info ci INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id FROM company_info ci INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id
WHERE ci.is_deleted = 0 WHERE 1 = 1
<if test="backUserIds != null"> <if test="backUserIds != null">
<foreach collection="backUserIds" item="backUserAccountId" open="and cbu.back_user_account_id in (" <foreach collection="backUserIds" item="backUserAccountId" open="and cbu.back_user_account_id in ("
close=")" separator=","> close=")" separator=",">
......
...@@ -432,4 +432,37 @@ ...@@ -432,4 +432,37 @@
AND ct.is_deleted = 0 AND ct.is_deleted = 0
AND ci.is_deleted = 0 AND ci.is_deleted = 0
</select> </select>
<select id="countListCompanyInfoByCoopId" resultType="java.lang.Integer">
SELECT count(*)
FROM user_apply_tag uat
INNER JOIN cooperation_tag ct ON uat.cooperation_tag_id = ct.id
INNER JOIN company_member cm ON cm.user_account_id = uat.user_account_id
INNER JOIN company_info ci ON cm.company_info_id = ci.id
WHERE ct.id = #{coopId}
and uat.is_deleted = 0 and uat.apply_status = 1 and ci.is_deleted = 0
</select>
<select id="listCompanyInfoByCoopId" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
SELECT ci.id,
ci.company_name,
ci.address,
ci.lon,
ci.lat,
ci.content,
ci.score,
ci.brand_name,
ci.brand_logo,
cbu.back_user_account_id,
round(st_distance_sphere(point(ci.lon, ci.lat),point(#{lon}, #{lat}))/1000, 2) AS distance
FROM user_apply_tag uat
INNER JOIN cooperation_tag ct ON uat.cooperation_tag_id = ct.id
INNER JOIN company_member cm ON cm.user_account_id = uat.user_account_id
INNER JOIN company_info ci ON cm.company_info_id = ci.id
INNER JOIN company_back_user cbu ON cbu.company_info_id = ci.id
WHERE ct.id = #{coopId}
and uat.is_deleted = 0 and uat.apply_status = 1 and ci.is_deleted = 0
ORDER BY distance ASC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper> </mapper>
...@@ -251,6 +251,39 @@ ...@@ -251,6 +251,39 @@
</select> </select>
<select id="interiorDetailPilot" resultMap="pilotList">
SELECT pc.id,
pc.license_type,
pc.license_number,
pc.license_url,
pc.area_number,
pc.years_of_working,
pc.ability_url,
pc.individual_resume,
pc.audit_status,
pc.user_account_id,
pc.time_of_application,
pc.remark,
pc.resident_city,
pc.create_time,
pc.update_time,
rna.user_name,
rna.birthday,
rna.sex,
ua.phone_num,
pc.reason_id,
pr.reason,
ua.user_img
FROM pilot_certification pc
LEFT JOIN real_name_auth rna ON pc.user_account_id = rna.user_account_id
LEFT JOIN user_account ua ON pc.user_account_id = ua.id
LEFT JOIN pilot_reason pr ON pr.id = pc.reason_id
WHERE pc.user_account_id = #{userAccountId}
and ua.`disable` = 0
and pc.audit_status = 1
</select>
<update id="updateRemark" parameterType="com.mmc.iuav.user.model.qo.dronepilot.PilotRemarkQO"> <update id="updateRemark" parameterType="com.mmc.iuav.user.model.qo.dronepilot.PilotRemarkQO">
UPDATE pilot_certification UPDATE pilot_certification
<set> <set>
......
...@@ -21,7 +21,10 @@ data-filter: ...@@ -21,7 +21,10 @@ data-filter:
- /userapp/back-user/listTest - /userapp/back-user/listTest
- /userapp/company/listCompanyPageBack - /userapp/company/listCompanyPageBack
- /userapp/company/getCompanyInfoById - /userapp/company/getCompanyInfoById
- /userapp/company/listCompanyInfoByIds
- /userapp/company/listCompanyInfoByBUIds
- /userapp/cooperation/service/bitmap - /userapp/cooperation/service/bitmap
- /userapp/cooperation/listCompanyInfoByCoopId
- /userapp/cooperation/appBrandList - /userapp/cooperation/appBrandList
- /userapp/cooperation/appBrandMessage - /userapp/cooperation/appBrandMessage
- /userapp/pilot/detailPilot - /userapp/pilot/detailPilot
......
...@@ -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: 7936cd6a4403d3bd1660483377211090da9f1772 newTag: 49adcd042b9e8736744fc8075bf2eca4874159ab
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论