|
1
|
package com.lframework.xingyun.sc.impl.contract;
|
1
|
package com.lframework.xingyun.sc.impl.contract;
|
|
2
|
|
2
|
|
|
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
3
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
4
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
4
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
5
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
5
|
import com.github.pagehelper.PageInfo;
|
6
|
import com.github.pagehelper.PageInfo;
|
|
|
|
7
|
+import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
6
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
8
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
|
7
|
import com.lframework.starter.common.utils.Assert;
|
9
|
import com.lframework.starter.common.utils.Assert;
|
|
8
|
import com.lframework.starter.common.utils.ObjectUtil;
|
10
|
import com.lframework.starter.common.utils.ObjectUtil;
|
|
9
|
import com.lframework.starter.web.core.annotations.oplog.OpLog;
|
11
|
import com.lframework.starter.web.core.annotations.oplog.OpLog;
|
|
10
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
12
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
|
|
|
13
|
+import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
11
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
14
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
|
12
|
import com.lframework.starter.web.core.utils.IdUtil;
|
15
|
import com.lframework.starter.web.core.utils.IdUtil;
|
|
13
|
import com.lframework.starter.web.core.utils.OpLogUtil;
|
16
|
import com.lframework.starter.web.core.utils.OpLogUtil;
|
|
@@ -20,17 +23,25 @@ import com.lframework.xingyun.sc.service.contract.SpecLockDelayApplicationServic |
|
@@ -20,17 +23,25 @@ import com.lframework.xingyun.sc.service.contract.SpecLockDelayApplicationServic |
|
20
|
import com.lframework.xingyun.sc.vo.contract.createVo.CreateSpecLockDelayApplicationVo;
|
23
|
import com.lframework.xingyun.sc.vo.contract.createVo.CreateSpecLockDelayApplicationVo;
|
|
21
|
import com.lframework.xingyun.sc.vo.contract.queryVo.QuerySpecLockDelayApplicationVo;
|
24
|
import com.lframework.xingyun.sc.vo.contract.queryVo.QuerySpecLockDelayApplicationVo;
|
|
22
|
import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateSpecLockDelayApplicationVo;
|
25
|
import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateSpecLockDelayApplicationVo;
|
|
|
|
26
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
27
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
23
|
import org.springframework.cache.annotation.CacheEvict;
|
28
|
import org.springframework.cache.annotation.CacheEvict;
|
|
24
|
import org.springframework.cache.annotation.Cacheable;
|
29
|
import org.springframework.cache.annotation.Cacheable;
|
|
25
|
import org.springframework.stereotype.Service;
|
30
|
import org.springframework.stereotype.Service;
|
|
26
|
import org.springframework.transaction.annotation.Transactional;
|
31
|
import org.springframework.transaction.annotation.Transactional;
|
|
27
|
|
32
|
|
|
28
|
import java.io.Serializable;
|
33
|
import java.io.Serializable;
|
|
|
|
34
|
+import java.time.LocalDateTime;
|
|
29
|
import java.util.List;
|
35
|
import java.util.List;
|
|
30
|
|
36
|
|
|
31
|
@Service
|
37
|
@Service
|
|
32
|
public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecLockDelayApplicationMapper, SpecLockDelayApplication> implements SpecLockDelayApplicationService {
|
38
|
public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecLockDelayApplicationMapper, SpecLockDelayApplication> implements SpecLockDelayApplicationService {
|
|
33
|
|
39
|
|
|
|
|
40
|
+ private static final String SPEC_LOCK_DELAY_FLAY = "SPEC_LOCK_DELAY"; // 未锁规格申请单审批
|
|
|
|
41
|
+
|
|
|
|
42
|
+ @Autowired
|
|
|
|
43
|
+ private FlowInstanceWrapperService flowInstanceWrapperService;
|
|
|
|
44
|
+
|
|
34
|
@Override
|
45
|
@Override
|
|
35
|
public PageResult<SpecLockDelayApplication> query(Integer pageIndex, Integer pageSize, QuerySpecLockDelayApplicationVo vo) {
|
46
|
public PageResult<SpecLockDelayApplication> query(Integer pageIndex, Integer pageSize, QuerySpecLockDelayApplicationVo vo) {
|
|
36
|
|
47
|
|
|
@@ -74,6 +85,8 @@ public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecL |
|
@@ -74,6 +85,8 @@ public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecL |
|
74
|
OpLogUtil.setVariable("id", data.getId());
|
85
|
OpLogUtil.setVariable("id", data.getId());
|
|
75
|
OpLogUtil.setExtra(vo);
|
86
|
OpLogUtil.setExtra(vo);
|
|
76
|
|
87
|
|
|
|
|
88
|
+ // 开启审核
|
|
|
|
89
|
+ flowInstanceWrapperService.startInstance(SPEC_LOCK_DELAY_FLAY, data.getId(), SPEC_LOCK_DELAY_FLAY, data);
|
|
77
|
return data.getId();
|
90
|
return data.getId();
|
|
78
|
}
|
91
|
}
|
|
79
|
|
92
|
|
|
@@ -101,6 +114,34 @@ public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecL |
|
@@ -101,6 +114,34 @@ public class SpecLockDelayApplicationServiceImpl extends BaseMpServiceImpl<SpecL |
|
101
|
OpLogUtil.setExtra(vo);
|
114
|
OpLogUtil.setExtra(vo);
|
|
102
|
}
|
115
|
}
|
|
103
|
|
116
|
|
|
|
|
117
|
+ @Override
|
|
|
|
118
|
+ @OpLog(type = OtherOpLogType.class, name = "锁价无规格操作申请单审批完成,ID:{}, 审批状态:{}", params = {"#id", "#approvedStatus"})
|
|
|
|
119
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
120
|
+ public void updateAuditStatus(String id, String approvedStatus) {
|
|
|
|
121
|
+ if (StringUtils.isBlank(id) || StringUtils.isBlank(approvedStatus)) {
|
|
|
|
122
|
+ return;
|
|
|
|
123
|
+ }
|
|
|
|
124
|
+
|
|
|
|
125
|
+ Wrapper<SpecLockDelayApplication> wrapper = Wrappers.lambdaUpdate(SpecLockDelayApplication.class)
|
|
|
|
126
|
+ .set(SpecLockDelayApplication::getApprovalStatus, approvedStatus)
|
|
|
|
127
|
+ .set(SpecLockDelayApplication::getApprovedAt, LocalDateTime.now())
|
|
|
|
128
|
+ .set(SpecLockDelayApplication::getApproverId, SecurityUtil.getCurrentUser().getId())
|
|
|
|
129
|
+ .eq(SpecLockDelayApplication::getId, id);
|
|
|
|
130
|
+
|
|
|
|
131
|
+ getBaseMapper().update(wrapper);
|
|
|
|
132
|
+
|
|
|
|
133
|
+ UpdateSpecLockDelayApplicationVo vo = new UpdateSpecLockDelayApplicationVo();
|
|
|
|
134
|
+ vo.setId(id);
|
|
|
|
135
|
+ vo.setApprovalStatus(approvedStatus);
|
|
|
|
136
|
+ vo.setApprovedAt(LocalDateTime.now());
|
|
|
|
137
|
+ vo.setApproverId(SecurityUtil.getCurrentUser().getId());
|
|
|
|
138
|
+
|
|
|
|
139
|
+ OpLogUtil.setVariable("id", id);
|
|
|
|
140
|
+ OpLogUtil.setExtra(vo);
|
|
|
|
141
|
+
|
|
|
|
142
|
+ cleanCacheByKey(id);
|
|
|
|
143
|
+ }
|
|
|
|
144
|
+
|
|
104
|
@CacheEvict(value = SpecLockDelayApplication.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
|
145
|
@CacheEvict(value = SpecLockDelayApplication.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
|
|
105
|
@Override
|
146
|
@Override
|
|
106
|
public void cleanCacheByKey(Serializable key) {
|
147
|
public void cleanCacheByKey(Serializable key) {
|