线索信息+ oss sts + 添加标签
This commit is contained in:
@@ -124,7 +124,7 @@ public class LineInfoDO {
|
||||
* 是否是加盟商:0.否 1.是
|
||||
*/
|
||||
@Column(name = "join_status")
|
||||
private Boolean joinStatus;
|
||||
private Integer joinStatus;
|
||||
|
||||
/**
|
||||
* 0.公海 1.私海 2黑名单
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2023/5/31 11:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class AddTagsRequest {
|
||||
|
||||
@ApiModelProperty("加盟申请线索ID")
|
||||
private Long lineId;
|
||||
@ApiModelProperty("标签列表")
|
||||
private List<Long> tags;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -28,8 +29,18 @@ public class LineInfoVO {
|
||||
private String partnerId;
|
||||
|
||||
@Column(name = "region_id")
|
||||
@ApiModelProperty("战区Id")
|
||||
private Long regionId;
|
||||
|
||||
@ApiModelProperty("战区名称")
|
||||
private String regionName;
|
||||
|
||||
@ApiModelProperty("大区ID")
|
||||
private Long largeRegionId;
|
||||
|
||||
@ApiModelProperty("大区ID名称")
|
||||
private String largeRegionName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@@ -54,6 +65,8 @@ public class LineInfoVO {
|
||||
@Column(name = "want_shop_area_id")
|
||||
@ApiModelProperty("意向开店区域")
|
||||
private Long wantShopAreaId;
|
||||
@ApiModelProperty("意向开店区域名称")
|
||||
private String wantShopAreaName;
|
||||
|
||||
/**
|
||||
* 居住地址
|
||||
@@ -111,13 +124,21 @@ public class LineInfoVO {
|
||||
@ApiModelProperty("线索来源")
|
||||
private Integer lineSource;
|
||||
|
||||
@ApiModelProperty("线索来源")
|
||||
private String lineSourceName;
|
||||
|
||||
/**
|
||||
* 招商经理
|
||||
*/
|
||||
@Column(name = "investment_manager")
|
||||
@ApiModelProperty("招商经理")
|
||||
private String investmentManager;
|
||||
|
||||
@ApiModelProperty("招商经理名称")
|
||||
private String investmentManagerName;
|
||||
|
||||
@ApiModelProperty("招商经理手机号")
|
||||
private String investmentManagerMobile;
|
||||
|
||||
/**
|
||||
* 拓展经理
|
||||
*/
|
||||
@@ -144,14 +165,14 @@ public class LineInfoVO {
|
||||
*/
|
||||
@Column(name = "user_portrait")
|
||||
@ApiModelProperty("用户画像")
|
||||
private String userPortrait;
|
||||
private List<LabelBaseInfoVO> userPortraitList;
|
||||
|
||||
/**
|
||||
* 是否是加盟商:0.否 1.是
|
||||
*/
|
||||
@Column(name = "join_status")
|
||||
@ApiModelProperty("0-线索 1-蓄水池 2-加盟商")
|
||||
private Boolean joinStatus;
|
||||
private Integer joinStatus;
|
||||
|
||||
/**
|
||||
* 0.公海 1.私海 2黑名单
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cool.store.vo.oss;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: OssUploadConfigVO
|
||||
* @Description: oss 上传config
|
||||
* @date 2023-06-01 13:46
|
||||
*/
|
||||
@Data
|
||||
public class OssUploadConfigVO {
|
||||
|
||||
@ApiModelProperty("域名")
|
||||
private String accessKeyId;
|
||||
|
||||
@ApiModelProperty("策略 Base64编过")
|
||||
private String policy;
|
||||
|
||||
@ApiModelProperty("对Policy签名后的字符串")
|
||||
private String signature;
|
||||
|
||||
@ApiModelProperty("上传目录")
|
||||
private String dir;
|
||||
|
||||
@ApiModelProperty("域名")
|
||||
private String host;
|
||||
|
||||
@ApiModelProperty("上传策略Policy失效时间")
|
||||
private String expire;
|
||||
|
||||
@ApiModelProperty("cdn地址")
|
||||
private String cdnUrl;
|
||||
|
||||
public OssUploadConfigVO(String accessKeyId, String policy, String signature, String dir, String host, String expire, String cdnUrl) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.policy = policy;
|
||||
this.signature = signature;
|
||||
this.dir = dir;
|
||||
this.host = host;
|
||||
this.expire = expire;
|
||||
this.cdnUrl = cdnUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.request.AddTagsRequest;
|
||||
import com.cool.store.request.LineListRequest;
|
||||
import com.cool.store.vo.LineInfoVO;
|
||||
import com.cool.store.vo.LineListVO;
|
||||
@@ -31,4 +32,12 @@ public interface LineService {
|
||||
PageInfo<LineListVO> getLineList(LineListRequest lineListRequest, LoginUserInfo loginUserInfo,Boolean teamFlag);
|
||||
|
||||
|
||||
/**
|
||||
* 添加标签
|
||||
* @param userInfo
|
||||
* @param addTagsRequest
|
||||
* @return
|
||||
*/
|
||||
Boolean addTags(LoginUserInfo userInfo, AddTagsRequest addTagsRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.vo.oss.OssUploadConfigVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/3/28 14:27
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface OSSService {
|
||||
/**
|
||||
* 上传文件
|
||||
* @return
|
||||
*/
|
||||
OssUploadConfigVO getUploadFileConfig();
|
||||
}
|
||||
@@ -1,32 +1,38 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.HyOpenAreaInfoDAO;
|
||||
import com.cool.store.dao.HyPartnerUserChannelDAO;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||
import com.cool.store.entity.HyPartnerLabelDO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.OperateTypeEnum;
|
||||
import com.cool.store.enums.WorkflowStageEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.RegionMapper;
|
||||
import com.cool.store.request.AddTagsRequest;
|
||||
import com.cool.store.request.LineListRequest;
|
||||
import com.cool.store.service.DeskService;
|
||||
import com.cool.store.service.LineService;
|
||||
import com.cool.store.service.RegionService;
|
||||
import com.cool.store.utils.CoolDateUtils;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.poi.DateUtils;
|
||||
import com.cool.store.vo.BaseInfoVO;
|
||||
import com.cool.store.vo.LineInfoVO;
|
||||
import com.cool.store.vo.LineListVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -47,6 +53,10 @@ public class LineServiceImpl implements LineService {
|
||||
HyPartnerUserChannelDAO hyPartnerUserChannelDAO;
|
||||
@Resource
|
||||
EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
RegionService regionService;
|
||||
@Resource
|
||||
RegionDao regionDao;
|
||||
|
||||
@Override
|
||||
public LineInfoVO getLineInfo(Long lineId) {
|
||||
@@ -56,6 +66,28 @@ public class LineServiceImpl implements LineService {
|
||||
if (lineInfo==null){
|
||||
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
||||
}
|
||||
if (lineInfo.getLineSource()!=null){
|
||||
Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(Arrays.asList(lineInfo.getLineSource()));
|
||||
result.setLineSourceName(channelMapByIds.get(lineInfo.getLineSource()));
|
||||
}
|
||||
if (StringUtil.isNotEmpty(lineInfo.getInvestmentManager())){
|
||||
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(lineInfo.getInvestmentManager());
|
||||
result.setInvestmentManagerName(user.getName());
|
||||
result.setInvestmentManagerMobile(user.getMobile());
|
||||
}
|
||||
if(lineInfo.getRegionId()!=null){
|
||||
Long bigRegionIdByAreaId = regionService.getBigRegionIdByAreaId(lineInfo.getWantShopAreaId());
|
||||
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(Arrays.asList(bigRegionIdByAreaId, lineInfo.getRegionId()));
|
||||
result.setRegionId(lineInfo.getRegionId());
|
||||
result.setRegionName(regionNameMap.get(lineInfo.getRegionId()));
|
||||
result.setLargeRegionId(bigRegionIdByAreaId);
|
||||
result.setLargeRegionName(regionNameMap.get(bigRegionIdByAreaId));
|
||||
}
|
||||
Map<Long, HyPartnerLabelDO> userPortraitMap = deskService.getUserPortraitMap(Arrays.asList(lineInfo));
|
||||
Map<Long, String> wantShopAreaMap = hyOpenAreaInfoDAO.selectNameMapByIds(Arrays.asList(lineInfo.getWantShopAreaId()));
|
||||
BaseInfoVO baseInfoVO = deskService.convertToBaseInfoVO(lineInfo, userPortraitMap, wantShopAreaMap);
|
||||
result.setWantShopAreaName(baseInfoVO.getWantShopAreaName());
|
||||
result.setUserPortraitList(baseInfoVO.getUserPortraitList());
|
||||
BeanUtil.copyProperties(lineInfo,result);
|
||||
return result;
|
||||
}
|
||||
@@ -90,4 +122,18 @@ public class LineServiceImpl implements LineService {
|
||||
page.setList(result);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addTags(LoginUserInfo user, AddTagsRequest addTagsRequest) {
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(addTagsRequest.getLineId());
|
||||
if (lineInfo==null){
|
||||
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
||||
}
|
||||
|
||||
lineInfo.setUserPortrait(CollectionUtils.isNotEmpty(addTagsRequest.getTags())?
|
||||
addTagsRequest.getTags().stream().map(Object::toString).collect(Collectors.joining(CommonConstants.COMMA, CommonConstants.COMMA, CommonConstants.COMMA)):"");
|
||||
lineInfoDAO.updateLineInfo(lineInfo);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.common.utils.BinaryUtil;
|
||||
import com.aliyun.oss.model.MatchMode;
|
||||
import com.aliyun.oss.model.PolicyConditions;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.OSSService;
|
||||
import com.cool.store.vo.oss.OssUploadConfigVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/3/28 14:29
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OSSServiceImpl implements OSSService {
|
||||
|
||||
@Value("${oss.accessKeyId:null}")
|
||||
private String accessKeyId;
|
||||
@Value("${oss.accessKeySecret:null}")
|
||||
private String accessKeySecret;
|
||||
@Value("${oss.endpoint:null}")
|
||||
private String endpoint;
|
||||
@Value("${oss.bucket:null}")
|
||||
private String bucket;
|
||||
@Value("${cdn.url:null}")
|
||||
private String cdnUrl;
|
||||
@Value("${oss.file.dir:null}")
|
||||
private String dir;
|
||||
|
||||
@Override
|
||||
public OssUploadConfigVO getUploadFileConfig() {
|
||||
// host的格式为 bucketname.endpoint
|
||||
String host = "https://" + bucket + "." + endpoint;
|
||||
OSS client = null;
|
||||
try {
|
||||
client = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
long expireTime = 300;
|
||||
long expireEndTime = System.currentTimeMillis() + expireTime * 1000;
|
||||
Date expiration = new Date(expireEndTime);
|
||||
PolicyConditions policyConds = new PolicyConditions();
|
||||
policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, 1048576000);
|
||||
policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, dir);
|
||||
String postPolicy = client.generatePostPolicy(expiration, policyConds);
|
||||
byte[] binaryData = postPolicy.getBytes("utf-8");
|
||||
String encodedPolicy = BinaryUtil.toBase64String(binaryData);
|
||||
String signature = client.calculatePostSignature(postPolicy);
|
||||
OssUploadConfigVO result = new OssUploadConfigVO(accessKeyId, encodedPolicy, signature, dir, host, String.valueOf(expireEndTime / 1000), cdnUrl);
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
log.info("exception", e);
|
||||
throw new ServiceException(ErrorCodeEnum.GET_INFO_ERROR);
|
||||
}finally {
|
||||
if(Objects.nonNull(client)){
|
||||
client.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.request.AddTagsRequest;
|
||||
import com.cool.store.request.LineListRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.LineService;
|
||||
@@ -58,6 +59,12 @@ public class LineInfoController {
|
||||
return ResponseResult.success(lineService.getLineList(lineListRequest,user,Boolean.TRUE));
|
||||
}
|
||||
|
||||
@PostMapping(path = "/addTags")
|
||||
@ApiOperation("添加标签接口")
|
||||
public ResponseResult<Boolean> addTags(@RequestBody AddTagsRequest addTagsRequest){
|
||||
return ResponseResult.success(lineService.addTags(CurrentUserHolder.getUser(),addTagsRequest));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.OSSService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/3/28 14:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Api("PC OSS配置")
|
||||
@RestController
|
||||
@RequestMapping({"/pc/oss"})
|
||||
@Slf4j
|
||||
public class OssClientController {
|
||||
|
||||
@Resource
|
||||
OSSService ossService;
|
||||
|
||||
@GetMapping("/getUploadFileConfig")
|
||||
public ResponseResult getUploadFileConfig(){
|
||||
return ResponseResult.success(ossService.getUploadFileConfig());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.OSSService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2024/3/28 14:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@Api("小程序OSS配置")
|
||||
@RequestMapping({"/mini/oss"})
|
||||
@Slf4j
|
||||
public class MiniOssClientController {
|
||||
|
||||
@Resource
|
||||
OSSService ossService;
|
||||
|
||||
@GetMapping("/getUploadFileConfig")
|
||||
public ResponseResult getUploadFileConfig(){
|
||||
return ResponseResult.success(ossService.getUploadFileConfig());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user