Commit 79806e466d2bbed55531c737f18958672bb83e40

Authored by 房远帅
1 parent 666c0a96

楚江ERP:获取当前人的部门负责人

... ... @@ -168,6 +168,21 @@ public class CustomerCreditController extends DefaultBaseController {
168 168 return InvokeResultBuilder.success(results);
169 169 }
170 170
  171 + /**
  172 + * 获取当前人的部门负责人
  173 + */
  174 + @ApiOperation("获取当前人的部门负责人")
  175 + @GetMapping("/getDeptUser")
  176 + public InvokeResult<QuerySysUserBo> getDeptUser() {
  177 +
  178 + SysUser deptUser = customerCreditService.getDeptUser();
  179 + QuerySysUserBo results = null;
  180 + if (deptUser != null) {
  181 + results = new QuerySysUserBo(deptUser);
  182 + }
  183 + return InvokeResultBuilder.success(results);
  184 + }
  185 +
171 186
172 187 /**
173 188 * 封装客户资信数据
... ...
... ... @@ -50,6 +50,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
50 50 /**
51 51 * 姓名是否变更
52 52 */
  53 + @TableField(exist = false)
53 54 private Boolean nameChange;
54 55
55 56 /**
... ... @@ -60,6 +61,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
60 61 /**
61 62 * 性别是否变更
62 63 */
  64 + @TableField(exist = false)
63 65 private Boolean sexChange;
64 66
65 67 /**
... ... @@ -70,6 +72,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
70 72 /**
71 73 * 籍贯是否变更
72 74 */
  75 + @TableField(exist = false)
73 76 private Boolean nativePlaceChange;
74 77
75 78 /**
... ... @@ -80,6 +83,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
80 83 /**
81 84 * 年龄是否变更
82 85 */
  86 + @TableField(exist = false)
83 87 private Boolean ageChange;
84 88
85 89 /**
... ... @@ -90,6 +94,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
90 94 /**
91 95 * 职务是否变更
92 96 */
  97 + @TableField(exist = false)
93 98 private Boolean positionChange;
94 99
95 100 /**
... ... @@ -100,6 +105,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
100 105 /**
101 106 * 手机是否变更
102 107 */
  108 + @TableField(exist = false)
103 109 private Boolean mobileChange;
104 110
105 111
... ... @@ -111,6 +117,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
111 117 /**
112 118 * 固定电话是否变更
113 119 */
  120 + @TableField(exist = false)
114 121 private Boolean phoneChange;
115 122
116 123 /**
... ... @@ -121,6 +128,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
121 128 /**
122 129 * 邮箱地址是否变更
123 130 */
  131 + @TableField(exist = false)
124 132 private Boolean emailChange;
125 133
126 134 /**
... ... @@ -131,6 +139,7 @@ public class CorePersonnelHistory extends BaseEntity implements BaseDto {
131 139 /**
132 140 * 现住址是否变更
133 141 */
  142 + @TableField(exist = false)
134 143 private Boolean addressChange;
135 144
136 145 /**
... ...
... ... @@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.github.pagehelper.PageInfo;
6 6 import com.lframework.starter.web.core.components.security.SecurityUtil;
7 7 import com.lframework.starter.web.inner.bo.system.user.GetSysUserBo;
  8 +import com.lframework.starter.web.inner.entity.SysDept;
8 9 import com.lframework.starter.web.inner.entity.SysUser;
  10 +import com.lframework.starter.web.inner.service.system.SysDeptService;
9 11 import com.lframework.starter.web.inner.service.system.SysUserService;
10 12 import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
11 13 import com.lframework.xingyun.sc.entity.CorePersonnel;
12   -import com.lframework.xingyun.sc.entity.CorePersonnelHistory;
13 14 import com.lframework.xingyun.sc.entity.CustomerCredit;
14 15 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
15 16 import com.lframework.starter.web.core.utils.PageResultUtil;
... ... @@ -37,7 +38,6 @@ import org.springframework.cache.annotation.Cacheable;
37 38 import org.springframework.stereotype.Service;
38 39 import org.springframework.transaction.annotation.Transactional;
39 40 import net.sourceforge.pinyin4j.PinyinHelper;
40   -import picocli.CommandLine;
41 41
42 42 import javax.annotation.Resource;
43 43 import java.util.HashSet;
... ... @@ -60,6 +60,8 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
60 60 private CustomerCreditHistoryService customerCreditHistoryService;
61 61 @Resource
62 62 private CorePersonnelHistoryService corePersonnelHistoryService;
  63 + @Resource
  64 + private SysDeptService sysDeptService;
63 65
64 66 @Override
65 67 public PageResult<CustomerCredit> query(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
... ... @@ -649,6 +651,34 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
649 651 }
650 652
651 653 /**
  654 + * 获取当前人的部门负责人
  655 + */
  656 + @Override
  657 + public SysUser getDeptUser() {
  658 + //获取当前人员ID
  659 + String currentUserId = SecurityUtil.getCurrentUser().getId();
  660 + SysUser sysUser = sysUserService.findById(currentUserId);
  661 + if (sysUser != null) {
  662 + GetSysUserBo getSysUserBo = new GetSysUserBo(sysUser);
  663 + //部门
  664 + List<String> depts = getSysUserBo.getDepts();
  665 + if (CollectionUtils.isNotEmpty(depts)) {
  666 + String deptId = depts.get(0);
  667 + SysDept sysDept = sysDeptService.findById(deptId);
  668 + //部门负责人
  669 + if (StringUtil.isNotEmpty(sysDept.getUserId())) {
  670 + return sysUserService.findById(sysDept.getUserId());
  671 + }
  672 + } else {
  673 + throw new IllegalArgumentException("部门名称为空");
  674 + }
  675 + } else {
  676 + throw new IllegalArgumentException("人员不存在");
  677 + }
  678 + return null;
  679 + }
  680 +
  681 + /**
652 682 * 自动生成资信编码
653 683 *
654 684 * @return 资信编码
... ...
... ... @@ -67,4 +67,9 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> {
67 67 */
68 68 List<SysUser> getAllUser();
69 69
  70 + /**
  71 + * 获取当前人的部门负责人
  72 + */
  73 + SysUser getDeptUser();
  74 +
70 75 }
... ...