Просмотр исходного кода

userw 员工创建人,修改人、渠道查询只能查自己

master
chenchaod 1 неделю назад
Родитель
Сommit
f068dc19fc

+ 3
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/AbstractUserwManager.java Просмотреть файл

@Autowired @Autowired
private AccountInfoRepo accountInfoRepo; private AccountInfoRepo accountInfoRepo;


//黔通渠道编号
public static String QTZL_AGENCY_ID = "52010106004";

/** /**
* type:1-身份证-人像面 2-身份证-国徽面 3-行驶证前页 4-行驶证背页 5-营业执照 * type:1-身份证-人像面 2-身份证-国徽面 3-行驶证前页 4-行驶证背页 5-营业执照
* imagePath:图片地址 * imagePath:图片地址

+ 1
- 1
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/agency/AgencyManager.java Просмотреть файл

* @description:渠道管理 * @description:渠道管理
*/ */
public interface AgencyManager { public interface AgencyManager {
Pagination page(AgencyPageRequestDTO reqDto);
Pagination page(AgencyPageRequestDTO reqDto) throws ServiceHandleException;


AgencyDetailsResponseDTO details(AgencyDetailsRequestDTO reqDto) throws ManagerException; AgencyDetailsResponseDTO details(AgencyDetailsRequestDTO reqDto) throws ManagerException;



+ 7
- 2
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/agency/AgencyManagerImpl.java Просмотреть файл

package cn.com.taiji.userw.manager.agency; package cn.com.taiji.userw.manager.agency;


import cn.com.taiji.common.manager.AbstractManager;
import cn.com.taiji.common.manager.ManagerException; import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException; import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.common.model.StringKeyValue; import cn.com.taiji.common.model.StringKeyValue;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;



/** /**
* @Author:ChenChao * @Author:ChenChao
* @Date:2025/5/19 21:55 * @Date:2025/5/19 21:55
private StaffRepo staffRepo; private StaffRepo staffRepo;


@Override @Override
public Pagination page(AgencyPageRequestDTO reqDto) {
public Pagination page(AgencyPageRequestDTO reqDto) throws ServiceHandleException {
AgencyPageRequest request = copyProperties(reqDto, new AgencyPageRequest()); AgencyPageRequest request = copyProperties(reqDto, new AgencyPageRequest());
String agencyId = findAgencyIdByToken(reqDto.getAccessToken());
if (!QTZL_AGENCY_ID.equals(agencyId)){
//非黔通员工,只能看自己渠道网点
request.setAgencyId(agencyId);
}
return qtkAgencyRepo.page(request).convertResult(this::covert); return qtkAgencyRepo.page(request).convertResult(this::covert);
} }



+ 6
- 1
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/excel/listener/StaffRegisterDataListener.java Просмотреть файл

private StaffRepo staffRepo; private StaffRepo staffRepo;
private Set<StaffRegisterData> errors = new HashSet<>(); private Set<StaffRegisterData> errors = new HashSet<>();
private List<StaffRegisterData> result = new ArrayList<>(); private List<StaffRegisterData> result = new ArrayList<>();
private String opneId;


public StaffRegisterDataListener(AccountInfoRepo accountInfoRepo, StaffRepo staffRepo) {
public StaffRegisterDataListener(AccountInfoRepo accountInfoRepo, StaffRepo staffRepo,String openId) {
this.accountInfoRepo = accountInfoRepo; this.accountInfoRepo = accountInfoRepo;
this.staffRepo = staffRepo; this.staffRepo = staffRepo;
this.opneId = openId;
} }


@Override @Override
//添加身份标识,是否脱敏 //添加身份标识,是否脱敏
staff.setIdentityType("NORMAL"); //默认普通员工 staff.setIdentityType("NORMAL"); //默认普通员工
staff.setDesensitization(1); staff.setDesensitization(1);
staff.setCreateOpenId(opneId);
} }
staff.setUpdateOpenId(opneId);
staff.setUpdateTime(LocalDateTime.now());
staff.setAgencyId(data.getAgencyId()); staff.setAgencyId(data.getAgencyId());
staff.setServiceHallId(data.getServiceHallId()); staff.setServiceHallId(data.getServiceHallId());
staff.setStaffName(data.getName()); staff.setStaffName(data.getName());

+ 1
- 2
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/serviceHall/ServiceHallManagerImpl.java Просмотреть файл

@Autowired @Autowired
private MinioUtil minioUtil; private MinioUtil minioUtil;


//黔通渠道编号
public static String QTZL_AGENCY_ID = "52010106004";



@Override @Override
public Pagination query(ServiceHallPageRequestDTO reqDto) throws ServiceHandleException { public Pagination query(ServiceHallPageRequestDTO reqDto) throws ServiceHandleException {

+ 25
- 2
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/manager/system/StaffManagerImpl.java Просмотреть файл

import cn.com.taiji.core.repo.jpa.user.StaffRepo; import cn.com.taiji.core.repo.jpa.user.StaffRepo;
import cn.com.taiji.core.repo.jpa.user.UserRoleRepo; import cn.com.taiji.core.repo.jpa.user.UserRoleRepo;
import cn.com.taiji.userw.dto.system.*; import cn.com.taiji.userw.dto.system.*;
import cn.com.taiji.userw.manager.AbstractUserwManager;
import cn.com.taiji.userw.manager.excel.listener.StaffRegisterDataListener; import cn.com.taiji.userw.manager.excel.listener.StaffRegisterDataListener;
import cn.com.taiji.userw.model.excel.ServiceHallRegisterData; import cn.com.taiji.userw.model.excel.ServiceHallRegisterData;
import cn.com.taiji.userw.model.excel.StaffRegisterData; import cn.com.taiji.userw.model.excel.StaffRegisterData;
import static cn.com.taiji.core.manager.tools.SystemFinals.staffIdentityTypeId; import static cn.com.taiji.core.manager.tools.SystemFinals.staffIdentityTypeId;


@Service @Service
public class StaffManagerImpl extends RedisCacheManager implements StaffManager {
public class StaffManagerImpl extends AbstractUserwManager implements StaffManager {


@Autowired @Autowired
private DictTypeUtil dictTypeUtil; private DictTypeUtil dictTypeUtil;
throw new ManagerException("传入的员工身份标识不合规,请前往字典管理进行核实!"); throw new ManagerException("传入的员工身份标识不合规,请前往字典管理进行核实!");
StaffPageRequest queryRequest = new StaffPageRequest(); StaffPageRequest queryRequest = new StaffPageRequest();
copyProperties(dto, queryRequest); copyProperties(dto, queryRequest);
//渠道迷糊查出id

String agencyId = findAgencyIdByToken(dto.getAccessToken());
if (!QTZL_AGENCY_ID.equals(agencyId)){
//非黔通员工,只能看自己渠道网点
queryRequest.setAgencyIds(Lists.newArrayList(agencyId));
} else
if (hasText(dto.getAgencyName())) { if (hasText(dto.getAgencyName())) {
//渠道迷糊查出id
List<String> agencyIds = agencyRepo.listByName("%"+dto.getAgencyName()+"%"); List<String> agencyIds = agencyRepo.listByName("%"+dto.getAgencyName()+"%");
queryRequest.setAgencyIds(agencyIds); queryRequest.setAgencyIds(agencyIds);
} }


@Override @Override
public String add(StaffAddRequestDTO dto) throws ManagerException { public String add(StaffAddRequestDTO dto) throws ManagerException {
String openId = findOpenIdByToken(dto.getAccessToken());
AccountInfo accountInfo = accountInfoRepo.findByAccount(dto.getMobile()); AccountInfo accountInfo = accountInfoRepo.findByAccount(dto.getMobile());
if (accountInfo == null) throw new ManagerException("该手机号码未注册,无法进行用户账号与员工绑定!"); if (accountInfo == null) throw new ManagerException("该手机号码未注册,无法进行用户账号与员工绑定!");
valid(dto.getMobile(), dto.getAgencyId(), dto.getServiceHallId(), dto.getIdentityType(),null); valid(dto.getMobile(), dto.getAgencyId(), dto.getServiceHallId(), dto.getIdentityType(),null);
//添加身份标识,是否脱敏 //添加身份标识,是否脱敏
staff.setIdentityType(dto.getIdentityType()); staff.setIdentityType(dto.getIdentityType());
staff.setDesensitization(dto.getDesensitization()); staff.setDesensitization(dto.getDesensitization());
staff.setCreateOpenId(openId);
staff.setUpdateOpenId(openId);
if (hasText(accountInfo.getOpenId())) staff.setOpenId(accountInfo.getOpenId()); if (hasText(accountInfo.getOpenId())) staff.setOpenId(accountInfo.getOpenId());
//员工表新增 //员工表新增
staffRepo.save(staff); staffRepo.save(staff);


@Override @Override
public String change(StaffChangeRequestDTO dto) throws ManagerException { public String change(StaffChangeRequestDTO dto) throws ManagerException {
String openId = findOpenIdByToken(dto.getAccessToken());
AccountInfo accountInfo = accountInfoRepo.findByAccount(dto.getMobile()); AccountInfo accountInfo = accountInfoRepo.findByAccount(dto.getMobile());
if (accountInfo == null) throw new ManagerException("该手机号码未注册,无法进行用户账号与员工绑定!"); if (accountInfo == null) throw new ManagerException("该手机号码未注册,无法进行用户账号与员工绑定!");
if (commonStaffId.equals(dto.getId())) throw new ManagerException("该员工不存在"); if (commonStaffId.equals(dto.getId())) throw new ManagerException("该员工不存在");
//修改手机号码、修改工号(现在是工号默认是手机号码) //修改手机号码、修改工号(现在是工号默认是手机号码)
staff.setMobile(dto.getMobile()); staff.setMobile(dto.getMobile());
staff.setStaffId(dto.getMobile()); staff.setStaffId(dto.getMobile());
staff.setUpdateTime(LocalDateTime.now());
staff.setUpdateOpenId(openId);
//更新openId //更新openId
if (hasText(accountInfo.getOpenId())) staff.setOpenId(accountInfo.getOpenId()); if (hasText(accountInfo.getOpenId())) staff.setOpenId(accountInfo.getOpenId());
staffRepo.save(staff); staffRepo.save(staff);
StaffStatus staffStatus = StaffStatus.findByCode(dto.getStatus()); StaffStatus staffStatus = StaffStatus.findByCode(dto.getStatus());
if (staffStatus == null) throw new ManagerException("该员工状态不存在,请传入有效值"); if (staffStatus == null) throw new ManagerException("该员工状态不存在,请传入有效值");
staff.setStatus(dto.getStatus()); staff.setStatus(dto.getStatus());
staff.setUpdateTime(LocalDateTime.now());
staff.setUpdateOpenId(openId);
staffRepo.save(staff); staffRepo.save(staff);
if (staffStatus == StaffStatus.DISABLE) deleteTokenByOpenId(staff.getOpenId()); if (staffStatus == StaffStatus.DISABLE) deleteTokenByOpenId(staff.getOpenId());
saveStaffChangeLog(staff.getStaffId(), dto.getRemark(), openId, StaffChangeType.STATUS); saveStaffChangeLog(staff.getStaffId(), dto.getRemark(), openId, StaffChangeType.STATUS);
} }
} }
staffVo.setStaffOpenId(staff.getOpenId()); staffVo.setStaffOpenId(staff.getOpenId());
Staff staffCreat = staffRepo.findByOpenId(staff.getCreateOpenId());
if(staffCreat != null) {
staffVo.setCreateName(staffCreat.getStaffName());
}
Staff staffUpdate = staffRepo.findByOpenId(staff.getUpdateOpenId());
if(staffUpdate != null) {
staffVo.setUpdateName(staffUpdate.getStaffName());
}
return staffVo; return staffVo;
} }



+ 1
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/CenterAgencyPageModel.java Просмотреть файл

@Data @Data
@ApiModel(description = "中心渠道分页信息") @ApiModel(description = "中心渠道分页信息")
public class CenterAgencyPageModel { public class CenterAgencyPageModel {
private String id;


@ApiModelProperty(value = "中心渠道编号") @ApiModelProperty(value = "中心渠道编号")
private String centerAgencyId; private String centerAgencyId;

+ 1
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/agency/QtkAgencyModelDetails.java Просмотреть файл

@Data @Data
@ApiModel(description = "渠道信息") @ApiModel(description = "渠道信息")
public class QtkAgencyModelDetails { public class QtkAgencyModelDetails {
private String id;
@ApiModelProperty(value = "协议编号") @ApiModelProperty(value = "协议编号")
private String issuerId = "520101";//发行方编号 private String issuerId = "520101";//发行方编号
@ApiModelProperty(value = "渠道编号") @ApiModelProperty(value = "渠道编号")

+ 1
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/serviceHall/CenterServicePageModel.java Просмотреть файл

@ApiModel(description = "中心网点分页信息") @ApiModel(description = "中心网点分页信息")
@Data @Data
public class CenterServicePageModel { public class CenterServicePageModel {
private String id;


@ApiModelProperty(value = "中心网点编号") @ApiModelProperty(value = "中心网点编号")
private String centerServiceHallId; private String centerServiceHallId;

+ 4
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/system/StaffVo.java Просмотреть файл

package cn.com.taiji.userw.model.system; package cn.com.taiji.userw.model.system;


import cn.com.taiji.common.model.BaseModel; import cn.com.taiji.common.model.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
private Integer desensitization;// 员工身份标识 1:脱敏 2:不脱敏 不填值,则默认脱敏 private Integer desensitization;// 员工身份标识 1:脱敏 2:不脱敏 不填值,则默认脱敏
private String realNameAuthentication;// 0,已实名,1未实名 private String realNameAuthentication;// 0,已实名,1未实名
private String staffOpenId; private String staffOpenId;

private String createName;//添加人名称
private String updateName;//修改人名称
} }

+ 1
- 0
zhywpt-app-userw/src/main/java/cn/com/taiji/userw/model/wx/CarParentPageModel.java Просмотреть файл

@Data @Data
@ApiModel(description = "车主签约父表分页信息") @ApiModel(description = "车主签约父表分页信息")
public class CarParentPageModel { public class CarParentPageModel {
private String id;
@ApiModelProperty(value = "描述") @ApiModelProperty(value = "描述")
private String info;//描述 private String info;//描述
@ApiModelProperty(value = "商户号") @ApiModelProperty(value = "商户号")

Загрузка…
Отмена
Сохранить