Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
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 df47ee7a
authored
Oct 09, 2023
by
tiger
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v1.0.1' of
http://192.168.3.233:8090/platform/platform-process-server
into v1.0.1
2 parents
559d76a9
dad2a8c2
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
277 additions
and
54 deletions
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopTplNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstNodeSkipEnum.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstNodeStatusEnum.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopTplNodeSkipableEnum.java
platform-process/src/main/java/cn/com/glsx/Application.java
platform-process/src/main/java/cn/com/glsx/process/common/sysenum/ResultEnum.java
platform-process/src/main/java/cn/com/glsx/process/exception/AdminException.java
platform-process/src/main/java/cn/com/glsx/process/exception/AdminExceptionHandler.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/TestXXLJobController.java
platform-process/src/main/java/cn/com/glsx/process/modules/model/SopCustomerExcelDTO.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitMQConstants.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/util/SopTplParamHandler.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
View file @
df47ee7
...
@@ -11,12 +11,6 @@ import javax.persistence.Transient;
...
@@ -11,12 +11,6 @@ import javax.persistence.Transient;
@Table
(
name
=
"sop_inst_node"
)
@Table
(
name
=
"sop_inst_node"
)
public
class
SopInstNode
{
public
class
SopInstNode
{
public
static
final
byte
NODE_SKIP_FALSE
=
0
;
public
static
final
byte
NODE_SKIP_TRUE
=
1
;
public
static
final
int
NODE_STATUS_DELETED
=
0
;
public
static
final
int
NODE_STATUS_NORMAL
=
1
;
/**
/**
* 实例节点id
* 实例节点id
*/
*/
...
...
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopTplNode.java
View file @
df47ee7
...
@@ -7,9 +7,6 @@ import javax.persistence.Table;
...
@@ -7,9 +7,6 @@ import javax.persistence.Table;
@Table
(
name
=
"sop_tpl_node"
)
@Table
(
name
=
"sop_tpl_node"
)
public
class
SopTplNode
{
public
class
SopTplNode
{
public
static
final
byte
NODE_SKIPABLE_NO
=
0
;
public
static
final
byte
NODE_SKIPABLE_YES
=
1
;
/**
/**
* 节点id
* 节点id
*/
*/
...
...
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstNodeSkipEnum.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
modules
.
model
.
enums
;
public
enum
SopInstNodeSkipEnum
{
FALSE
(
"不跳过节点"
,
(
byte
)
0
),
TRUE
(
"跳过节点"
,
(
byte
)
1
);
private
String
name
;
private
byte
value
;
SopInstNodeSkipEnum
(
String
name
,
byte
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
byte
getValue
()
{
return
value
;
}
public
void
setValue
(
byte
value
)
{
this
.
value
=
value
;
}
}
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstNodeStatusEnum.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
modules
.
model
.
enums
;
public
enum
SopInstNodeStatusEnum
{
DELETED
(
"停用"
,
0
),
NORMAL
(
"启用"
,
1
);
private
String
name
;
private
int
value
;
SopInstNodeStatusEnum
(
String
name
,
int
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
int
getValue
()
{
return
value
;
}
public
void
setValue
(
int
value
)
{
this
.
value
=
value
;
}
}
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopTplNodeSkipableEnum.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
modules
.
model
.
enums
;
public
enum
SopTplNodeSkipableEnum
{
NO
(
"不可跳过节点"
,
(
byte
)
0
),
YES
(
"可跳过节点"
,
(
byte
)
1
);
private
String
name
;
private
byte
value
;
SopTplNodeSkipableEnum
(
String
name
,
byte
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
byte
getValue
()
{
return
value
;
}
public
void
setValue
(
byte
value
)
{
this
.
value
=
value
;
}
}
platform-process/src/main/java/cn/com/glsx/Application.java
View file @
df47ee7
package
cn
.
com
.
glsx
;
package
cn
.
com
.
glsx
;
import
static
java
.
time
.
ZoneId
.
of
;
import
static
java
.
util
.
TimeZone
.
getTimeZone
;
import
java.util.TimeZone
;
import
javax.annotation.PostConstruct
;
import
cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil
;
import
com.glsx.plat.context.EnableRestAdmin
;
import
org.apache.dubbo.config.spring.context.annotation.EnableDubbo
;
import
org.apache.dubbo.config.spring.context.annotation.EnableDubbo
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
...
@@ -16,9 +12,11 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
...
@@ -16,9 +12,11 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
com.glsx.plat.context.EnableRestAdmin
;
import
javax.annotation.PostConstruct
;
import
java.util.TimeZone
;
import
cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil
;
import
static
java
.
time
.
ZoneId
.
of
;
import
static
java
.
util
.
TimeZone
.
getTimeZone
;
/**
/**
* @author payu
* @author payu
...
@@ -26,7 +24,7 @@ import cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil;
...
@@ -26,7 +24,7 @@ import cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil;
@EnableDubbo
@EnableDubbo
@EnableRestAdmin
@EnableRestAdmin
@EnableDiscoveryClient
@EnableDiscoveryClient
@EnableFeignClients
(
basePackages
=
{
"cn.com.glsx.*.api"
,
"cn.com.glsx.process.modules.client"
})
@EnableFeignClients
(
basePackages
=
{
"cn.com.glsx.*.api"
})
@SpringBootApplication
@SpringBootApplication
@EnableAspectJAutoProxy
@EnableAspectJAutoProxy
@EnableTransactionManagement
@EnableTransactionManagement
...
...
platform-process/src/main/java/cn/com/glsx/process/common/sysenum/ResultEnum.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
common
.
sysenum
;
import
com.glsx.plat.exception.SystemMessage
;
/**
* 试驾服务错误码
*
* @author zhouhaibao
*/
public
enum
ResultEnum
{
PARAM_ERROR
(
1001
,
"参数错误"
),
FEIGN_REQUEST_ERROR
(
1002
,
"feign请求异常"
),
DATA_HANDLE_ERROR
(
1003
,
"数据处理异常"
);
private
final
Integer
code
;
private
final
String
message
;
ResultEnum
(
Integer
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
ResultEnum
(
SystemMessage
systemMessage
)
{
this
.
code
=
systemMessage
.
getCode
();
this
.
message
=
systemMessage
.
getMsg
();
}
public
Integer
getCode
()
{
return
code
;
}
public
String
getMessage
()
{
return
message
;
}
}
platform-process/src/main/java/cn/com/glsx/process/exception/AdminException.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
exception
;
import
cn.com.glsx.process.common.sysenum.ResultEnum
;
import
com.glsx.plat.exception.SystemMessage
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* @author payu
*/
@Setter
@Getter
public
class
AdminException
extends
RuntimeException
{
private
int
errorCode
;
private
String
message
;
public
AdminException
()
{
}
public
AdminException
(
String
message
)
{
super
(
message
);
this
.
errorCode
=
SystemMessage
.
FAILURE
.
getCode
();
this
.
message
=
message
;
}
public
AdminException
(
int
errorCode
,
String
message
)
{
super
(
message
);
this
.
errorCode
=
errorCode
;
this
.
message
=
message
;
}
public
AdminException
(
ResultEnum
resultEnum
)
{
this
.
errorCode
=
resultEnum
.
getCode
();
this
.
message
=
resultEnum
.
getMessage
();
}
public
AdminException
(
Throwable
cause
)
{
super
(
cause
);
}
public
AdminException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
platform-process/src/main/java/cn/com/glsx/process/exception/AdminExceptionHandler.java
0 → 100644
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
exception
;
import
com.alibaba.excel.exception.ExcelDataConvertException
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.exception.ExceptionLevel
;
import
com.glsx.plat.exception.GlobalRExceptionHandler
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.binding.BindingException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
* 全局异常处理
*
* @author payu
*/
@Slf4j
@RestControllerAdvice
public
class
AdminExceptionHandler
extends
GlobalRExceptionHandler
{
@ExceptionHandler
(
AdminException
.
class
)
public
R
handleAdminException
(
AdminException
e
)
{
return
R
.
error
(
e
.
getErrorCode
(),
e
.
getMessage
());
}
/**
* Mybatis BindingException
*
* @param e
* @return
*/
@ExceptionHandler
(
BindingException
.
class
)
public
R
handleBindingException
(
BindingException
e
)
{
return
R
.
error
(
e
.
getMessage
());
}
@ExceptionHandler
(
ExcelDataConvertException
.
class
)
public
R
handleExcelDataConvertException
(
ExcelDataConvertException
e
)
{
return
R
.
error
(
e
.
getMessage
());
}
@Override
protected
void
saveException
(
Exception
e
,
ExceptionLevel
level
)
{
super
.
saveException
(
e
,
level
);
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/controller/TestXXLJobController.java
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
modules
.
controller
;
package
cn
.
com
.
glsx
.
process
.
modules
.
controller
;
import
cn.com.glsx.process.common.sysenum.ResultEnum
;
import
cn.com.glsx.process.exception.AdminException
;
import
com.glsx.plat.exception.BusinessException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -29,8 +32,7 @@ public class TestXXLJobController {
...
@@ -29,8 +32,7 @@ public class TestXXLJobController {
@GetMapping
(
"/jobtest"
)
@GetMapping
(
"/jobtest"
)
@Operation
(
summary
=
"动态任务添加"
,
description
=
"动态任务添加"
)
@Operation
(
summary
=
"动态任务添加"
,
description
=
"动态任务添加"
)
public
void
addtest
(
@RequestParam
(
"cron"
)
String
cron
,
@RequestParam
(
"jobName"
)
String
jobName
,
@RequestParam
(
"param"
)
String
param
,
public
void
addtest
(
@RequestParam
(
"cron"
)
String
cron
,
@RequestParam
(
"jobName"
)
String
jobName
,
@RequestParam
(
"param"
)
String
param
,
@RequestParam
(
"executorHandler"
)
String
executorHandler
,
@RequestParam
(
"busKey"
)
String
busKey
)
{
@RequestParam
(
"executorHandler"
)
String
executorHandler
,
@RequestParam
(
"busKey"
)
String
busKey
)
{
// cron表达式
// cron表达式
XxlJobInfo
jobInfo
=
new
XxlJobInfo
();
XxlJobInfo
jobInfo
=
new
XxlJobInfo
();
jobInfo
.
setExecutorParam
(
param
);
jobInfo
.
setExecutorParam
(
param
);
...
@@ -44,11 +46,7 @@ public class TestXXLJobController {
...
@@ -44,11 +46,7 @@ public class TestXXLJobController {
@PostMapping
(
"/jobtestupdate"
)
@PostMapping
(
"/jobtestupdate"
)
@Operation
(
summary
=
"动态任务更新"
,
description
=
"动态任务更新"
)
@Operation
(
summary
=
"动态任务更新"
,
description
=
"动态任务更新"
)
public
void
updatetest
(
@RequestParam
(
value
=
"cron"
,
required
=
false
)
String
cron
,
public
void
updatetest
(
@RequestParam
(
value
=
"cron"
,
required
=
false
)
String
cron
,
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
value
=
"executorParam"
,
required
=
false
)
String
executorParam
,
@RequestParam
(
value
=
"jobDesc"
,
required
=
false
)
String
jobDesc
,
@RequestParam
(
value
=
"triggerStatus"
,
required
=
false
)
Integer
triggerStatus
)
{
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
value
=
"executorParam"
,
required
=
false
)
String
executorParam
,
@RequestParam
(
value
=
"jobDesc"
,
required
=
false
)
String
jobDesc
,
@RequestParam
(
value
=
"triggerStatus"
,
required
=
false
)
Integer
triggerStatus
)
{
XxlJobInfo
jobInfo
=
new
XxlJobInfo
();
XxlJobInfo
jobInfo
=
new
XxlJobInfo
();
jobInfo
.
setBusKey
(
id
);
jobInfo
.
setBusKey
(
id
);
jobInfo
.
setScheduleConf
(
cron
);
jobInfo
.
setScheduleConf
(
cron
);
...
@@ -91,6 +89,9 @@ public class TestXXLJobController {
...
@@ -91,6 +89,9 @@ public class TestXXLJobController {
@PostMapping
(
"/testJava"
)
@PostMapping
(
"/testJava"
)
@Operation
(
summary
=
"测试java"
,
description
=
"动态任务触发"
)
@Operation
(
summary
=
"测试java"
,
description
=
"动态任务触发"
)
public
R
testJava
(
@RequestParam
(
"busKey"
)
String
busKey
)
throws
Exception
{
public
R
testJava
(
@RequestParam
(
"busKey"
)
String
busKey
)
throws
Exception
{
if
(
true
)
{
throw
new
AdminException
(
ResultEnum
.
PARAM_ERROR
);
}
return
R
.
ok
().
data
(
userDemoService
.
testJava
(
busKey
));
return
R
.
ok
().
data
(
userDemoService
.
testJava
(
busKey
));
}
}
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/model/SopCustomerExcelDTO.java
View file @
df47ee7
...
@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelIgnore;
...
@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Objects
;
/**
/**
*
*
...
@@ -75,6 +76,10 @@ public class SopCustomerExcelDTO {
...
@@ -75,6 +76,10 @@ public class SopCustomerExcelDTO {
}
}
public
int
getSopJourneyDays
()
{
public
int
getSopJourneyDays
()
{
if
(
Objects
.
isNull
(
sopJourneyEnterTime
))
{
return
0
;
}
Date
now
=
new
Date
();
Date
now
=
new
Date
();
long
nowTime
=
now
.
getTime
();
long
nowTime
=
now
.
getTime
();
long
enterTime
=
sopJourneyEnterTime
.
getTime
();
long
enterTime
=
sopJourneyEnterTime
.
getTime
();
...
@@ -103,7 +108,10 @@ public class SopCustomerExcelDTO {
...
@@ -103,7 +108,10 @@ public class SopCustomerExcelDTO {
}
}
public
int
getSopJourneyStageDays
()
{
public
int
getSopJourneyStageDays
()
{
// TODO 注意空指针
if
(
Objects
.
isNull
(
sopJourneyStageEnterTime
))
{
return
0
;
}
Date
now
=
new
Date
();
Date
now
=
new
Date
();
long
nowTime
=
now
.
getTime
();
long
nowTime
=
now
.
getTime
();
long
enterTime
=
sopJourneyStageEnterTime
.
getTime
();
long
enterTime
=
sopJourneyStageEnterTime
.
getTime
();
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
View file @
df47ee7
...
@@ -10,10 +10,6 @@ import org.springframework.context.annotation.Configuration;
...
@@ -10,10 +10,6 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@Configuration
public
class
RabbitConfig
{
public
class
RabbitConfig
{
public
static
final
String
DATA_REPORT_QUEUE_NAME
=
"dataReport_queue"
;
public
static
final
String
DATA_REPORT_EXCHANGE_NAME
=
"dataReport_exchange"
;
public
static
final
String
DATA_REPORT_TOPIC
=
"dataReport.#"
;
//声明topic交换机
//声明topic交换机
@Bean
@Bean
public
TopicExchange
topicExchange
()
{
public
TopicExchange
topicExchange
()
{
...
@@ -23,18 +19,18 @@ public class RabbitConfig {
...
@@ -23,18 +19,18 @@ public class RabbitConfig {
@Bean
(
name
=
"dataReportQueue"
)
@Bean
(
name
=
"dataReportQueue"
)
public
Queue
dataReportQueue
()
{
public
Queue
dataReportQueue
()
{
return
new
Queue
(
DATA_REPORT_QUEUE_NAME
,
true
);
return
new
Queue
(
RabbitMQConstants
.
DATA_REPORT_QUEUE_NAME
,
true
);
}
}
@Bean
(
name
=
"dataReportTopicExchange"
)
@Bean
(
name
=
"dataReportTopicExchange"
)
public
TopicExchange
dataReportTopicExchange
()
{
public
TopicExchange
dataReportTopicExchange
()
{
return
new
TopicExchange
(
DATA_REPORT_EXCHANGE_NAME
);
return
new
TopicExchange
(
RabbitMQConstants
.
DATA_REPORT_EXCHANGE_NAME
);
}
}
@Bean
@Bean
public
Binding
bindingDataReport
(
@Qualifier
(
"dataReportQueue"
)
Queue
dataReportQueue
,
public
Binding
bindingDataReport
(
@Qualifier
(
"dataReportQueue"
)
Queue
dataReportQueue
,
@Qualifier
(
"dataReportTopicExchange"
)
TopicExchange
dataReportTopicExchange
)
{
@Qualifier
(
"dataReportTopicExchange"
)
TopicExchange
dataReportTopicExchange
)
{
return
BindingBuilder
.
bind
(
dataReportQueue
).
to
(
dataReportTopicExchange
).
with
(
DATA_REPORT_TOPIC
);
return
BindingBuilder
.
bind
(
dataReportQueue
).
to
(
dataReportTopicExchange
).
with
(
RabbitMQConstants
.
DATA_REPORT_TOPIC
);
}
}
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitMQConstants.java
View file @
df47ee7
...
@@ -4,4 +4,10 @@ public interface RabbitMQConstants {
...
@@ -4,4 +4,10 @@ public interface RabbitMQConstants {
String
TOPIC_EXCHANGE_PLATFORM_PROCESS
=
"sop.platform-process"
;
String
TOPIC_EXCHANGE_PLATFORM_PROCESS
=
"sop.platform-process"
;
String
ROUTING_KEY_SOP_INST_INST_PARAM_CUSTOM_DATA_UPDATE
=
"sop_inst.inst_param.custom_data.update"
;
String
ROUTING_KEY_SOP_INST_INST_PARAM_CUSTOM_DATA_UPDATE
=
"sop_inst.inst_param.custom_data.update"
;
//上报给cdp的相关信息常量(cdp那边固定)
String
DATA_REPORT_QUEUE_NAME
=
"dataReport_queue"
;
String
DATA_REPORT_EXCHANGE_NAME
=
"dataReport_exchange"
;
String
DATA_REPORT_TOPIC
=
"dataReport.#"
;
String
DATA_REPORT_ROUTING_KEY
=
"dataReport.customer.event"
;
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
df47ee7
...
@@ -5,6 +5,8 @@ import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
...
@@ -5,6 +5,8 @@ import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch
;
import
cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch
;
import
cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest
;
import
cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest
;
import
cn.com.glsx.process.common.sysenum.ResultEnum
;
import
cn.com.glsx.process.exception.AdminException
;
import
cn.com.glsx.process.modules.converter.SopInstConverter
;
import
cn.com.glsx.process.modules.converter.SopInstConverter
;
import
cn.com.glsx.process.modules.converter.SopTplConverter
;
import
cn.com.glsx.process.modules.converter.SopTplConverter
;
import
cn.com.glsx.process.modules.converter.SopTplLinKConverter
;
import
cn.com.glsx.process.modules.converter.SopTplLinKConverter
;
...
@@ -12,19 +14,20 @@ import cn.com.glsx.process.modules.converter.SopTplNodeConverter;
...
@@ -12,19 +14,20 @@ import cn.com.glsx.process.modules.converter.SopTplNodeConverter;
import
cn.com.glsx.process.modules.entity.*
;
import
cn.com.glsx.process.modules.entity.*
;
import
cn.com.glsx.process.modules.mapper.*
;
import
cn.com.glsx.process.modules.mapper.*
;
import
cn.com.glsx.process.modules.model.*
;
import
cn.com.glsx.process.modules.model.*
;
import
cn.com.glsx.process.modules.model.enums.SopInstNodeSkipEnum
;
import
cn.com.glsx.process.modules.model.enums.SopInstNodeStatusEnum
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.model.enums.SopTplNodeSkipableEnum
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitConfig
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
cn.com.glsx.process.util.FileUploadUtil
;
import
cn.com.glsx.process.util.FileUploadUtil
;
import
cn.com.glsx.process.util.SopTplParamHandler
;
import
cn.com.glsx.process.util.SopTplParamHandler
;
import
cn.hutool.core.date.DatePattern
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.core.enums.SysConstants
;
import
com.glsx.plat.core.enums.SysConstants
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.exception.ResultException
;
import
com.glsx.plat.exception.SystemMessage
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -272,13 +275,13 @@ public class SopInstService {
...
@@ -272,13 +275,13 @@ public class SopInstService {
List
<
SopTplGrant
>
sopTplGrants
=
sopInstDTO
.
getSopTplGrants
();
List
<
SopTplGrant
>
sopTplGrants
=
sopInstDTO
.
getSopTplGrants
();
if
(
CollectionUtils
.
isEmpty
(
sopTplGrants
))
{
if
(
CollectionUtils
.
isEmpty
(
sopTplGrants
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
"请选择门店"
);
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
"请选择门店"
);
}
}
List
<
String
>
groupIds
=
sopTplGrants
.
stream
().
map
(
sopTplGrant
->
sopTplGrant
.
getGroupId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
groupIds
=
sopTplGrants
.
stream
().
map
(
sopTplGrant
->
sopTplGrant
.
getGroupId
()).
collect
(
Collectors
.
toList
());
List
<
SopTplGrant
>
grants
=
sopTplGrantMapper
.
selectInUseGrants
(
tplId
,
groupIds
);
List
<
SopTplGrant
>
grants
=
sopTplGrantMapper
.
selectInUseGrants
(
tplId
,
groupIds
);
if
(!
CollectionUtils
.
isEmpty
(
grants
))
{
if
(!
CollectionUtils
.
isEmpty
(
grants
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
String
.
format
(
"%s已存在该旅程,请确认后重新操作"
,
grants
.
get
(
0
).
getGroupName
()));
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
String
.
format
(
"%s已存在该旅程,请确认后重新操作"
,
grants
.
get
(
0
).
getGroupName
()));
}
}
//新增派发门店记录
//新增派发门店记录
...
@@ -327,7 +330,7 @@ public class SopInstService {
...
@@ -327,7 +330,7 @@ public class SopInstService {
for
(
SopTplNode
sopTplNode
:
nodes
)
{
for
(
SopTplNode
sopTplNode
:
nodes
)
{
SopInstNode
sopInstNode
=
sopTplNodeConverter
.
tpl2inst
(
sopTplNode
);
SopInstNode
sopInstNode
=
sopTplNodeConverter
.
tpl2inst
(
sopTplNode
);
sopInstNode
.
setInstId
(
instId
);
sopInstNode
.
setInstId
(
instId
);
sopInstNode
.
setNodeStatus
(
SopInstNode
.
NODE_STATUS_NORMAL
);
sopInstNode
.
setNodeStatus
(
SopInstNode
StatusEnum
.
NORMAL
.
getValue
()
);
// 处理模板节点定义的初始化参数
// 处理模板节点定义的初始化参数
sopInstNode
.
setNodeParam
(
SopTplParamHandler
.
extract
(
sopTplNode
.
getNodeParamDef
()));
sopInstNode
.
setNodeParam
(
SopTplParamHandler
.
extract
(
sopTplNode
.
getNodeParamDef
()));
...
@@ -335,12 +338,12 @@ public class SopInstService {
...
@@ -335,12 +338,12 @@ public class SopInstService {
//页面选择是否跳过处理
//页面选择是否跳过处理
SopInstNode
sopInstNodeTemp
=
customNodesMap
.
get
(
sopInstNode
.
getNodeId
());
SopInstNode
sopInstNodeTemp
=
customNodesMap
.
get
(
sopInstNode
.
getNodeId
());
if
(!
Objects
.
isNull
(
sopInstNodeTemp
)
if
(!
Objects
.
isNull
(
sopInstNodeTemp
)
&&
sopInstNodeTemp
.
getNodeSkip
().
equals
(
SopInstNode
.
NODE_SKIP_TRUE
)
&&
sopInstNodeTemp
.
getNodeSkip
().
equals
(
SopInstNode
SkipEnum
.
TRUE
.
getValue
()
)
&&
sopTplNode
.
getNodeSkipable
().
equals
(
SopTplNode
.
NODE_SKIPABLE_NO
))
{
&&
sopTplNode
.
getNodeSkipable
().
equals
(
SopTplNode
SkipableEnum
.
NO
.
getValue
()
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
String
.
format
(
"节点 %s 不可跳过"
,
sopInstNode
.
getNodeName
()));
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
String
.
format
(
"节点 %s 不可跳过"
,
sopInstNode
.
getNodeName
()));
}
}
sopInstNode
.
setNodeSkip
(!
Objects
.
isNull
(
sopInstNodeTemp
)
?
sopInstNodeTemp
.
getNodeSkip
()
:
SopInstNode
.
NODE_SKIP_FALSE
);
sopInstNode
.
setNodeSkip
(!
Objects
.
isNull
(
sopInstNodeTemp
)
?
sopInstNodeTemp
.
getNodeSkip
()
:
SopInstNode
SkipEnum
.
FALSE
.
getValue
()
);
sopInstNodes
.
add
(
sopInstNode
);
sopInstNodes
.
add
(
sopInstNode
);
}
}
sopInstNodeMapper
.
insertList
(
sopInstNodes
);
sopInstNodeMapper
.
insertList
(
sopInstNodes
);
...
@@ -357,7 +360,7 @@ public class SopInstService {
...
@@ -357,7 +360,7 @@ public class SopInstService {
String
sopJourneyId
=
search
.
getSopJourneyId
();
String
sopJourneyId
=
search
.
getSopJourneyId
();
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
sopJourneyId
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
sopJourneyId
);
if
(
Objects
.
isNull
(
sopInst
))
{
if
(
Objects
.
isNull
(
sopInst
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
"该模板实例不存在!"
);
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
"该模板实例不存在!"
);
}
}
SopTplGrant
sopTplGrant
=
sopTplGrantMapper
.
selectByPrimaryKey
(
sopInst
.
getGrantId
());
SopTplGrant
sopTplGrant
=
sopTplGrantMapper
.
selectByPrimaryKey
(
sopInst
.
getGrantId
());
...
@@ -409,12 +412,12 @@ public class SopInstService {
...
@@ -409,12 +412,12 @@ public class SopInstService {
String
oneId
=
body
.
getOneId
();
String
oneId
=
body
.
getOneId
();
Result
<
CustomerSopJourneyDetailDTO
>
detail
=
customerSopJourneyFeignClient
.
detail
(
orgId
,
sopJourneyId
,
oneId
);
Result
<
CustomerSopJourneyDetailDTO
>
detail
=
customerSopJourneyFeignClient
.
detail
(
orgId
,
sopJourneyId
,
oneId
);
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
detail
.
getCode
()))
{
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
detail
.
getCode
()))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
"查询客户信息异常"
);
throw
new
AdminException
(
ResultEnum
.
FEIGN_REQUEST
_ERROR
.
getCode
(),
"查询客户信息异常"
);
}
}
CustomerSopJourneyDetailDTO
customerDetail
=
detail
.
getData
();
CustomerSopJourneyDetailDTO
customerDetail
=
detail
.
getData
();
if
(
Objects
.
isNull
(
customerDetail
))
{
if
(
Objects
.
isNull
(
customerDetail
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
"客户信息不存在"
);
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
"客户信息不存在"
);
}
}
ModifySopJourneyStageRequest
request
=
new
ModifySopJourneyStageRequest
();
ModifySopJourneyStageRequest
request
=
new
ModifySopJourneyStageRequest
();
...
@@ -426,7 +429,7 @@ public class SopInstService {
...
@@ -426,7 +429,7 @@ public class SopInstService {
Result
<
Boolean
>
booleanResult
=
customerSopJourneyFeignClient
.
modifyStage
(
request
);
Result
<
Boolean
>
booleanResult
=
customerSopJourneyFeignClient
.
modifyStage
(
request
);
Date
now
=
new
Date
();
Date
now
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DatePattern
.
NORM_DATETIME_PATTERN
);
HashMap
<
String
,
Object
>
mqMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
mqMap
=
new
HashMap
<>();
mqMap
.
put
(
"org_id"
,
orgId
);
mqMap
.
put
(
"org_id"
,
orgId
);
...
@@ -437,7 +440,7 @@ public class SopInstService {
...
@@ -437,7 +440,7 @@ public class SopInstService {
mqMap
.
put
(
"platform"
,
"WebPage"
);
mqMap
.
put
(
"platform"
,
"WebPage"
);
mqMap
.
put
(
"extra"
,
body
);
mqMap
.
put
(
"extra"
,
body
);
msgProducer
.
topicSend
(
Rabbit
Config
.
DATA_REPORT_EXCHANGE_NAME
,
"dataReport.customer.event"
,
Lists
.
newArrayList
(
mqMap
));
msgProducer
.
topicSend
(
Rabbit
MQConstants
.
DATA_REPORT_EXCHANGE_NAME
,
RabbitMQConstants
.
DATA_REPORT_ROUTING_KEY
,
Lists
.
newArrayList
(
mqMap
));
return
booleanResult
;
return
booleanResult
;
}
}
...
@@ -445,7 +448,7 @@ public class SopInstService {
...
@@ -445,7 +448,7 @@ public class SopInstService {
search
.
setPageSize
(
5000
);
search
.
setPageSize
(
5000
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
search
.
getSopJourneyId
());
if
(
Objects
.
isNull
(
sopInst
))
{
if
(
Objects
.
isNull
(
sopInst
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS
_ERROR
.
getCode
(),
"模板实例不存在"
);
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
"模板实例不存在"
);
}
}
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
List
<
SopCustomerExcelDTO
>
data
=
new
ArrayList
<>();
...
@@ -477,14 +480,14 @@ public class SopInstService {
...
@@ -477,14 +480,14 @@ public class SopInstService {
FileUploadServerData
fileUploadServerData
=
FileUploadUtil
.
uploadToFileSystem
(
String
.
format
(
"客户数据_%d"
,
now
.
getTime
()),
bytes
,
"xlsx"
);
FileUploadServerData
fileUploadServerData
=
FileUploadUtil
.
uploadToFileSystem
(
String
.
format
(
"客户数据_%d"
,
now
.
getTime
()),
bytes
,
"xlsx"
);
return
fileUploadServerData
;
return
fileUploadServerData
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
ResultException
.
create
(
SystemMessage
.
DATA_HANDLE_ERROR
.
getCode
(),
"客户数据导出处理异常"
);
throw
new
AdminException
(
ResultEnum
.
DATA_HANDLE_ERROR
.
getCode
(),
"客户数据导出处理异常"
);
}
}
}
}
private
void
getCustomersForExcel
(
SopCustomerSearch
search
,
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
)
{
private
void
getCustomersForExcel
(
SopCustomerSearch
search
,
List
<
CustomerSopJourneyDTO
>
customerSopJourneyDTOList
)
{
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customersResult
=
customers
(
search
);
Result
<
PageInfo
<
CustomerSopJourneyDTO
>>
customersResult
=
customers
(
search
);
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
customersResult
.
getCode
()))
{
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
customersResult
.
getCode
()))
{
throw
ResultException
.
create
(
SystemMessage
.
MICROSERVICE_CALL_FAIL
.
getCode
(),
"查询客户数据接口异常"
);
throw
new
AdminException
(
ResultEnum
.
FEIGN_REQUEST_ERROR
.
getCode
(),
"查询客户数据接口异常"
);
}
}
PageInfo
<
CustomerSopJourneyDTO
>
pageInfo
=
customersResult
.
getData
();
PageInfo
<
CustomerSopJourneyDTO
>
pageInfo
=
customersResult
.
getData
();
...
...
platform-process/src/main/java/cn/com/glsx/process/util/SopTplParamHandler.java
View file @
df47ee7
package
cn
.
com
.
glsx
.
process
.
util
;
package
cn
.
com
.
glsx
.
process
.
util
;
import
cn.com.glsx.process.common.sysenum.ResultEnum
;
import
cn.com.glsx.process.exception.AdminException
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.glsx.plat.exception.ResultException
;
import
com.glsx.plat.exception.SystemMessage
;
import
lombok.experimental.UtilityClass
;
import
lombok.experimental.UtilityClass
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -24,7 +24,7 @@ public class SopTplParamHandler {
...
@@ -24,7 +24,7 @@ public class SopTplParamHandler {
JsonNode
rootNode
=
objectMapper
.
readTree
(
tplParam
);
JsonNode
rootNode
=
objectMapper
.
readTree
(
tplParam
);
return
processNode
(
rootNode
);
return
processNode
(
rootNode
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
ResultException
.
create
(
SystemMessage
.
DATA_HANDLE
_ERROR
.
getCode
(),
"参数转json对象异常"
);
throw
new
AdminException
(
ResultEnum
.
PARAM
_ERROR
.
getCode
(),
"参数转json对象异常"
);
}
}
}
}
...
...
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