Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
1139fb66
提交
1139fb66
authored
2月 12, 2025
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
获取阿里云sts_token,职能角色上传计划
上级
6925b5c2
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
343 行增加
和
45 行删除
+343
-45
pom.xml
pom.xml
+7
-0
PromPlanCoreController.java
...ion/controller/activityplanv2/PromPlanCoreController.java
+51
-29
AliyunGetToken.java
...m/wangxiaolu/promotion/controller/yun/AliyunGetToken.java
+12
-1
ManageEmployeeInfoDao.java
.../promotion/domain/activity/dao/ManageEmployeeInfoDao.java
+2
-0
ManageEmployeeInfoInfoDaoImpl.java
...main/activity/dao/impl/ManageEmployeeInfoInfoDaoImpl.java
+5
-0
ManageEmployeeInfoMapper.java
...tion/domain/activity/mapper/ManageEmployeeInfoMapper.java
+1
-0
PromPlanCoreService.java
...promotion/service/activityplanv2/PromPlanCoreService.java
+1
-0
PromPlanCoreServiceImpl.java
.../service/activityplanv2/impl/PromPlanCoreServiceImpl.java
+227
-12
ManageEmployeeQueryService.java
...lu/promotion/service/user/ManageEmployeeQueryService.java
+2
-0
ManageEmployeeQueryServiceImpl.java
...ion/service/user/impl/ManageEmployeeQueryServiceImpl.java
+5
-0
AliyunUtils.java
...main/java/com/wangxiaolu/promotion/utils/AliyunUtils.java
+23
-3
ManageEmployeeInfoMapper.xml
src/main/resources/mapper/ManageEmployeeInfoMapper.xml
+7
-0
没有找到文件。
pom.xml
浏览文件 @
1139fb66
...
...
@@ -245,6 +245,13 @@
<artifactId>
aliyun-sdk-oss
</artifactId>
<version>
${aliyun.oss.version}
</version>
</dependency>
<dependency>
<groupId>
com.aliyun
</groupId>
<artifactId>
sts20150401
</artifactId>
<version>
${aliyun.sts.version}
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/wangxiaolu/promotion/controller/activityplanv2/PromPlanCoreController.java
浏览文件 @
1139fb66
...
...
@@ -30,7 +30,7 @@ public class PromPlanCoreController {
/**
* 城市经理 - 上传计划
* 城市经理 - 上传计划
(新增)
* 当月只能上传次月的新增(当月需要新增需要交由职能角色上传)
*/
@PostMapping
(
"/self/upload"
)
...
...
@@ -61,39 +61,61 @@ public class PromPlanCoreController {
}
}
@GetMapping
(
"/self/upload/{uuid}"
)
/**
* todo 城市经理修改
*/
/**
* todo 职能角色修改
*/
/**
* 职能角色 - 上传计划(新增)
*/
@PostMapping
(
"/auth/upload"
)
public
R
authPlan
(
@RequestBody
ActivityPlanVo
activityPlanVo
)
{
// 判断当前账号是否是城市经理
boolean
isAuth
=
manageEmployeeQueryService
.
isAuth
(
activityPlanVo
.
getEmployeeId
());
if
(!
isAuth
)
{
throw
new
DataException
(
RCode
.
EMP_PRIVILEGE_ERROR
);
}
try
{
String
[]
urlArr
=
activityPlanVo
.
getExcelUrl
().
split
(
"weda-uploader/"
);
String
fileId
=
urlArr
[
urlArr
.
length
-
1
];
if
(
fileId
.
length
()
>
53
)
{
throw
new
DataException
(
RCode
.
ACTIVITY_PLAN_FILENAME_LONG
);
}
String
filePath
=
"/home/"
+
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
);
}
catch
(
DataException
e
)
{
return
new
R
(
e
.
getCode
(),
e
.
getMsg
(),
null
);
}
catch
(
Exception
e
)
{
return
R
.
fail
();
}
}
/**
* 确认上传(根据任一UUID)
*/
@GetMapping
(
"/upload/{uuid}"
)
public
R
selfPlanAf
(
@PathVariable
(
"uuid"
)
String
planUuid
){
promPlanCoreService
.
selfPlanAf
(
planUuid
);
return
R
.
success
();
}
/**
* 职能角色 - 上传计划
*/
@GetMapping
(
"/auth/upload"
)
public
void
authPlan
(
@RequestBody
ActivityPlanVo
activityPlanVo
)
{
// 判断当前账号是否是城市经理
// boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeId());
// if (!isSelf) {
// throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
// }
//
// try {
// String[] urlArr = activityPlanVo.getExcelUrl().split("weda-uploader/");
// String fileId = urlArr[urlArr.length - 1];
// if (fileId.length() > 53) {
// throw new DataException(RCode.ACTIVITY_PLAN_FILENAME_LONG);
// }
//
// String filePath = "/home/" + fileId;
// FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// String filePath = "/Users/a02200059/Desktop/测试新增v3 2.xlsx";
// activityPlanVo.setExcelId(fileId);
// Map<String, Object> map = promPlanCoreService.selfPlanUp(activityPlanVo, filePath);
// return R.success(map);
// } catch (DataException e) {
// return new R(e.getCode(), e.getMsg(), null);
}
/**
* 删除计划 计划日期大于今日可直接删除,如果计划日期是今日则必需是10点之前,包含过去日期不可删除
...
...
src/main/java/com/wangxiaolu/promotion/controller/yun/AliyunGetToken.java
浏览文件 @
1139fb66
package
com
.
wangxiaolu
.
promotion
.
controller
.
yun
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.wangxiaolu.promotion.result.basedata.R
;
import
com.wangxiaolu.promotion.utils.AliyunUtils
;
...
...
@@ -10,6 +9,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
/**
* @author : liqiulin
* @date : 2025-02-06 13
...
...
@@ -31,4 +32,14 @@ public class AliyunGetToken {
return
R
.
fail
();
}
}
@GetMapping
(
"/sts_token"
)
public
R
getStsToken
()
{
try
{
String
stsToken
=
aliyunUtils
.
getStsToken
();
return
R
.
success
(
stsToken
);
}
catch
(
Exception
e
)
{
return
R
.
fail
(
e
.
getMessage
());
}
}
}
src/main/java/com/wangxiaolu/promotion/domain/activity/dao/ManageEmployeeInfoDao.java
浏览文件 @
1139fb66
...
...
@@ -26,4 +26,6 @@ public interface ManageEmployeeInfoDao {
void
updateAccount
(
String
employeeNo
,
Integer
privilegeId
,
String
status
);
boolean
isOneSelf
(
Integer
employeeId
);
boolean
isAuth
(
Integer
employeeId
);
}
src/main/java/com/wangxiaolu/promotion/domain/activity/dao/impl/ManageEmployeeInfoInfoDaoImpl.java
浏览文件 @
1139fb66
...
...
@@ -92,6 +92,11 @@ public class ManageEmployeeInfoInfoDaoImpl implements ManageEmployeeInfoDao {
return
manageEmployeeInfoMapper
.
isOneSelf
(
employeeId
);
}
@Override
public
boolean
isAuth
(
Integer
employeeId
)
{
return
manageEmployeeInfoMapper
.
isAuth
(
employeeId
);
}
/**
* 增加权限
*/
...
...
src/main/java/com/wangxiaolu/promotion/domain/activity/mapper/ManageEmployeeInfoMapper.java
浏览文件 @
1139fb66
...
...
@@ -29,6 +29,7 @@ public interface ManageEmployeeInfoMapper extends BaseMapper<ManageEmployeeInfoD
void
updatePrivilege
(
@Param
(
"employeeNo"
)
String
employeeNo
,
@Param
(
"privilegeId"
)
Integer
privilegeId
);
boolean
isOneSelf
(
Integer
employeeId
);
boolean
isAuth
(
Integer
employeeId
);
}
...
...
src/main/java/com/wangxiaolu/promotion/service/activityplanv2/PromPlanCoreService.java
浏览文件 @
1139fb66
...
...
@@ -18,4 +18,5 @@ public interface PromPlanCoreService {
void
deletePlan
(
List
<
Long
>
planIds
);
Map
<
String
,
Object
>
authPlanUp
(
ActivityPlanVo
activityPlanVo
,
String
filePath
);
}
src/main/java/com/wangxiaolu/promotion/service/activityplanv2/impl/PromPlanCoreServiceImpl.java
浏览文件 @
1139fb66
...
...
@@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.wangxiaolu.promotion.common.excel.ReadExcelUtils
;
import
com.wangxiaolu.promotion.common.redis.RedisKeys
;
import
com.wangxiaolu.promotion.common.redis.service.RedisCache
;
import
com.wangxiaolu.promotion.domain.activity.dao.ManageEmployeeInfoDao
;
import
com.wangxiaolu.promotion.domain.activity.wrapperQo.ManageEmployeeWrapper
;
import
com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao
;
import
com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao
;
import
com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao
;
...
...
@@ -16,6 +18,7 @@ import com.wangxiaolu.promotion.exception.DataException;
import
com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanInfoDto
;
import
com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanRecordDto
;
import
com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo
;
import
com.wangxiaolu.promotion.pojo.user.dto.ManageEmployeeInfoDto
;
import
com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto
;
import
com.wangxiaolu.promotion.result.basedata.RCode
;
import
com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService
;
...
...
@@ -45,8 +48,13 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
@Autowired
private
ActivityPlanInfoDao
activityPlanInfoDao
;
@Autowired
private
ManageEmployeeInfoDao
manageEmployeeInfoDao
;
@Autowired
private
RedisCache
redisCache
;
/**
* 城市经理 - 上传计划
*/
@Override
public
Map
<
String
,
Object
>
selfPlanUp
(
ActivityPlanVo
planVo
,
String
filePath
)
throws
DataException
{
// 1、解析活动计划文件是否符合规范
...
...
@@ -92,6 +100,31 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
activityPlanInfoDao
.
deleteByPlanIds
(
planIds
);
}
/**
* 职能角色 - 上传计划
*/
@Override
public
Map
<
String
,
Object
>
authPlanUp
(
ActivityPlanVo
planVo
,
String
filePath
)
{
// 1、解析活动计划文件是否符合规范
Map
<
String
,
Object
>
map
=
readSheetByZNJSUp
(
planVo
,
filePath
);
if
(!
map
.
containsKey
(
"uuid"
)){
return
map
;
}
// 2、生成uuid并关联上传记录
ActivityPlanRecordDto
record
=
new
ActivityPlanRecordDto
()
.
setEmployeeId
(
planVo
.
getEmployeeId
())
.
setEmployeeName
(
planVo
.
getEmployeeName
())
.
setEmployeeNo
(
planVo
.
getEmployeeNo
())
.
setExcelUrl
(
planVo
.
getExcelUrl
())
.
setExcelFiledId
(
planVo
.
getExcelId
());
map
.
put
(
"record"
,
record
);
// 保存到缓存(uuid)
redisCache
.
addToJsonToMinute
(
RedisKeys
.
Manage
.
ACTIVITY_PLAN_UP
.
getKey
()+
map
.
get
(
"uuid"
).
toString
(),
map
,
30
);
// 返回结果
return
map
;
}
/**
* 解析excel文件中的计划
* @param planVo 请求信息(包含人员信息)
...
...
@@ -120,7 +153,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
indexList
.
add
(
row
.
getKey
()
+
1
);
}
}
if
(
isEmpty
)
{
if
(
CollectionUtil
.
isNotEmpty
(
indexList
)
)
{
throw
new
DataException
(
RCode
.
ACTIVITY_PLAN_CELL_NOT_NULL
,
indexList
);
}
...
...
@@ -136,6 +169,185 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
return
rMap
;
}
/**
* 解析excel文件中的计划
* @param planVo 请求信息(包含人员信息)
* @param filePath 文件地址
* @throws DataException 数据异常
*/
private
Map
<
String
,
Object
>
readSheetByZNJSUp
(
ActivityPlanVo
planVo
,
String
filePath
)
throws
DataException
{
ReadExcelUtils
readExcelUtils
=
new
ReadExcelUtils
(
filePath
);
String
[]
headers
=
readExcelUtils
.
readTitle
();
Map
<
Integer
,
List
<
Object
>>
rows
=
readExcelUtils
.
readContent
();
if
(
headers
.
length
!=
10
)
{
throw
new
DataException
(
RCode
.
ACTIVITY_PLAN_TEM_ERROR
);
}
if
(
CollectionUtil
.
isEmpty
(
rows
))
{
throw
new
DataException
(
RCode
.
DATA_NOT_HAVE_ERROR
);
}
boolean
isEmpty
=
false
;
ArrayList
<
Integer
>
indexList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
List
<
Object
>>
row
:
rows
.
entrySet
())
{
List
<
Object
>
cells
=
row
.
getValue
();
// 判断当前行是否有任一数据为空,如果有则报错,不进行解析
isEmpty
=
(
cells
.
size
()
!=
10
)
||
cells
.
stream
().
anyMatch
(
cell
->
ObjectUtil
.
isNull
(
cell
)
||
StringUtils
.
isBlank
(
cell
.
toString
()));
if
(
isEmpty
)
{
indexList
.
add
(
row
.
getKey
()
+
1
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
indexList
))
{
throw
new
DataException
(
RCode
.
ACTIVITY_PLAN_CELL_NOT_NULL
,
indexList
);
}
Map
<
String
,
Object
>
rMap
=
new
HashMap
<>();
rMap
.
put
(
"uuid"
,
UUID
.
randomUUID
().
toString
());
List
<
ActivityPlanInfoDto
>
rDtos
=
new
ArrayList
<>(
rows
.
size
()
*
4
);
for
(
Map
.
Entry
<
Integer
,
List
<
Object
>>
row
:
rows
.
entrySet
())
{
List
<
ActivityPlanInfoDto
>
infoDtos
=
getRowByZNJSUp
(
planVo
,
row
.
getValue
(),
rMap
);
rDtos
.
addAll
(
infoDtos
);
}
rMap
.
put
(
"table"
,
rDtos
);
return
rMap
;
}
/**
* 城市经理上传的计划工号只能是自己
* @param row 表中的每一行数据
* @return
*/
private
List
<
ActivityPlanInfoDto
>
getRowByZNJSUp
(
ActivityPlanVo
planVo
,
List
<
Object
>
row
,
Map
<
String
,
Object
>
rMap
)
{
List
<
ActivityPlanInfoDto
>
dtos
=
new
ArrayList
<>();
LocalDate
now
=
LocalDate
.
now
();
int
monthValue
=
now
.
getMonthValue
();
int
nextMonthValue
=
now
.
plusMonths
(
1
).
getMonthValue
();
/**
* 5:多日期
*/
String
days
=
row
.
get
(
5
).
toString
();
String
[]
dayArr
=
days
.
split
(
"、"
);
for
(
int
i
=
0
;
i
<
dayArr
.
length
;
i
++)
{
ActivityPlanInfoDto
dto
=
new
ActivityPlanInfoDto
();
try
{
String
dayStr
=
dayArr
[
i
];
int
day
=
Integer
.
parseInt
(
dayStr
);
/**
* 0:工号
*/
Object
empNoO
=
row
.
get
(
0
);
if
(
planVo
.
getEmployeeNo
().
equals
(
empNoO
.
toString
()))
{
dto
.
setErrorMsg
(
"不能填写自己的工号;"
);
}
else
{
// 查询当前工号的人员信息
ManageEmployeeInfoDto
employeeInfoDto
=
manageEmployeeInfoDao
.
selectOne
(
new
ManageEmployeeWrapper
().
setEmployeeNo
(
empNoO
.
toString
()));
if
(
Objects
.
isNull
(
employeeInfoDto
))
{
dto
.
setErrorMsg
(
"员工不存在或被禁用;"
);
}
else
{
dto
.
setEmployeeId
(
employeeInfoDto
.
getId
());
dto
.
setEmployeeNo
(
employeeInfoDto
.
getEmployeeNo
());
dto
.
setEmployeeName
(
employeeInfoDto
.
getName
());
dto
.
setOrgQcId
(
employeeInfoDto
.
getDeptQcId
());
dto
.
setOrgName
(
employeeInfoDto
.
getDeptQcName
());
}
}
/**
* 1:门店编码
*/
String
sc
=
row
.
get
(
1
).
toString
();
StoreWrapper
storeWrap
=
new
StoreWrapper
().
setStoreCode
(
sc
);
QinCeClienteleStoreDto
storeDto
=
qinCeClienteleStoreDao
.
getOneStore
(
storeWrap
);
if
(
ObjectUtil
.
isEmpty
(
storeDto
))
{
dto
.
setErrorMsg
(
"门店编码错误;"
);
}
else
{
if
(
StringUtils
.
isAnyBlank
(
storeDto
.
getLineName
(),
storeDto
.
getDealersName
(),
storeDto
.
getDealerId
()))
{
dto
.
setErrorMsg
(
"门店「系统名称」或「经销商」为空,请到勤策中进充;"
);
}
dto
.
setLineName
(
storeDto
.
getLineName
());
dto
.
setStoreCode
(
sc
);
dto
.
setStoreName
(
storeDto
.
getStoreName
());
dto
.
setDealerId
(
storeDto
.
getDealerId
());
dto
.
setDealerName
(
storeDto
.
getDealersName
());
dto
.
setProvince
(
storeDto
.
getStoreMssProvince
());
dto
.
setCity
(
storeDto
.
getStoreMssCity
());
dto
.
setArea
(
storeDto
.
getStoreMssArea
());
dto
.
setAddr
(
storeDto
.
getStoreAddr
());
}
/**
* 3:活动模式
*/
String
pattern
=
row
.
get
(
3
).
toString
();
if
(
"单点CP,常规MINI秀,校园活动"
.
contains
(
pattern
))
{
dto
.
setPattern
(
pattern
);
}
else
{
dto
.
setErrorMsg
(
"活动模式分为:单点CP、常规MINI秀、校园活动;"
);
}
/**
* 4:月份 新增逻辑只支持次月计划;
* 6:促销员上班时间 当月份错误,促销员上下班时间也不进行计算
* 7:促销员下班时间
* 年份:当月份为1时,判定为跨年
*/
int
year
=
DateUtil
.
thisYear
();
int
monthInt
=
Integer
.
parseInt
(
row
.
get
(
4
).
toString
());
Month
month
=
Month
.
of
(
monthInt
);
if
(
month
.
equals
(
Month
.
JANUARY
))
{
year
+=
1
;
}
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
if
(
monthInt
!=
nextMonthValue
||
monthInt
!=
monthValue
)
{
dto
.
setErrorMsg
(
"月份只能是当月或次月;"
);
}
else
if
(
planDate
.
isBefore
(
LocalDate
.
now
()))
{
dto
.
setErrorMsg
(
"日期不能是以前;"
);
}
else
{
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:工资
dto
.
setSalary
(
new
BigDecimal
(
row
.
get
(
8
).
toString
()));
// 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
(
"月份、日期、时间需要调整;"
);
}
if
(
StringUtils
.
isNotBlank
(
dto
.
getErrorMsg
())){
rMap
.
remove
(
"uuid"
);
}
dtos
.
add
(
dto
);
}
return
dtos
;
}
/**
* 城市经理上传的计划工号只能是自己
* @param row 表中的每一行数据
...
...
@@ -181,7 +393,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto
.
setErrorMsg
(
"门店编码错误;"
);
}
else
{
if
(
StringUtils
.
isAnyBlank
(
storeDto
.
getLineName
(),
storeDto
.
getDealersName
(),
storeDto
.
getDealerId
()))
{
dto
.
setErrorMsg
(
"门店
系统名称或经销商
为空,请到勤策中进充;"
);
dto
.
setErrorMsg
(
"门店
「系统名称」或「经销商」
为空,请到勤策中进充;"
);
}
dto
.
setLineName
(
storeDto
.
getLineName
());
dto
.
setStoreCode
(
sc
);
...
...
@@ -210,16 +422,14 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
* 7:促销员下班时间
* 年份:当月份为1时,判定为跨年
*/
int
year
=
DateUtil
.
thisYear
();
int
monthInt
=
Integer
.
parseInt
(
row
.
get
(
4
).
toString
());
Month
month
=
Month
.
of
(
monthInt
);
if
(
month
.
equals
(
Month
.
JANUARY
))
{
year
+=
1
;
}
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
if
(
monthInt
!=
nextMonthValue
)
{
dto
.
setErrorMsg
(
"月份必需是下个月;"
);
}
else
{
if
(
monthInt
==
nextMonthValue
)
{
int
year
=
DateUtil
.
thisYear
();
Month
month
=
Month
.
of
(
monthInt
);
if
(
month
.
equals
(
Month
.
JANUARY
))
{
year
+=
1
;
}
LocalDate
planDate
=
LocalDate
.
of
(
year
,
month
,
day
);
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
());
...
...
@@ -232,6 +442,8 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto
.
setClockInTime
(
LocalDateTime
.
of
(
planDate
,
inLocalTime
));
dto
.
setClockOutTime
(
LocalDateTime
.
of
(
planDate
,
outLocalTime
));
}
}
else
{
dto
.
setErrorMsg
(
"月份必需是下个月;"
);
}
// 8:工资
...
...
@@ -242,7 +454,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
// 判断计划是否已存在
ActivityPlanInfoDto
hasDto
=
activityPlanInfoDao
.
selectPlan
(
dto
.
getStoreCode
(),
dto
.
getDate
());
if
(
Objects
.
nonNull
(
hasDto
))
{
dto
.
setErrorMsg
(
"
此
计划已存在,创建人:"
+
hasDto
.
getEmployeeName
()
+
",创建时间:"
+
DateUtil
.
formatDate
(
hasDto
.
getCreateTime
())
+
";"
);
dto
.
setErrorMsg
(
"计划已存在,创建人:"
+
hasDto
.
getEmployeeName
()
+
",创建时间:"
+
DateUtil
.
formatDate
(
hasDto
.
getCreateTime
())
+
";"
);
}
}
catch
(
DateTimeException
e
)
{
...
...
@@ -257,4 +469,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
return
dtos
;
}
}
src/main/java/com/wangxiaolu/promotion/service/user/ManageEmployeeQueryService.java
浏览文件 @
1139fb66
...
...
@@ -23,4 +23,6 @@ public interface ManageEmployeeQueryService {
boolean
hasByEmpNo
(
String
employeeNo
);
boolean
isOneSelf
(
Integer
employeeId
);
boolean
isAuth
(
Integer
employeeId
);
}
src/main/java/com/wangxiaolu/promotion/service/user/impl/ManageEmployeeQueryServiceImpl.java
浏览文件 @
1139fb66
...
...
@@ -62,4 +62,9 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic
public
boolean
isOneSelf
(
Integer
employeeId
)
{
return
manageEmployeeInfoDao
.
isOneSelf
(
employeeId
);
}
@Override
public
boolean
isAuth
(
Integer
employeeId
)
{
return
manageEmployeeInfoDao
.
isAuth
(
employeeId
);
}
}
src/main/java/com/wangxiaolu/promotion/utils/AliyunUtils.java
浏览文件 @
1139fb66
...
...
@@ -14,6 +14,7 @@ import com.aliyuncs.exceptions.ClientException;
import
com.aliyuncs.profile.DefaultProfile
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
com.aliyun.sts20150401.Client
;
import
javax.crypto.Mac
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
@@ -53,11 +54,11 @@ public class AliyunUtils {
public
JSONObject
getSignature
()
throws
JsonProcessingException
{
//获取发送STS请求基础信息
//
环境变量中
获取access_key_id
//获取access_key_id
String
accessKeyId
=
OSS_ACCESS_KEY_ID
;
//
环境变量中
获取access_key_secret
//获取access_key_secret
String
accessKeySecret
=
OSS_ACCESS_KEY_SECRET
;
//
环境变量中
获取ARN
//获取ARN
String
roleArnForOssUpload
=
OSS_STS_ROLE_ARN
;
//色会话名称,用来区分不同的令牌,可自定义
String
roleSessionName
=
YOUR_ROLE_SESSION_NAME
;
...
...
@@ -180,4 +181,22 @@ public class AliyunUtils {
throw
new
RuntimeException
(
"Failed to calculate HMAC-SHA256"
,
e
);
}
}
public
String
getStsToken
()
throws
Exception
{
com
.
aliyun
.
teaopenapi
.
models
.
Config
config
=
new
com
.
aliyun
.
teaopenapi
.
models
.
Config
()
.
setAccessKeyId
(
OSS_ACCESS_KEY_ID
)
.
setAccessKeySecret
(
OSS_ACCESS_KEY_SECRET
);
config
.
endpoint
=
"sts."
+
REGION_ID
+
".aliyuncs.com"
;
Client
client
=
new
Client
(
config
);
com
.
aliyun
.
sts20150401
.
models
.
AssumeRoleRequest
assumeRoleRequest
=
new
com
.
aliyun
.
sts20150401
.
models
.
AssumeRoleRequest
()
.
setDurationSeconds
(
3600L
)
.
setRoleArn
(
OSS_STS_ROLE_ARN
)
.
setRoleSessionName
(
"000516"
);
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
runtime
=
new
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
();
com
.
aliyun
.
sts20150401
.
models
.
AssumeRoleResponse
assumeRoleResponse
=
client
.
assumeRoleWithOptions
(
assumeRoleRequest
,
runtime
);
return
assumeRoleResponse
.
body
.
getCredentials
().
getSecurityToken
();
}
}
\ No newline at end of file
src/main/resources/mapper/ManageEmployeeInfoMapper.xml
浏览文件 @
1139fb66
...
...
@@ -67,8 +67,15 @@
where employee_id = (select id from manage_employee_info where employee_no = #{employeeNo});
</update>
<!-- 权限(1:oneself,2:admin)-->
<select
id=
"isOneSelf"
resultType=
"boolean"
>
select count(*) > 0
from manage_employee_ref_privilege where employee_id = #{employeeId} and privilege_id = 1;
</select>
<!-- 权限(1:oneself,2:admin)-->
<select
id=
"isAuth"
resultType=
"boolean"
>
select count(*) > 0
from manage_employee_ref_privilege where employee_id = #{employeeId} and privilege_id = 2;
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论