修改代码bug

master
bynt 9 months ago
parent b78aff5727
commit 14438d3bd4

@ -34,9 +34,9 @@ import java.util.Objects;
public enum SalesManEnum {
/**
*
*
*/
DISPENSER(19L, 1),
ENTRY_CLERK(19L, 1),
/**
*
@ -51,7 +51,7 @@ public enum SalesManEnum {
/**
*
*/
EXECUTIVE(14L, 0),
EXECUTIVE(22L, 0),
/**
*

@ -70,5 +70,9 @@
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>com.baiye</groupId>
<artifactId>common-core</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,47 @@
package com.baiye.common.excel.converters;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.enums.ChannelTypeEnum;
import org.apache.commons.lang3.StringUtils;
/**
* @author Enzo
* @date : 2023/12/9
*/
public class ChannelConverter implements Converter<Integer> {
@Override
public Class<?> supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
if (StringUtils.isNotBlank(cellData.getStringValue())) {
return Integer.parseInt(cellData.getStringValue());
}
return DefaultNumberConstants.MINUS_ONE_NUMBER;
}
@Override
public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return ObjectUtil.isNotNull(value) ? new WriteCellData<>(ChannelTypeEnum.find(value)) : new WriteCellData<>(CharSequenceUtil.EMPTY);
}
}

@ -1,17 +1,20 @@
package com.baiye.modules.distribute.controller;
import cn.hutool.json.JSONUtil;
import com.baiye.modules.distribute.dto.PushClueDTO;
import com.baiye.modules.distribute.service.TripartiteService;
import com.baiye.result.R;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* @author Enzo
* @date 2023-12-6
*/
@RequiredArgsConstructor
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/tripartite")
public class TripartiteController {
@ -21,7 +24,9 @@ public class TripartiteController {
*
*/
@PostMapping("/push/clue/{appKey}")
public R<String> pushClue(@PathVariable("appKey") String appKey, @RequestBody PushClueDTO dto) {
public R<String> pushClue(@PathVariable("appKey") String appKey, @RequestBody String body) {
log.info(" =============== the body as {} ===============", body);
PushClueDTO dto = JSONUtil.toBean(body, PushClueDTO.class);
return Boolean.TRUE.equals(tripartiteService.callbackByAppKeyAndNid
(appKey, dto)) ? R.ok("success") : R.failed("message callback failed");
}

@ -13,6 +13,8 @@ import java.util.List;
@Builder
public class CallbackCustomDTO {
private Integer sex;
private String remark;
private Long companyId;
@ -21,6 +23,8 @@ public class CallbackCustomDTO {
private String customName;
private Integer customType;
private String customNid;
private Integer channelType;
@ -29,6 +33,8 @@ public class CallbackCustomDTO {
private Long distributeId;
private String channelName;
private List<String> identifying;
}

@ -3,6 +3,7 @@ package com.baiye.modules.distribute.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -21,7 +22,7 @@ public class PushLinkEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
private Long id;

@ -58,14 +58,14 @@ public interface ClueMapper extends ExtendMapper<ClueEntity> {
LambdaQueryWrapperX<ClueEntity> wrapperX = WrappersX.lambdaQueryX(ClueEntity.class);
wrapperX.eqIfPresent(ClueEntity::getDeleted, 0)
.eqIfPresent(ClueEntity::getNid, qo.getNid())
.eqIfPresent(ClueEntity::getClueId, qo.getClueId())
.eqIfPresent(ClueEntity::getCreateBy, qo.getCreateBy())
.likeIfPresent(ClueEntity::getClueLabelName, qo.getClueLabelName())
.eqIfPresent(ClueEntity::getAssignedBy, qo.getAssignedBy())
.eqIfPresent(ClueEntity::getCompanyId, qo.getCompanyId())
.orderByDesc(ClueEntity::getCreateTime);
.eqIfPresent(ClueEntity::getNid, qo.getNid())
.eqIfPresent(ClueEntity::getClueId, qo.getClueId())
.eqIfPresent(ClueEntity::getCreateBy, qo.getCreateBy())
.likeIfPresent(ClueEntity::getClueLabelName, qo.getClueLabelName())
.eqIfPresent(ClueEntity::getAssignedBy, qo.getAssignedBy())
.eqIfPresent(ClueEntity::getCompanyId, qo.getCompanyId())
.inIfPresent(ClueEntity::getAssignedBy, (Object[]) qo.getSalesmanArray())
.orderByDesc(ClueEntity::getCreateTime);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(ClueEntity::getCreateTime, qo.getStartTime(), qo.getEndTime());
}

@ -34,4 +34,8 @@ public class ClueQo {
@Schema(title = "业务类型")
private Integer salesmanType;
@Schema(title = "业务员id")
private Long[] salesmanArray;
}

@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.enums.ClueSourceEnum;
import com.baiye.exception.BadRequestException;
import com.baiye.extend.mybatis.plus.service.impl.ExtendServiceImpl;
import com.baiye.modules.distribute.converter.CustomConverter;
@ -47,7 +46,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -176,9 +174,9 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
// 扣减余额
Boolean result = sysUserService.deductionQuantity(entity.getUserId(), entity.getStoreName());
if (Boolean.TRUE.equals(result)) {
ClueDTO clueDTO = new ClueDTO(clueId, ClueSourceEnum.STORE_DISTRIBUTION.getDescription(), phone, customEntity.getRemark(),
ClueDTO clueDTO = new ClueDTO(clueId, customEntity.getChannelName(), phone, customEntity.getRemark(),
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);
}
}
@ -260,10 +258,12 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
ArrayList<CustomEntity> customEntities = Lists.newArrayList();
CustomEntity entity = new CustomEntity();
for (CallbackCustomDTO dto : dtoList) {
entity.setSex(dto.getSex());
entity.setRemark(dto.getRemark());
entity.setCustomNid(dto.getCustomNid());
entity.setChannelType(dto.getChannelType());
entity.setCreateBy(dto.getReportUserId());
entity.setChannelName(dto.getChannelName());
entity.setChannelType(dto.getChannelType());
entity.setDistributorId(dto.getDistributeId());
entity.setChannelIdentifying(dto.getIdentifying());
customEntities.add(getCustomEntity(entity, dto.getCompanyId(), dto.getEnterName()));
@ -279,11 +279,12 @@ public class CustomServiceImpl extends ExtendServiceImpl<CustomMapper, CustomEnt
String newCode = StringUtils.isNotBlank(maxCode) ?
code.concat(SerialCode.getNum(Integer.parseInt
(maxCode.substring(10)))) : code.concat(LetterConst.ONE);
entity.setType(2);
entity.setBatchNo(newCode);
entity.setCompanyId(companyId);
entity.setEnterName(username);
entity.setUpdateTime(LocalDateTime.now());
entity.setType(DefaultNumberConstants.TWO_NUMBER);
entity.setCustomType(DefaultNumberConstants.ZERO_NUMBER);
entity.setEnrollStatus(DefaultNumberConstants.ONE_NUMBER);
return entity;
}

@ -246,9 +246,9 @@ public class OceanEngineClueServiceImpl extends ExtendServiceImpl<OceanEngineSou
clueService.saveClueListByStoreInfo(list);
}
CallbackCustomDTO customDTO = CallbackCustomDTO.builder().channelType(DefaultNumberConstants.THREE_NUMBER).customNid
(phone).customName(name).distributeId(distributeId).identifying(pushLinkEntity.getChannelIdentifying()).reportUserId(userId).remark
(jsonStr).companyId(byId.getWhichUserId()).enterName(byId.getUsername()).build();
CallbackCustomDTO customDTO = CallbackCustomDTO.builder().channelType(DefaultNumberConstants.THREE_NUMBER).customNid(phone).channelName(pushLinkEntity.getName())
.customName(name).distributeId(distributeId).sex(DefaultNumberConstants.MINUS_ONE_NUMBER).identifying(pushLinkEntity.getChannelIdentifying()).reportUserId
(userId).remark(jsonStr).companyId(byId.getWhichUserId()).enterName(byId.getUsername()).build();
dtoList.add(customDTO);
}
}

@ -1,6 +1,7 @@
package com.baiye.modules.distribute.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil;
@ -32,6 +33,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.ballcat.security.properties.SecurityProperties;
import org.jsoup.helper.DataUtil;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -84,7 +86,7 @@ public class OceanEngineServiceImpl extends ExtendServiceImpl<OceanEngineTokenMa
if (split.length > DefaultNumberConstants.ONE_NUMBER) {
long parseLong = Long.parseLong(split[DefaultNumberConstants.ZERO_NUMBER]);
String authorizeName = split[DefaultNumberConstants.ONE_NUMBER];
OceanEngineToken byUserId = oceanEngineTokenMapper.selectOne(WrappersX.lambdaAliasQueryX(OceanEngineToken.class)
OceanEngineToken byUserId = oceanEngineTokenMapper.selectOne(WrappersX.lambdaQueryX(OceanEngineToken.class)
.eq(OceanEngineToken::getUserId, parseLong).eq(OceanEngineToken::getAuthorizeName, authorizeName));
if (ObjectUtil.isNull(byUserId)) {
byUserId = new OceanEngineToken();
@ -100,6 +102,7 @@ public class OceanEngineServiceImpl extends ExtendServiceImpl<OceanEngineTokenMa
oceanEngineTokenMapper.insert(byUserId);
return;
}
byUserId.setAuthorizeTime(DateUtil.date());
byUserId.setExpiresIn(data.getExpiresIn());
byUserId.setAccessToken(data.getAccessToken());
byUserId.setRefreshToken(data.getRefreshToken());

@ -95,6 +95,7 @@ public class TripartiteServiceImpl implements TripartiteService {
(baseUserId, RoleCodeEnum.ROLE_PRELIMINARY_EXAMINER.getRoleCode());
QueueBalance<Long> balance = new QueueBalance<>();
Long distributeId = balance.chooseOne(userList);
log.info("============ the distribute id {} this assigned id {} ============", userList, distributeId);
if (ObjectUtil.isNotNull(distributeId)) {
SysUserRolePromise promise = sysUserRolePromiseService.queryIsShowByUserId(distributeId);
if (ObjectUtil.isNotNull(promise) && ObjectUtil.isNotNull
@ -109,8 +110,8 @@ public class TripartiteServiceImpl implements TripartiteService {
clueService.saveClueListByStoreInfo(list);
}
SysUser byId = sysUserService.findById(reportUserId);
CallbackCustomDTO customDTO = CallbackCustomDTO.builder().channelType(DefaultNumberConstants.FOUR_NUMBER).customNid
(phone).distributeId(distributeId).identifying(channelIdentifying).reportUserId(reportUserId).remark(remark).companyId
CallbackCustomDTO customDTO = CallbackCustomDTO.builder().channelType(DefaultNumberConstants.FOUR_NUMBER).customNid(phone).channelName(byAppKey.getName()).
distributeId(distributeId).sex(DefaultNumberConstants.MINUS_ONE_NUMBER).identifying(channelIdentifying).reportUserId(reportUserId).remark(remark).companyId
(byId.getWhichUserId()).enterName(byId.getUsername()).build();
// 插入资源表

@ -23,12 +23,14 @@ public class ClueVO {
@Schema(title = "是否有效")
private Boolean isEffective;
@Schema(title = "手机号")
@ExcelProperty(value = "手机号", converter = NidStringConverter.class, index = 0)
private String nid;
@Schema(title = "线索来源")
@ExcelProperty(value = "线索来源", index = 1)
@ExcelProperty(value = "线索来源名称", index = 1)
private String originName;
@ -107,6 +109,7 @@ public class ClueVO {
private List<String> channelIdentifying;
@ExcelIgnore
// @ExcelProperty(value = "线索来源渠道", converter = ChannelConverter.class, index = 7)
@Schema(title = "渠道类型渠道类型(1 手动创建 2文件上传 3飞鱼回传 4话单回传 5 api回传)")
private Integer channelType;

@ -5,7 +5,7 @@ spring:
application:
name: @artifactId@
profiles:
active: dev
active: test
# 天爱图形验证码
@ -54,6 +54,7 @@ ballcat:
- /outside/**
- /store/**
- /v1/tripartite/**
- /api/oceanEngine/**
# 项目 redis 缓存的 key 前缀
redis:
key-prefix: 'ballcat:'

Loading…
Cancel
Save