Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
637fb6c0
提交
637fb6c0
authored
2月 07, 2025
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
活动计划新增并返回解析数据、活动计划提交、阿里云oss获取token
上级
372bb68b
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
87 行增加
和
44 行删除
+87
-44
PromPlanCoreController.java
...ion/controller/activityplanv2/PromPlanCoreController.java
+1
-1
ActivityPlanInfoDao.java
...motion/domain/activityplanv2/dao/ActivityPlanInfoDao.java
+5
-0
ActivityPlanInfoDaoImpl.java
...main/activityplanv2/dao/impl/ActivityPlanInfoDaoImpl.java
+9
-0
ActivityPlanInfoMapper.java
.../domain/activityplanv2/mapper/ActivityPlanInfoMapper.java
+4
-0
ActivityPlanInfoDo.java
...main/activityplanv2/mapper/entity/ActivityPlanInfoDo.java
+0
-5
ActivityPlanInfoDto.java
...omotion/pojo/activity/manage/dto/ActivityPlanInfoDto.java
+2
-0
PromPlanCoreServiceImpl.java
.../service/activityplanv2/impl/PromPlanCoreServiceImpl.java
+50
-33
ActivityPlanInfoMapper.xml
...esources/mapper/activityplanv2/ActivityPlanInfoMapper.xml
+16
-5
没有找到文件。
src/main/java/com/wangxiaolu/promotion/controller/activityplanv2/PromPlanCoreController.java
浏览文件 @
637fb6c0
...
...
@@ -47,7 +47,7 @@ public class PromPlanCoreController {
//todo String filePath = "/home/" + fileId;
// FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
String
filePath
=
"/Users/a02200059/Desktop/测试新增v3.xlsx"
;
String
filePath
=
"/Users/a02200059/Desktop/测试新增v3
2
.xlsx"
;
activityPlanVo
.
setExcelId
(
fileId
);
Map
<
String
,
Object
>
map
=
promPlanCoreService
.
selfPlanUp
(
activityPlanVo
,
filePath
);
return
R
.
success
(
map
);
...
...
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/dao/ActivityPlanInfoDao.java
浏览文件 @
637fb6c0
...
...
@@ -3,6 +3,9 @@ package com.wangxiaolu.promotion.domain.activityplanv2.dao;
import
com.alibaba.fastjson.JSONArray
;
import
com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper
;
import
com.wangxiaolu.promotion.pojo.PageInfo
;
import
com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanInfoDto
;
import
java.util.Date
;
/**
* @author : liqiulin
...
...
@@ -13,4 +16,6 @@ public interface ActivityPlanInfoDao {
void
saveList
(
JSONArray
table
,
Long
recordId
);
void
page
(
PageInfo
pageInfo
,
ActivityPlanInfoWrapper
wrapper
);
ActivityPlanInfoDto
selectPlan
(
String
storeCode
,
Date
date
);
}
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/dao/impl/ActivityPlanInfoDaoImpl.java
浏览文件 @
637fb6c0
...
...
@@ -4,18 +4,22 @@ import com.alibaba.fastjson.JSONArray;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.wangxiaolu.promotion.common.enums.StatusType
;
import
com.wangxiaolu.promotion.common.util.BeanUtils
;
import
com.wangxiaolu.promotion.common.util.DataUtils
;
import
com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao
;
import
com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanInfoMapper
;
import
com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo
;
import
com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper
;
import
com.wangxiaolu.promotion.exception.DataException
;
import
com.wangxiaolu.promotion.pojo.PageInfo
;
import
com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanInfoDto
;
import
com.wangxiaolu.promotion.result.basedata.RCode
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.exceptions.PersistenceException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Objects
;
/**
...
...
@@ -48,6 +52,11 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
pageInfo
.
setRecords
(
doPage
.
getRecords
());
}
@Override
public
ActivityPlanInfoDto
selectPlan
(
String
storeCode
,
Date
date
)
{
ActivityPlanInfoDo
activityPlanInfoDo
=
activityPlanInfoMapper
.
selectPlan
(
storeCode
,
date
);
return
BeanUtils
.
transitionDto
(
activityPlanInfoDo
,
ActivityPlanInfoDto
.
class
);
}
private
LambdaQueryWrapper
<
ActivityPlanInfoDo
>
buildWrapper
(
ActivityPlanInfoWrapper
wrapper
)
{
...
...
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/mapper/ActivityPlanInfoMapper.java
浏览文件 @
637fb6c0
...
...
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
/**
* @author a02200059
* @description 针对表【activity_plan_info(活动计划列表)】的数据库操作Mapper
...
...
@@ -18,6 +20,8 @@ import org.springframework.stereotype.Repository;
public
interface
ActivityPlanInfoMapper
extends
BaseMapper
<
ActivityPlanInfoDo
>
{
void
saveList
(
@Param
(
"table"
)
JSONArray
table
,
@Param
(
"recordId"
)
Long
recordId
);
ActivityPlanInfoDo
selectPlan
(
String
storeCode
,
Date
date
);
}
...
...
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/mapper/entity/ActivityPlanInfoDo.java
浏览文件 @
637fb6c0
...
...
@@ -122,11 +122,6 @@ public class ActivityPlanInfoDo implements Serializable {
*/
private
String
area
;
/**
* 门店所属行政区域-乡镇街道名称,如:宁海路街道
*/
private
String
street
;
/**
* 门店所在地址
*/
...
...
src/main/java/com/wangxiaolu/promotion/pojo/activity/manage/dto/ActivityPlanInfoDto.java
浏览文件 @
637fb6c0
...
...
@@ -157,6 +157,8 @@ public class ActivityPlanInfoDto implements Serializable {
private
Integer
index
;
private
Date
createTime
;
/**
* 当前行错误,不可保存
* 错误信息
...
...
src/main/java/com/wangxiaolu/promotion/service/activityplanv2/impl/PromPlanCoreServiceImpl.java
浏览文件 @
637fb6c0
...
...
@@ -71,11 +71,14 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
selfPlanAf
(
String
planUuid
)
{
JSONObject
mapJson
=
redisCache
.
getToJson
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()
+
planUuid
);
public
synchronized
void
selfPlanAf
(
String
planUuid
)
{
String
key
=
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()
+
planUuid
;
JSONObject
mapJson
=
redisCache
.
getToJson
(
key
);
if
(
Objects
.
isNull
(
mapJson
)){
throw
new
DataException
(
RCode
.
REDIS_PUSH_DATA_NOT_EXIT
);
}
redisCache
.
removeKey
(
key
);
JSONObject
record
=
mapJson
.
getJSONObject
(
"record"
);
JSONArray
table
=
mapJson
.
getJSONArray
(
"table"
);
...
...
@@ -84,6 +87,12 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
activityPlanInfoDao
.
saveList
(
table
,
recordId
);
}
/**
* 解析excel文件中的计划
* @param planVo 请求信息(包含人员信息)
* @param filePath 文件地址
* @throws DataException 数据异常
*/
private
Map
<
String
,
Object
>
readSheetByCSJLUp
(
ActivityPlanVo
planVo
,
String
filePath
)
throws
DataException
{
ReadExcelUtils
readExcelUtils
=
new
ReadExcelUtils
(
filePath
);
String
[]
headers
=
readExcelUtils
.
readTitle
();
...
...
@@ -112,7 +121,8 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
Map
<
String
,
Object
>
rMap
=
new
HashMap
<>();
rMap
.
put
(
"uuid"
,
UUID
.
randomUUID
().
toString
());
List
<
ActivityPlanInfoDto
>
rDtos
=
new
ArrayList
<>(
rows
.
size
()
*
2
);
List
<
ActivityPlanInfoDto
>
rDtos
=
new
ArrayList
<>(
rows
.
size
()
*
4
);
for
(
Map
.
Entry
<
Integer
,
List
<
Object
>>
row
:
rows
.
entrySet
())
{
List
<
ActivityPlanInfoDto
>
infoDtos
=
getRowByCSJLUp
(
planVo
,
row
.
getValue
(),
rMap
);
rDtos
.
addAll
(
infoDtos
);
...
...
@@ -123,12 +133,14 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
/**
* 城市经理上传的计划工号只能是自己
*
* @param row 表中的每一行数据
* @return
*/
private
List
<
ActivityPlanInfoDto
>
getRowByCSJLUp
(
ActivityPlanVo
planVo
,
List
<
Object
>
row
,
Map
<
String
,
Object
>
rMap
)
{
List
<
ActivityPlanInfoDto
>
dtos
=
new
ArrayList
<>();
LocalDate
now
=
LocalDate
.
now
();
int
nextMonthValue
=
now
.
plusMonths
(
1
).
getMonthValue
();
/**
* 5:多日期
*/
...
...
@@ -150,6 +162,8 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto
.
setEmployeeId
(
planVo
.
getEmployeeId
());
dto
.
setEmployeeNo
(
planVo
.
getEmployeeNo
());
dto
.
setEmployeeName
(
planVo
.
getEmployeeName
());
dto
.
setOrgQcId
(
planVo
.
getDeptQcId
());
dto
.
setOrgName
(
planVo
.
getDeptQcName
());
}
/**
...
...
@@ -161,7 +175,9 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
if
(
ObjectUtil
.
isEmpty
(
storeDto
))
{
dto
.
setErrorMsg
(
"门店编码错误;"
);
}
else
{
// todo 门店一定有系统名称?
if
(
StringUtils
.
isAnyBlank
(
storeDto
.
getLineName
(),
storeDto
.
getDealersName
(),
storeDto
.
getDealerId
()))
{
dto
.
setErrorMsg
(
"门店系统名称或经销商为空,请到勤策中进充;"
);
}
dto
.
setLineName
(
storeDto
.
getLineName
());
dto
.
setStoreCode
(
sc
);
dto
.
setStoreName
(
storeDto
.
getStoreName
());
...
...
@@ -183,39 +199,34 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto
.
setErrorMsg
(
"活动模式分为:单点CP、常规MINI秀、校园活动;"
);
}
/**
* 4:月份
* 年份 todo 以后判断是否跨年
*/
int
year
=
DateUtil
.
thisYear
();
Month
month
=
Month
.
of
(
Integer
.
parseInt
(
row
.
get
(
4
).
toString
()));
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
dto
.
setYear
(
year
).
setMonth
(
planDate
.
getMonthValue
()).
setDate
(
DateUtils
.
parseDateBylocalDate
(
planDate
));
if
(
planDate
.
isBefore
(
LocalDate
.
now
()))
{
dto
.
setErrorMsg
(
"不能是过去日期;"
);
}
/**
* 6:促销员上班时间
*/
LocalTime
inLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
6
).
toString
());
/**
* 4:月份 新增逻辑只支持次月计划;
* 6:促销员上班时间 当月份错误,促销员上下班时间也不进行计算
* 7:促销员下班时间
* 年份:当月份为1时,判定为跨年
*/
LocalTime
outLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
7
).
toString
());
if
(
ObjectUtils
.
anyNull
(
inLocalTime
,
outLocalTime
))
{
dto
.
setErrorMsg
(
"上下班时间必填;"
);
int
year
=
DateUtil
.
thisYear
();
int
monthInt
=
Integer
.
parseInt
(
row
.
get
(
4
).
toString
());
Month
month
=
Month
.
of
(
monthInt
);
if
(
month
.
equals
(
Month
.
JANUARY
))
{
year
+=
1
;
}
if
(
ObjectUtils
.
allNotNull
(
inLocalTime
,
outLocalTime
)
&&
inLocalTime
.
isAfter
(
outLocalTime
)
)
{
dto
.
setErrorMsg
(
"
下班时间需晚于上班时间
;"
);
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
if
(
monthInt
!=
nextMonthValue
)
{
dto
.
setErrorMsg
(
"
月份必需是下个月
;"
);
}
else
{
dto
.
setClockInTime
(
LocalDateTime
.
of
(
planDate
,
inLocalTime
));
dto
.
setClockOutTime
(
LocalDateTime
.
of
(
planDate
,
outLocalTime
));
dto
.
setYear
(
year
).
setMonth
(
planDate
.
getMonthValue
()).
setDate
(
DateUtils
.
parseDateBylocalDate
(
planDate
));
LocalTime
inLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
6
).
toString
());
LocalTime
outLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
7
).
toString
());
if
(
ObjectUtils
.
anyNull
(
inLocalTime
,
outLocalTime
))
{
dto
.
setErrorMsg
(
"上下班时间必填;"
);
}
if
(
ObjectUtils
.
allNotNull
(
inLocalTime
,
outLocalTime
)
&&
inLocalTime
.
isAfter
(
outLocalTime
))
{
dto
.
setErrorMsg
(
"下班时间需晚于上班时间;"
);
}
else
{
dto
.
setClockInTime
(
LocalDateTime
.
of
(
planDate
,
inLocalTime
));
dto
.
setClockOutTime
(
LocalDateTime
.
of
(
planDate
,
outLocalTime
));
}
}
// 8:工资
...
...
@@ -223,6 +234,12 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
// 9:杂费
dto
.
setIncidentals
(
new
BigDecimal
(
row
.
get
(
9
).
toString
()));
// 判断计划是否已存在
ActivityPlanInfoDto
hasDto
=
activityPlanInfoDao
.
selectPlan
(
dto
.
getStoreCode
(),
dto
.
getDate
());
if
(
Objects
.
nonNull
(
hasDto
))
{
dto
.
setErrorMsg
(
"此计划已存在,创建人:"
+
hasDto
.
getEmployeeName
()
+
",创建时间:"
+
DateUtil
.
formatDate
(
hasDto
.
getCreateTime
())
+
";"
);
}
}
catch
(
DateTimeException
e
)
{
dto
.
setErrorMsg
(
"月份、日期、时间需要调整;"
);
}
...
...
src/main/resources/mapper/activityplanv2/ActivityPlanInfoMapper.xml
浏览文件 @
637fb6c0
...
...
@@ -26,7 +26,6 @@
<result
property=
"province"
column=
"province"
jdbcType=
"VARCHAR"
/>
<result
property=
"city"
column=
"city"
jdbcType=
"VARCHAR"
/>
<result
property=
"area"
column=
"area"
jdbcType=
"VARCHAR"
/>
<result
property=
"street"
column=
"street"
jdbcType=
"VARCHAR"
/>
<result
property=
"addr"
column=
"addr"
jdbcType=
"VARCHAR"
/>
<result
property=
"planStatus"
column=
"plan_status"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
...
...
@@ -34,6 +33,13 @@
<result
property=
"isDelete"
column=
"is_delete"
jdbcType=
"INTEGER"
/>
</resultMap>
<resultMap
id=
"PlanBase"
type=
"com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo"
>
<id
property=
"id"
column=
"id"
jdbcType=
"BIGINT"
/>
<result
property=
"employeeName"
column=
"employee_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,plan_file_id,employee_id,
employee_name,employee_no,year,
...
...
@@ -48,17 +54,22 @@
<insert
id=
"saveList"
>
INSERT INTO activity_plan_info
(plan_file_id,employee_id,employee_name,employee_no,year,month,date,line_name,store_name,store_code,org_qc_id,org_name,pattern_id,pattern,dealer_id,dealer_name,both_t,province,city,area,
street,
addr,clock_in_time,clock_out_time,salary,incidentals)
(plan_file_id,employee_id,employee_name,employee_no,year,month,date,line_name,store_name,store_code,org_qc_id,org_name,pattern_id,pattern,dealer_id,dealer_name,both_t,province,city,area,addr,clock_in_time,clock_out_time,salary,incidentals)
VALUES
<foreach
collection=
"table"
item=
"item"
index=
"index"
separator=
","
>
(#{recordId}, #{item.employeeId}, #{item.employeeName}, #{item.employeeNo}, #{item.year},
#{item.month}, FROM_UNIXTIME(#{item.date} / 1000), #{item.lineName}, #{item.storeName}, #{item.storeCode},
'',
'', 0, #{item.pattern}, #{item.dealerId}, #{item.dealerName}, '未确定',
#{item.province}, #{item.city}, #{item.area}, #{item.street}, #{item.addr},
#{item.orgQcId},#{item.orgName}, 0, #{item.pattern}, #{item.dealerId}, #{item.dealerName}, '未确定',
#{item.province}, #{item.city}, #{item.area}, #{item.addr},
FROM_UNIXTIME(#{item.clockInTime} / 1000), FROM_UNIXTIME(#{item.clockOutTime} / 1000), #{item.salary},
#{item.incidentals})
</foreach>
</insert>
<select
id=
"selectPlan"
resultMap=
"BaseResultMap"
>
select employee_name, create_time
from activity_plan_info
where date = #{date} and store_code = #{storeCode} and is_delete = 1;
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论