Commit ded2da7dd8af326bdd23cc9337bf907dd0d3bc62

Authored by 杨鸣坤
1 parent 2fc6e2a5

楚江ERP:新增合同获取办事处逻辑修改

... ... @@ -377,7 +377,14 @@ public class ContractDistributorStandardController extends DefaultBaseController
377 377 //部门
378 378 List<String> depts = getSysUserBo.getDepts();
379 379 if (org.apache.commons.collections.CollectionUtils.isNotEmpty(depts)) {
380   - vo.setDeptId(depts.get(0));
  380 + SysDept sysDept = sysDeptService.findById(depts.get(0));
  381 + vo.setDeptId(sysDept.getId());
  382 + if (sysDept.getName().endsWith("区域") && StringUtils.isNotBlank(sysDept.getParentId())) { // 如果是**区域,则查询上一层次是否为**办事处,获取办事处code
  383 + SysDept parentSysDept = sysDeptService.findById(sysDept.getParentId());
  384 + if (parentSysDept != null && parentSysDept.getName().endsWith("办事处")) {
  385 + vo.setDeptId(sysDept.getParentId());
  386 + }
  387 + }
381 388 }
382 389 }
383 390
... ... @@ -435,7 +442,16 @@ public class ContractDistributorStandardController extends DefaultBaseController
435 442 if (CollectionUtils.isNotEmpty(depts)) {
436 443 String deptId = depts.get(0);
437 444 SysDept sysDept = sysDeptService.findById(deptId);
438   - stringBuilder.append(sysDept.getCode());
  445 + if (sysDept.getName().endsWith("区域") && StringUtils.isNotBlank(sysDept.getParentId())) { // 如果是**区域,则查询上一层次是否为**办事处,获取办事处code
  446 + SysDept parentSysDept = sysDeptService.findById(sysDept.getParentId());
  447 + if (parentSysDept != null && parentSysDept.getName().endsWith("办事处")) {
  448 + stringBuilder.append(parentSysDept.getCode());
  449 + } else {
  450 + stringBuilder.append(sysDept.getCode());
  451 + }
  452 + } else {
  453 + stringBuilder.append(sysDept.getCode());
  454 + }
439 455 }
440 456 }
441 457
... ...