客户分发+资源字段增加

master
yqy 10 months ago
parent 8b32fa64c0
commit 01bb203e05

@ -20,6 +20,7 @@ public class CustomListener extends AnalysisEventListener<Map<Integer, String>>
public final LinkedList<String> headInfo = new LinkedList<>(); public final LinkedList<String> headInfo = new LinkedList<>();
public Integer index = 0;
/** /**
* springservice * springservice
*/ */
@ -45,13 +46,16 @@ public class CustomListener extends AnalysisEventListener<Map<Integer, String>>
String param = data.get(i); String param = data.get(i);
if (str.equals(UploadTemplateHeadConstant.HEAD_NID)) customDTO.setCustomNid(param); if (str.equals(UploadTemplateHeadConstant.HEAD_NID)) customDTO.setCustomNid(param);
else if (str.equals(UploadTemplateHeadConstant.HEAD_REMARK)) customDTO.setRemark(param); else if (str.equals(UploadTemplateHeadConstant.HEAD_REMARK)) customDTO.setRemark(param);
int index = userIdList.size() % (i+1);
customDTO.setDistributorId(userIdList.get(index));
} }
customDTO.setDistributorId(userIdList.get(index));
customDTO.setCreateBy(clueRecordEntity.getCreateBy()); customDTO.setCreateBy(clueRecordEntity.getCreateBy());
customDTO.setChannelType(2); customDTO.setChannelType(2);
customDTO.setChannelName(readFileDTO.getChannelName()); customDTO.setChannelName(readFileDTO.getChannelName());
customDTO.setEnrollStatus(1);
customDTO.setCustomType(1);
customDTO.setType(2);
customService.add(customDTO); customService.add(customDTO);
index = (index < userIdList.size() - 1) ? index + 1 : 0;
} }
@Override @Override

@ -66,8 +66,6 @@ public class CustomController {
return Boolean.TRUE.equals(customService.createByType(createCustomDTO)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "添加失败"); return Boolean.TRUE.equals(customService.createByType(createCustomDTO)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "添加失败");
} }
@PostMapping("/update") @PostMapping("/update")
@Operation(summary = "修改客户", description = "修改客户") @Operation(summary = "修改客户", description = "修改客户")
public R<Object> update(@Validated({UpdateGroup.class}) @RequestBody CustomDTO customDTO) { public R<Object> update(@Validated({UpdateGroup.class}) @RequestBody CustomDTO customDTO) {
@ -90,12 +88,11 @@ public class CustomController {
@PostMapping("/audit") @PostMapping("/audit")
@Operation(summary = "审核表单") @Operation(summary = "审核表单")
public R<String> audit(@Validated({SubmitGroup.class}) @RequestBody CustomDTO customDTO) { public R<String> audit(@Validated({SubmitGroup.class}) @RequestBody ChangeCustomDTO dto) {
Boolean result = customService.auditFormById(customDTO); Boolean result = customService.auditFormById(dto);
return Boolean.TRUE.equals(result) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "审核失败"); return Boolean.TRUE.equals(result) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "审核失败");
} }
@ResponseExcel(name = "客户表单") @ResponseExcel(name = "客户表单")
@GetMapping("/export") @GetMapping("/export")
public List<CustomVO> exportI18nData(CustomQo customQo) { public List<CustomVO> exportI18nData(CustomQo customQo) {
@ -109,7 +106,6 @@ public class CustomController {
} }
@PostMapping("/reAudit") @PostMapping("/reAudit")
@Operation(summary = "表单重审") @Operation(summary = "表单重审")
public R<Boolean> reAudit(@Validated({UpdateGroup.class}) @RequestBody ChangeCustomDTO dto) { public R<Boolean> reAudit(@Validated({UpdateGroup.class}) @RequestBody ChangeCustomDTO dto) {
@ -117,7 +113,6 @@ public class CustomController {
return Boolean.TRUE.equals(result) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "审核失败"); return Boolean.TRUE.equals(result) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "审核失败");
} }
private void setQueryQo(CustomQo customQo) { private void setQueryQo(CustomQo customQo) {
Integer salesmanType = customQo.getSalesmanType(); Integer salesmanType = customQo.getSalesmanType();
// 查询属于自己的信息 // 查询属于自己的信息
@ -133,10 +128,12 @@ public class CustomController {
if (salesmanType == DefaultNumberConstants.TWO_NUMBER) { if (salesmanType == DefaultNumberConstants.TWO_NUMBER) {
// 查询分发员 // 查询分发员
customQo.setDistributorId(SecurityUtils.getCurrentUserId()); customQo.setDistributorId(SecurityUtils.getCurrentUserId());
customQo.setType(2);
} }
if (salesmanType == DefaultNumberConstants.THREE_NUMBER) { if (salesmanType == DefaultNumberConstants.THREE_NUMBER) {
// 只查询复审员 // 只查询复审员
customQo.setReviewUserId(SecurityUtils.getCurrentUserId()); customQo.setReviewUserId(SecurityUtils.getCurrentUserId());
customQo.setType(3);
} }
} }
} }

@ -29,5 +29,5 @@ public class ChangeCustomDTO {
/** /**
* ID * ID
*/ */
private List<Long> salesmanUserIdList; private List<Long> salesmanUserId;
} }

@ -1,9 +1,7 @@
package com.baiye.modules.distribute.dto; package com.baiye.modules.distribute.dto;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.modules.distribute.entity.LabelEntity; import com.baiye.modules.distribute.entity.LabelEntity;
import com.baiye.validation.group.UpdateGroup; import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -76,7 +74,6 @@ public class ClueDTO {
@Schema(title = "客户资料") @Schema(title = "客户资料")
private String customInformation; private String customInformation;
@TableField(value = "channel_identifying", typeHandler = JsonStringArrayTypeHandler.class)
@Schema(title = "渠道标识") @Schema(title = "渠道标识")
private List<String> channelIdentifying; private List<String> channelIdentifying;

@ -2,7 +2,6 @@ package com.baiye.modules.distribute.dto;
import com.baiye.modules.distribute.entity.CustomStoreEntity; import com.baiye.modules.distribute.entity.CustomStoreEntity;
import com.baiye.validation.group.CreateGroup; import com.baiye.validation.group.CreateGroup;
import com.baiye.validation.group.SubmitGroup;
import com.baiye.validation.group.UpdateGroup; import com.baiye.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -15,7 +14,7 @@ import java.util.List;
public class CustomDTO { public class CustomDTO {
@Schema(title = "ID") @Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class, SubmitGroup.class }) @NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long customId; private Long customId;
@Schema(title = "客户名称") @Schema(title = "客户名称")
@ -51,8 +50,11 @@ public class CustomDTO {
@Schema(title = "备注") @Schema(title = "备注")
private String remark; private String remark;
@Schema(title = "客户类型 0:A型 1:B型") @Schema(description = "审核类型 2初审 3复审")
@NotNull(message = "客户类型不能为空") private Integer type;
@Schema(title = "客户类型 0:地理 1:基本")
@NotNull(message = "客户类型不能为空", groups = { CreateGroup.class })
private Integer customType; private Integer customType;
@Schema(title = "门店信息") @Schema(title = "门店信息")
@ -61,28 +63,21 @@ public class CustomDTO {
@Schema(title = "创建人") @Schema(title = "创建人")
private Long createBy; private Long createBy;
@Schema(title = "客户资料")
private String customInformation;
@Schema(title = "渠道类型(1 手动创建 2文件上传 3飞鱼回传 4话单回传 5 api回传)") @Schema(title = "渠道类型(1 手动创建 2文件上传 3飞鱼回传 4话单回传 5 api回传)")
private Integer channelType; private Integer channelType;
@Schema(title = "渠道名称") @Schema(title = "渠道名称")
private String channelName; private String channelName;
@Schema(title = "复审员id")
private Long reviewUserId;
@Schema(title = "分发员id") @Schema(title = "分发员id")
private Long distributorId; private Long distributorId;
@Schema(title = "性别(0-男1-女)") @Schema(title = "业务员ID集合")
private Integer sex; private List<String> salesmanUserId;
@Schema(title = "业务员用户ID") @Schema(title = "客户资料")
private List<Long> salesmanUserIdList; private String customInformation;
@Schema(title = "分发员分发时状态:0-地理分发 1-基础分发 2-复审") @Schema(title = "性别(0-男1-女)")
@NotNull(message = "状态不能为空", groups = { SubmitGroup.class }) private Integer sex;
private Integer status;
} }

@ -17,7 +17,7 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
@ToString @ToString
@TableName("tb_clue") @TableName(value = "tb_clue", autoResultMap = true)
@Schema(title = "线索") @Schema(title = "线索")
@TableAlias("ce") @TableAlias("ce")
public class ClueEntity extends LogicDeletedBaseEntity { public class ClueEntity extends LogicDeletedBaseEntity {

@ -22,7 +22,7 @@ import java.util.List;
*/ */
@Getter @Getter
@Setter @Setter
@TableName("tb_custom") @TableName(value = "tb_custom", autoResultMap = true)
@TableAlias("cm") @TableAlias("cm")
@Validated @Validated
@Schema(title = "客户表") @Schema(title = "客户表")

@ -3,13 +3,18 @@ package com.baiye.modules.distribute.mapper;
import com.baiye.domain.PageParam; import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult; import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaAliasQueryWrapperX; import com.baiye.extend.mybatis.plus.conditions.query.LambdaAliasQueryWrapperX;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper; import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX; import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.distribute.converter.ClueConverter;
import com.baiye.modules.distribute.converter.PushLinkConverter;
import com.baiye.modules.distribute.dto.HomePageDTO; import com.baiye.modules.distribute.dto.HomePageDTO;
import com.baiye.modules.distribute.entity.ClueEntity; import com.baiye.modules.distribute.entity.ClueEntity;
import com.baiye.modules.distribute.entity.PushLinkEntity;
import com.baiye.modules.distribute.qo.ClueQo; import com.baiye.modules.distribute.qo.ClueQo;
import com.baiye.modules.distribute.qo.HomePageQo; import com.baiye.modules.distribute.qo.HomePageQo;
import com.baiye.modules.distribute.vo.ClueVO; import com.baiye.modules.distribute.vo.ClueVO;
import com.baiye.modules.distribute.vo.PushLinkVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
@ -25,14 +30,13 @@ public interface ClueMapper extends ExtendMapper<ClueEntity> {
List<Long> findUndistributedClueIds(@Param("list") List<Long> recordIdList); List<Long> findUndistributedClueIds(@Param("list") List<Long> recordIdList);
default PageResult<ClueVO> queryPage(PageParam pageParam, ClueQo qo) { default PageResult<ClueVO> queryPage(PageParam pageParam, ClueQo qo) {
IPage<ClueVO> page = this.prodPage(pageParam); IPage<ClueEntity> page = this.prodPage(pageParam);
Wrapper<ClueEntity> wrapperX = this.buildQueryWrapper(qo); Wrapper<ClueEntity> wrapperX = this.buildQueryWrapper(qo);
this.selectByPage(page, wrapperX); this.selectPage(page, wrapperX);
return new PageResult<>(page.getRecords(), page.getTotal()); IPage<ClueVO> convert = page.convert(ClueConverter.INSTANCE::poToExcelVo);
return new PageResult<>(convert.getRecords(), convert.getTotal());
} }
IPage<ClueVO> selectByPage(IPage<ClueVO> page, @Param(Constants.WRAPPER) Wrapper<ClueEntity> wrapper);
/** /**
* *
* @param qo * @param qo
@ -57,7 +61,8 @@ public interface ClueMapper extends ExtendMapper<ClueEntity> {
* @return LambdaQueryWrapperX * @return LambdaQueryWrapperX
*/ */
default Wrapper<ClueEntity> buildQueryWrapper(ClueQo qo) { default Wrapper<ClueEntity> buildQueryWrapper(ClueQo qo) {
LambdaAliasQueryWrapperX<ClueEntity> wrapperX = WrappersX.lambdaAliasQueryX(ClueEntity.class);
LambdaQueryWrapperX<ClueEntity> wrapperX = WrappersX.lambdaQueryX(ClueEntity.class);
wrapperX.eqIfPresent(ClueEntity::getDeleted, 0) wrapperX.eqIfPresent(ClueEntity::getDeleted, 0)
.eqIfPresent(ClueEntity::getNid, qo.getNid()) .eqIfPresent(ClueEntity::getNid, qo.getNid())
.eqIfPresent(ClueEntity::getClueId, qo.getClueId()) .eqIfPresent(ClueEntity::getClueId, qo.getClueId())

@ -31,13 +31,11 @@ public interface CustomMapper extends ExtendMapper<CustomEntity> {
IPage<CustomVO> selectByPage(IPage<CustomVO> page, @Param(Constants.WRAPPER) Wrapper<CustomEntity> wrapper, @Param("storeId") Long storeId); IPage<CustomVO> selectByPage(IPage<CustomVO> page, @Param(Constants.WRAPPER) Wrapper<CustomEntity> wrapper, @Param("storeId") Long storeId);
/** /**
* *
*/ */
String selectMaxBatchNoByCompanyId(@Param("code") String code, @Param("companyId") Long companyId); String selectMaxBatchNoByCompanyId(@Param("code") String code, @Param("companyId") Long companyId);
/** /**
* qo wrapper * qo wrapper
* *
@ -54,6 +52,7 @@ public interface CustomMapper extends ExtendMapper<CustomEntity> {
.eqIfPresent(CustomEntity::getCompanyId, qo.getCompanyId()) .eqIfPresent(CustomEntity::getCompanyId, qo.getCompanyId())
.eqIfPresent(CustomEntity::getCustomNid, qo.getCustomNid()) .eqIfPresent(CustomEntity::getCustomNid, qo.getCustomNid())
.eqIfPresent(CustomEntity::getReviewUserId, qo.getReviewUserId()) .eqIfPresent(CustomEntity::getReviewUserId, qo.getReviewUserId())
.eqIfPresent(CustomEntity::getType, qo.getType())
.eqIfPresent(CustomEntity::getDistributorId, qo.getDistributorId()) .eqIfPresent(CustomEntity::getDistributorId, qo.getDistributorId())
.gtIfPresent(CustomEntity::getEnrollStatus, qo.getGreaterStatus()) .gtIfPresent(CustomEntity::getEnrollStatus, qo.getGreaterStatus())
.eqIfPresent(CustomEntity::getEnrollStatus, qo.getEnrollStatus()); .eqIfPresent(CustomEntity::getEnrollStatus, qo.getEnrollStatus());
@ -66,6 +65,7 @@ public interface CustomMapper extends ExtendMapper<CustomEntity> {
} }
return wrapperX; return wrapperX;
} }
default List<CustomEntity> queryList(CustomQo customQo) {
default List<CustomEntity> queryList(CustomQo customQo) { default List<CustomEntity> queryList(CustomQo customQo) {

@ -43,24 +43,21 @@ public class CustomQo {
@Schema(title = "编号") @Schema(title = "编号")
private String batchNo; private String batchNo;
@Schema(title = "门店id") @Schema(title = "门店id")
private Long storeId; private Long storeId;
@Schema(title = "备注") @Schema(title = "备注")
private String remark; private String remark;
@Schema(title = "复审员id") @Schema(title = "复审员id")
private Long reviewUserId; private Long reviewUserId;
@Schema(title = "复审员id") @Schema(title = "分发员id")
private Long distributorId; private Long distributorId;
@Parameter(description = "大于状态值") @Parameter(description = "大于状态值")
private Integer greaterStatus; private Integer greaterStatus;
@Schema(description = "审核类型 2初审 3复审")
private Integer type;
} }

@ -45,7 +45,7 @@ public interface CustomService extends ExtendService<CustomEntity> {
/** /**
* *
*/ */
Boolean auditFormById(CustomDTO customDTO); Boolean auditFormById(ChangeCustomDTO dto);
/** /**
* *

@ -1,5 +1,6 @@
package com.baiye.modules.distribute.service.impl; package com.baiye.modules.distribute.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelReader;
import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.EasyExcelFactory;
import com.baiye.constant.DefaultNumberConstants; import com.baiye.constant.DefaultNumberConstants;
@ -69,7 +70,10 @@ public class ClueFileServiceImpl implements ClueFileService {
@Override @Override
public void readFile(ReadFileDTO readFileDTO) { public void readFile(ReadFileDTO readFileDTO) {
ClueRecordEntity clueRecordEntity = clueRecordService.getById(readFileDTO.getRecordId()); ClueRecordEntity clueRecordEntity = clueRecordService.getBaseMapper().selectOne(new LambdaQueryWrapper<ClueRecordEntity>()
.eq(ClueRecordEntity::getClueRecordId, readFileDTO.getRecordId())
.eq(ClueRecordEntity::getCreateBy, SecurityUtils.getCurrentUserId()));
if (ObjectUtil.isNotNull(clueRecordEntity)){
try { try {
FileInputStream file = new FileInputStream(clueRecordEntity.getUrl()); FileInputStream file = new FileInputStream(clueRecordEntity.getUrl());
EasyExcelFactory.read(file, new CustomListener(customService, clueRecordEntity, readFileDTO)).build().readAll(); EasyExcelFactory.read(file, new CustomListener(customService, clueRecordEntity, readFileDTO)).build().readAll();
@ -77,6 +81,7 @@ public class ClueFileServiceImpl implements ClueFileService {
log.error("========文件读取错误: {}==========", e.getMessage()); log.error("========文件读取错误: {}==========", e.getMessage());
} }
} }
}
@Override @Override
public Map<String, Object> generateSecretKey() { public Map<String, Object> generateSecretKey() {

@ -30,7 +30,6 @@ import com.baiye.system.constant.LetterConst;
import com.baiye.system.enums.RoleCodeEnum; import com.baiye.system.enums.RoleCodeEnum;
import com.baiye.system.model.entity.SysUser; import com.baiye.system.model.entity.SysUser;
import com.baiye.system.service.SysUserRoleService; import com.baiye.system.service.SysUserRoleService;
import com.baiye.system.model.entity.SysUser;
import com.baiye.system.service.SysUserService; import com.baiye.system.service.SysUserService;
import com.baiye.util.AESUtils; import com.baiye.util.AESUtils;
import com.baiye.utils.SerialCode; import com.baiye.utils.SerialCode;
@ -48,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -67,13 +67,10 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
private final SysUserService sysUserService; private final SysUserService sysUserService;
private final ClueService clueService; private final ClueService clueService;
private final StoreService storeService; private final StoreService storeService;
@Value("${snowflake.workerId}") @Value("${snowflake.workerId}")
private int workerId; private int workerId;
@ -83,18 +80,7 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
@Override @Override
public PageResult<CustomVO> queryPage(PageParam pageParam, CustomQo qo) { public PageResult<CustomVO> queryPage(PageParam pageParam, CustomQo qo) {
PageResult<CustomVO> customVOPageResult = baseMapper.queryPage(pageParam, qo); return baseMapper.queryPage(pageParam, qo);
/*List<CustomVO> records = customVOPageResult.getRecords();
// 返回数据处理
if (CollUtil.isNotEmpty(records)) {
for (CustomVO record : records) {
if (record.getEnrollStatus() == 2) {
StringBuilder stringBuilder = new StringBuilder(record.getCustomNid());
record.setCustomNid(stringBuilder.replace(3, 7, "****").toString());
}
}
}*/
return customVOPageResult;
} }
@Override @Override
@ -105,8 +91,10 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
CustomEntity customEntity = getCustomEntity(CustomConverter.INSTANCE.dtoToPo(customDTO), user.getWhichUserId(), user.getUsername()); CustomEntity customEntity = getCustomEntity(CustomConverter.INSTANCE.dtoToPo(customDTO), user.getWhichUserId(), user.getUsername());
int insert = baseMapper.insert(customEntity); int insert = baseMapper.insert(customEntity);
List<CustomStoreEntity> customStoreEntities = customDTO.getCustomStoreEntities(); List<CustomStoreEntity> customStoreEntities = customDTO.getCustomStoreEntities();
if (CollUtil.isNotEmpty(customStoreEntities)){
customStoreEntities.forEach(c -> c.setCustomId(customEntity.getCustomId())); customStoreEntities.forEach(c -> c.setCustomId(customEntity.getCustomId()));
customStoreService.saveBatch(customStoreEntities); customStoreService.saveBatch(customStoreEntities);
}
return SqlHelper.retBool(insert); return SqlHelper.retBool(insert);
} }
@ -125,6 +113,9 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
CustomVO customVO = new CustomVO(); CustomVO customVO = new CustomVO();
CustomEntity customEntity = baseMapper.selectById(id); CustomEntity customEntity = baseMapper.selectById(id);
BeanUtils.copyProperties(customEntity, customVO); BeanUtils.copyProperties(customEntity, customVO);
if (CollUtil.isNotEmpty(customEntity.getSalesmanUserId())){
customVO.setSalesmanUserId(customEntity.getSalesmanUserId().stream().map(Long::parseLong).collect(Collectors.toList()));
}
List<CustomStoreVO> customStoreVOList = new ArrayList<>(); List<CustomStoreVO> customStoreVOList = new ArrayList<>();
List<CustomStoreEntity> customStores = customStoreService.selectListByCustomId(id); List<CustomStoreEntity> customStores = customStoreService.selectListByCustomId(id);
@ -159,16 +150,13 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean auditFormById(CustomDTO customDTO) { public Boolean auditFormById(ChangeCustomDTO dto) {
Long customId = customDTO.getCustomId(); Integer status = dto.getStatus();
Integer status = customDTO.getStatus(); List<Long> salesmanUserIdList = dto.getSalesmanUserId();
List<Long> salesmanUserIdList = customDTO.getSalesmanUserIdList();
Long reviewUserId = customDTO.getReviewUserId();
Long currentUserId = SecurityUtils.getCurrentUserId(); Long currentUserId = SecurityUtils.getCurrentUserId();
CustomEntity updateCustomEntity = CustomConverter.INSTANCE.dtoToPo(customDTO);
List<ClueDTO> list = Lists.newArrayList(); List<ClueDTO> list = Lists.newArrayList();
CustomEntity customEntity = baseMapper.selectById(customId); CustomEntity customEntity = baseMapper.selectById(dto.getCustomId());
if (ObjectUtil.isNotNull(customEntity)) { if (ObjectUtil.isNotNull(customEntity)) {
String phone = AESUtils.encrypt(customEntity.getCustomNid(), securityProperties.getPasswordSecretKey()); String phone = AESUtils.encrypt(customEntity.getCustomNid(), securityProperties.getPasswordSecretKey());
Long companyId = customEntity.getCompanyId(); Long companyId = customEntity.getCompanyId();
@ -178,7 +166,7 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
BeanUtils.copyProperties(customEntity, address); BeanUtils.copyProperties(customEntity, address);
address.setCustomerName(customEntity.getCustomName()); address.setCustomerName(customEntity.getCustomName());
String otherClue = gson.toJson(address); String otherClue = gson.toJson(address);
List<CustomStoreEntity> customStores = customStoreService.selectListByCustomId(customId); List<CustomStoreEntity> customStores = customStoreService.selectListByCustomId(dto.getCustomId());
if (CollUtil.isNotEmpty(customStores)) { if (CollUtil.isNotEmpty(customStores)) {
for (CustomStoreEntity store : customStores) { for (CustomStoreEntity store : customStores) {
Long clueId = IdUtil.getSnowflake(workerId, datacenterId).nextId(); Long clueId = IdUtil.getSnowflake(workerId, datacenterId).nextId();
@ -188,8 +176,8 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
// 扣减余额 // 扣减余额
Boolean result = sysUserService.deductionQuantity(entity.getUserId(), entity.getStoreName()); Boolean result = sysUserService.deductionQuantity(entity.getUserId(), entity.getStoreName());
if (Boolean.TRUE.equals(result)) { if (Boolean.TRUE.equals(result)) {
ClueDTO clueDTO = new ClueDTO(clueId, ClueSourceEnum.STORE_DISTRIBUTION.getDescription(), phone, updateCustomEntity.getRemark(), ClueDTO clueDTO = new ClueDTO(clueId, ClueSourceEnum.STORE_DISTRIBUTION.getDescription(), phone, customEntity.getRemark(),
otherClue, entity.getUserId(), username, currentUserId, Boolean.TRUE, companyId, updateCustomEntity.getSex(), otherClue, entity.getUserId(), username, currentUserId, Boolean.TRUE, companyId, customEntity.getSex(),
customEntity.getCustomInformation(), customEntity.getChannelIdentifying(), customEntity.getChannelType()); customEntity.getCustomInformation(), customEntity.getChannelIdentifying(), customEntity.getChannelType());
list.add(clueDTO); list.add(clueDTO);
} }
@ -205,25 +193,25 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
Boolean result = sysUserService.deductionQuantity(userId, null); Boolean result = sysUserService.deductionQuantity(userId, null);
if (Boolean.TRUE.equals(result)) { if (Boolean.TRUE.equals(result)) {
Long clueId = IdUtil.getSnowflake(workerId, datacenterId).nextId(); Long clueId = IdUtil.getSnowflake(workerId, datacenterId).nextId();
ClueDTO clueDTO = new ClueDTO(clueId, customEntity.getChannelName(), phone, updateCustomEntity.getRemark(), null, userId, ClueDTO clueDTO = new ClueDTO(clueId, customEntity.getChannelName(), phone, customEntity.getRemark(), null, userId,
username, currentUserId, Boolean.TRUE, companyId, updateCustomEntity.getSex(), customEntity.getCustomInformation(), username, currentUserId, Boolean.TRUE, companyId, customEntity.getSex(), customEntity.getCustomInformation(),
customEntity.getChannelIdentifying(), customEntity.getChannelType()); customEntity.getChannelIdentifying(), customEntity.getChannelType());
list.add(clueDTO); list.add(clueDTO);
} }
} }
} else { } else {
if (reviewUserId != null) throw new BadRequestException("复审员不能为空!"); if (ObjectUtil.isNull(dto.getReviewUserId())) throw new BadRequestException("复审员不能为空!");
updateCustomEntity.setType(3); customEntity.setType(3);
updateCustomEntity.setReviewUserId(customDTO.getReviewUserId()); customEntity.setReviewUserId(dto.getReviewUserId());
return SqlHelper.retBool(baseMapper.updateById(updateCustomEntity)); return SqlHelper.retBool(baseMapper.updateById(customEntity));
} }
// 扣减数量,插入资源 // 插入资源,修改信息
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
updateCustomEntity.setEnrollStatus(2);
clueService.saveClueListByStoreInfo(list); clueService.saveClueListByStoreInfo(list);
updateCustomEntity.setDistributeTime(DateUtil.date()); customEntity.setEnrollStatus(2);
updateCustomEntity.setUpdateTime(LocalDateTime.now()); customEntity.setDistributeTime(DateUtil.date());
return SqlHelper.retBool(baseMapper.updateById(updateCustomEntity)); customEntity.setUpdateTime(LocalDateTime.now());
return SqlHelper.retBool(baseMapper.updateById(customEntity));
} }
} }
return Boolean.FALSE; return Boolean.FALSE;
@ -311,8 +299,7 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
String detailAddress = customDTO.getDetailAddress(); String detailAddress = customDTO.getDetailAddress();
String radius = customDTO.getRadius(); String radius = customDTO.getRadius();
List<CustomStoreEntity> customStoreEntities = customDTO.getCustomStoreEntities(); List<CustomStoreEntity> customStoreEntities = customDTO.getCustomStoreEntities();
if (StringUtils.isBlank(economize) || StringUtils.isBlank(market)) if (StringUtils.isBlank(economize) || StringUtils.isBlank(market)) throw new BadRequestException("省市不能为空");
throw new BadRequestException("省市不能为空");
if (StringUtils.isBlank(detailAddress)) throw new BadRequestException("详细地址不能为空"); if (StringUtils.isBlank(detailAddress)) throw new BadRequestException("详细地址不能为空");
if (StringUtils.isBlank(radius)) throw new BadRequestException("半径不能为空"); if (StringUtils.isBlank(radius)) throw new BadRequestException("半径不能为空");
if (CollUtil.isEmpty(customStoreEntities)) throw new BadRequestException("门店信息不能为空"); if (CollUtil.isEmpty(customStoreEntities)) throw new BadRequestException("门店信息不能为空");

@ -1,8 +1,11 @@
package com.baiye.modules.distribute.vo; package com.baiye.modules.distribute.vo;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.modules.distribute.entity.ClueStageEntity; import com.baiye.modules.distribute.entity.ClueStageEntity;
import com.baiye.modules.distribute.entity.LabelOrganizeEntity; import com.baiye.modules.distribute.entity.LabelOrganizeEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -73,4 +76,16 @@ public class ClueVO {
@Schema(title = "阶段信息") @Schema(title = "阶段信息")
List<ClueStageEntity> clueStageEntities; List<ClueStageEntity> clueStageEntities;
@Schema(title = "性别(0-男1-女)")
private Integer sex;
@Schema(title = "客户资料")
private String customInformation;
@Schema(title = "渠道标识")
private List<String> channelIdentifying;
@Schema(title = "渠道类型渠道类型(1 手动创建 2文件上传 3飞鱼回传 4话单回传 5 api回传)")
private Integer channelType;
} }

@ -72,12 +72,18 @@ public class CustomVO {
@Schema(title = "备注") @Schema(title = "备注")
private String remark; private String remark;
@Schema(title = "客户类型 0:A型 1:B型") @Schema(title = "客户类型 0:地理 1:基本")
private Integer customType; private Integer customType;
@Schema(title = "渠道类型") @Schema(title = "渠道类型渠道类型(1 手动创建 2文件上传 3飞鱼回传 4话单回传 5 api回传)")
private Integer channelType; private Integer channelType;
@Schema(title = "渠道标识") @Schema(title = "性别(0-男1-女)")
private Integer channelFlag; private Integer sex;
@Schema(title = "客户资料")
private String customInformation;
@Schema(title = "业务员ID集合")
private List<Object> salesmanUserId;
} }

@ -20,7 +20,12 @@
ce.create_time, ce.create_time,
ce.assigned_name, ce.assigned_name,
ce.clue_stage_id, ce.clue_stage_id,
ce.clue_stage_name ce.clue_stage_name,
ce.sex,
ce.custom_information,
ce.channel_identifying,
ce.channel_type
</sql> </sql>
<select id="findUndistributedClueIds" resultType="java.lang.Long"> <select id="findUndistributedClueIds" resultType="java.lang.Long">
@ -40,7 +45,7 @@
</if> </if>
</select> </select>
<select id="selectByPage" resultType="com.baiye.modules.distribute.vo.ClueVO"> <select id="selectByPage" resultType="com.baiye.modules.distribute.entity.ClueEntity">
SELECT SELECT
<include refid="Base_Alias_Column_List"/> <include refid="Base_Alias_Column_List"/>
FROM FROM

Loading…
Cancel
Save