提交 6831e9c0 authored 作者: 000516's avatar 000516 提交者: Coding

导入计划中添加勤策终端编码并验证与经销商之间的关系

导入计划中添加勤策终端编码并验证与经销商之间的关系
......@@ -2,9 +2,7 @@ package com.wangxiaolu.promotion.controller.activity.temporary;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityMarketCellDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryActivityMarketCellVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
......@@ -14,7 +12,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
......@@ -89,23 +86,13 @@ public class TemporaryActivityQueryController {
public R findActivityApprovedVerify(@PathVariable("id") Long activityId){
TemporaryActivityReportedDto activityReportedDto = temporaryActivityQueryService.findTemporaryActivityById(activityId);
if (CollectionUtils.isEmpty(activityReportedDto.getTgscPhotoUrls()) || activityReportedDto.getTgscPhotoUrls().size() < 4){
if (CollectionUtils.isEmpty(activityReportedDto.getTgscPhotoInfos()) || activityReportedDto.getTgscPhotoInfos().size() < 4){
throw new DataException(RCode.NOT_TGSH_PHOTO_ERROR);
}else if (CollectionUtils.isEmpty(activityReportedDto.getTghdPhotoUrls()) || activityReportedDto.getTghdPhotoUrls().size() < 4){
}else if (CollectionUtils.isEmpty(activityReportedDto.getTghdPhotoInfos()) || activityReportedDto.getTghdPhotoInfos().size() < 4){
throw new DataException(RCode.NOT_TGHD_PHOTO_ERROR);
}else if (CollectionUtils.isEmpty(activityReportedDto.getTgcjPhotoUrls()) || activityReportedDto.getTgcjPhotoUrls().size() < 4){
}else if (CollectionUtils.isEmpty(activityReportedDto.getTgcjPhotoInfos()) || activityReportedDto.getTgcjPhotoInfos().size() < 4){
throw new DataException(RCode.NOT_TGCJ_PHOTO_ERROR);
}
// else if (CollectionUtils.isEmpty(activityReportedDto.getPsvPhotoUrls())){
// throw new DataException(RCode.NOT_POS_PHOTO_ERROR);
// }
// List<TemporaryActivityMarketCellDto> marketCells = temporaryActivityQueryService.findActivityMarketCellByDb(activityId);
// if (CollectionUtils.isEmpty(marketCells)){
// throw new DataException(RCode.NOT_MARKET_CELL_ERROR);
// }
return R.success();
}
}
......@@ -35,4 +35,6 @@ public interface TemporaryActivityPhotoDao {
void saveClockPhotoByUpdate(Integer temporaryId, Long id, Integer photoType, String url);
Map<Long, Map<Integer, String>> findClockPhotoGroupByClockIds(List<Long> clockIds);
Map<Integer, List<TemporaryActivityPhotoDto>> findReportedInfoGroup(Integer temporaryId, Long reportedId);
}
......@@ -98,6 +98,19 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
return groupClockPhotoMap;
}
@Override
public Map<Integer, List<TemporaryActivityPhotoDto>> findReportedInfoGroup(Integer temporaryId, Long reportedId) {
LambdaQueryWrapper<TemporaryActivityPhotoDO> wq = new LambdaQueryWrapper<>();
wq.eq(TemporaryActivityPhotoDO::getReportedId, reportedId).eq(TemporaryActivityPhotoDO::getIsDelete, StatusType.VALID.getType());
List<TemporaryActivityPhotoDO> dos = temporaryActivityPhotoMapper.selectList(wq);
if (CollectionUtils.isEmpty(dos)) {
return null;
}
List<TemporaryActivityPhotoDto> photoDtos = transitionDtos(dos);
Map<Integer, List<TemporaryActivityPhotoDto>> groupPhoto = photoDtos.stream().collect(Collectors.groupingBy(TemporaryActivityPhotoDto::getType));
return groupPhoto;
}
/**
* 活动上报图片查询
......
......@@ -54,6 +54,7 @@ public class TemporaryActivityClockDO implements Serializable {
* qince_clientele_store表store_name
*/
private String storeName;
private String qinceStoreCode;
private String deptQcId;
......
......@@ -61,10 +61,12 @@ public class TemporaryActivityPhotoDO implements Serializable {
private Integer isDelete;
/**
* 图片的创建时间,只是用来前端显示,所以用varchar不timestamp
* 同一类型下的图片修改时间
*/
private Date updateTime;
private Date createTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -151,6 +151,10 @@ public class EmployeeActivityPlanInfoDaoImpl implements EmployeeActivityPlanInfo
qw.eq(EmployeeActivityPlanInfoDO::getActivityStatus, wrapper.getActivityStatus().getType());
}
if (StringUtils.isNotBlank(wrapper.getQinceStoreCode())) {
qw.or(q1 -> q1.eq(EmployeeActivityPlanInfoDO::getQinceStoreCode, wrapper.getQinceStoreCode()));
}
qw.eq(EmployeeActivityPlanInfoDO::getIsDelete, StatusType.VALID.getType());
qw.orderByDesc(EmployeeActivityPlanInfoDO::getCreateTime);
return qw;
......
......@@ -76,6 +76,7 @@ public class EmployeeActivityPlanInfoDO implements Serializable {
* 店铺名称
*/
private String storeName;
private String qinceStoreCode;
/**
* 活动模式
......
......@@ -60,6 +60,7 @@ public class ActivityPlanInfoWrapper {
*/
private String storeName;
private String storeNameLike;
private String qinceStoreCode;
/**
* 经销商名称
......
......@@ -96,7 +96,8 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
// 指定字段查询
qw.select(QinCeClienteleStoreDO::getQcId,
QinCeClienteleStoreDO::getStoreName,
QinCeClienteleStoreDO::getStoreAddr);
QinCeClienteleStoreDO::getStoreAddr,
QinCeClienteleStoreDO::getDealersName);
QinCeClienteleStoreDO qinCeClienteleStoreDO = qinCeClienteleStoreMapper.selectOne(qw);
return transitionDto(qinCeClienteleStoreDO);
......@@ -114,6 +115,11 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
qw.eq(QinCeClienteleStoreDO::getQcId, storeWrapper.getQcId());
return qw;
}
// 按终端编码查询
if (StringUtils.isNotBlank(storeWrapper.getStoreCode())) {
qw.eq(QinCeClienteleStoreDO::getStoreCode, storeWrapper.getStoreCode());
return qw;
}
// 按门店名称模糊查询
if (StringUtils.isNotBlank(storeWrapper.getStoreNameVague())) {
qw.like(QinCeClienteleStoreDO::getStoreName, storeWrapper.getStoreNameVague().trim());
......
......@@ -29,4 +29,5 @@ public class StoreWrapper {
*/
private String storeStatus = "1";
private String storeApprovalStatus = "3";
private String storeCode;
}
......@@ -79,7 +79,7 @@ public class EmployeeActivityPlanInfoDto implements Serializable {
* 店铺名称
*/
private String storeName;
private String qinceStoreCode;
/**
* 活动模式
*/
......
......@@ -34,6 +34,7 @@ public class ActivityPlanInfoVo {
private Integer employeeId;
private String storeName;
private String qinceStoreCode;
/**
* 活动计划表上传记录id
......
......@@ -59,5 +59,7 @@ public class TemporaryActivityPhotoDto implements Serializable {
*/
private Date updateTime;
private Date createTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -6,7 +6,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -109,24 +108,28 @@ public class TemporaryActivityReportedDto {
* 推广试吃照片
*/
List<String> tgscPhotoUrls;
List<TemporaryActivityPhotoDto> tgscPhotoInfos;
List<String> tgscChangePhotoUrls;
/**
* 推广互动照片
*/
List<String> tghdPhotoUrls;
List<TemporaryActivityPhotoDto> tghdPhotoInfos;
List<String> tghdChangePhotoUrls;
/**
* 推广成交照片
*/
List<String> tgcjPhotoUrls;
List<TemporaryActivityPhotoDto> tgcjPhotoInfos;
List<String> tgcjChangePhotoUrls;
/**
* POS机页面凭证
*/
private List<String> psvPhotoUrls;
private List<TemporaryActivityPhotoDto> psvPhotoInfos;
private List<String> psvChangePhotoUrls;
/**
......
......@@ -46,6 +46,7 @@ public class TemporaryClockDto {
* qince_clientele_store表store_name
*/
String storeName;
private String qinceStoreCode;
String deptQcId;
......
......@@ -24,4 +24,5 @@ public class QinCeClienteleStoreDto {
private String storeName;
private String storeAddr;
private String dealersName;
}
package com.wangxiaolu.promotion.service.activity.manage.impl;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.domain.manage.dao.EmployeeActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.activity.manage.dto.EmployeeActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanInfoVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.manage.ActivityPlanInfoCoreService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,6 +28,8 @@ public class ActivityPlanInfoCoreServiceImpl implements ActivityPlanInfoCoreServ
@Autowired
EmployeeActivityPlanInfoDao employeeActivityPlanInfoDao;
@Autowired
QinCeClienteleStoreDao qinCeClienteleStoreDao;
@Override
public void updateActivityInfo(ActivityPlanInfoVo activityPlanInfoVo) {
......@@ -33,10 +39,20 @@ public class ActivityPlanInfoCoreServiceImpl implements ActivityPlanInfoCoreServ
employeeActivityPlanInfoDao.update(wrap);
}
/**
* 根据终端编码验证门店准确性
*/
@Override
public void save(ActivityPlanInfoVo activityPlanInfoVo) {
StoreWrapper storeWrap = new StoreWrapper()
.setStoreCode(activityPlanInfoVo.getQinceStoreCode());
QinCeClienteleStoreDto qcStore = qinCeClienteleStoreDao.getOneStore(storeWrap);
if (Objects.isNull(qcStore) || !qcStore.getStoreName().equals(activityPlanInfoVo.getStoreName())) {
throw new ParamException(RCode.QINCE_STORE_CODE_ERROR);
}
EmployeeActivityPlanInfoDto dto = new EmployeeActivityPlanInfoDto();
BeanUtils.copyProperties(activityPlanInfoVo,dto);
BeanUtils.copyProperties(activityPlanInfoVo, dto);
employeeActivityPlanInfoDao.saveList(Arrays.asList(dto));
}
}
package com.wangxiaolu.promotion.service.activity.manage.impl;
import cn.hutool.core.util.ObjectUtil;
import com.wangxiaolu.promotion.common.excel.ReadExcelUtils;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
......@@ -7,15 +8,17 @@ import com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper;
import com.wangxiaolu.promotion.domain.manage.dao.EmployeeActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.manage.dao.EmployeeActivityPlanRecordDao;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.activity.manage.dto.EmployeeActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.activity.manage.dto.EmployeeActivityPlanRecordDto;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo;
import com.wangxiaolu.promotion.pojo.user.dto.ManageEmployeeInfoDto;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activity.manage.ActivityPlanRecordCoreService;
import org.apache.commons.lang3.StringUtils;
import org.apache.groovy.util.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -42,6 +45,8 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
EmployeeActivityPlanInfoDao employeeActivityPlanInfoDao;
@Autowired
ManageEmployeeInfoDao manageEmployeeInfoDao;
@Autowired
QinCeClienteleStoreDao qinCeClienteleStoreDao;
@Transactional(rollbackFor = Exception.class)
@Override
......@@ -66,18 +71,19 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
public void transferActivityPlan(ActivityPlanVo activityPlanVo) {
ManageEmployeeInfoDto oriUser = manageEmployeeInfoDao.selectById(activityPlanVo.getOriginalEmpId());
ManageEmployeeInfoDto tranUser = manageEmployeeInfoDao.selectById(activityPlanVo.getTransferEmpId());
if (Objects.isNull(oriUser) || Objects.isNull(tranUser)){
if (Objects.isNull(oriUser) || Objects.isNull(tranUser)) {
throw new DataException(RCode.CHARGER_ID_ERROR);
}
employeeActivityPlanRecordDao.transfer(oriUser.getId(),tranUser);
employeeActivityPlanInfoDao.transfer(oriUser.getId(),tranUser);
employeeActivityPlanRecordDao.transfer(oriUser.getId(), tranUser);
employeeActivityPlanInfoDao.transfer(oriUser.getId(), tranUser);
}
private void saveActivityPlanInfo(ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
// 下载
String filePath = "/home/" + planDto.getExcelFiledId();
downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// 读取
List<EmployeeActivityPlanInfoDto> planInfoDtos = readSheet0(filePath, activityPlanVo, planDto);
// 保存
......@@ -104,36 +110,68 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
// 1、解析表格数据
ReadExcelUtils readExcelUtils = new ReadExcelUtils(filePath);
Map<Integer, List<Object>> rows = readExcelUtils.readContent();
String[] headers = readExcelUtils.readTitle();
if (rows.size() <= 0) {
throw new DataException(RCode.API_DATA_ERROR);
}
// 2、校验表头
validateHeader(headers);
// 判断是否是城市经理已经的数据,5列数据是城市经理自己的,6列数据是战区顾问批量上传的
if (rows.get(1).size() == 5){
return saveEmployeeOneselfPlan(rows,activityPlanVo,planDto);
}else if (rows.get(1).size() == 6){
return saveDistrictPlan(rows,activityPlanVo,planDto);
}else {
if (rows.get(1).size() == 6) {
return saveEmployeeOneselfPlan(rows, activityPlanVo, planDto);
} else if (rows.get(1).size() == 7) {
return saveDistrictPlan(rows, activityPlanVo, planDto);
} else {
throw new DataException(RCode.API_DATA_ERROR);
}
}
public void validateHeader(String[] templateHeader) {
StringBuilder msg = new StringBuilder();
if (templateHeader.length < 5 || templateHeader.length > 7) {
throw new DataException("模板异常");
}
String[] expectedHeaderGh = {"执行城市(二级行政单位市)", "门店负责人-工号", "经销商编码(T100中的编码)", "系统名称", "门店编码(勤策-终端编码)", "门店名称(勤策-终端名称)", "活动模式"};
String[] expectedHeader = {"执行城市(二级行政单位市)", "经销商编码(T100中的编码)", "系统名称", "门店编码(勤策-终端编码)", "门店名称(勤策-终端名称)", "活动模式"};
// 包含工号
boolean containsGh = templateHeader[1].contains("门店负责人-工号");
if(containsGh){
for (int i = 0; i < expectedHeaderGh.length; i++) {
String expectHeaderStr = String.format("第%d列表头是:%s;", i + 1, expectedHeaderGh[i]);
if (!(i< templateHeader.length && templateHeader[i].contains(expectedHeaderGh[i]) )) {
msg.append(expectHeaderStr);
}
}
}else{
for (int i = 0; i < expectedHeader.length; i++) {
String expectHeaderStr = String.format("第%d列表头是:%s;", i + 1, expectedHeader[i]);
if (!(i< templateHeader.length && templateHeader[i].contains(expectedHeader[i]) )) {
msg.append(expectHeaderStr);
}
}
}
if (msg.toString().length() > 0) {
throw new DataException("模板不正确:"+ msg);
}
}
/**
* 读取表格并进行数据校验
* 上传文件人员:城市经理自己
*/
private List<EmployeeActivityPlanInfoDto> saveEmployeeOneselfPlan(Map<Integer, List<Object>> rows,ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
private List<EmployeeActivityPlanInfoDto> saveEmployeeOneselfPlan(Map<Integer, List<Object>> rows, ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
// 查询当前用户下有效的门店名称列表,用于检查是否存在同名店铺
Set<String> storeNameDbList = employeeActivityPlanInfoDao.findStoreNameByEmployeeId(activityPlanVo.getEmployeeId());
Map<Object, Object> dealers = redisCache.getAllHash(RedisKeys.UserKeys.DEALER_HAVE_LIST.getKey());
Map<Object, Object> patternMap = redisCache.getAllHash(RedisKeys.TemporaryKeys.TENOIRART_ACTIVITY_PATTERN.getKey());
// 2、校验数据准确性
verifyRowEmployeeOneselfPlan(rows, dealers,patternMap.values(),storeNameDbList);
verifyRowEmployeeOneselfPlan(rows, dealers, patternMap.values(), storeNameDbList);
Map<String,Integer> patternInfoMap = new HashMap<>();
Map<String, Integer> patternInfoMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : patternMap.entrySet()) {
patternInfoMap.put(entry.getValue().toString(),Integer.parseInt((String) entry.getKey()));
patternInfoMap.put(entry.getValue().toString(), Integer.parseInt((String) entry.getKey()));
}
/**
* 3、保存入库
......@@ -154,8 +192,9 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
.setDealerId((String) value.get(1))
.setDealerName((String) dealers.get(value.get(1)))
.setLineName((String) value.get(2))
.setStoreName((String) value.get(3))
.setActivityPattern((String) value.get(4));
.setQinceStoreCode((String) value.get(3))
.setStoreName((String) value.get(4))
.setActivityPattern((String) value.get(5));
planInfoDto.setActivityPatternId(patternInfoMap.get(planInfoDto.getActivityPattern()));
......@@ -168,7 +207,7 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
* 读取表格并进行数据校验
* 上传文件人员:城市顾问批量上传
*/
private List<EmployeeActivityPlanInfoDto> saveDistrictPlan(Map<Integer, List<Object>> rows,ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
private List<EmployeeActivityPlanInfoDto> saveDistrictPlan(Map<Integer, List<Object>> rows, ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
// 查询当前用户下有效的门店名称列表,用于检查是否存在同名店铺
Set<String> storeNameDbList = employeeActivityPlanInfoDao.findStoreNameByEmployeeId(activityPlanVo.getEmployeeId());
......@@ -179,10 +218,9 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
List<ManageEmployeeInfoDto> employeeInfos = manageEmployeeInfoDao.selectList(new ManageEmployeeWrapper().setEmployeeNos(employeeNos));
Map<String, ManageEmployeeInfoDto> employeeInfoMap = employeeInfos.stream().collect(Collectors.toMap(ManageEmployeeInfoDto::getEmployeeNo, o -> o));
Map<String,Integer> patternInfoMap = new HashMap<>();
Map<String, Integer> patternInfoMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : patternMap.entrySet()) {
patternInfoMap.put(entry.getValue().toString(),Integer.parseInt((String) entry.getKey()));
patternInfoMap.put(entry.getValue().toString(), Integer.parseInt((String) entry.getKey()));
}
/**
* 3、保存入库
......@@ -192,8 +230,8 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
for (Map.Entry<Integer, List<Object>> entry : rows.entrySet()) {
List<Object> value = entry.getValue();
ManageEmployeeInfoDto employeeInfo = employeeInfoMap.get((String) value.get(1));
if (Objects.isNull(employeeInfo)){
throw new DataException("工号错误:"+value.get(1));
if (Objects.isNull(employeeInfo)) {
throw new DataException("工号错误:" + value.get(1));
}
EmployeeActivityPlanInfoDto planInfoDto = new EmployeeActivityPlanInfoDto()
......@@ -207,8 +245,9 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
.setDealerId((String) value.get(2))
.setDealerName((String) dealers.get(value.get(2)))
.setLineName((String) value.get(3))
.setStoreName((String) value.get(4))
.setActivityPattern((String) value.get(5));
.setQinceStoreCode((String) value.get(4))
.setStoreName((String) value.get(5))
.setActivityPattern((String) value.get(6));
planInfoDto.setActivityPatternId(patternInfoMap.get(planInfoDto.getActivityPattern()));
......@@ -221,7 +260,7 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
* 校验数据是否规范
* 上传文件人员:城市经理自己
*/
private void verifyRowEmployeeOneselfPlan(Map<Integer, List<Object>> rows, Map<Object, Object> dealers,Collection<Object> patterns,Set<String> storeNameDbSet) throws Exception {
private void verifyRowEmployeeOneselfPlan(Map<Integer, List<Object>> rows, Map<Object, Object> dealers, Collection<Object> patterns, Set<String> storeNameDbSet) throws Exception {
StringBuilder msg = new StringBuilder();
List<String> storeList = new ArrayList<>(storeNameDbSet);
......@@ -235,31 +274,47 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
String city = (String) value.get(0);
if (StringUtils.isBlank(city)) {
sb.append("城市不可为空;");
}else if (!city.contains("市")){
value.set(0,city+"市");
}
if (!dealers.containsKey(((String) value.get(1)).trim())) {
sb.append("经销商编码错误;");
} else if (!city.contains("市")) {
value.set(0, city + "市");
}
if (StringUtils.isBlank((String) value.get(2))) {
sb.append("系统名称不可为空;");
}
String storeName = (String) value.get(3);
if (StringUtils.isBlank(storeName)) {
sb.append("店铺名称不可为空;");
} else if (storeList.contains(storeName)) {
sb.append("店铺名称已存在;");
String qinceStoreCode = (String) value.get(3);
String storeName = (String) value.get(4);
if (StringUtils.isBlank(qinceStoreCode)) {
sb.append("勤策店铺编码不可为空;");
if (StringUtils.isBlank(storeName)) {
sb.append("店铺名称不可为空;");
}
} else {
storeList.add(storeName);
// 验证店铺code是否存在
StoreWrapper storeWrap = new StoreWrapper()
.setStoreCode(qinceStoreCode);
QinCeClienteleStoreDto oneStore = qinCeClienteleStoreDao.getOneStore(storeWrap);
if (ObjectUtil.isEmpty(oneStore)) {
sb.append("勤策店铺编码不正确;");
} else {
if (StringUtils.isBlank(storeName)) {
sb.append("勤策店铺名称不可为空;");
} else if (!storeName.equals(oneStore.getStoreName())) {
sb.append("勤策店铺编码/名称不正确;");
}
String dealersName = oneStore.getDealersName();
String dealerId = ((String) value.get(1)).trim();
if (!dealers.containsKey(dealerId) || !dealers.get(dealerId).equals(dealersName)) {
sb.append("店铺不归属此经销商;");
}
}
}
String pattern = (String) value.get(4);
String pattern = (String) value.get(5);
if (StringUtils.isBlank(pattern)) {
sb.append("活动模式不可为空;");
}else if (!patterns.contains(pattern)){
} else if (!patterns.contains(pattern)) {
patternY = true;
}
......@@ -269,7 +324,7 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
}
if (patternY){
if (patternY) {
msg.append("活动模式列仅限:").append(patterns).append("(需区分大小写)");
}
if (msg.length() > 0) {
......@@ -282,7 +337,7 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
* 校验数据是否规范
* 上传文件人员:城市顾问批量上传
*/
private Set<String> verifyDistrictPlan(Map<Integer, List<Object>> rows, Map<Object, Object> dealers,Collection<Object> patterns,Set<String> storeNameDbSet) throws Exception {
private Set<String> verifyDistrictPlan(Map<Integer, List<Object>> rows, Map<Object, Object> dealers, Collection<Object> patterns, Set<String> storeNameDbSet) throws Exception {
Set<String> employeeNos = new HashSet<>(20);
StringBuilder msg = new StringBuilder();
......@@ -297,47 +352,68 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
String city = (String) value.get(0);
if (StringUtils.isBlank(city)) {
sb.append("城市不可为空;");
}else if (!city.contains("市")){
value.set(0,city+"市");
} else if (!city.contains("市")) {
value.set(0, city + "市");
}
if (StringUtils.isBlank((String) value.get(1))) {
sb.append("门店负责人不可为空;");
}else {
} else {
employeeNos.add((String) value.get(1));
}
if (!dealers.containsKey(((String) value.get(2)).trim())) {
sb.append("经销商编码错误;");
}
// if (!dealers.containsKey(((String) value.get(2)).trim())) {
// sb.append("经销商编码错误;");
// }
if (StringUtils.isBlank((String) value.get(3))) {
sb.append("系统名称不可为空;");
}
String storeName = (String) value.get(4);
if (StringUtils.isBlank(storeName)) {
sb.append("店铺名称不可为空;");
} else if (storeList.contains(storeName)) {
sb.append("店铺名称已存在;");
String qinceStoreCode = (String) value.get(4);
String storeName = (String) value.get(5);
if (StringUtils.isBlank(qinceStoreCode)) {
sb.append("勤策店铺编码不可为空;");
if (StringUtils.isBlank(storeName)) {
sb.append("店铺名称不可为空;");
}
} else {
storeList.add(storeName);
// 验证店铺code是否存在
StoreWrapper storeWrap = new StoreWrapper()
.setStoreCode(qinceStoreCode);
QinCeClienteleStoreDto oneStore = qinCeClienteleStoreDao.getOneStore(storeWrap);
if (ObjectUtil.isEmpty(oneStore)) {
sb.append("勤策店铺编码不正确;");
} else {
if (StringUtils.isBlank(storeName)) {
sb.append("勤策店铺名称不可为空;");
} else if (!storeName.equals(oneStore.getStoreName())) {
sb.append("勤策店铺编码/名称不正确;");
}
String dealersName = oneStore.getDealersName();
String dealerId = ((String) value.get(2)).trim();
if (!dealers.containsKey(dealerId) || !dealers.get(dealerId).equals(dealersName)) {
sb.append("店铺不归属此经销商;");
}
}
}
String pattern = (String) value.get(5);
String pattern = (String) value.get(6);
if (StringUtils.isBlank(pattern)) {
sb.append("活动模式不可为空;");
}else if (!patterns.contains(pattern)){
} else if (!patterns.contains(pattern)) {
patternY = true;
}
if (sb.length() > 0) {
msg.append("第").append(rowNo).append("行:").append(sb);
}
// entry.setValue(value);
}
if (patternY){
if (patternY) {
msg.append("活动模式列仅限:").append(patterns).append("(需区分大小写)");
}
if (msg.length() > 0) {
......@@ -348,9 +424,4 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
}
}
......@@ -67,7 +67,8 @@ public class TemporaryActivityClockCoreServiceImpl implements TemporaryActivityC
.setChargerName(employeeDto.getName())
.setActivityPatternId(planInfoDto.getActivityPatternId())
.setActivityPattern(planInfoDto.getActivityPattern())
.setDealerName(planInfoDto.getDealerName());
.setDealerName(planInfoDto.getDealerName())
.setQinceStoreCode(planInfoDto.getQinceStoreCode());
temporaryActivityClockDao.save(dto);
} else {
temporaryActivityClockDao.updateById(dto);
......
......@@ -13,6 +13,7 @@ import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryMarketCellWra
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityMarketCellDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityPhotoDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import lombok.extern.slf4j.Slf4j;
......@@ -67,7 +68,7 @@ public class TemporaryActivityQueryServiceImpl implements TemporaryActivityQuery
@Override
public TemporaryActivityReportedDto findTemporaryActivityById(Long activityId) {
TemporaryActivityReportedDto dto = temporaryActivityReportedDao.findOneById(activityId);
findActivityReportedPhoto(dto);
findActivityReportedPhotoInfo(dto);
return dto;
}
......@@ -98,4 +99,17 @@ public class TemporaryActivityQueryServiceImpl implements TemporaryActivityQuery
dto.setPsvPhotoUrls(reportedGroup.get(ActivityPhotoType.POS_SELL_VOUCHER.getType()));
}
}
private void findActivityReportedPhotoInfo(TemporaryActivityReportedDto dto) {
if (Objects.isNull(dto)) {
return;
}
Map<Integer, List<TemporaryActivityPhotoDto>> reportedGroup = temporaryActivityPhotoDao.findReportedInfoGroup(dto.getTemporaryId(), dto.getId());
if (!CollectionUtils.isEmpty(reportedGroup)) {
dto.setTgscPhotoInfos(reportedGroup.get(ActivityPhotoType.TGSC.getType()));
dto.setTghdPhotoInfos(reportedGroup.get(ActivityPhotoType.TGHD.getType()));
dto.setTgcjPhotoInfos(reportedGroup.get(ActivityPhotoType.TGCJ.getType()));
dto.setPsvPhotoInfos(reportedGroup.get(ActivityPhotoType.POS_SELL_VOUCHER.getType()));
}
}
}
......@@ -38,12 +38,12 @@
<insert id="saveList">
insert into employee_activity_plan_info (activity_plan_record_id, excel_filed_id, employee_id, employee_name,
employee_no, city, dealer_id, dealer_name, line_name,
store_name, activity_pattern, activity_pattern_id)
store_name, activity_pattern, activity_pattern_id,qince_store_code)
values
<foreach collection="dos" item="item" separator=",">
(#{item.activityPlanRecordId},#{item.excelFiledId},#{item.employeeId},#{item.employeeName},
#{item.employeeNo},#{item.city},#{item.dealerId},#{item.dealerName},#{item.lineName},
#{item.storeName},#{item.activityPattern},#{item.activityPatternId})
#{item.storeName},#{item.activityPattern},#{item.activityPatternId},#{item.qinceStoreCode})
</foreach>
</insert>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论