Commit e22ff16ea6a335201a1e4de6729770e217e65507

Authored by yeqianyong
1 parent 3c76385c

楚江ERP-客户开发-待办、已办相关功能调整

... ... @@ -176,10 +176,10 @@ public class CustomerDevelopPlanController extends DefaultBaseController {
176 176 *
177 177 */
178 178 @ApiOperation("待办类型数量统计")
179   - @HasPermission({"customer-dev-manage:customer-dev-plan:statistics"})
  179 + @HasPermission({"customer-dev-manage:customer-dev-plan:query"})
180 180 @GetMapping("/todoTypeStatistics")
181   - public InvokeResult<CustomerDevelopPlanStatisticsBo> todoTypeStatistics() {
182   - CustomerDevelopPlanStatisticsBo statistics = customerDevelopPlanService.todoTypeStatistics();
  181 + public InvokeResult<CustomerDevelopPlanStatisticsBo> todoTypeStatistics(@Valid QueryCustomerDevelopPlanVo vo) {
  182 + CustomerDevelopPlanStatisticsBo statistics = customerDevelopPlanService.todoTypeStatistics(vo);
183 183 return InvokeResultBuilder.success(statistics);
184 184 }
185 185
... ...
... ... @@ -65,6 +65,7 @@ public class TransactorHandler {
65 65 */
66 66 public List<String> listByRoleAndWorkshop(String roleCode, String workshopType, String workshopId) {
67 67 log.info("================== listByRoleAndWorkshop invoke start, roleCode:{}, workshopType:{}, workshopId:{}", roleCode, workshopType, workshopId);
  68 + // 获取厂房数据
68 69 Workshop workshop = workshopService.findById(workshopId);
69 70 if (workshop == null) {
70 71 log.info("================== listByRoleAndWorkshop workshop is not exist!");
... ... @@ -78,6 +79,7 @@ public class TransactorHandler {
78 79 }
79 80 List<String> result = new ArrayList<>();
80 81 for (String id : userIdList) {
  82 + log.info("================== listByRoleAndWorkshop roleUserId:{}", id);
81 83 if ("TYPE_1".equals(workshopType) && ("一分厂".equals(workshopName) || "二分厂".equals(workshopName))) {
82 84 // 一、二分厂
83 85 result.add(id);
... ...
... ... @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo;
7 7 import com.lframework.starter.bpm.dto.FlowTaskDto;
8 8 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
9 9 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  10 +import com.lframework.starter.bpm.service.FlowTaskWrapperService;
10 11 import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
11 12 import com.lframework.starter.web.core.components.security.SecurityUtil;
12 13 import com.lframework.starter.web.core.utils.*;
... ... @@ -51,6 +52,8 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
51 52 private FlowTaskWrapperMapper flowTaskWrapperMapper;
52 53 @Resource
53 54 private FlowInstanceWrapperService flowInstanceWrapperService;
  55 + @Resource
  56 + private FlowTaskWrapperService flowTaskWrapperService;
54 57
55 58
56 59
... ... @@ -81,20 +84,27 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
81 84 // 待办类型
82 85 String todoType = vo.getTodoType();
83 86 if ("COMPLETED".equals(todoType)) {
84   - vo.setStatus(CustomerDevelopStatus.PASS.getCode());
  87 + // 获取当前人已办理业务数据ID
  88 + List<String> businessIds = flowTaskWrapperService.listBusinessId("CUSTOMER_DEVELOP", SecurityUtil.getCurrentUser().getId(), true);
  89 + if (CollectionUtils.isEmpty(businessIds)) {
  90 + return new PageResult<>();
  91 + }
  92 + vo.setIds(businessIds);
85 93 } else if ("WAIT".equals(todoType)) {
86   - log.info("=================== CustomerDevelopPlanService.query SecurityUtil.getCurrentUser.getId =================={}"
87   - , JsonUtil.toJsonString(SecurityUtil.getCurrentUser().getId()));
88   - // 获取当前人员的待办任务数据
89   - List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
90   - if (CollectionUtils.isEmpty(flowTaskList)) {
  94 + // 获取当前人待办理业务数据ID
  95 + List<String> businessIds = flowTaskWrapperService.listBusinessId("CUSTOMER_DEVELOP", SecurityUtil.getCurrentUser().getId(), false);
  96 + if (CollectionUtils.isEmpty(businessIds)) {
91 97 return new PageResult<>();
92 98 }
93   - List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
94   - vo.setIds(ids);
  99 + vo.setIds(businessIds);
95 100 }
  101 + List<CustomerDevelopPlan> dataList = new ArrayList<>();
96 102 PageHelperUtil.startPage(pageIndex, pageSize);
97   - List<CustomerDevelopPlan> dataList = this.query(vo);
  103 + if ("COMPLETED".equals(todoType) || "WAIT".equals(todoType)) {
  104 + dataList = this.getBaseMapper().noDataPermissionQuery(vo);
  105 + } else {
  106 + dataList = this.query(vo);
  107 + }
98 108
99 109 return PageResultUtil.convert(new PageInfo<>(dataList));
100 110 }
... ... @@ -270,33 +280,19 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
270 280 * @return CustomerDevelopPlanStatisticsBo
271 281 */
272 282 @Override
273   - public CustomerDevelopPlanStatisticsBo todoTypeStatistics() {
  283 + public CustomerDevelopPlanStatisticsBo todoTypeStatistics(QueryCustomerDevelopPlanVo vo) {
274 284 // 获取所有客户开发数据
275   - LambdaQueryWrapper<CustomerDevelopPlan> queryWrapper = Wrappers.lambdaQuery(CustomerDevelopPlan.class);
276   - List<CustomerDevelopPlan> customerDevelopPlans = this.getBaseMapper().selectList(queryWrapper);
277   - if (CollectionUtils.isEmpty(customerDevelopPlans)) {
278   - return null;
279   - }
  285 + List<CustomerDevelopPlan> customerDevelopPlans = query(vo);
280 286 // 获取当前人员流程任务数据
281   - List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo()
282   - , SecurityUtil.getCurrentUser().getId());
283   - List<String> businessIds = new ArrayList<>();
284   - if (CollectionUtils.isNotEmpty(flowTaskList)) {
285   - businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
286   - }
287   - int completedCount = 0;
288   - int todoCount = 0;
289   - for (CustomerDevelopPlan plan : customerDevelopPlans) {
290   - CustomerDevelopStatus status = plan.getStatus();
291   - if (CustomerDevelopStatus.PASS.equals(status)) {
292   - completedCount++;
293   - }
294   - if (businessIds.contains(plan.getId())) {
295   - todoCount++;
296   - }
297   - }
  287 + List<String> completedBusinessIds = flowTaskWrapperService.listBusinessId("CUSTOMER_DEVELOP"
  288 + , SecurityUtil.getCurrentUser().getId(), true);
  289 + List<String> todoBusinessIds = flowTaskWrapperService.listBusinessId("CUSTOMER_DEVELOP"
  290 + , SecurityUtil.getCurrentUser().getId(), false);
  291 + int completedCount = CollectionUtils.isEmpty(completedBusinessIds) ? 0 : completedBusinessIds.size();
  292 + int todoCount = CollectionUtils.isEmpty(todoBusinessIds) ? 0 : todoBusinessIds.size();
  293 +
298 294 CustomerDevelopPlanStatisticsBo statisticsBo = new CustomerDevelopPlanStatisticsBo();
299   - statisticsBo.setAllCount(customerDevelopPlans.size());
  295 + statisticsBo.setAllCount(CollectionUtils.isEmpty(customerDevelopPlans) ? 0 : customerDevelopPlans.size());
300 296 statisticsBo.setCompletedCount(completedCount);
301 297 statisticsBo.setTodoCount(todoCount);
302 298
... ...
... ... @@ -34,4 +34,17 @@ public interface CustomerDevelopPlanMapper extends BaseMapper<CustomerDevelopPla
34 34 @DataPermission(template = "order", alias = "tb")
35 35 })
36 36 List<CustomerDevelopPlan> query(@Param("vo") QueryCustomerDevelopPlanVo vo);
  37 +
  38 + /**
  39 + * 待办已办列表
  40 + *
  41 + * @param vo 查询条件
  42 + * @return List<CustomerDevelopPlan>
  43 + */
  44 + @Sorts({
  45 + @Sort(value = "c.name", autoParse = true),
  46 + @Sort(value = "tb.createTime", autoParse = true),
  47 + @Sort(value = "tb.updateTime", autoParse = true),
  48 + })
  49 + List<CustomerDevelopPlan> noDataPermissionQuery(@Param("vo") QueryCustomerDevelopPlanVo vo);
37 50 }
... ...
... ... @@ -83,5 +83,5 @@ public interface CustomerDevelopPlanService extends BaseMpService<CustomerDevelo
83 83 *
84 84 * @return CustomerDevelopPlanStatisticsBo
85 85 */
86   - CustomerDevelopPlanStatisticsBo todoTypeStatistics();
  86 + CustomerDevelopPlanStatisticsBo todoTypeStatistics(QueryCustomerDevelopPlanVo vo);
87 87 }
... ...
... ... @@ -62,8 +62,7 @@
62 62 INNER JOIN base_data_customer AS c ON tb.customer_id = c.id
63 63 </sql>
64 64
65   - <select id="query" resultMap="CustomerDevelopPlan">
66   - <include refid="CustomerDevelopPlan_sql"/>
  65 + <sql id="queryConditionSql">
67 66 <if test = "vo.workshopType != null and vo.workshopType != ''">
68 67 LEFT JOIN base_data_workshop w ON tb.workshop_id = w.id
69 68 </if>
... ... @@ -77,9 +76,6 @@
77 76 <if test="vo.customerId != null and vo.customerId != ''">
78 77 AND tb.customer_id = #{vo.customerId}
79 78 </if>
80   - <if test="vo.workshopId != null and vo.workshopId != ''">
81   - AND tb.workshop_id = #{vo.workshopId}
82   - </if>
83 79 <if test="vo.officeId != null and vo.officeId != ''">
84 80 AND tb.office_id = #{vo.officeId}
85 81 </if>
... ... @@ -93,5 +89,15 @@
93 89 </foreach>
94 90 </if>
95 91 </where>
  92 + </sql>
  93 +
  94 + <select id="query" resultMap="CustomerDevelopPlan">
  95 + <include refid="CustomerDevelopPlan_sql"/>
  96 + <include refid="queryConditionSql"/>
  97 + </select>
  98 +
  99 + <select id="noDataPermissionQuery" resultMap="CustomerDevelopPlan">
  100 + <include refid="CustomerDevelopPlan_sql"/>
  101 + <include refid="queryConditionSql"/>
96 102 </select>
97 103 </mapper>
... ...