Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
66210828
提交
66210828
authored
6月 24, 2024
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步终端记录
上级
5006fb36
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
108 行增加
和
20 行删除
+108
-20
ControllerResponseAdvice.java
...wangxiaolu/promotion/advice/ControllerResponseAdvice.java
+1
-1
PromotionStoreCoreController.java
...ller/activity/temporary/PromotionStoreCoreController.java
+17
-1
TemporaryActivityClockCoreController.java
...ivity/temporary/TemporaryActivityClockCoreController.java
+24
-12
TemporaryActivityQueryController.java
.../activity/temporary/TemporaryActivityQueryController.java
+2
-1
PromotionStoreDao.java
...aolu/promotion/domain/activity/dao/PromotionStoreDao.java
+2
-0
PromotionStoreDaoImpl.java
...otion/domain/activity/dao/impl/PromotionStoreDaoImpl.java
+45
-0
PromotionStoreDO.java
...otion/domain/activity/mapper/entity/PromotionStoreDO.java
+7
-0
PromotionStoreWrapper.java
...tion/domain/activity/wrapperQo/PromotionStoreWrapper.java
+1
-0
QinCeDataTaskServiceImpl.java
...promotion/service/user/impl/QinCeDataTaskServiceImpl.java
+5
-1
QinCeUtils.java
src/main/java/com/wangxiaolu/promotion/utils/QinCeUtils.java
+4
-4
没有找到文件。
src/main/java/com/wangxiaolu/promotion/advice/ControllerResponseAdvice.java
浏览文件 @
66210828
...
...
@@ -16,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
/**
* @author : liqiulin
* @date : 2024-03-28 17
* @describe :
todo
自动封装
* @describe : 自动封装
*/
@RestControllerAdvice
public
class
ControllerResponseAdvice
implements
ResponseBodyAdvice
<
Object
>
{
...
...
src/main/java/com/wangxiaolu/promotion/controller/activity/temporary/PromotionStoreCoreController.java
浏览文件 @
66210828
...
...
@@ -3,13 +3,18 @@ package com.wangxiaolu.promotion.controller.activity.temporary;
import
com.alibaba.fastjson.JSONObject
;
import
com.wangxiaolu.promotion.common.redis.RedisKeys
;
import
com.wangxiaolu.promotion.common.redis.service.RedisCache
;
import
com.wangxiaolu.promotion.exception.FlowException
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo
;
import
com.wangxiaolu.promotion.result.basedata.R
;
import
com.wangxiaolu.promotion.result.basedata.RCode
;
import
com.wangxiaolu.promotion.service.activity.temporary.PromotionStoreCoreService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Objects
;
/**
* @author : liqiulin
* @date : 2024-06-18 13
...
...
@@ -27,6 +32,9 @@ public class PromotionStoreCoreController {
@PostMapping
(
"/save"
)
public
R
saveStore
(
@RequestHeader
(
"Authorization"
)
String
authorization
,
@RequestBody
PromotionStoreDto
promotionStoreDto
)
{
// 是否重复提交
repetitiveSaveStore
(
authorization
);
// 在缓存中查询
JSONObject
userJson
=
redisCache
.
getToJson
(
RedisKeys
.
UserKeys
.
TEMPORARY_TOKEN
.
getKey
()
+
authorization
);
...
...
@@ -37,8 +45,16 @@ public class PromotionStoreCoreController {
promotionStoreDto
.
setChargerQcId
(
userJson
.
getString
(
"chargerQcId"
));
promotionStoreDto
.
setChargerName
(
userJson
.
getString
(
"chargerName"
));
promotionStoreCoreService
.
saveStore
(
promotionStoreDto
);
return
R
.
success
();
}
private
void
repetitiveSaveStore
(
String
authorization
)
{
String
recordKey
=
RedisKeys
.
TemporaryKeys
.
TEMPORARY_SAVE_STORE_REPETITIVE
.
getKey
()
+
authorization
;
String
record
=
redisCache
.
get
(
recordKey
);
if
(
Objects
.
nonNull
(
record
))
{
throw
new
FlowException
(
RCode
.
PROMOTION_STORE_SAVE_ERROR
.
getCode
(),
String
.
format
(
RCode
.
PROMOTION_STORE_SAVE_ERROR
.
getMsg
(),
"3"
));
}
redisCache
.
addToJsonToMinute
(
recordKey
,
authorization
,
3
);
}
}
src/main/java/com/wangxiaolu/promotion/controller/activity/temporary/TemporaryActivityClockCoreController.java
浏览文件 @
66210828
package
com
.
wangxiaolu
.
promotion
.
controller
.
activity
.
temporary
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wangxiaolu.promotion.common.redis.RedisKeys
;
import
com.wangxiaolu.promotion.common.redis.service.RedisCache
;
import
com.wangxiaolu.promotion.enums.activity.ClockType
;
import
com.wangxiaolu.promotion.exception.FlowException
;
import
com.wangxiaolu.promotion.exception.ParamException
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.vo.TemporaryClockVo
;
...
...
@@ -9,9 +11,7 @@ import com.wangxiaolu.promotion.result.basedata.R;
import
com.wangxiaolu.promotion.result.basedata.RCode
;
import
com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCoreService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -32,6 +32,8 @@ public class TemporaryActivityClockCoreController {
@Autowired
private
TemporaryActivityCoreService
tempActivityCoreService
;
@Autowired
RedisCache
redisCache
;
/**
* 促销员当日打卡信息保存
...
...
@@ -53,11 +55,8 @@ public class TemporaryActivityClockCoreController {
// 根据打卡经纬度判断与打卡店铺的距离,距离超过100米不能打卡
// tempActivityCoreService.clockStoreCalDistance(clockVo.getStoreQcId(),clockVo.getId(),clockVo.getClockCoordinates());
/**
* todo redis打卡-限制重复提交
* todo 后续添加,基于redis
*/
// 限制重复提交
repetitiveClock
(
clockVo
);
Date
clockTime
=
new
Date
();
TemporaryClockDto
dto
=
new
TemporaryClockDto
(
clockVo
.
getClockType
(),
clockVo
.
getId
(),
clockVo
.
getTemporaryId
(),
clockVo
.
getTemporaryName
(),
clockVo
.
getClockProvince
(),
clockVo
.
getClockCity
());
...
...
@@ -75,9 +74,22 @@ public class TemporaryActivityClockCoreController {
return
R
.
success
();
}
/**
* redis打卡-限制重复提交
*/
private
void
repetitiveClock
(
TemporaryClockVo
clockVo
)
{
String
clockRecordKey
=
RedisKeys
.
TemporaryKeys
.
TEMPORARY_CLOCK_RECIRD
.
getKey
()
+
clockVo
.
getTemporaryId
()
+
"_"
+
clockVo
.
getClockType
();
String
record
=
redisCache
.
get
(
clockRecordKey
);
if
(
Objects
.
nonNull
(
record
))
{
throw
new
FlowException
(
RCode
.
USER_REPETITIVE_CLOCK_MINUTE
.
getCode
(),
String
.
format
(
RCode
.
USER_REPETITIVE_CLOCK_MINUTE
.
getMsg
(),
"2"
));
}
redisCache
.
addToJsonToMinute
(
clockRecordKey
,
clockVo
.
getTemporaryName
(),
2
);
}
// 上班打卡
private
void
builderClockInData
(
TemporaryClockVo
clockVo
,
TemporaryClockDto
clockDto
,
Date
dateTime
)
{
//
todo
if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_IN_END_TIME)) {
// if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_IN_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
...
...
@@ -93,7 +105,7 @@ public class TemporaryActivityClockCoreController {
// 午休下班卡
private
void
builderNoonClockOutData
(
TemporaryClockVo
clockVo
,
TemporaryClockDto
clockDto
,
Date
dateTime
)
{
//
todo
if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_OUT_END_TIME)) {
// if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_OUT_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto
.
setId
(
clockVo
.
getId
())
...
...
@@ -106,7 +118,7 @@ public class TemporaryActivityClockCoreController {
// 午休上班卡
private
void
builderNoonClockInData
(
TemporaryClockVo
clockVo
,
TemporaryClockDto
clockDto
,
Date
dateTime
)
{
//
todo
if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_IN_END_TIME)) {
// if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_NOON_CLOCK_IN_BEGIN_TIME, ClockType.TEMPORARY_NOON_CLOCK_IN_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto
.
setId
(
clockVo
.
getId
())
...
...
@@ -118,7 +130,7 @@ public class TemporaryActivityClockCoreController {
// 下班卡
private
void
builderClockOutData
(
TemporaryClockVo
clockVo
,
TemporaryClockDto
clockDto
,
Date
dateTime
)
{
//
todo
if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_OUT_END_TIME)) {
// if (!DateUtils.parseTime(new Date(), ClockType.TEMPORARY_CLOCK_OUT_BEGIN_TIME, ClockType.TEMPORARY_CLOCK_OUT_END_TIME)) {
// throw new ParamException(RCode.CLOCK_DETAIL_TIME_ERROR, null);
// }
clockDto
.
setId
(
clockVo
.
getId
())
...
...
src/main/java/com/wangxiaolu/promotion/controller/activity/temporary/TemporaryActivityQueryController.java
浏览文件 @
66210828
...
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotNull
;
import
java.util.Objects
;
/**
* @author : liqiulin
...
...
@@ -69,7 +70,7 @@ public class TemporaryActivityQueryController {
*/
@GetMapping
(
"/today/reported/market_cell/{id}"
)
public
R
findActivityMarketCellByDb
(
@PathVariable
(
"id"
)
Long
activityId
)
{
if
(
activityId
<=
0
)
{
if
(
Objects
.
isNull
(
activityId
)
||
(
activityId
<=
0
))
{
return
R
.
success
();
}
return
R
.
success
(
temporaryActivityQueryService
.
findActivityMarketCellByDb
(
activityId
));
...
...
src/main/java/com/wangxiaolu/promotion/domain/activity/dao/PromotionStoreDao.java
浏览文件 @
66210828
package
com
.
wangxiaolu
.
promotion
.
domain
.
activity
.
dao
;
import
com.alibaba.fastjson.JSONArray
;
import
com.wangxiaolu.promotion.domain.activity.wrapperQo.PromotionStoreWrapper
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.vo.PromotionStoreVo
;
...
...
@@ -19,4 +20,5 @@ public interface PromotionStoreDao {
PromotionStoreDto
selectOneById
(
Long
id
);
void
qinceShopDetailAllTask
(
JSONArray
responseDatas
);
}
src/main/java/com/wangxiaolu/promotion/domain/activity/dao/impl/PromotionStoreDaoImpl.java
浏览文件 @
66210828
package
com
.
wangxiaolu
.
promotion
.
domain
.
activity
.
dao
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.wangxiaolu.promotion.domain.activity.dao.PromotionStoreDao
;
import
com.wangxiaolu.promotion.domain.activity.mapper.PromotionStoreMapper
;
import
com.wangxiaolu.promotion.domain.activity.mapper.entity.PromotionStoreDO
;
import
com.wangxiaolu.promotion.domain.activity.wrapperQo.PromotionStoreWrapper
;
import
com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeClienteleStoreDO
;
import
com.wangxiaolu.promotion.domain.user.mapper.entity.QinCeDepartmentDO
;
import
com.wangxiaolu.promotion.exception.ParamException
;
import
com.wangxiaolu.promotion.pojo.activity.temporary.dto.PromotionStoreDto
;
import
com.wangxiaolu.promotion.result.basedata.RCode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -35,6 +40,14 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao {
*/
@Override
public
void
save
(
PromotionStoreDto
promotionStoreDto
)
{
// 查询是否重名
PromotionStoreWrapper
psw
=
new
PromotionStoreWrapper
()
.
setStoreName
(
promotionStoreDto
.
getStoreName
());
int
coud
=
findCoud
(
psw
);
if
(
coud
>
0
){
throw
new
ParamException
(
RCode
.
PROMOTION_STORE_HAS_NAME
,
null
);
}
PromotionStoreDO
storeDo
=
new
PromotionStoreDO
();
BeanUtils
.
copyProperties
(
promotionStoreDto
,
storeDo
);
promotionStoreMapper
.
insert
(
storeDo
);
...
...
@@ -56,6 +69,32 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao {
return
transitionDto
(
promotionStoreDO
);
}
@Override
public
void
qinceShopDetailAllTask
(
JSONArray
responseDatas
)
{
for
(
Object
responseData
:
responseDatas
)
{
JSONObject
jo
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
responseData
));
try
{
PromotionStoreDO
storeDo
=
new
PromotionStoreDO
();
storeDo
.
setQcId
(
jo
.
getString
(
"id"
))
.
setStoreName
(
jo
.
getString
(
"store_name"
))
.
setProvince
(
jo
.
getString
(
"store_mss_province"
))
.
setCity
(
jo
.
getString
(
"store_mss_city"
))
.
setArea
(
jo
.
getString
(
"store_mss_area"
))
.
setStreet
(
jo
.
getString
(
"store_mss_street"
))
.
setAddress
(
jo
.
getString
(
"store_addr"
))
.
setTemporaryId
(
0
)
.
setTemporaryName
(
"系统同步"
);
promotionStoreMapper
.
insert
(
storeDo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"勤策-同步终端store数据异常,异常数据:{}"
,
responseData
);
log
.
error
(
"勤策-同步终端store数据异常\n{}"
,
e
.
getMessage
());
}
}
}
private
LambdaQueryWrapper
<
PromotionStoreDO
>
buildWrapper
(
PromotionStoreWrapper
promotionStoreWrapper
){
LambdaQueryWrapper
<
PromotionStoreDO
>
lqw
=
new
LambdaQueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
promotionStoreWrapper
.
getArea
())){
...
...
@@ -64,6 +103,12 @@ public class PromotionStoreDaoImpl implements PromotionStoreDao {
return
lqw
;
}
private
int
findCoud
(
PromotionStoreWrapper
promotionStoreWrapper
){
LambdaQueryWrapper
<
PromotionStoreDO
>
qw
=
buildWrapper
(
promotionStoreWrapper
);
Integer
count
=
promotionStoreMapper
.
selectCount
(
qw
);
return
count
;
}
/**
* DO to DTO (单个对象)
...
...
src/main/java/com/wangxiaolu/promotion/domain/activity/mapper/entity/PromotionStoreDO.java
浏览文件 @
66210828
...
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 促销店铺数据
...
...
@@ -14,6 +15,7 @@ import lombok.Data;
*/
@TableName
(
value
=
"promotion_store"
)
@Data
@Accessors
(
chain
=
true
)
public
class
PromotionStoreDO
implements
Serializable
{
/**
* 主键id
...
...
@@ -21,6 +23,11 @@ public class PromotionStoreDO implements Serializable {
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* qc_id
*/
private
String
qcId
;
/**
* 店铺名称
*/
...
...
src/main/java/com/wangxiaolu/promotion/domain/activity/wrapperQo/PromotionStoreWrapper.java
浏览文件 @
66210828
...
...
@@ -24,4 +24,5 @@ public class PromotionStoreWrapper {
private
String
area
;
private
String
storeNameLike
;
private
String
storeName
;
}
src/main/java/com/wangxiaolu/promotion/service/user/impl/QinCeDataTaskServiceImpl.java
浏览文件 @
66210828
...
...
@@ -2,6 +2,7 @@ package com.wangxiaolu.promotion.service.user.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wangxiaolu.promotion.domain.activity.dao.PromotionStoreDao
;
import
com.wangxiaolu.promotion.domain.user.dao.*
;
import
com.wangxiaolu.promotion.service.user.QinCeDataTaskService
;
import
com.wangxiaolu.promotion.utils.OkHttp
;
...
...
@@ -33,6 +34,8 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
QinceProductTypeDao
qinceProductTypeDao
;
@Autowired
QinceProductInfoDao
qinceProductInfoDao
;
@Autowired
PromotionStoreDao
promotionStoreDao
;
@Override
public
void
departmentSyncTask
()
{
...
...
@@ -118,7 +121,8 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
}
log
.
info
(
"勤策-同步终端store数据,查询到第{}页数据「{}」条"
,
pageNum
,
responseDatas
.
size
());
qinCeClienteleShopDao
.
shopDetailAllTask
(
responseDatas
);
// qinCeClienteleShopDao.shopDetailAllTask(responseDatas);
promotionStoreDao
.
qinceShopDetailAllTask
(
responseDatas
);
return
true
;
}
}
src/main/java/com/wangxiaolu/promotion/utils/QinCeUtils.java
浏览文件 @
66210828
...
...
@@ -126,7 +126,7 @@ public class QinCeUtils {
params
.
put
(
"page_number"
,
pageNum
);
// 记录状态。0:已删除,1:正常
// 0:已删除:客户回收站中的终端数据
params
.
put
(
"status"
,
""
);
params
.
put
(
"status"
,
"
1
"
);
// 勤策的门店唯一ID
params
.
put
(
"id"
,
""
);
// 来源于第三方系统的门店唯一ID,对应新增门店 (store_id)字段,只有当数据来源于新增接口时才有值,如果数据从勤策系统中直接创建则该字段值为空。 如果两个值同时存在则优先顺序为store_waiqin_id、store_id
...
...
@@ -140,9 +140,9 @@ public class QinCeUtils {
// 门店类型编码,store_type、store_type_code如果同时存在优先取store_type_code
params
.
put
(
"store_type_code"
,
""
);
// 门店类型
params
.
put
(
"store_
type"
,
"
"
);
// 门店
所属销售区域,此字段需要销售区域的完整层级结构, 多层级间以“,”分隔,如:华中大区,南京分区,秦淮社区
params
.
put
(
"store_
district"
,
"
"
);
params
.
put
(
"store_
status"
,
"1
"
);
// 门店
审批状态。1:待审批,2:审批打回,3:审批通过
params
.
put
(
"store_
approval_status"
,
"3
"
);
return
params
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论