Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
aa49c971
提交
aa49c971
authored
2月 14, 2025
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UUID保存促销计划时,进行区分,并修改保存逻辑
上级
7dca7bba
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
110 行增加
和
19 行删除
+110
-19
PromPlanCoreController.java
...ion/controller/activityplanv2/PromPlanCoreController.java
+5
-8
ActivityPlanInfoDao.java
...motion/domain/activityplanv2/dao/ActivityPlanInfoDao.java
+2
-0
ActivityPlanInfoDaoImpl.java
...main/activityplanv2/dao/impl/ActivityPlanInfoDaoImpl.java
+17
-0
ActivityPlanInfoMapper.java
.../domain/activityplanv2/mapper/ActivityPlanInfoMapper.java
+2
-0
OperationType.java
...va/com/wangxiaolu/promotion/enums/plan/OperationType.java
+32
-0
PromPlanCoreServiceImpl.java
.../service/activityplanv2/impl/PromPlanCoreServiceImpl.java
+19
-9
ActivityPlanInfoMapper.xml
...esources/mapper/activityplanv2/ActivityPlanInfoMapper.xml
+33
-2
没有找到文件。
src/main/java/com/wangxiaolu/promotion/controller/activityplanv2/PromPlanCoreController.java
浏览文件 @
aa49c971
...
...
@@ -54,7 +54,7 @@ public class PromPlanCoreController {
String
[]
urlArr
=
activityPlanVo
.
getExcelUrl
().
split
(
"/"
);
String
fileId
=
urlArr
[
urlArr
.
length
-
1
];
String
filePath
=
"/root/promotion/planv2/"
+
fileId
;
// String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
//
todo
String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
FileUtils
.
downloadExcel
(
activityPlanVo
.
getExcelUrl
(),
filePath
);
activityPlanVo
.
setExcelId
(
fileId
);
Map
<
String
,
Object
>
map
=
promPlanCoreService
.
selfPlanUp
(
activityPlanVo
,
filePath
);
...
...
@@ -87,8 +87,8 @@ public class PromPlanCoreController {
String
[]
urlArr
=
activityPlanVo
.
getExcelUrl
().
split
(
"/"
);
String
fileId
=
urlArr
[
urlArr
.
length
-
1
];
String
filePath
=
"/root/promotion/planv2/"
+
fileId
;
// todo String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
FileUtils
.
downloadExcel
(
activityPlanVo
.
getExcelUrl
(),
filePath
);
// todo String filePath = "/Users/a02200059/Desktop/职能角色-新增-1.xlsx";
activityPlanVo
.
setExcelId
(
fileId
);
Map
<
String
,
Object
>
map
=
promPlanCoreService
.
authPlanUp
(
activityPlanVo
,
filePath
);
return
R
.
success
(
map
);
...
...
@@ -109,9 +109,6 @@ public class PromPlanCoreController {
return
R
.
success
();
}
/**
* 促销计划修改
*/
...
...
@@ -129,9 +126,9 @@ public class PromPlanCoreController {
try
{
String
[]
urlArr
=
activityPlanVo
.
getExcelUrl
().
split
(
"/"
);
String
fileId
=
urlArr
[
urlArr
.
length
-
1
];
//todo
String filePath = "/root/promotion/planv2/" + fileId;
String
filePath
=
"/Users/a02200059/Desktop/2.0/"
+
fileId
;
//
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
String
filePath
=
"/root/promotion/planv2/"
+
fileId
;
//todo
String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
FileUtils
.
downloadExcel
(
activityPlanVo
.
getExcelUrl
(),
filePath
);
activityPlanVo
.
setExcelId
(
fileId
);
Map
<
String
,
Object
>
map
=
promPlanCoreService
.
selfPlanPut
(
activityPlanVo
,
filePath
);
return
R
.
success
(
map
);
...
...
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/dao/ActivityPlanInfoDao.java
浏览文件 @
aa49c971
...
...
@@ -21,4 +21,6 @@ public interface ActivityPlanInfoDao {
ActivityPlanInfoDto
selectPlan
(
String
storeCode
,
Date
date
);
void
deleteByPlanIds
(
List
<
Long
>
planIds
);
void
updateList
(
JSONArray
table
,
Long
recordId
);
}
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/dao/impl/ActivityPlanInfoDaoImpl.java
浏览文件 @
aa49c971
...
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.time.LocalTime
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -44,6 +45,22 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
}
}
@Override
public
void
updateList
(
JSONArray
table
,
Long
recordId
)
{
try
{
// 将table中的数据转换为ActivityPlanInfoDo
for
(
int
i
=
0
;
i
<
table
.
size
();
i
++)
{
ActivityPlanInfoDo
pdo
=
table
.
getObject
(
i
,
ActivityPlanInfoDo
.
class
);
activityPlanInfoMapper
.
updateOne
(
pdo
,
recordId
);
}
}
catch
(
PersistenceException
e
)
{
e
.
printStackTrace
();
throw
new
DataException
(
RCode
.
ACTIVITY_PLAN_REPETITION_ERROR
);
}
}
@Override
public
void
page
(
PageInfo
pageInfo
,
ActivityPlanInfoWrapper
wrapper
)
{
LambdaQueryWrapper
<
ActivityPlanInfoDo
>
qw
=
buildWrapper
(
wrapper
);
...
...
src/main/java/com/wangxiaolu/promotion/domain/activityplanv2/mapper/ActivityPlanInfoMapper.java
浏览文件 @
aa49c971
...
...
@@ -27,6 +27,8 @@ public interface ActivityPlanInfoMapper extends BaseMapper<ActivityPlanInfoDo> {
void
updateIsDelete
(
List
<
Long
>
planIds
);
Integer
selectNotDelCount
(
@Param
(
"planIds"
)
List
<
Long
>
planIds
);
void
updateOne
(
@Param
(
"pDo"
)
ActivityPlanInfoDo
pDo
,
@Param
(
"recordId"
)
Long
recordId
);
}
...
...
src/main/java/com/wangxiaolu/promotion/enums/plan/OperationType.java
0 → 100644
浏览文件 @
aa49c971
package
com
.
wangxiaolu
.
promotion
.
enums
.
plan
;
/**
* @author : liqiulin
* @date : 2025-02-14 13
* @describe :
*/
public
enum
OperationType
{
/**
* up:新增
* put:修改
*/
UP
(
"UP"
,
"新增"
),
PUT
(
"PUT"
,
"修改"
);
private
final
String
code
;
private
final
String
desc
;
OperationType
(
String
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getDesc
()
{
return
desc
;
}
}
src/main/java/com/wangxiaolu/promotion/service/activityplanv2/impl/PromPlanCoreServiceImpl.java
浏览文件 @
aa49c971
...
...
@@ -14,6 +14,7 @@ import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import
com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao
;
import
com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao
;
import
com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper
;
import
com.wangxiaolu.promotion.enums.plan.OperationType
;
import
com.wangxiaolu.promotion.enums.plan.PlanStatus
;
import
com.wangxiaolu.promotion.exception.DataException
;
import
com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanInfoDto
;
...
...
@@ -72,6 +73,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
.
setExcelUrl
(
planVo
.
getExcelUrl
())
.
setExcelFiledId
(
planVo
.
getExcelId
());
map
.
put
(
"record"
,
record
);
map
.
put
(
"type"
,
OperationType
.
UP
.
getCode
());
// 保存到缓存(uuid)
redisCache
.
addToJsonToMinute
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()+
map
.
get
(
"uuid"
).
toString
(),
map
,
30
);
// 返回结果
...
...
@@ -260,6 +262,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
.
setExcelUrl
(
planVo
.
getExcelUrl
())
.
setExcelFiledId
(
planVo
.
getExcelId
());
map
.
put
(
"record"
,
record
);
map
.
put
(
"type"
,
OperationType
.
UP
.
getCode
());
// 保存到缓存(uuid)
redisCache
.
addToJsonToMinute
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()+
map
.
get
(
"uuid"
).
toString
(),
map
,
30
);
// 返回结果
...
...
@@ -394,7 +397,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
year
+=
1
;
}
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
if
(
monthInt
!=
nextMonthValue
||
monthInt
!=
monthValue
)
{
if
(
monthInt
!=
nextMonthValue
&&
monthInt
!=
monthValue
)
{
dto
.
setErrorMsg
(
"月份只能是当月或次月;"
);
}
else
if
(
planDate
.
isBefore
(
LocalDate
.
now
()))
{
dto
.
setErrorMsg
(
"日期不能是以前;"
);
...
...
@@ -455,8 +458,9 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
.
setExcelUrl
(
planVo
.
getExcelUrl
())
.
setExcelFiledId
(
planVo
.
getExcelId
());
map
.
put
(
"record"
,
record
);
map
.
put
(
"type"
,
OperationType
.
PUT
.
getCode
());
// 保存到缓存(uuid)
redisCache
.
addToJsonToMinute
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_
PUT
.
getKey
()+
map
.
get
(
"uuid"
).
toString
(),
map
,
30
);
redisCache
.
addToJsonToMinute
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_
UP
.
getKey
()+
map
.
get
(
"uuid"
).
toString
(),
map
,
30
);
// 返回结果
return
map
;
}
...
...
@@ -541,6 +545,8 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
if
(
StringUtils
.
isAnyBlank
(
storeDto
.
getLineName
(),
storeDto
.
getDealersName
(),
storeDto
.
getDealerId
()))
{
dto
.
setErrorMsg
(
"门店「系统名称」或「经销商」为空,请到勤策中进充;"
);
}
dto
.
setStoreCode
(
sc
);
dto
.
setStoreName
(
storeDto
.
getStoreName
());
dto
.
setLineName
(
storeDto
.
getLineName
());
dto
.
setDealerId
(
storeDto
.
getDealerId
());
dto
.
setDealerName
(
storeDto
.
getDealersName
());
...
...
@@ -564,7 +570,9 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
}
else
if
(!
hasDto
.
getEmployeeNo
().
equals
(
row
.
get
(
0
).
toString
()))
{
dto
.
setErrorMsg
(
"计划不属于"
+
row
.
get
(
0
)+
",归属人:"
+
hasDto
.
getEmployeeName
()
+
";"
);
}
dto
.
setEmployeeName
(
hasDto
.
getEmployeeName
())
.
setOrgQcId
(
hasDto
.
getOrgQcId
())
.
setOrgName
(
hasDto
.
getOrgName
());
LocalTime
inLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
6
).
toString
());
LocalTime
outLocalTime
=
DateUtils
.
parseLocalTimeByEmdtime
(
row
.
get
(
7
).
toString
());
...
...
@@ -577,8 +585,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto
.
setClockInTime
(
LocalDateTime
.
of
(
planDate
,
inLocalTime
));
dto
.
setClockOutTime
(
LocalDateTime
.
of
(
planDate
,
outLocalTime
));
}
LocalDateTime
localDateTime
=
hasDto
.
getClockInTime
().
plusHours
(
1
);
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(
LocalDateTime
.
now
().
isAfter
(
hasDto
.
getClockInTime
().
plusHours
(
1
))){
dto
.
setErrorMsg
(
"已超促销员上班时间1小时,不可修改;"
);
}
...
...
@@ -606,7 +612,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
}
dtos
.
add
(
dto
);
}
return
dtos
;
}
...
...
@@ -617,17 +622,22 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
public
synchronized
void
selfPlanAf
(
String
planUuid
)
{
String
key
=
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()
+
planUuid
;
JSONObject
mapJson
=
redisCache
.
getToJson
(
key
);
if
(
Objects
.
isNull
(
mapJson
)){
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"
);
String
type
=
mapJson
.
getString
(
"type"
);
if
(
OperationType
.
UP
.
getCode
().
equals
(
type
))
{
// 保存上传记录
Long
recordId
=
activityPlanRecordDao
.
save
(
record
);
activityPlanInfoDao
.
saveList
(
table
,
recordId
);
activityPlanInfoDao
.
saveList
(
table
,
recordId
);
}
else
if
(
OperationType
.
PUT
.
getCode
().
equals
(
type
))
{
Long
recordId
=
activityPlanRecordDao
.
save
(
record
);
activityPlanInfoDao
.
updateList
(
table
,
recordId
);
}
}
@Override
...
...
src/main/resources/mapper/activityplanv2/ActivityPlanInfoMapper.xml
浏览文件 @
aa49c971
...
...
@@ -42,6 +42,8 @@
<result
property=
"province"
column=
"province"
jdbcType=
"VARCHAR"
/>
<result
property=
"planStatus"
column=
"plan_status"
jdbcType=
"INTEGER"
/>
<result
property=
"clockInTime"
column=
"clock_in_time"
jdbcType=
"DATE"
/>
<result
property=
"orgQcId"
column=
"org_qc_id"
jdbcType=
"VARCHAR"
/>
<result
property=
"orgName"
column=
"org_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"modifyTime"
column=
"modify_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
...
...
@@ -79,9 +81,20 @@
</insert>
<select
id=
"selectPlan"
resultMap=
"SimResultMap"
>
select id,employee_name,employee_no,province,plan_status,clock_in_time,create_time,modify_time
select id,
employee_name,
employee_no,
province,
plan_status,
clock_in_time,
create_time,
modify_time,
org_qc_id,
org_name
from activity_plan_info
where date = #{date} and store_code = #{storeCode} and is_delete = 1;
where date = #{date}
and store_code = #{storeCode}
and is_delete = 1;
</select>
<update
id=
"updateIsDelete"
parameterType=
"java.util.List"
>
...
...
@@ -104,4 +117,22 @@
and date
<
= now()
</select>
<update
id=
"updateOne"
>
update activity_plan_info
set plan_file_id = #{recordId},
line_name = #{pDo.lineName},
store_name = #{pDo.storeName},
org_qc_id = #{pDo.orgQcId},
org_name = #{pDo.orgName},
pattern = #{pDo.pattern},
dealer_id = #{pDo.dealerId},
dealer_name = #{pDo.dealerName},
clock_in_time = #{pDo.clockInTime},
clock_out_time = #{pDo.clockOutTime},
salary = #{pDo.salary},
incidentals = #{pDo.incidentals}
where store_code = #{pDo.storeCode}
and date = #{pDo.date};
</update>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论