提交 ab7c15cc authored 作者: 李秋林's avatar 李秋林

促销员注册增加注册信息:所属战区,所属负责人;

上级 24bb58a7
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.pojo.user.vo.ClienteleStoreQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeClienteleDataQueryService;
......@@ -10,8 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-04-22 17
......
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeDepartmentQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe : 勤策部门查询
*/
@RestController
@RequestMapping("/user/dept/query")
public class QinCeDepartmentQueryController {
@Autowired
QinCeDepartmentQueryService qinCeDepartmentQueryService;
/**
* 查询部门列表
* 仅限注册时使用
*/
@PostMapping("/enroll/list")
public R getDeptList(@RequestBody QinceOrgQueryVo qinceOrgQueryVo){
List<QinCeDepartmentDto> deptDto = qinCeDepartmentQueryService.getDeptList(qinceOrgQueryVo);
return R.success(deptDto);
}
}
package com.wangxiaolu.promotion.controller.user.qince;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.user.QinCeEmployeeQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 14
* @describe : 勤策人员查询
*/
@RestController
@RequestMapping("/user/employee/query")
public class QinCeEmployeeQueryController {
@Autowired
QinCeEmployeeQueryService qinCeEmployeeQueryService;
/**
* 查询人员列表
* 仅限注册时使用
*/
@PostMapping("/enroll/list")
public R getEmployeeList(@RequestBody QinceEmployeeQueryVo employeeQueryVo){
List<QinCeEmployeeDto> employees = qinCeEmployeeQueryService.getEmployeeList(employeeQueryVo);
return R.success(employees);
}
}
......@@ -54,7 +54,7 @@ public class WeChatUserCoreController {
*/
String redisKey = RedisKeys.UserKeys.PHONE_VER_CODE.getKey() + wxTemporaryEnrollVo.getPhone();
String phoneCodeOld = redisCache.get(redisKey);
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())){
if (StringUtils.isBlank(phoneCodeOld) || !phoneCodeOld.equals(wxTemporaryEnrollVo.getPhoneCode())) {
throw new ParamException(RCode.TENCENT_SMS_PHONE_CODE_ERROR, null);
}
redisCache.removeKey(redisKey);
......@@ -62,6 +62,8 @@ public class WeChatUserCoreController {
WxTemporaryInfoDto temporaryDto = new WxTemporaryInfoDto();
BeanUtils.copyProperties(wxTemporaryEnrollVo, temporaryDto);
return R.success(weChatUserCoreService.saveWxUserInfoTemporary(temporaryDto));
// System.out.println(JSONObject.toJSONString(temporaryDto));
// return R.success();
}
}
package com.wangxiaolu.promotion.controller.wechat;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.common.util.DataUtils;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
......@@ -26,6 +29,8 @@ public class WeChatUserQueryController {
@Autowired
private WeChatUserQueryService weChatUserQueryService;
@Autowired
RedisCache redisCache;
/**
* 根据OpenId、Phone登录(促销员查询是否存在)
......@@ -47,13 +52,17 @@ public class WeChatUserQueryController {
* 促销员信息查询
*/
@PostMapping("/temporary/phone_openid")
public R getTemporaryInfoByOpenIdAndPhone(@RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
phontAndOpenIdVerify(wxTemporaryLoginVo);
WxTemporaryInfoDto temporaryInfoDto = weChatUserQueryService.getTemporaryInfoByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
if (Objects.isNull(temporaryInfoDto)) {
throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
}
return R.success(temporaryInfoDto);
public R getTemporaryInfoByOpenIdAndPhone(@RequestHeader("Authorization") String authorization, @RequestBody WxTemporaryLoginVo wxTemporaryLoginVo) {
// 在缓存中查询
JSONObject userJson = redisCache.getToJson(RedisKeys.UserKeys.TEMPORARY_TOKEN.getKey() + authorization);
return R.success(userJson);
// phontAndOpenIdVerify(wxTemporaryLoginVo);
// WxTemporaryInfoDto temporaryInfoDto = weChatUserQueryService.getTemporaryInfoByOpenIdAndPhone(wxTemporaryLoginVo.getOpenId(), wxTemporaryLoginVo.getPhone());
// if (Objects.isNull(temporaryInfoDto)) {
// throw new ParamException(RCode.LOGIN_PARAM_ERROR, null);
// }
// return R.success(temporaryInfoDto);
}
private void phontAndOpenIdVerify(WxTemporaryLoginVo wxTemporaryLoginVo) {
......
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import java.util.List;
/**
* @author : liqiulin
......@@ -13,4 +17,6 @@ public interface QinCeDepartmentDao {
* 勤策部门数据同步
*/
void departmentSyncTask(JSONArray responseDatas);
List<QinCeDepartmentDto> selectList(DeptWrapper dw);
}
package com.wangxiaolu.promotion.domain.user.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-03-29 17
......@@ -19,4 +22,6 @@ public interface QinCeEmployeeDao {
* 根据勤策ID查询人员信息
*/
QinCeEmployeeDto selectOntByQcId(String qcId);
List<QinCeEmployeeDto> getEmployeeList(EmployeeWrapper ew);
}
......@@ -6,10 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeDepartmentDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceDepartmentMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeDepartmentDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
......@@ -51,5 +58,54 @@ public class QinCeDepartmentDaoImpl implements QinCeDepartmentDao {
}
@Override
public List<QinCeDepartmentDto> selectList(DeptWrapper dw) {
LambdaQueryWrapper<QinCeDepartmentDO> qw = buildWrapper(dw);
List<QinCeDepartmentDO> qinCeDepartmentDOS = qinceDepartmentMapper.selectList(qw);
return transitionDtos(qinCeDepartmentDOS);
}
private LambdaQueryWrapper<QinCeDepartmentDO> buildWrapper(DeptWrapper dw) {
LambdaQueryWrapper<QinCeDepartmentDO> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(dw.getOrgNameLike())) {
queryWrapper.like(QinCeDepartmentDO::getOrgName, dw.getOrgNameLike());
}
// 0:删除,1:正常
queryWrapper.eq(QinCeDepartmentDO::getOrgStatus, 1);
return queryWrapper;
}
/**
* DO to DTO (单个对象)
*
* @param deptDos DO对象List
* @return DTO对象
*/
private List<QinCeDepartmentDto> transitionDtos(List<QinCeDepartmentDO> deptDos) {
if (CollectionUtils.isEmpty(deptDos)) {
return new ArrayList<>();
}
List<QinCeDepartmentDto> dtos = new ArrayList<>(deptDos.size() * 2);
for (QinCeDepartmentDO deptDto : deptDos) {
dtos.add(transitionDto(deptDto));
}
return dtos;
}
/**
* DO to DTO (单个对象)
*
* @param deptDo DO对象
* @return DTO对象
*/
private QinCeDepartmentDto transitionDto(QinCeDepartmentDO deptDo) {
QinCeDepartmentDto deptDto = null;
if (!Objects.isNull(deptDo)) {
deptDto = new QinCeDepartmentDto();
BeanUtils.copyProperties(deptDo, deptDto);
}
return deptDto;
}
}
......@@ -5,15 +5,20 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.domain.user.mapper.QinceEmployeeMapper;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeDepartmentDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeEmployeeDO;
import com.wangxiaolu.promotion.domain.user.mapper.entity.TemporaryInfoDO;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.dto.WxTemporaryInfoDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
......@@ -63,6 +68,39 @@ public class QinCeEmployeeDaoImpl implements QinCeEmployeeDao {
return transitionDto(qcEmpDo);
}
@Override
public List<QinCeEmployeeDto> getEmployeeList(EmployeeWrapper ew) {
LambdaQueryWrapper<QinCeEmployeeDO> qw = buildWrapper(ew);
List<QinCeEmployeeDO> qinCeEmployeeDOS = qinceEmployeeMapper.selectList(qw);
return transitionDtos(qinCeEmployeeDOS);
}
private LambdaQueryWrapper<QinCeEmployeeDO> buildWrapper(EmployeeWrapper ew){
LambdaQueryWrapper<QinCeEmployeeDO> qw = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(ew.getWaiqin365OrgId())){
qw.eq(QinCeEmployeeDO::getWaiqin365OrgId,ew.getWaiqin365OrgId());
}
qw.eq(QinCeEmployeeDO::getEmpStatus,1);
return qw;
}
/**
* DO to DTO (单个对象)
*
* @param employeeDOS DO对象List
* @return DTO对象
*/
private List<QinCeEmployeeDto> transitionDtos(List<QinCeEmployeeDO> employeeDOS) {
if (CollectionUtils.isEmpty(employeeDOS)) {
return new ArrayList<>();
}
List<QinCeEmployeeDto> dtos = new ArrayList<>(employeeDOS.size() * 2);
for (QinCeEmployeeDO employe : employeeDOS) {
dtos.add(transitionDto(employe));
}
return dtos;
}
/**
* DO to DTO (单个对象)
......
......@@ -42,6 +42,16 @@ public class TemporaryInfoDO implements Serializable {
*/
private String openId;
/**
* 所属战区-部门
*/
String deptQcId;
/**
* 所属战区-部门
*/
String deptQcOrgName;
/**
* 此促销员的任务人-勤策id
*/
......
package com.wangxiaolu.promotion.domain.user.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe : 部门查询对象
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class DeptWrapper {
private String orgNameLike;
/**
* 部门状态。0:删除,1:正常
*/
private Integer orgStatus;
}
package com.wangxiaolu.promotion.domain.user.wrapperQo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author : liqiulin
* @date : 2024-04-22 17
* @describe : 部门查询对象
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class EmployeeWrapper {
/**
* 勤策部门唯一标识
* 对应QinCeDepartmentDO.qcId
*/
private String waiqin365OrgId;
/**
* 员工账号状态。0:销户,1:正常,2:停用
*/
@JsonProperty("emp_status")
private String empStatus;
}
package com.wangxiaolu.promotion.pojo.user.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-03-29 15
* @describe : 勤策-组织架构
*/
@Data
public class QinCeDepartmentDto {
/**
* 勤策的部门唯一ID。如果id和org_id同时存在则优先顺序为id、org_id
*/
private String qcId;
/**
* 部门名称。同一部门下的子部门的名称不能重复
*/
private String orgName;
/**
* 勤策上级部门唯一ID
*/
private String waiqin365ParentId;
/**
* 上级部门名称
*/
@JsonProperty("parent_name")
private String parentName;
}
......@@ -59,9 +59,14 @@ public class WxTemporaryInfoDto {
String idenReversePhotoUrl;
/**
* 详细地址
* 所属战区-部门
*/
String address;
String deptQcId;
/**
* 所属战区-部门
*/
String deptQcOrgName;
/**
* 创建时间
......
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe : 查询qince组织架构条件查询
*/
@Data
public class QinceEmployeeQueryVo {
/**
* 按部门查询
*/
private String waiqin365OrgId;
}
package com.wangxiaolu.promotion.pojo.user.vo;
import lombok.Data;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe : 查询qince组织架构条件查询
*/
@Data
public class QinceOrgQueryVo {
/**
* 部门名称模糊查询
*/
private String orgNameLike;
}
......@@ -64,9 +64,14 @@ public class WxTemporaryEnrollVo {
String idenReversePhotoUrl;
/**
* 详细地址
* 所属战区-部门
*/
String address;
String deptQcId;
/**
* 所属战区-部门
*/
String deptQcOrgName;
/**
* 手机验证码
......@@ -75,10 +80,15 @@ public class WxTemporaryEnrollVo {
/**
* 促销员的任务人-勤策id
* 促销员的任务人-勤策id
*/
String chargerQcId;
/**
* 此促销员的任务人姓名
*/
String chargerName;
public void validate() {
if (
StringUtils.isBlank(openId) ||
......@@ -88,7 +98,8 @@ public class WxTemporaryEnrollVo {
StringUtils.isBlank(phoneCode) ||
StringUtils.isBlank(idenNumber) ||
StringUtils.isBlank(openId) ||
StringUtils.isBlank(idenFrontPhotoUrl)
StringUtils.isBlank(chargerQcId) ||
StringUtils.isBlank(deptQcId)
) {
throw new ParamException(RCode.ENROLL_PARAM_ERROR, null);
}
......
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe :
*/
public interface QinCeDepartmentQueryService {
List<QinCeDepartmentDto> getDeptList(QinceOrgQueryVo qinceOrgQueryVo);
}
package com.wangxiaolu.promotion.service.user;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 14
* @describe :
*/
public interface QinCeEmployeeQueryService {
List<QinCeEmployeeDto> getEmployeeList(QinceEmployeeQueryVo employeeQueryVo);
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinCeDepartmentDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.DeptWrapper;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeDepartmentDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceOrgQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeDepartmentQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 13
* @describe :
*/
@Service
public class QinCeDepartmentQueryServiceImpl implements QinCeDepartmentQueryService {
@Autowired
QinCeDepartmentDao qinCeDepartmentDao;
@Override
public List<QinCeDepartmentDto> getDeptList(QinceOrgQueryVo qinceOrgQueryVo) {
DeptWrapper dw = new DeptWrapper()
.setOrgNameLike(qinceOrgQueryVo.getOrgNameLike());
return qinCeDepartmentDao.selectList(dw);
}
}
package com.wangxiaolu.promotion.service.user.impl;
import com.wangxiaolu.promotion.domain.user.dao.QinCeEmployeeDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.EmployeeWrapper;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.QinCeEmployeeDto;
import com.wangxiaolu.promotion.pojo.user.vo.QinceEmployeeQueryVo;
import com.wangxiaolu.promotion.service.user.QinCeEmployeeQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author : liqiulin
* @date : 2024-06-17 14
* @describe :
*/
@Service
public class QinCeEmployeeQueryServiceImpl implements QinCeEmployeeQueryService {
@Autowired
QinCeEmployeeDao qinCeEmployeeDao;
@Override
public List<QinCeEmployeeDto> getEmployeeList(QinceEmployeeQueryVo employeeQueryVo) {
EmployeeWrapper ew = new EmployeeWrapper()
.setWaiqin365OrgId(employeeQueryVo.getWaiqin365OrgId());
return qinCeEmployeeDao.getEmployeeList(ew);
}
}
......@@ -35,13 +35,12 @@ public class WeChatUserCoreServiceImpl implements WeChatUserCoreService {
@Override
public boolean saveWxUserInfoTemporary(WxTemporaryInfoDto temporaryDto) {
// 根据chargerQcId查询人员详情
temporaryDto.setChargerQcId("7854192836507620251");
QinCeEmployeeDto qcEmpDto = qinCeEmployeeDao.selectOntByQcId(temporaryDto.getChargerQcId());
if (Objects.isNull(qcEmpDto)){
log.info("促销员注册,根据qc_id:{}查询负责人为空",temporaryDto.getChargerQcId());
throw new ParamException(RCode.CHARGER_ID_ERROR,null);
}
temporaryDto.setChargerName(qcEmpDto.getEmpName());
// QinCeEmployeeDto qcEmpDto = qinCeEmployeeDao.selectOntByQcId(temporaryDto.getChargerQcId());
// if (Objects.isNull(qcEmpDto)){
// log.info("促销员注册,根据qc_id:{}查询负责人为空",temporaryDto.getChargerQcId());
// throw new ParamException(RCode.CHARGER_ID_ERROR,null);
// }
// temporaryDto.setChargerName(qcEmpDto.getEmpName());
int saveId = temporaryInfoDao.saveWxTemporaryInfo(temporaryDto);
log.info("微信-促销员[{}]:[{}]注册成功:{}", saveId, temporaryDto.getName(), JSONObject.toJSONString(temporaryDto));
return saveId > 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论