提交 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));
}
}
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论