Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-supervisor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 41157774
authored
Mar 10, 2026
by
范富荣
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加报表任务提交接口
1 parent
4286f767
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
618 additions
and
6 deletions
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/dto/SupervisorTaskDTO.java
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/model/SupervisorTaskImage.java
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/model/SupervisorTaskInfo.java
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/remote/SupervisorTaskInfoRemote.java
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/utils/DateUtils.java
rpc-dj-supervisor/pom.xml
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/config/PlatformMerchantsDubboConfig.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorDayTaskJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorMonthTaskJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorWeekTaskJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/remote/SupervisorTaskInfoRemoteImpl.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskImageService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskInfoService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorWeekTaskStaffService.java
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/dto/SupervisorTaskDTO.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
dto
;
import
cn.com.glsx.dj.supervisor.model.SupervisorTaskImage
;
import
cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff
;
import
cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemote
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.ToString
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Data
@ToString
public
class
SupervisorTaskDTO
implements
Serializable
{
/**
* 主键ID
*/
@NotNull
(
message
=
"主键ID不能为空"
)
@ApiModelProperty
(
notes
=
"主键ID"
,
required
=
true
)
private
Long
id
;
@NotNull
(
message
=
"日报类型不能为空"
)
@ApiModelProperty
(
notes
=
"日报类型 0-日报 1-周报,2-月报, 3-录音"
,
required
=
true
)
private
Integer
taskType
;
@ApiModelProperty
(
notes
=
"任务状态 0-待完成 1-进行中,2-已完成"
)
private
Integer
taskStatus
;
@NotNull
(
groups
=
{
SupervisorTaskInfoRemote
.
SubmitDayTask
.
class
},
message
=
"在岗标识不能为空"
)
@ApiModelProperty
(
notes
=
"在岗标识 0-在岗 1-调休(日报)"
)
private
Integer
onDutyFlag
;
@NotNull
(
groups
=
{
SupervisorTaskInfoRemote
.
SubmitDayTask
.
class
},
message
=
"门店ID不能为空"
)
@ApiModelProperty
(
notes
=
"门店ID"
)
private
Integer
merchantId
;
@NotEmpty
(
groups
=
{
SupervisorTaskInfoRemote
.
SubmitDayTask
.
class
},
message
=
"门店名称不能为空"
)
@ApiModelProperty
(
notes
=
"门店名称"
)
private
String
merchantName
;
/**
* 督导记录(富文本内容)
*/
@NotEmpty
(
message
=
"督导记录不能为空"
)
@ApiModelProperty
(
notes
=
"督导记录"
,
required
=
true
)
private
String
taskContext
;
/**
* 更新时间
*/
@ApiModelProperty
(
notes
=
"更新时间"
)
private
Date
updatedDate
;
private
String
updatedBy
;
private
String
updatedPhone
;
/**
* 周任务人员列表
*/
@NotEmpty
(
groups
=
{
SupervisorTaskInfoRemote
.
SubmitWeekTask
.
class
},
message
=
"周任务复盘人员列表不能为空"
)
@ApiModelProperty
(
notes
=
"周任务人员列表"
)
private
List
<
SupervisorWeekTaskStaff
>
weekTaskStaffList
;
@NotEmpty
(
groups
=
{
SupervisorTaskInfoRemote
.
SubmitDayTask
.
class
,
SupervisorTaskInfoRemote
.
SubmitWeekTask
.
class
},
message
=
"照片图片列表不能为空"
)
@ApiModelProperty
(
notes
=
"照片图片列表"
)
private
List
<
SupervisorTaskImage
>
taskImageList
;
}
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/model/SupervisorTaskImage.java
View file @
4115777
...
@@ -4,6 +4,7 @@ import java.io.Serializable;
...
@@ -4,6 +4,7 @@ import java.io.Serializable;
import
java.util.Date
;
import
java.util.Date
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.ToString
;
import
lombok.ToString
;
...
@@ -27,6 +28,7 @@ public class SupervisorTaskImage implements Serializable {
...
@@ -27,6 +28,7 @@ public class SupervisorTaskImage implements Serializable {
/**
/**
* 图片地址(OSS/本地路径)
* 图片地址(OSS/本地路径)
*/
*/
@ApiModelProperty
(
notes
=
"图片地址(OSS/本地路径)"
)
@Column
(
name
=
"image_url"
)
@Column
(
name
=
"image_url"
)
private
String
imageUrl
;
private
String
imageUrl
;
...
...
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/model/SupervisorTaskInfo.java
View file @
4115777
...
@@ -41,13 +41,13 @@ public class SupervisorTaskInfo implements Serializable {
...
@@ -41,13 +41,13 @@ public class SupervisorTaskInfo implements Serializable {
private
Integer
onDutyFlag
;
private
Integer
onDutyFlag
;
/**
/**
* 门店ID
(关联门店表)
* 门店ID
*/
*/
@Column
(
name
=
"merchant_id"
)
@Column
(
name
=
"merchant_id"
)
private
Long
merchantId
;
private
Integer
merchantId
;
/**
/**
* 门店名称
(冗余字段)
* 门店名称
*/
*/
@Column
(
name
=
"merchant_name"
)
@Column
(
name
=
"merchant_name"
)
private
String
merchantName
;
private
String
merchantName
;
...
@@ -77,6 +77,12 @@ public class SupervisorTaskInfo implements Serializable {
...
@@ -77,6 +77,12 @@ public class SupervisorTaskInfo implements Serializable {
private
String
supervisorName
;
private
String
supervisorName
;
/**
/**
* 督导UUID
*/
@Column
(
name
=
"supervisor_uuid"
)
private
String
supervisorUuid
;
/**
* 创建人姓名
* 创建人姓名
*/
*/
@Column
(
name
=
"created_by"
)
@Column
(
name
=
"created_by"
)
...
...
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/remote/SupervisorTaskInfoRemote.java
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
remote
;
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
remote
;
import
cn.com.glsx.framework.core.annotation.ApiService
;
import
cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO
;
import
cn.com.glsx.framework.core.annotation.*
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
@ApiService
(
value
=
"督导任务"
,
owner
=
"fanfr"
)
@ApiService
(
value
=
"督导任务"
,
owner
=
"fanfr"
)
public
interface
SupervisorTaskInfoRemote
{
public
interface
SupervisorTaskInfoRemote
{
@interface
SubmitDayTask
{}
@ApiMethod
(
"提交日报任务"
)
@ApiParams
({
@ApiParam
(
name
=
"request"
,
notes
=
"日报信息"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)})
@ApiResponse
(
"提交结果"
)
RpcResponse
<
Boolean
>
submitDayTask
(
SupervisorTaskDTO
request
);
@interface
SubmitWeekTask
{}
@ApiMethod
(
"提交周报任务"
)
@ApiParams
({
@ApiParam
(
name
=
"request"
,
notes
=
"周报信息"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)})
@ApiResponse
(
"提交结果"
)
RpcResponse
<
Boolean
>
submitWeekTask
(
SupervisorTaskDTO
request
);
@ApiMethod
(
"提交月报任务"
)
@ApiParams
({
@ApiParam
(
name
=
"request"
,
notes
=
"月报信息"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)})
@ApiResponse
(
"提交结果"
)
RpcResponse
<
Boolean
>
submitMonthTask
(
SupervisorTaskDTO
request
);
}
}
rpc-dj-supervisor-api/src/main/java/cn/com/glsx/dj/supervisor/utils/DateUtils.java
View file @
4115777
...
@@ -325,6 +325,19 @@ public class DateUtils extends cn.com.glsx.framework.core.util.DateUtils {
...
@@ -325,6 +325,19 @@ public class DateUtils extends cn.com.glsx.framework.core.util.DateUtils {
return
calendar
.
getTime
();
return
calendar
.
getTime
();
}
}
/**
* 获取指定Date日期参数的当月开始日期Date
*/
public
static
Date
getDateStartMonth
(
Date
date
)
{
if
(
date
==
null
)
{
return
null
;
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
return
calendar
.
getTime
();
}
/**
/**
* 生成今年的月份列表Date类型
* 生成今年的月份列表Date类型
...
...
rpc-dj-supervisor/pom.xml
View file @
4115777
...
@@ -19,6 +19,16 @@
...
@@ -19,6 +19,16 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.oreframework.boot
</groupId>
<artifactId>
ore-boot-starter-redis
</artifactId>
</dependency>
<dependency>
<groupId>
org.oreframework.boot
</groupId>
<artifactId>
ore-boot-starter-distribute-lock
</artifactId>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp
</artifactId>
<artifactId>
okhttp
</artifactId>
<version>
3.14.8
</version>
<version>
3.14.8
</version>
...
@@ -33,7 +43,11 @@
...
@@ -33,7 +43,11 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
cn.com.glsx.merchants
</groupId>
<artifactId>
platform-merchants-api
</artifactId>
<version>
5.6.1-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
\ No newline at end of file
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/config/PlatformMerchantsDubboConfig.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
config
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.merchants.remote.MerchantRoleRemote
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
PlatformMerchantsDubboConfig
extends
DubboConfig
{
@Bean
public
MerchantStaffRemote
merchantStaffRemote
(){
return
factory
.
builder
(
MerchantStaffRemote
.
class
).
timeout
(
timeout
).
check
(
check
).
version
(
"2.0.0"
).
build
();
}
@Bean
public
MerchantRoleRemote
merchantRoleRemote
()
{
return
factory
.
builder
(
MerchantRoleRemote
.
class
).
version
(
"2.0.0"
).
check
(
check
).
timeout
(
timeout
).
build
();
}
@Bean
public
MerchantRemote
MerchantRemote
(){
return
factory
.
builder
(
MerchantRemote
.
class
).
version
(
"2.0.0"
).
check
(
check
).
timeout
(
timeout
).
build
();
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorDayTaskJob.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* 督导日报任务定时生成任务
* 每日凌晨1点0分0秒开始执行
*
*/
@Service
@ElasticJobConf
(
name
=
"SupervisorDayTaskJob"
,
cron
=
"0 0 1 * * ?"
,
description
=
"督导日报任务定时生成任务"
,
overwrite
=
true
)
@Slf4j
public
class
SupervisorDayTaskJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
try
{
String
startTimeStr
=
shardingContext
.
getJobParameter
();
log
.
info
(
"督导日报生成任务开始执行,runTime: {}"
,
startTimeStr
);
if
(
StringUtils
.
isBlank
(
startTimeStr
))
{
Date
date
=
new
Date
();
startTimeStr
=
DateUtils
.
formatDate
(
date
);
}
supervisorTaskInfoService
.
generateDayTask
(
startTimeStr
);
log
.
info
(
"督导日报生成任务结束"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"督导日报生成定时任务执行异常 {}"
,
e
);
}
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorMonthTaskJob.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* 督导月报任务定时生成任务
* 每月一号凌晨1点10分0秒开始执行
*
*/
@Service
@ElasticJobConf
(
name
=
"SupervisorMonthTaskJob"
,
cron
=
"0 10 1 1 * ?"
,
description
=
"督导月报任务定时生成任务"
,
overwrite
=
true
)
@Slf4j
public
class
SupervisorMonthTaskJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
try
{
String
dates
=
shardingContext
.
getJobParameter
();
log
.
info
(
"督导月报生成任务开始执行,入参: {}"
,
dates
);
String
startTimeStr
=
null
;
String
endTimeStr
=
null
;
if
(
StringUtils
.
isBlank
(
dates
))
{
Date
date
=
new
Date
();
//根据当前日期,计算本月日期的起始和结束日期
startTimeStr
=
DateUtils
.
formatDate
(
DateUtils
.
getDateStartMonth
(
date
));
endTimeStr
=
DateUtils
.
formatDate
(
DateUtils
.
getDateEndMonth
(
date
));
}
else
{
String
[]
dateArray
=
dates
.
split
(
","
);
startTimeStr
=
dateArray
[
0
];
endTimeStr
=
dateArray
[
1
];
}
supervisorTaskInfoService
.
generateMonthTask
(
startTimeStr
,
endTimeStr
);
log
.
info
(
"督导月报生成任务结束"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"督导月报生成定时任务执行异常 {}"
,
e
);
}
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorWeekTaskJob.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* 督导周报任务定时生成任务
* 每周一凌晨1点5分0秒开始执行
*
*/
@Service
@ElasticJobConf
(
name
=
"SupervisorWeekTaskJob"
,
cron
=
"0 5 1 ? * 1"
,
description
=
"督导周报任务定时生成任务"
,
overwrite
=
true
)
@Slf4j
public
class
SupervisorWeekTaskJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
try
{
String
dates
=
shardingContext
.
getJobParameter
();
log
.
info
(
"督导周报生成任务开始执行,入参: {}"
,
dates
);
String
startTimeStr
=
null
;
String
endTimeStr
=
null
;
if
(
StringUtils
.
isBlank
(
dates
))
{
Date
date
=
new
Date
();
//根据当前日期,计算本周日期的起始和结束日期
startTimeStr
=
DateUtils
.
formatDate
(
DateUtils
.
getMondayOfWeek
(
date
));
endTimeStr
=
DateUtils
.
formatDate
(
DateUtils
.
getSundayOfWeek
(
date
));
}
else
{
String
[]
dateArray
=
dates
.
split
(
","
);
startTimeStr
=
dateArray
[
0
];
endTimeStr
=
dateArray
[
1
];
}
supervisorTaskInfoService
.
generateWeekTask
(
startTimeStr
,
endTimeStr
);
log
.
info
(
"督导周报生成任务结束"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"督导周报生成定时任务执行异常 {}"
,
e
);
}
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/remote/SupervisorTaskInfoRemoteImpl.java
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
remote
;
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
remote
;
import
cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
@Slf4j
@Slf4j
@DubboService
(
retries
=
0
,
timeout
=
30000
)
@DubboService
(
retries
=
0
,
timeout
=
30000
,
validation
=
"true"
)
public
class
SupervisorTaskInfoRemoteImpl
implements
SupervisorTaskInfoRemote
{
public
class
SupervisorTaskInfoRemoteImpl
implements
SupervisorTaskInfoRemote
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Override
public
RpcResponse
<
Boolean
>
submitDayTask
(
SupervisorTaskDTO
request
)
{
try
{
Boolean
result
=
supervisorTaskInfoService
.
submitDayTask
(
request
);
return
RpcResponse
.
success
(
result
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitDayTask error {}"
,
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitDayTask system error {}"
,
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVER_ERROR
,
e
.
getMessage
());
}
}
@Override
public
RpcResponse
<
Boolean
>
submitWeekTask
(
SupervisorTaskDTO
request
)
{
try
{
Boolean
result
=
supervisorTaskInfoService
.
submitWeekTask
(
request
);
return
RpcResponse
.
success
(
result
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitWeekTask error {}"
,
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitWeekTask system error {}"
,
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVER_ERROR
,
e
.
getMessage
());
}
}
@Override
public
RpcResponse
<
Boolean
>
submitMonthTask
(
SupervisorTaskDTO
request
)
{
try
{
Boolean
result
=
supervisorTaskInfoService
.
submitMonthTask
(
request
);
return
RpcResponse
.
success
(
result
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitMonthTask error {}"
,
e
);
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemoteImpl.submitMonthTask system error {}"
,
e
);
return
RpcResponse
.
error
(
DefaultErrorEnum
.
SERVER_ERROR
,
e
.
getMessage
());
}
}
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskImageService.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
service
;
import
cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO
;
import
cn.com.glsx.dj.supervisor.mapper.SupervisorTaskImageMapper
;
import
cn.com.glsx.dj.supervisor.model.SupervisorTaskImage
;
import
cn.com.glsx.framework.core.beans.BaseModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
public
class
SupervisorTaskImageService
{
@Autowired
private
SupervisorTaskImageMapper
supervisorTaskImageMapper
;
/**
* 批量插入图片
*
* @param request
* @param date
* @return
*/
public
int
batchInsertImage
(
SupervisorTaskDTO
request
,
Date
date
)
{
//插入图片列表
List
<
SupervisorTaskImage
>
taskImageList
=
request
.
getTaskImageList
();
if
(
CollectionUtils
.
isNotEmpty
(
taskImageList
))
{
taskImageList
.
stream
().
forEach
(
image
->
{
image
.
setRelationId
(
request
.
getId
());
image
.
setCreatedBy
(
request
.
getUpdatedBy
());
image
.
setCreateTime
(
date
);
image
.
setDeletedFlag
(
BaseModel
.
DeletedFlagEnum
.
N
.
name
());
});
return
supervisorTaskImageMapper
.
insertList
(
taskImageList
);
}
return
0
;
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskInfoService.java
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
service
;
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
service
;
import
cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO
;
import
cn.com.glsx.dj.supervisor.enums.TaskStatusEnum
;
import
cn.com.glsx.dj.supervisor.enums.TaskTypeEnum
;
import
cn.com.glsx.dj.supervisor.mapper.SupervisorTaskInfoMapper
;
import
cn.com.glsx.dj.supervisor.mapper.SupervisorTaskInfoMapper
;
import
cn.com.glsx.dj.supervisor.model.SupervisorTaskInfo
;
import
cn.com.glsx.framework.core.beans.BaseModel
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.merchants.model.request.MerchantStaffRequest
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.distribute.lock.annotation.GlsxDistributeLockable
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
@Slf4j
...
@@ -12,4 +33,158 @@ public class SupervisorTaskInfoService {
...
@@ -12,4 +33,158 @@ public class SupervisorTaskInfoService {
@Autowired
@Autowired
private
SupervisorTaskInfoMapper
supervisorTaskInfoMapper
;
private
SupervisorTaskInfoMapper
supervisorTaskInfoMapper
;
@Autowired
private
MerchantStaffRemote
merchantStaffRemote
;
@Autowired
private
Environment
env
;
@Autowired
private
SupervisorTaskImageService
supervisorTaskImageService
;
@Autowired
private
SupervisorWeekTaskStaffService
supervisorWeekTaskStaffService
;
/**
* 生成日报信息
* @param startTimeStr 日报的开始时间,yyyy-MM-dd
*/
public
void
generateDayTask
(
String
startTimeStr
)
{
//日报的起止时间相同
generateTask
(
TaskTypeEnum
.
DAILY_REPORT
.
getCode
(),
startTimeStr
,
startTimeStr
);
}
public
void
generateTask
(
Integer
taskType
,
String
startTimeStr
,
String
endTimeStr
)
{
//查询督导人员列表
List
<
MerchantStaffResponse
>
staffList
=
listAllSupervisors
();
if
(
CollectionUtils
.
isEmpty
(
staffList
))
{
log
.
error
(
"查询督导人员列表为空,startTimeStr={}"
,
startTimeStr
);
return
;
}
//遍历列表,为每个督导初始化日报信息
Date
date
=
new
Date
();
List
<
SupervisorTaskInfo
>
taskList
=
staffList
.
stream
().
map
(
x
->
{
SupervisorTaskInfo
taskInfo
=
new
SupervisorTaskInfo
();
taskInfo
.
setTaskType
(
taskType
);
taskInfo
.
setTaskStatus
(
TaskStatusEnum
.
PENDING
.
getCode
());
taskInfo
.
setStartDate
(
startTimeStr
);
taskInfo
.
setEndDate
(
endTimeStr
);
taskInfo
.
setSupervisorPhone
(
x
.
getStaffPhone
());
taskInfo
.
setSupervisorName
(
x
.
getStaffName
());
taskInfo
.
setSupervisorUuid
(
x
.
getUuid
());
taskInfo
.
setCreatedBy
(
"system"
);
taskInfo
.
setCreateTime
(
date
);
taskInfo
.
setDeletedFlag
(
BaseModel
.
DeletedFlagEnum
.
N
.
name
());
return
taskInfo
;
}).
collect
(
Collectors
.
toList
());
//批量入库
supervisorTaskInfoMapper
.
insertList
(
taskList
);
}
/**
* 生成周报信息
* @param startTimeStr 周报的开始时间,yyyy-MM-dd
* @param endTimeStr 周报的结束时间,yyyy-MM-dd
*/
public
void
generateWeekTask
(
String
startTimeStr
,
String
endTimeStr
)
{
generateTask
(
TaskTypeEnum
.
WEEKLY_REPORT
.
getCode
(),
startTimeStr
,
endTimeStr
);
}
public
void
generateMonthTask
(
String
startTimeStr
,
String
endTimeStr
)
{
generateTask
(
TaskTypeEnum
.
MONTHLY_REPORT
.
getCode
(),
startTimeStr
,
endTimeStr
);
}
/**
* 查询所有飞行督导人员
* @return
*/
public
List
<
MerchantStaffResponse
>
listAllSupervisors
()
{
//查询督导人员列表
MerchantStaffRequest
staffRequest
=
new
MerchantStaffRequest
();
staffRequest
.
setMerchantNo
(
env
.
getProperty
(
"glsk_merchant_id"
,
Integer
.
class
,
44205577
));
staffRequest
.
setRoleName
(
env
.
getProperty
(
"glsk_supervisor_role_name"
,
String
.
class
,
"飞行督导"
));
staffRequest
.
setDelFlag
((
byte
)
0
);
// 过滤被删除被禁用的员工
RpcResponse
<
List
<
MerchantStaffResponse
>>
response
=
merchantStaffRemote
.
findMerchantStaffListRemote
(
staffRequest
);
if
(
response
.
hasResult
())
{
return
response
.
getResult
();
}
else
{
log
.
error
(
"查询督导人员列表失败,merchantNo={}, roleName={}, message={}"
,
staffRequest
.
getMerchantNo
(),
staffRequest
.
getRoleName
(),
response
.
getMessage
());
throw
new
RpcServiceException
(
DefaultErrorEnum
.
RPC_ERROR
,
response
.
getMessage
());
}
}
/**
* 提交日任务
* @param request
* @return
*/
public
Boolean
submitDayTask
(
SupervisorTaskDTO
request
)
{
return
doSubmitTask
(
request
);
}
/**
* 提价任务
* @param request
* @return
*/
@GlsxDistributeLockable
(
name
=
"'SupervisorTaskInfoService_doSubmitTask_' +#request.id"
,
timeoutException
=
Exception
.
class
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
public
Boolean
doSubmitTask
(
SupervisorTaskDTO
request
)
{
//根据id查询任务信息
SupervisorTaskInfo
taskInfo
=
supervisorTaskInfoMapper
.
selectByPrimaryKey
(
request
.
getId
());
if
(
taskInfo
==
null
)
{
log
.
error
(
"根据id查询任务信息不存在,id={}"
,
request
.
getId
());
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATA_NOT_EXIST
,
"根据id查询任务信息不存在"
);
}
//判断是否已经完成
if
(
TaskStatusEnum
.
COMPLETED
.
getCode
().
equals
(
taskInfo
.
getTaskStatus
()))
{
log
.
error
(
"任务信息已完成,id={}"
,
request
.
getId
());
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATA_NOT_EXIST
,
"任务信息已完成"
);
}
SupervisorTaskInfo
update
=
new
SupervisorTaskInfo
();
Date
date
=
new
Date
();
BeanUtils
.
copyProperties
(
request
,
update
);
update
.
setId
(
taskInfo
.
getId
());
update
.
setTaskStatus
(
TaskStatusEnum
.
COMPLETED
.
getCode
());
update
.
setUpdatedDate
(
date
);
int
count
=
supervisorTaskInfoMapper
.
updateByPrimaryKeySelective
(
update
);
if
(
count
<=
0
)
{
log
.
error
(
"更新任务信息失败,id={}"
,
request
.
getId
());
throw
new
RpcServiceException
(
DefaultErrorEnum
.
DATABASE_ERROR
,
"更新任务信息失败"
);
}
//插入图片列表
supervisorTaskImageService
.
batchInsertImage
(
request
,
date
);
//判断是否是周报
if
(
TaskTypeEnum
.
WEEKLY_REPORT
.
getCode
().
equals
(
taskInfo
.
getTaskType
()))
{
//插入周任务员工列表
supervisorWeekTaskStaffService
.
batchInsert
(
request
,
date
);
}
return
true
;
}
/**
* 提交周任务
* @param request
* @return
*/
public
Boolean
submitWeekTask
(
SupervisorTaskDTO
request
)
{
return
doSubmitTask
(
request
);
}
/**
* 提交月任务
* @param request
* @return
*/
public
Boolean
submitMonthTask
(
SupervisorTaskDTO
request
)
{
return
doSubmitTask
(
request
);
}
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorWeekTaskStaffService.java
0 → 100644
View file @
4115777
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
service
;
import
cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO
;
import
cn.com.glsx.dj.supervisor.mapper.SupervisorWeekTaskStaffMapper
;
import
cn.com.glsx.dj.supervisor.model.SupervisorWeekTaskStaff
;
import
cn.com.glsx.framework.core.beans.BaseModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
@Slf4j
public
class
SupervisorWeekTaskStaffService
{
@Autowired
private
SupervisorWeekTaskStaffMapper
supervisorWeekTaskStaffMapper
;
/**
* 批量插入周任务员工列表
* @param request
* @param date
* @return
*/
public
int
batchInsert
(
SupervisorTaskDTO
request
,
Date
date
)
{
List
<
SupervisorWeekTaskStaff
>
weekTaskStaffList
=
request
.
getWeekTaskStaffList
();
if
(
CollectionUtils
.
isNotEmpty
(
weekTaskStaffList
))
{
weekTaskStaffList
.
stream
().
forEach
(
weekTaskStaff
->
{
weekTaskStaff
.
setRelationId
(
request
.
getId
());
weekTaskStaff
.
setCreatedBy
(
request
.
getUpdatedBy
());
weekTaskStaff
.
setCreateTime
(
date
);
weekTaskStaff
.
setDeletedFlag
(
BaseModel
.
DeletedFlagEnum
.
N
.
name
());
});
return
supervisorWeekTaskStaffMapper
.
insertList
(
weekTaskStaffList
);
}
return
0
;
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment