提交 4a0f8366 authored 作者: 李秋林's avatar 李秋林

促销员今日活动上报数据保存

上级 efc41076
...@@ -17,6 +17,7 @@ public interface TemporaryActivityPhotoDao { ...@@ -17,6 +17,7 @@ public interface TemporaryActivityPhotoDao {
* 保存活动上报照片list * 保存活动上报照片list
*/ */
void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls, List<String> changeUrls); void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls, List<String> changeUrls);
void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls);
/** /**
* 保存促销员上下班打卡图片 * 保存促销员上下班打卡图片
...@@ -37,4 +38,6 @@ public interface TemporaryActivityPhotoDao { ...@@ -37,4 +38,6 @@ public interface TemporaryActivityPhotoDao {
Map<Long, Map<Integer, String>> findClockPhotoGroupByClockIds(List<Long> clockIds); Map<Long, Map<Integer, String>> findClockPhotoGroupByClockIds(List<Long> clockIds);
Map<Integer, List<TemporaryActivityPhotoDto>> findReportedInfoGroup(Integer temporaryId, Long reportedId); Map<Integer, List<TemporaryActivityPhotoDto>> findReportedInfoGroup(Integer temporaryId, Long reportedId);
void deleteList(Long reportedId, int type);
} }
...@@ -63,6 +63,24 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao ...@@ -63,6 +63,24 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
} }
} }
@Override
public void saveReportedList(Integer temporaryId, Long reportedId, Integer photoType, List<String> urls) {
List<TemporaryActivityPhotoDO> dos = new ArrayList<>();
for (String url : urls) {
String[] uArr = url.split("/");
String uId = uArr[uArr.length - 1];
TemporaryActivityPhotoDO photoDo = new TemporaryActivityPhotoDO()
.setTemporaryId(temporaryId)
.setReportedId(reportedId)
.setType(photoType)
.setPhotoUrl(url)
.setPhotoFiledId(uId);
dos.add(photoDo);
}
temporaryActivityPhotoMapper.insertList(dos);
temporaryActivityPhotoMapper.updateListIsDelete(reportedId,photoType,dos);
}
/** /**
* 保存促销员上下班打卡图片 * 保存促销员上下班打卡图片
*/ */
...@@ -111,6 +129,11 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao ...@@ -111,6 +129,11 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
return groupPhoto; return groupPhoto;
} }
@Override
public void deleteList(Long reportedId, int type) {
temporaryActivityPhotoMapper.deletebyReportedId(reportedId,type);
}
/** /**
* 活动上报图片查询 * 活动上报图片查询
......
...@@ -3,8 +3,11 @@ package com.wangxiaolu.promotion.domain.activity.mapper; ...@@ -3,8 +3,11 @@ package com.wangxiaolu.promotion.domain.activity.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityPhotoDO; import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityPhotoDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @author a02200059 * @author a02200059
* @description 针对表【temporary_activity_photo】的数据库操作Mapper * @description 针对表【temporary_activity_photo】的数据库操作Mapper
...@@ -15,6 +18,12 @@ import org.springframework.stereotype.Repository; ...@@ -15,6 +18,12 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface TemporaryActivityPhotoMapper extends BaseMapper<TemporaryActivityPhotoDO> { public interface TemporaryActivityPhotoMapper extends BaseMapper<TemporaryActivityPhotoDO> {
void updateIsDelete(Long reportedId, String photoFiledId); void updateIsDelete(Long reportedId, String photoFiledId);
void insertList(@Param("dos") List<TemporaryActivityPhotoDO> dos);
void updateListIsDelete(@Param("reportedId") Long reportedId,@Param("photoType") Integer photoType,@Param("dos") List<TemporaryActivityPhotoDO> dos);
void deletebyReportedId(@Param("reportedId") Long reportedId,@Param("photoType") int type);
} }
......
...@@ -77,7 +77,7 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe ...@@ -77,7 +77,7 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
temActDto.setId(reportedId); temActDto.setId(reportedId);
// 保存图片 // 保存图片
saveActivityPhoto(temActDto); saveActivityPhotoV2(temActDto);
// 售卖单元新增保存 // 售卖单元新增保存
// String key = temMarketCellRedisKey(temActDto.getTemporaryId()); // String key = temMarketCellRedisKey(temActDto.getTemporaryId());
...@@ -96,7 +96,7 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe ...@@ -96,7 +96,7 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
@Override @Override
public void activityDataReportedUpdate(TemporaryActivityReportedDto temActDto) { public void activityDataReportedUpdate(TemporaryActivityReportedDto temActDto) {
// 图片增量保存 // 图片增量保存
saveActivityPhoto(temActDto); saveActivityPhotoV2(temActDto);
temporaryActivityReportedDao.updateById(temActDto); temporaryActivityReportedDao.updateById(temActDto);
// 售卖单元新增保存 // 售卖单元新增保存
...@@ -233,26 +233,54 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe ...@@ -233,26 +233,54 @@ public class TemporaryActivityCoreServiceImpl implements TemporaryActivityCoreSe
* *
* @param temActDto 活动提交数据 * @param temActDto 活动提交数据
*/ */
private void saveActivityPhoto(TemporaryActivityReportedDto temActDto) { private void saveActivityPhotoV2(TemporaryActivityReportedDto temActDto) {
Integer temporaryId = temActDto.getTemporaryId(); Integer temporaryId = temActDto.getTemporaryId();
Long reportedId = temActDto.getId(); Long reportedId = temActDto.getId();
// 推广试吃照片 // 推广试吃照片
if (!CollectionUtils.isEmpty(temActDto.getTgscPhotoUrls())) { if (CollectionUtils.isEmpty(temActDto.getTgscPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGSC.getType(), temActDto.getTgscPhotoUrls(), temActDto.getTgscChangePhotoUrls()); tempActivityPhotoDao.deleteList(reportedId,ActivityPhotoType.TGSC.getType());
}else {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGSC.getType(), temActDto.getTgscPhotoUrls());
} }
// 推广互动照片 // 推广互动照片
if (!CollectionUtils.isEmpty(temActDto.getTghdPhotoUrls())) { if (CollectionUtils.isEmpty(temActDto.getTghdPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGHD.getType(), temActDto.getTghdPhotoUrls(), temActDto.getTghdChangePhotoUrls()); tempActivityPhotoDao.deleteList(reportedId,ActivityPhotoType.TGHD.getType());
}else {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGHD.getType(), temActDto.getTghdPhotoUrls());
} }
// 推广成交照片 // 推广成交照片
if (!CollectionUtils.isEmpty(temActDto.getTgcjPhotoUrls())) { if (CollectionUtils.isEmpty(temActDto.getTgcjPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGCJ.getType(), temActDto.getTgcjPhotoUrls(), temActDto.getTgcjChangePhotoUrls()); tempActivityPhotoDao.deleteList(reportedId,ActivityPhotoType.TGCJ.getType());
}else {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGCJ.getType(), temActDto.getTgcjPhotoUrls());
} }
// POS机页面凭证 // POS机页面凭证
if (!CollectionUtils.isEmpty(temActDto.getPsvPhotoUrls())) { // if (!CollectionUtils.isEmpty(temActDto.getPsvPhotoUrls())) {
tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.POS_SELL_VOUCHER.getType(), temActDto.getPsvPhotoUrls(), temActDto.getPsvChangePhotoUrls()); // tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.POS_SELL_VOUCHER.getType(), temActDto.getPsvPhotoUrls());
} // }
} }
// private void saveActivityPhoto(TemporaryActivityReportedDto temActDto) {
// Integer temporaryId = temActDto.getTemporaryId();
// Long reportedId = temActDto.getId();
// // 推广试吃照片
// if (!CollectionUtils.isEmpty(temActDto.getTgscPhotoUrls())) {
// tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGSC.getType(), temActDto.getTgscPhotoUrls(), temActDto.getTgscChangePhotoUrls());
// }
//
// // 推广互动照片
// if (!CollectionUtils.isEmpty(temActDto.getTghdPhotoUrls())) {
// tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGHD.getType(), temActDto.getTghdPhotoUrls(), temActDto.getTghdChangePhotoUrls());
// }
//
// // 推广成交照片
// if (!CollectionUtils.isEmpty(temActDto.getTgcjPhotoUrls())) {
// tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.TGCJ.getType(), temActDto.getTgcjPhotoUrls(), temActDto.getTgcjChangePhotoUrls());
// }
// // POS机页面凭证
// if (!CollectionUtils.isEmpty(temActDto.getPsvPhotoUrls())) {
// tempActivityPhotoDao.saveReportedList(temporaryId, reportedId, ActivityPhotoType.POS_SELL_VOUCHER.getType(), temActDto.getPsvPhotoUrls(), temActDto.getPsvChangePhotoUrls());
// }
// }
} }
...@@ -26,4 +26,23 @@ ...@@ -26,4 +26,23 @@
and photo_filed_id = #{photoFiledId}; and photo_filed_id = #{photoFiledId};
</update> </update>
<insert id="insertList">
insert into temporary_activity_photo (temporary_id, reported_id, type, photo_url, photo_filed_id)
<foreach collection="dos" item="item" index="index" separator=" UNION ALL ">
SELECT #{item.temporaryId}, #{item.reportedId}, #{item.type}, #{item.photoUrl}, #{item.photoFiledId} FROM dual
WHERE NOT EXISTS( SELECT 1 FROM temporary_activity_photo WHERE reported_id = #{item.reportedId} AND type = #{item.type} AND photo_filed_id = #{item.photoFiledId} )
</foreach>
</insert>
<update id="updateListIsDelete">
update temporary_activity_photo set is_delete = 0 where reported_id = #{reportedId} and type = #{photoType} and photo_filed_id not in
<foreach collection="dos" item="item" index="index" open="(" separator="," close=")">
#{item.photoFiledId}
</foreach>
</update>
<update id="deletebyReportedId">
update temporary_activity_photo set is_delete = 0 where reported_id = #{reportedId} and type = #{photoType};
</update>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论