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 9d2d33fc
authored
Sep 14, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/v1.0.1' into v1.0.1
2 parents
3968c0a5
67c30581
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
52 deletions
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInst.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopTplGrantMapper.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstStatusEnum.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/SopTplGrantController.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopTplGrantService.java
platform-process/src/main/resources/mapper/SopTplGrantMapper.xml
platform-process/src/main/resources/mapper/SopTplMapper.xml
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInst.java
View file @
9d2d33f
package
cn
.
com
.
glsx
.
process
.
modules
.
entity
;
package
cn
.
com
.
glsx
.
process
.
modules
.
entity
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
import
java.util.Date
;
import
javax.persistence.*
;
@Table
(
name
=
"sop_inst"
)
@Table
(
name
=
"sop_inst"
)
public
class
SopInst
{
public
class
SopInst
{
/**
/**
* 启用状态:0,未启用;1,启用;-1,已删除/过期;
*/
public
static
final
byte
INST_STATUS_DELETED
=
-
1
;
public
static
final
byte
INST_STATUS_UNUSED
=
0
;
public
static
final
byte
INST_STATUS_NORMAL
=
1
;
/**
* 实例id,一般sop只允许一个实例。特殊情况可以根据输入参数来区分不同实例。实例名可以用于在cdp保存状态
* 实例id,一般sop只允许一个实例。特殊情况可以根据输入参数来区分不同实例。实例名可以用于在cdp保存状态
*/
*/
@Id
@Id
...
...
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopTplGrantMapper.java
View file @
9d2d33f
...
@@ -24,4 +24,13 @@ public interface SopTplGrantMapper extends CommonBaseMapper<SopTplGrant> {
...
@@ -24,4 +24,13 @@ public interface SopTplGrantMapper extends CommonBaseMapper<SopTplGrant> {
* @return
* @return
*/
*/
int
countAllByTplId
(
@Param
(
"tplId"
)
String
tplId
);
int
countAllByTplId
(
@Param
(
"tplId"
)
String
tplId
);
/**
* 根据模板id和门店id集合查询授权记录
*
* @param tplId 模板id
* @param groupIds 门店id集合
* @return
*/
List
<
SopTplGrant
>
selectByTplIdAndGroupIds
(
@Param
(
"tplId"
)
String
tplId
,
@Param
(
"groupIds"
)
List
<
String
>
groupIds
);
}
}
\ No newline at end of file
\ No newline at end of file
platform-process-api/src/main/java/cn/com/glsx/process/modules/model/enums/SopInstStatusEnum.java
0 → 100644
View file @
9d2d33f
package
cn
.
com
.
glsx
.
process
.
modules
.
model
.
enums
;
public
enum
SopInstStatusEnum
{
DELETED
(
"已删除"
,
(
byte
)-
1
),
UNUSED
(
"未启用"
,
(
byte
)
0
),
NORMAL
(
"启用"
,
(
byte
)
1
);
private
String
name
;
private
Byte
value
;
private
SopInstStatusEnum
(
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/process/modules/controller/SopTplGrantController.java
View file @
9d2d33f
...
@@ -46,10 +46,4 @@ public class SopTplGrantController extends BaseController {
...
@@ -46,10 +46,4 @@ public class SopTplGrantController extends BaseController {
return
"success"
;
return
"success"
;
}
}
@Operation
(
summary
=
"撤销下发门店"
,
description
=
"撤销下发门店"
)
@DeleteMapping
(
"/{id}"
)
public
String
del
(
@PathVariable
(
"id"
)
Integer
id
)
{
sopTplGrantService
.
del
(
id
);
return
"success"
;
}
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
9d2d33f
...
@@ -9,6 +9,7 @@ import cn.com.glsx.process.modules.mapper.SopInstMapper;
...
@@ -9,6 +9,7 @@ import cn.com.glsx.process.modules.mapper.SopInstMapper;
import
cn.com.glsx.process.modules.mapper.SopInstNodeMapper
;
import
cn.com.glsx.process.modules.mapper.SopInstNodeMapper
;
import
cn.com.glsx.process.modules.model.SopInstDTO
;
import
cn.com.glsx.process.modules.model.SopInstDTO
;
import
cn.com.glsx.process.modules.model.SopInstSearch
;
import
cn.com.glsx.process.modules.model.SopInstSearch
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
...
@@ -147,12 +148,12 @@ public class SopInstService {
...
@@ -147,12 +148,12 @@ public class SopInstService {
Result
<
String
>
result
=
Result
.
success
(
"success"
);
Result
<
String
>
result
=
Result
.
success
(
"success"
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
instId
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
instId
);
if
(
sopInst
==
null
||
sopInst
.
getInstStatus
().
equals
(
SopInst
.
INST_STATUS_DELETED
))
{
if
(
sopInst
==
null
||
sopInst
.
getInstStatus
().
equals
(
SopInst
StatusEnum
.
DELETED
.
getValue
()
))
{
result
=
Result
.
failure
();
result
=
Result
.
failure
();
result
.
setMessage
(
"模板实例不存在或已关闭"
);
result
.
setMessage
(
"模板实例不存在或已关闭"
);
return
result
;
return
result
;
}
}
if
(
sopInst
.
getInstStatus
().
equals
(
SopInst
.
INST_STATUS_NORMAL
))
{
if
(
sopInst
.
getInstStatus
().
equals
(
SopInst
StatusEnum
.
NORMAL
.
getValue
()
))
{
result
=
Result
.
failure
();
result
=
Result
.
failure
();
result
.
setMessage
(
"模板实例已开启,此参数不允许再变更"
);
result
.
setMessage
(
"模板实例已开启,此参数不允许再变更"
);
return
result
;
return
result
;
...
@@ -173,29 +174,25 @@ public class SopInstService {
...
@@ -173,29 +174,25 @@ public class SopInstService {
public
Result
<
String
>
updateInstStatus
(
String
instId
,
Byte
status
)
{
public
Result
<
String
>
updateInstStatus
(
String
instId
,
Byte
status
)
{
Result
<
String
>
result
=
Result
.
success
(
"success"
);
Result
<
String
>
result
=
Result
.
success
(
"success"
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
instId
);
SopInst
sopInst
=
sopInstMapper
.
selectByPrimaryKey
(
instId
);
if
(
sopInst
==
null
||
sopInst
.
getInstStatus
().
equals
(
SopInst
.
INST_STATUS_DELETED
))
{
if
(
sopInst
==
null
||
sopInst
.
getInstStatus
().
equals
(
SopInst
StatusEnum
.
DELETED
.
getValue
()
))
{
result
=
Result
.
failure
();
result
=
Result
.
failure
();
result
.
setMessage
(
"模板实例不存在或已关闭"
);
result
.
setMessage
(
"模板实例不存在或已关闭"
);
return
result
;
return
result
;
}
}
Byte
instStatus
=
sopInst
.
getInstStatus
();
Byte
instStatus
=
sopInst
.
getInstStatus
();
switch
(
instStatus
)
{
if
(
instStatus
.
equals
(
SopInstStatusEnum
.
UNUSED
.
getValue
()))
{
case
SopInst
.
INST_STATUS_UNUSED
:
if
(!
status
.
equals
(
SopInstStatusEnum
.
NORMAL
.
getValue
()))
{
if
(!
status
.
equals
(
SopInst
.
INST_STATUS_NORMAL
))
{
result
=
Result
.
failure
();
result
=
Result
.
failure
();
result
.
setMessage
(
"参数错误,模板实例未开启,只能开启"
);
result
.
setMessage
(
"参数错误,模板实例未开启,只能开启"
);
return
result
;
return
result
;
}
}
break
;
}
else
{
case
SopInst
.
INST_STATUS_NORMAL
:
if
(!
status
.
equals
(
SopInstStatusEnum
.
DELETED
.
getValue
()))
{
if
(!
status
.
equals
(
SopInst
.
INST_STATUS_DELETED
))
{
result
=
Result
.
failure
();
result
=
Result
.
failure
();
result
.
setMessage
(
"参数错误,模板实例已开启,只能关闭"
);
result
.
setMessage
(
"参数错误,模板实例已开启,只能关闭"
);
return
result
;
return
result
;
}
}
break
;
default
:
}
}
sopInstMapper
.
updateInstStatus
(
instId
,
status
);
sopInstMapper
.
updateInstStatus
(
instId
,
status
);
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopTplGrantService.java
View file @
9d2d33f
package
cn
.
com
.
glsx
.
process
.
modules
.
service
;
package
cn
.
com
.
glsx
.
process
.
modules
.
service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
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
;
import
cn.com.glsx.process.modules.converter.SopTplNodeConverter
;
import
cn.com.glsx.process.modules.converter.SopTplNodeConverter
;
import
cn.com.glsx.process.modules.entity.SopInst
;
import
cn.com.glsx.process.modules.entity.*
;
import
cn.com.glsx.process.modules.entity.SopInstLink
;
import
cn.com.glsx.process.modules.mapper.*
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
cn.com.glsx.process.modules.entity.SopTpl
;
import
cn.com.glsx.process.modules.entity.SopTplGrant
;
import
cn.com.glsx.process.modules.entity.SopTplLink
;
import
cn.com.glsx.process.modules.entity.SopTplNode
;
import
cn.com.glsx.process.modules.mapper.SopInstLinkMapper
;
import
cn.com.glsx.process.modules.mapper.SopInstMapper
;
import
cn.com.glsx.process.modules.mapper.SopInstNodeMapper
;
import
cn.com.glsx.process.modules.mapper.SopTplGrantMapper
;
import
cn.com.glsx.process.modules.mapper.SopTplLinkMapper
;
import
cn.com.glsx.process.modules.mapper.SopTplMapper
;
import
cn.com.glsx.process.modules.mapper.SopTplNodeMapper
;
import
cn.com.glsx.process.modules.model.SopTplGrantSearch
;
import
cn.com.glsx.process.modules.model.SopTplGrantSearch
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
com.glsx.plat.exception.ResultException
;
import
com.glsx.plat.exception.SystemMessage
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
SopTplGrantService
{
public
class
SopTplGrantService
{
...
@@ -58,6 +49,13 @@ public class SopTplGrantService {
...
@@ -58,6 +49,13 @@ public class SopTplGrantService {
@Transactional
@Transactional
public
void
add
(
List
<
SopTplGrant
>
sopTplGrants
)
{
public
void
add
(
List
<
SopTplGrant
>
sopTplGrants
)
{
String
tplId
=
sopTplGrants
.
get
(
0
).
getTplId
();
List
<
String
>
groupIds
=
sopTplGrants
.
stream
().
map
(
sopTplGrant
->
sopTplGrant
.
getGroupId
()).
collect
(
Collectors
.
toList
());
List
<
SopTplGrant
>
grants
=
sopTplGrantMapper
.
selectByTplIdAndGroupIds
(
tplId
,
groupIds
);
if
(!
CollectionUtils
.
isEmpty
(
grants
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
String
.
format
(
"%s已存在该旅程,请确认后重新操作"
,
grants
.
get
(
0
).
getGroupName
()));
}
Date
date
=
new
Date
();
Date
date
=
new
Date
();
//新增派发门店记录
//新增派发门店记录
sopTplGrants
.
forEach
(
sopTplGrant
->
{
sopTplGrants
.
forEach
(
sopTplGrant
->
{
...
@@ -67,7 +65,6 @@ public class SopTplGrantService {
...
@@ -67,7 +65,6 @@ public class SopTplGrantService {
});
});
sopTplGrantMapper
.
insertList
(
sopTplGrants
);
sopTplGrantMapper
.
insertList
(
sopTplGrants
);
String
tplId
=
sopTplGrants
.
get
(
0
).
getTplId
();
SopTpl
sopTpl
=
sopTplMapper
.
selectByPrimaryKey
(
tplId
);
SopTpl
sopTpl
=
sopTplMapper
.
selectByPrimaryKey
(
tplId
);
Assert
.
state
(
sopTpl
!=
null
,
"模板不存在!"
);
Assert
.
state
(
sopTpl
!=
null
,
"模板不存在!"
);
...
@@ -84,7 +81,6 @@ public class SopTplGrantService {
...
@@ -84,7 +81,6 @@ public class SopTplGrantService {
SopTplNodeConverter
sopTplNodeConverter
=
SopTplNodeConverter
.
INSTANCE
;
SopTplNodeConverter
sopTplNodeConverter
=
SopTplNodeConverter
.
INSTANCE
;
for
(
SopTplGrant
sopTplGrant
:
sopTplGrants
)
{
for
(
SopTplGrant
sopTplGrant
:
sopTplGrants
)
{
//TODO 门店-模板 单次授权 多实例 处理
Integer
grantId
=
sopTplGrant
.
getGrantId
();
Integer
grantId
=
sopTplGrant
.
getGrantId
();
//克隆模板内容
//克隆模板内容
SopInst
sopInst
=
sopTplConverter
.
do2inst
(
sopTpl
);
SopInst
sopInst
=
sopTplConverter
.
do2inst
(
sopTpl
);
...
@@ -92,7 +88,7 @@ public class SopTplGrantService {
...
@@ -92,7 +88,7 @@ public class SopTplGrantService {
sopInst
.
setGrantId
(
grantId
);
sopInst
.
setGrantId
(
grantId
);
sopInst
.
setCreateTime
(
date
);
sopInst
.
setCreateTime
(
date
);
sopInst
.
setUpdateTime
(
date
);
sopInst
.
setUpdateTime
(
date
);
sopInst
.
setInstStatus
(
SopInst
.
INST_STATUS_UNUSED
);
sopInst
.
setInstStatus
(
SopInst
StatusEnum
.
UNUSED
.
getValue
()
);
sopInstMapper
.
insert
(
sopInst
);
sopInstMapper
.
insert
(
sopInst
);
//克隆连接
//克隆连接
...
...
platform-process/src/main/resources/mapper/SopTplGrantMapper.xml
View file @
9d2d33f
...
@@ -34,6 +34,13 @@
...
@@ -34,6 +34,13 @@
SELECT COUNT(0) FROM sop_tpl_grant WHERE tpl_id = #{tplId}
SELECT COUNT(0) FROM sop_tpl_grant WHERE tpl_id = #{tplId}
</select>
</select>
<select
id=
"selectByTplIdAndGroupIds"
resultType=
"cn.com.glsx.process.modules.entity.SopTplGrant"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM sop_tpl_grant
WHERE tpl_id = #{tplId} AND group_id IN
<foreach
collection=
"groupIds"
item=
"groupId"
open=
"("
separator=
","
close=
")"
>
#{groupId}
</foreach>
</select>
<delete
id=
"del"
>
<delete
id=
"del"
>
update sop_tpl_grant set grant_status = -1 where grant_id = #{id}
update sop_tpl_grant set grant_status = -1 where grant_id = #{id}
</delete>
</delete>
...
...
platform-process/src/main/resources/mapper/SopTplMapper.xml
View file @
9d2d33f
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
and tpl_status = #{status}
and tpl_status = #{status}
</if>
</if>
</where>
</where>
order by update_time desc
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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