提交 a0aa06c4 authored 作者: lvbencai's avatar lvbencai

合并分支 'qa' 到 'master'

增加18:15任务和pos任务,增加导出多维表格三列 查看合并请求 !7
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.wangxiaolu</groupId> <groupId>com.wangxiaolu</groupId>
<artifactId>wangxiaolu-promotion-parent</artifactId> <artifactId>wangxiaolu-promotion-parent</artifactId>
<version>0.0.3</version> <version>0.0.4</version>
</parent> </parent>
<groupId>com.wangxiaolu</groupId> <groupId>com.wangxiaolu</groupId>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<dependency> <dependency>
<groupId>com.wangxiaolu</groupId> <groupId>com.wangxiaolu</groupId>
<artifactId>wangxiaolu-promotion-common</artifactId> <artifactId>wangxiaolu-promotion-common</artifactId>
<version>0.0.3</version> <version>0.0.4</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>spring-cloud-gateway-server</artifactId> <artifactId>spring-cloud-gateway-server</artifactId>
......
...@@ -9,12 +9,13 @@ import java.util.Date; ...@@ -9,12 +9,13 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* *
* @TableName temporary_activity_clock * @TableName temporary_activity_clock
*/ */
@TableName(value ="temporary_activity_clock") @TableName(value ="temporary_activity_clock")
@Data @Data
public class TemporaryActivityClockDO implements Serializable { public class TemporaryActivityClockDO implements Serializable {
private Long id;
private Long temporaryId; private Long temporaryId;
...@@ -67,4 +68,4 @@ public class TemporaryActivityClockDO implements Serializable { ...@@ -67,4 +68,4 @@ public class TemporaryActivityClockDO implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ import lombok.Data; ...@@ -8,7 +8,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* @TableName temporary_activity_reported * @TableName temporary_activity_reported
*/ */
@TableName(value ="temporary_activity_reported") @TableName(value ="temporary_activity_reported")
...@@ -18,7 +18,7 @@ public class TemporaryActivityReportedDO implements Serializable { ...@@ -18,7 +18,7 @@ public class TemporaryActivityReportedDO implements Serializable {
@TableId @TableId
private Long id; private Long id;
private Integer temporaryId; private Long temporaryId;
private String temporaryName; private String temporaryName;
...@@ -56,4 +56,4 @@ public class TemporaryActivityReportedDO implements Serializable { ...@@ -56,4 +56,4 @@ public class TemporaryActivityReportedDO implements Serializable {
* 活动品项:老品/黑鸭/散称 * 活动品项:老品/黑鸭/散称
*/ */
private String prdClass; private String prdClass;
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.wangxiaolu.export.service.impl; ...@@ -3,6 +3,7 @@ package com.wangxiaolu.export.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.export.mapper.FeishuSheetRecordMapper; import com.wangxiaolu.export.mapper.FeishuSheetRecordMapper;
import com.wangxiaolu.export.mapper.entity.FeishuSheetRecordDO; import com.wangxiaolu.export.mapper.entity.FeishuSheetRecordDO;
...@@ -20,7 +21,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -20,7 +21,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.swing.*;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -76,6 +76,7 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -76,6 +76,7 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
List<TemporaryActivityPhotoDO> activityClock = clockPhotoMap.containsKey(clockKey) ? clockPhotoMap.get(clockKey) : new ArrayList<>(); List<TemporaryActivityPhotoDO> activityClock = clockPhotoMap.containsKey(clockKey) ? clockPhotoMap.get(clockKey) : new ArrayList<>();
activityDataToSheetRow(rdo, temporaryActivityPhotoDOS, activityClock,clockDo); activityDataToSheetRow(rdo, temporaryActivityPhotoDOS, activityClock,clockDo);
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString(),e);
log.error("上传标号{}报错,跳过此次上传,上传数据:{}", index,JSONObject.toJSONString(rdo)); log.error("上传标号{}报错,跳过此次上传,上传数据:{}", index,JSONObject.toJSONString(rdo));
} }
...@@ -89,9 +90,9 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -89,9 +90,9 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
* *
* @param rdo 活动数据 * @param rdo 活动数据
* @param temporaryActivityPhotoDOS 活动中涉及到的照片(推广、POS) * @param temporaryActivityPhotoDOS 活动中涉及到的照片(推广、POS)
* @param activityClock(打卡照片) * @param activityPhotoDOS(打卡照片)
*/ */
private void activityDataToSheetRow(TemporaryActivityReportedDO rdo, List<TemporaryActivityPhotoDO> temporaryActivityPhotoDOS, List<TemporaryActivityPhotoDO> activityClock,TemporaryActivityClockDO clockDo) throws Exception { private void activityDataToSheetRow(TemporaryActivityReportedDO rdo, List<TemporaryActivityPhotoDO> temporaryActivityPhotoDOS, List<TemporaryActivityPhotoDO> activityPhotoDOS,TemporaryActivityClockDO clockDo) throws Exception {
List<Object> row = new ArrayList<>(); List<Object> row = new ArrayList<>();
// 证明标识(请忽略),一定要在开头第一个单元格有数据,才能保证之后的数据即使缺失也不会串行 // 证明标识(请忽略),一定要在开头第一个单元格有数据,才能保证之后的数据即使缺失也不会串行
// A-C:证明标识(请忽略) 问题标识(请忽略) 促销员姓名 // A-C:证明标识(请忽略) 问题标识(请忽略) 促销员姓名
...@@ -237,9 +238,12 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -237,9 +238,12 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
/** /**
* 打卡照片 * 打卡照片
* 打卡类型小于9 的 类型大于等于4的 照片
* 打卡类型大于等于9 的 单独筛选出处理
*/ */
Map<Integer, String> clockMap = activityPhotoDOS.stream()
Map<Integer, String> clockMap = activityClock.stream().collect(Collectors.toMap(TemporaryActivityPhotoDO::getType, TemporaryActivityPhotoDO::getPhotoUrl)); .filter(photo -> photo.getType() < 9 && photo.getType() >= 4)
.collect(Collectors.toMap(TemporaryActivityPhotoDO::getType, TemporaryActivityPhotoDO::getPhotoUrl));
// 上班打卡照片 >>> // 上班打卡照片 >>>
if (clockMap.containsKey(4)) { if (clockMap.containsKey(4)) {
valuesImageToSheet(String.format(rangFormat, "X", "X"), clockMap.get(4)); valuesImageToSheet(String.format(rangFormat, "X", "X"), clockMap.get(4));
...@@ -259,6 +263,8 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -259,6 +263,8 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
if (clockMap.containsKey(7)) { if (clockMap.containsKey(7)) {
valuesImageToSheetByRobot2(String.format(rangFormat, "AA", "AA"), clockMap.get(7)); valuesImageToSheetByRobot2(String.format(rangFormat, "AA", "AA"), clockMap.get(7));
} }
log.info("上传打卡照片完成,行号:{}", rowNumStr); log.info("上传打卡照片完成,行号:{}", rowNumStr);
/** /**
...@@ -292,6 +298,8 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -292,6 +298,8 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
} }
log.info("上传推广-试吃照片完成,行号:{}", rowNumStr); log.info("上传推广-试吃照片完成,行号:{}", rowNumStr);
/** /**
* 推广互动照片 * 推广互动照片
*/ */
...@@ -351,8 +359,30 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -351,8 +359,30 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
pct.append("、成交4:"+DateUtil.formatDateTime(photosType3.get(3).getCreateTime())); pct.append("、成交4:"+DateUtil.formatDateTime(photosType3.get(3).getCreateTime()));
} }
Map<Integer, List<TemporaryActivityPhotoDO>> taskMap = activityPhotoDOS.stream()
.filter(photo -> photo.getType() >= 9)
.collect(Collectors.groupingBy(TemporaryActivityPhotoDO::getType ));
// pos任务照片
List<TemporaryActivityPhotoDO> posTaskPhotos = taskMap.get(9);
if (ObjectUtil.isNotEmpty(posTaskPhotos) && posTaskPhotos.size() >0 && ObjectUtil.isNotEmpty(posTaskPhotos.get(0))) {
valuesImageToSheetByRobot2(String.format(rangFormat, "AO", "AO"), posTaskPhotos.get(0).getPhotoUrl());
pct.append("、pos任务1:"+DateUtil.formatDateTime(posTaskPhotos.get(0).getCreateTime()));
}
if (ObjectUtil.isNotEmpty(posTaskPhotos) && posTaskPhotos.size() >1 && ObjectUtil.isNotEmpty(posTaskPhotos.get(1))) {
valuesImageToSheetByRobot2(String.format(rangFormat, "AP", "AP"), posTaskPhotos.get(1).getPhotoUrl());
pct.append("、pos任务2:"+DateUtil.formatDateTime(posTaskPhotos.get(1).getCreateTime()));
}
// 随机任务照片
List<TemporaryActivityPhotoDO> randTaskPhotos = taskMap.get(10);
if (ObjectUtil.isNotEmpty(randTaskPhotos) && randTaskPhotos.size() > 0 && ObjectUtil.isNotEmpty(randTaskPhotos.get(0))) {
valuesImageToSheetByRobot2(String.format(rangFormat, "AN", "AN"), randTaskPhotos.get(0).getPhotoUrl());
pct.append("、随机任务:"+DateUtil.formatDateTime(randTaskPhotos.get(0).getCreateTime()));
}
// 推广类照片上传时间 // 推广类照片上传时间
String range =String.format(rangFormat, "AN", "AN"); String range =String.format(rangFormat, "AQ", "AQ");
updateClockData(range,Arrays.asList(pct.toString())); updateClockData(range,Arrays.asList(pct.toString()));
log.info("上传推广-成交照片完成,行号:{}", rowNumStr); log.info("上传推广-成交照片完成,行号:{}", rowNumStr);
......
...@@ -119,7 +119,7 @@ public class FeishuSheetUtils { ...@@ -119,7 +119,7 @@ public class FeishuSheetUtils {
JSONObject resultJson = JSONObject.parseObject(result); JSONObject resultJson = JSONObject.parseObject(result);
int code = resultJson.getInteger("code"); int code = resultJson.getInteger("code");
if (code != 0) { if (code != 0) {
log.error("图片上传错误,上传表格位置:{},报错详情:\n{}", range, result); log.error("图片{}上传错误,上传表格位置:{},报错详情:\n{}",imageUrl, range, result);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("图片转换/上传异常,上传表格位置:{}", range); log.error("图片转换/上传异常,上传表格位置:{}", range);
......
...@@ -7,16 +7,16 @@ spring: ...@@ -7,16 +7,16 @@ spring:
username: root username: root
password: Zt%68Dsuv&M password: Zt%68Dsuv&M
redis: redis:
port: 21101 port: 6379
host: bj-crs-oyzhz3c6.sql.tencentcdb.com host: 192.168.100.40
database: 0 database: 0
password: u)R3jrHk(qwt~mv$Tg=U password: QjL6H5nH
cloud: cloud:
nacos: nacos:
discovery: discovery:
server-addr: 42.193.103.153:8848 server-addr: 192.168.100.38:8848
namespace: dd681f3c-0d21-42e5-a96e-14863a7cdcdb namespace: 68c8d97c-715a-4983-99b7-9df9b99f89e7
group: promotion group: promotion
logging: logging:
...@@ -53,11 +53,12 @@ xxl: ...@@ -53,11 +53,12 @@ xxl:
job: job:
accessToken: default_token accessToken: default_token
admin: admin:
addresses: http://42.193.103.153:9001/xxl-job-admin addresses: http://192.168.100.38:9000/xxl-job-admin
executor: executor:
appname: export-dev appname: export-dev
port: 9989 port: 9989
logretentiondays: 30 logretentiondays: 30
address: address:
ip: ip:
logpath: /var/logs/xxl_job # 执行器日志路径 logpath: /var/logs/xxl_job # 执行器日志路径
\ No newline at end of file # logpath: ./logs/xxl_job # 执行器日志路径
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://bj-cdb-j8ppdy86.sql.tencentcdb.com:63569/promotion_dev?autoReconnect=true
url: jdbc:mysql://192.168.100.39:25301/promotion_dev?autoReconnect=true
username: root
password: Zt%68Dsuv&M
redis:
port: 6379
host: 192.168.100.40
database: 0
password: QjL6H5nH
cloud:
nacos:
discovery:
server-addr: 192.168.100.38:8848
namespace: 68c8d97c-715a-4983-99b7-9df9b99f89e7
group: promotion
logging:
config: classpath:logback-spring.xml
# mybatis-plus 控制台打印sql日志
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
wx:
miniapp:
configs:
- appid:
secret:
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat:
temporary:
token_secret:
employee:
token_secret:
feishu:
activity_robot_1:
app_id: cli_a622204c69e8100b
app_secret: qzezaWe7Kxd61quiU9zRIf7COb4piEkF
activity_robot_2:
app_id: cli_a6220d5dcadf900b
app_secret: WeVaZ6yGXFEON6Lkl53rFdhHc8beQF1Y
# xxl-job配置
xxl:
job:
accessToken: default_token
admin:
addresses: http://192.168.100.38:9000/xxl-job-admin
executor:
appname: export-qa
port: 9989
logretentiondays: 30
address:
ip: 192.168.100.55
logpath: /var/logs/xxl_job # 执行器日志路径
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<mapper namespace="com.wangxiaolu.export.mapper.TemporaryActivityClockMapper"> <mapper namespace="com.wangxiaolu.export.mapper.TemporaryActivityClockMapper">
<resultMap id="clockMap" type="com.wangxiaolu.export.mapper.entity.TemporaryActivityClockDO"> <resultMap id="clockMap" type="com.wangxiaolu.export.mapper.entity.TemporaryActivityClockDO">
<result property="clockId" column="id" jdbcType="BIGINT"/>
<result property="temporaryId" column="temporary_id" jdbcType="BIGINT"/> <result property="temporaryId" column="temporary_id" jdbcType="BIGINT"/>
<result property="createDate" column="create_date" jdbcType="VARCHAR"/> <result property="createDate" column="create_date" jdbcType="VARCHAR"/>
<collection property="photoList" ofType="com.wangxiaolu.export.mapper.entity.TemporaryActivityPhotoDO"> <collection property="photoList" ofType="com.wangxiaolu.export.mapper.entity.TemporaryActivityPhotoDO">
...@@ -32,12 +33,11 @@ ...@@ -32,12 +33,11 @@
</resultMap> </resultMap>
<select id="findClockPhotoList" resultMap="clockMap"> <select id="findClockPhotoList" resultMap="clockMap">
select ar.temporary_id temporary_id, select ar.temporary_id temporary_id,
ar.create_date create_date, ar.create_date create_date,
ap.type type, ap.type type,
ap.photo_url photo_url ap.photo_url photo_url
from temporary_activity_reported ar from temporary_activity_reported ar
inner join temporary_activity_clock ac inner join temporary_activity_clock ac
on ar.temporary_id = ac.temporary_id and ar.create_date = ac.create_date on ar.temporary_id = ac.temporary_id and ar.create_date = ac.create_date
...@@ -48,71 +48,72 @@ ...@@ -48,71 +48,72 @@
<select id="findClockPhotoListByCreateDate" resultMap="clockMap"> <select id="findClockPhotoListByCreateDate" resultMap="clockMap">
select select ar.temporary_id temporary_id,
ar.temporary_id temporary_id, ar.create_date create_date,
ar.create_date create_date, ap.type type,
ap.type type, ap.photo_url photo_url,
ap.photo_url photo_url, ap.create_time create_time
ap.create_time create_time from temporary_activity_reported ar
from inner join temporary_activity_clock ac on ar.temporary_id = ac.temporary_id
temporary_activity_reported ar and ar.create_date = ac.create_date
inner join temporary_activity_clock ac on ar.temporary_id = ac.temporary_id inner join temporary_activity_photo ap on ac.id = ap.clock_id
and ar.create_date = ac.create_date where ar.create_time BETWEEN '${dateStr} 00:00:00' and '${dateStr} 23:59:00'
inner join temporary_activity_photo ap on ac.id = ap.clock_id and ap.is_delete = 1;
where
ar.create_time BETWEEN '${dateStr} 00:00:00' and '${dateStr} 23:59:00' and ap.is_delete = 1;
</select> </select>
<!-- <select id="findClockPhotoListByCreateDate" resultMap="clockMap">--> <!-- <select id="findClockPhotoListByCreateDate" resultMap="clockMap">-->
<!-- select ar.temporary_id temporary_id,--> <!-- select ar.temporary_id temporary_id,-->
<!-- ar.create_date create_date,--> <!-- ar.create_date create_date,-->
<!-- ap.type type,--> <!-- ap.type type,-->
<!-- ap.photo_url photo_url--> <!-- ap.photo_url photo_url-->
<!-- from temporary_activity_reported ar--> <!-- from temporary_activity_reported ar-->
<!-- inner join temporary_activity_clock ac--> <!-- inner join temporary_activity_clock ac-->
<!-- on ar.temporary_id = ac.temporary_id and ar.create_date = ac.create_date--> <!-- on ar.temporary_id = ac.temporary_id and ar.create_date = ac.create_date-->
<!-- inner join temporary_activity_photo ap on ac.id = ap.clock_id--> <!-- inner join temporary_activity_photo ap on ac.id = ap.clock_id-->
<!-- where ar.create_date LIKE '2024-10-%' and ap.is_delete = 1;--> <!-- where ar.create_date LIKE '2024-10-%' and ap.is_delete = 1;-->
<!-- </select>--> <!-- </select>-->
<select id="findClockListByActivityIds" resultMap="clockInfoMap"> <select id="findClockListByActivityIds" resultMap="clockInfoMap">
SELECT SELECT
reported_id, reported_id,
qince_store_code, qince_store_code,
clock_in_time, clock_in_time,
clock_in_address, clock_in_address,
noon_clock_out_time, noon_clock_out_time,
noon_clock_out_address, noon_clock_out_address,
noon_clock_in_time, noon_clock_in_time,
noon_clock_in_address, noon_clock_in_address,
clock_out_time, clock_out_time,
clock_out_address clock_out_address
FROM FROM
temporary_activity_clock tac temporary_activity_clock tac
WHERE WHERE
reported_id in
reported_id in
<foreach collection="activityIds" item="activityId" open="(" close=")" separator=","> <foreach collection="activityIds" item="activityId" open="(" close=")" separator=",">
#{activityId} #{activityId}
</foreach> </foreach>
</select> </select>
<select id="findClockPhotoByActivityIds" resultMap="clockMap"> <select id="findClockPhotoByActivityIds" resultMap="clockMap">
select select
ar.temporary_id temporary_id, ar.temporary_id temporary_id,
ar.create_date create_date, ac.id as clockId ,
ap.type type, ar.create_date create_date,
ap.photo_url photo_url ap.type type,
ap.create_time ,
ap.photo_url
from from
temporary_activity_reported ar temporary_activity_reported ar
inner join temporary_activity_clock ac on ar.temporary_id = ac.temporary_id inner join temporary_activity_clock ac on ar.temporary_id = ac.temporary_id
and ar.create_date = ac.create_date and ar.create_date = ac.create_date
inner join temporary_activity_photo ap on ac.id = ap.clock_id inner join temporary_activity_photo ap on ac.id = ap.clock_id
where where
ar.id in ap.is_delete = 1 and
ar.id in
<foreach collection="activityIds" item="activityId" open="(" close=")" separator=","> <foreach collection="activityIds" item="activityId" open="(" close=")" separator=",">
#{activityId} #{activityId}
</foreach> </foreach>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</resultMap> </resultMap>
<select id="findActivityPhotos" resultMap="BaseResultMap"> <select id="findActivityPhotos" resultMap="BaseResultMap">
select reported_id, type, photo_url,create_time select reported_id, type, photo_url ,create_time
from temporary_activity_photo from temporary_activity_photo
where is_delete = 1 where is_delete = 1
and reported_id in and reported_id in
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论