|
...
|
...
|
@@ -9,12 +9,17 @@ import com.lframework.starter.common.utils.Assert; |
|
9
|
9
|
import com.lframework.starter.common.utils.ObjectUtil;
|
|
10
|
10
|
import com.lframework.starter.web.core.annotations.oplog.OpLog;
|
|
11
|
11
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
|
|
12
|
+import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
12
|
13
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
|
13
|
14
|
import com.lframework.starter.web.core.utils.IdUtil;
|
|
14
|
15
|
import com.lframework.starter.web.core.utils.OpLogUtil;
|
|
15
|
16
|
import com.lframework.starter.web.core.utils.PageHelperUtil;
|
|
16
|
17
|
import com.lframework.starter.web.core.utils.PageResultUtil;
|
|
17
|
18
|
import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
|
|
|
19
|
+import com.lframework.starter.web.inner.entity.SysRole;
|
|
|
20
|
+import com.lframework.starter.web.inner.entity.SysUserDept;
|
|
|
21
|
+import com.lframework.starter.web.inner.service.system.SysRoleService;
|
|
|
22
|
+import com.lframework.starter.web.inner.service.system.SysUserDeptService;
|
|
18
|
23
|
import com.lframework.xingyun.basedata.entity.BreedRelationship;
|
|
19
|
24
|
import com.lframework.xingyun.basedata.service.breed.BreedRelationshipService;
|
|
20
|
25
|
import com.lframework.xingyun.sc.events.quotation.CommonChangedEvent;
|
|
...
|
...
|
@@ -28,11 +33,17 @@ import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSupplierQuotatio |
|
28
|
33
|
import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySupplierQuotationProjectVo;
|
|
29
|
34
|
import com.lframework.xingyun.sc.procurement.vo.quotation.UpdateSupplierQuotationProjectVo;
|
|
30
|
35
|
import java.io.Serializable;
|
|
|
36
|
+import java.security.Security;
|
|
31
|
37
|
import java.time.LocalDate;
|
|
32
|
38
|
import java.time.LocalDateTime;
|
|
33
|
39
|
import java.time.format.DateTimeFormatter;
|
|
|
40
|
+import java.util.ArrayList;
|
|
34
|
41
|
import java.util.List;
|
|
|
42
|
+import java.util.Set;
|
|
|
43
|
+import java.util.stream.Collectors;
|
|
35
|
44
|
import javax.annotation.Resource;
|
|
|
45
|
+
|
|
|
46
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
36
|
47
|
import org.apache.commons.lang3.StringUtils;
|
|
37
|
48
|
import org.springframework.context.ApplicationEventPublisher;
|
|
38
|
49
|
import org.springframework.stereotype.Service;
|
|
...
|
...
|
@@ -72,6 +83,10 @@ public class SupplierQuotationProjectServiceImpl |
|
72
|
83
|
private SupplierQuotationProjectQuoteMapper supplierQuotationProjectQuoteMapper;
|
|
73
|
84
|
@Resource
|
|
74
|
85
|
private ApplicationEventPublisher applicationEventPublisher;
|
|
|
86
|
+ @Resource
|
|
|
87
|
+ private SysRoleService sysRoleService;
|
|
|
88
|
+ @Resource
|
|
|
89
|
+ private SysUserDeptService sysUserDeptService;
|
|
75
|
90
|
|
|
76
|
91
|
@Override
|
|
77
|
92
|
public PageResult<SupplierQuotationProject> query(Integer pageIndex, Integer pageSize, QuerySupplierQuotationProjectVo vo) {
|
|
...
|
...
|
@@ -85,11 +100,34 @@ public class SupplierQuotationProjectServiceImpl |
|
85
|
100
|
|
|
86
|
101
|
@Override
|
|
87
|
102
|
public List<SupplierQuotationProject> query(QuerySupplierQuotationProjectVo vo) {
|
|
|
103
|
+ //供应商报价
|
|
|
104
|
+ String userId = SecurityUtil.getCurrentUser().getId();
|
|
|
105
|
+ Set<String> roleCodeSet = getRoleCodeSet(userId);
|
|
|
106
|
+
|
|
|
107
|
+ //判断是否为供应商角色
|
|
|
108
|
+ boolean isSupplier = roleCodeSet.contains("gys");
|
|
|
109
|
+ if (isSupplier) {
|
|
|
110
|
+ List<SysUserDept> userDepts = sysUserDeptService.getByUserId(userId);
|
|
|
111
|
+ List<String> userDeptIds = new ArrayList<>();
|
|
|
112
|
+ if (CollectionUtils.isNotEmpty(userDepts)) {
|
|
|
113
|
+ userDeptIds = userDepts.stream()
|
|
|
114
|
+ .map(SysUserDept::getDeptId)
|
|
|
115
|
+ .collect(Collectors.toList());
|
|
|
116
|
+ vo.setCurrentSupplierDeptIds(userDeptIds);
|
|
|
117
|
+ }
|
|
|
118
|
+ }
|
|
88
|
119
|
List<SupplierQuotationProject> datas = getBaseMapper().query(vo);
|
|
89
|
120
|
fillComputedStatus(datas);
|
|
90
|
121
|
return datas;
|
|
91
|
122
|
}
|
|
92
|
123
|
|
|
|
124
|
+ private Set<String> getRoleCodeSet(String userId) {
|
|
|
125
|
+ List<SysRole> sysRoleList = sysRoleService.getByUserId(userId);
|
|
|
126
|
+ return sysRoleList.stream()
|
|
|
127
|
+ .map(SysRole::getCode)
|
|
|
128
|
+ .collect(Collectors.toSet());
|
|
|
129
|
+ }
|
|
|
130
|
+
|
|
93
|
131
|
@Override
|
|
94
|
132
|
public List<SupplierQuotationProject> queryCurrentMonthBoardList(LocalDate month, String userId) {
|
|
95
|
133
|
LocalDate monthStart = month.withDayOfMonth(1);
|
...
|
...
|
|