AdminServiceImpl.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. package com.goafanti.admin.service.impl;
  2. import java.util.*;
  3. import javax.annotation.Resource;
  4. import com.goafanti.admin.service.DepartmentService;
  5. import com.goafanti.admin.service.NewAdminService;
  6. import com.goafanti.common.dao.*;
  7. import com.goafanti.common.error.BusinessException;
  8. import com.goafanti.common.model.Department;
  9. import com.goafanti.common.utils.RedisUtil;
  10. import org.springframework.beans.BeanUtils;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import com.goafanti.admin.bo.AdminContacts;
  14. import com.goafanti.admin.bo.AdminCustomerBo;
  15. import com.goafanti.admin.bo.AdminCustomerDetailBo;
  16. import com.goafanti.admin.bo.AdminDetail;
  17. import com.goafanti.admin.bo.AdminListBo;
  18. import com.goafanti.admin.bo.DepCountBo;
  19. import com.goafanti.admin.service.AdminService;
  20. import com.goafanti.common.constant.AFTConstants;
  21. import com.goafanti.common.model.Admin;
  22. import com.goafanti.common.model.UserBusiness;
  23. import com.goafanti.common.utils.LoggerUtils;
  24. import com.goafanti.common.utils.PasswordUtil;
  25. import com.goafanti.common.utils.StringUtils;
  26. import com.goafanti.core.mybatis.BaseMybatisDao;
  27. import com.goafanti.core.mybatis.page.Pagination;
  28. import com.goafanti.core.shiro.token.TokenManager;
  29. import com.goafanti.customer.bo.BusinessListBo;
  30. import com.goafanti.organization.bo.OrganizationListOut;
  31. @Service
  32. public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements AdminService {
  33. @Autowired
  34. private AdminMapper adminMapper;
  35. @Autowired
  36. private UserRoleMapper userRoleMapper;
  37. @Autowired
  38. private AdminLocationMapper adminLocationMapper;
  39. @Autowired
  40. private UserLockReleaseMapper userLockReleaseMapper;
  41. @Autowired
  42. private UserBusinessMapper userBusinessMapper;
  43. @Autowired
  44. private UserMapper userMapper;
  45. @Autowired
  46. private DepartmentMapper departmentMapper;
  47. @Autowired
  48. private DepartmentService departmentService;
  49. @Resource(name = "passwordUtil")
  50. private PasswordUtil passwordUtil;
  51. @Autowired
  52. private NewAdminService newAdminService;
  53. @Autowired
  54. private RedisUtil redisUtil;
  55. @Override
  56. public List<Admin> selectAllAdmin() {
  57. return adminMapper.selectAllAdmin(null);
  58. }
  59. @Override
  60. public Admin selectByMobile(String mobile) {
  61. return adminMapper.selectByMobile(mobile);
  62. }
  63. @Override
  64. public Admin selectByPrimaryKey(String key) {
  65. return adminMapper.selectByPrimaryKey(key);
  66. }
  67. @SuppressWarnings("unchecked")
  68. @Override
  69. public Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name,String roleName,Integer seniorStaff,
  70. Integer pageNo, Integer pageSize) {
  71. Map<String, Object> params = new HashMap<>();
  72. if (StringUtils.isNotBlank(roleName))params.put("roleName", roleName);
  73. if (StringUtils.isNotBlank(mobile))params.put("mobile", mobile);
  74. if (StringUtils.isNotBlank(name))params.put("name", name);
  75. if (null != number)params.put("number", number);
  76. if (null != seniorStaff)params.put("seniorStaff", seniorStaff);
  77. if (pageNo == null || pageNo < 0)pageNo = 1;
  78. if (pageSize == null || pageSize < 0 || pageSize > 10)pageSize = 10;
  79. if (province != null) params.put("province", province);
  80. return (Pagination<AdminListBo>) findPage("findAdminListByPage", "findAdminCount", params, pageNo,
  81. pageSize);
  82. }
  83. @Override
  84. public int insert(Admin ad) {
  85. return adminMapper.insert(ad);
  86. }
  87. @Override
  88. public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds) {
  89. Map<String, Object> params = new HashMap<>();
  90. params.put("uid", ad.getId());
  91. params.put("roles", roleIds);
  92. if (ad.getId() != "1") {
  93. userRoleMapper.deleteByUserId(ad.getId());
  94. if (!roleIds.isEmpty()) {
  95. userRoleMapper.insertBatch(params);
  96. }
  97. TokenManager.clearUserAuthByUserId(ad.getId());
  98. }
  99. return adminMapper.updateByPrimaryKeySelective(ad);
  100. }
  101. @Override
  102. public int updateByPrimaryKey(Admin a) {
  103. return adminMapper.updateByPrimaryKeySelective(a);
  104. }
  105. @Override
  106. public AdminDetail selectAdminDetail(String id) {
  107. Admin a = adminMapper.selectByPrimaryKey(id);
  108. if (null == a) {
  109. return null;
  110. }
  111. AdminDetail ad = new AdminDetail();
  112. BeanUtils.copyProperties(a, ad);
  113. ad.setRoles(adminMapper.selectRolesByPrimaryKey(id));
  114. return null;
  115. }
  116. @Override
  117. public List<Admin> selectCognizanceConsultant() {
  118. return adminMapper.selectCognizanceConsultant();
  119. }
  120. @Override
  121. public List<Admin> selectPatentAuthor() {
  122. return adminMapper.selectPatentAuthor();
  123. }
  124. @Override
  125. public List<Admin> selectPatentPrincipal() {
  126. return adminMapper.selectPatentPrincipal();
  127. }
  128. @Override
  129. public List<Admin> selectCopyrightConsultant() {
  130. return adminMapper.selectCopyrightConsultant();
  131. }
  132. @Override
  133. public List<Admin> selectCognizancePrincipal() {
  134. return adminMapper.selectCognizancePrincipal();
  135. }
  136. @Override
  137. public List<Admin> selectCopyrightPrincipal() {
  138. return adminMapper.selectCopyrightPrincipal();
  139. }
  140. @Override
  141. public List<Admin> selectTechprojectConsultant() {
  142. return adminMapper.selectTechprojectConsultant();
  143. }
  144. @Override
  145. public List<Admin> selectTechprojectPrincipal() {
  146. return adminMapper.selectTechprojectPrincipal();
  147. }
  148. @Override
  149. public List<String> selectRoleByPrimaryKey(String uid) {
  150. return adminMapper.selectRoleByPrimaryKey(uid);
  151. }
  152. @Override
  153. public List<String> listAuditor() {
  154. return userRoleMapper.listAuditor();
  155. }
  156. @Override
  157. public Map<String, String> selectAccoutManager() {
  158. return disposeAdminList(adminMapper.selectAccoutManager());
  159. }
  160. @Override
  161. public Map<String, String> selectTechnician() {
  162. return disposeAdminList(adminMapper.selectTechnician());
  163. }
  164. @Override
  165. public Map<String, String> selectSalesman() {
  166. return disposeAdminList(adminMapper.selectSalesman());
  167. }
  168. @Override
  169. public Map<String, String> selectContractManager() {
  170. return disposeAdminList(adminMapper.selectContractManager());
  171. }
  172. @Override
  173. public Map<String, String> selectTechBroder() {
  174. return disposeAdminList(adminMapper.selectTechBroder());
  175. }
  176. @Override
  177. public int insertNewAdmin(Admin ad) {
  178. return adminMapper.insert(ad);
  179. }
  180. @Override
  181. public Map<String, String> listAdminSelect() {
  182. if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  183. return disposeAdminList(adminMapper.listAdminSelectBySuperAdmin());
  184. } else if (TokenManager.hasRole(AFTConstants.AREAADMIN)) {
  185. List<Integer> provinceList = adminLocationMapper
  186. .selectProvinceWhereCityIsNullByAdminId(TokenManager.getAdminId());
  187. List<Integer> cityList = adminLocationMapper.selectCityByAdminId(TokenManager.getAdminId());
  188. provinceList.addAll(cityList);
  189. return disposeAdminList(adminMapper.listAdminSelectByAreaAdmin(provinceList, cityList));
  190. }
  191. return null;
  192. }
  193. private Map<String, String> disposeAdminList(List<Admin> list) {
  194. Map<String, String> map = new TreeMap<String, String>();
  195. for (Admin o : list) {
  196. map.put(o.getId(), o.getName());
  197. }
  198. return map;
  199. }
  200. @Override
  201. public List<Admin> listAdminByName(String name,Integer status) {
  202. if(status==null)status=0;
  203. return adminMapper.listAdminByName(name,status);
  204. }
  205. @Override
  206. public List<AdminListBo> selectDepartmentStaff(String departmentId, String name) {
  207. return adminMapper.selectDepartmentStaff( departmentId, name);
  208. }
  209. @Override
  210. public int updateLockAdmin() {
  211. int count=0;
  212. List<Admin> list=adminMapper.selectAllAdmin(null);//获取所有用户
  213. List<List<Admin>>aList=groupList(list);//拆分成多个
  214. String lockIds = "";
  215. for(List<Admin> al:aList){
  216. for (Admin a : al) {
  217. String pwd=a.getPassword();
  218. a.setPassword("123456");
  219. String pwd2=passwordUtil.getEncryptPwd(a);
  220. if (pwd.equals(pwd2)) {
  221. lockIds += a.getId() + ",";
  222. }
  223. }
  224. if(lockIds.length()>0){
  225. try {
  226. lockIds = "'" + lockIds.substring(0,lockIds.length()-1).replace(",", "','") + "'";
  227. count+= adminMapper.updateLockIds(lockIds);
  228. lockIds = "";
  229. Thread.sleep(1000);
  230. } catch (InterruptedException e) {
  231. LoggerUtils.error(getClass(), "未修改管理员锁定失败", e);
  232. }
  233. }
  234. }
  235. return count;
  236. }
  237. /*
  238. * List分割
  239. */
  240. public List<List<Admin>> groupList(List<Admin> list) {
  241. List<List<Admin>> listGroup = new ArrayList<List<Admin>>();
  242. int listSize = list.size();
  243. //子集合的长度
  244. int toIndex = 100;
  245. for (int i = 0; i < list.size(); i += toIndex) {
  246. if (i + toIndex > listSize) {
  247. toIndex = listSize - i;
  248. }
  249. List<Admin> newList = list.subList(i, i + toIndex);
  250. listGroup.add(newList);
  251. }
  252. return listGroup;
  253. }
  254. @Override
  255. public List<Admin> getListDefaultPassword(String depId) {
  256. List<Admin> list=adminMapper.selectAllAdmin(depId);
  257. List<Admin> list2=new ArrayList<>();
  258. for (Admin a : list) {
  259. String pwd=a.getPassword();
  260. a.setPassword("123456");
  261. String pwd2=passwordUtil.getEncryptPwd(a);
  262. if (pwd.equals(pwd2)) {
  263. list2.add(a);
  264. }
  265. }
  266. return list2;
  267. }
  268. @Override
  269. public List<Admin> getAdminRoleList(String roleName) {
  270. return adminMapper.getAdminRoleNameList(roleName);
  271. }
  272. @Override
  273. public int addFrequentContacts(String id) {
  274. String []ss=id.split(",");
  275. List<String> list=adminMapper.getaidFrequentContacts(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
  276. for (String s : ss) {
  277. boolean flag=true;
  278. for (String s2 : list) {
  279. if (s.equals(s2)) {
  280. flag=false;
  281. }
  282. }
  283. if (flag) {
  284. AdminContacts a=new AdminContacts();
  285. a.setId(UUID.randomUUID().toString());
  286. a.setAid(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
  287. a.setContactsId(s);
  288. adminMapper.addAdminContacts(a);
  289. }
  290. }
  291. return 1;
  292. }
  293. @SuppressWarnings("unchecked")
  294. @Override
  295. public Pagination<AdminListBo> frequentContactsList(String deps, String name,String roleName, Integer pageSize, Integer pageNo) {
  296. Map<String, Object> params = new HashMap<String, Object>();
  297. if(pageSize==null||pageSize<0)pageSize=10;
  298. if(pageNo==null||pageNo<0)pageNo=1;
  299. if (StringUtils.isNotBlank(deps)){
  300. params.put("depId", departmentService.parseArray(deps));
  301. }
  302. if (StringUtils.isNotBlank(name)) params.put("name", name);
  303. if (StringUtils.isNotBlank(roleName)) params.put("roleName", roleName);
  304. params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
  305. Pagination<AdminListBo> p = (Pagination<AdminListBo>)findPage("frequentContactsList", "frequentContactsCount", params, pageNo, pageSize);
  306. List<AdminListBo> list=(List<AdminListBo>)p.getList();
  307. for(AdminListBo i:list){
  308. newAdminService.pushRolesName(i);
  309. }
  310. return p;
  311. }
  312. @Override
  313. public int deleteFrequentContacts(String id) {
  314. return adminMapper.deleteFrequentContacts(id);
  315. }
  316. @SuppressWarnings("unchecked")
  317. @Override
  318. public Pagination<AdminCustomerBo> selectAdminCustomerStatistics(String depId, String startTime, String endTime, Integer pageSize, Integer pageNo) {
  319. Map<String, Object> params = new HashMap<String, Object>();
  320. if(pageSize==null||pageSize<0)pageSize=10;
  321. if(pageNo==null||pageNo<0)pageNo=1;
  322. if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
  323. if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
  324. if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
  325. return (Pagination<AdminCustomerBo>)findPage("selectAdminCustomerList", "selectAdminCustomerCount", params, pageNo, pageSize);
  326. }
  327. @Override
  328. public DepCountBo selectAllUser(String depId, String startTime, String endTime,String aName) {
  329. DepCountBo acb=new DepCountBo();
  330. if (endTime!=null)endTime=endTime+" 23:59:59";
  331. List<DepCountBo >deps=new ArrayList<>();
  332. List<Department> depIds=new ArrayList<>();
  333. //总裁助力不查看老员工
  334. Integer seniorstaff = null;
  335. if (TokenManager.hasRole(AFTConstants.CED_ASSISTANT)){
  336. seniorstaff=0;
  337. }
  338. if (depId==null) {
  339. acb.setName("科德集团");
  340. deps=departmentMapper.selectBysuperName("科德集团");
  341. }else {
  342. OrganizationListOut oo=departmentMapper.selectAllById(depId);
  343. acb.setName(oo.getName());
  344. acb.setId(depId);
  345. if(TokenManager.hasRole(AFTConstants.OPERATION_MANAGER)){
  346. List<String> myShiroDep = departmentService.selectMyDeps();
  347. if (!myShiroDep.contains(depId))throw new BusinessException("无权查看此部门信息");
  348. }
  349. depIds =departmentService.selectSubordinateDeps(depId);
  350. Department department = new Department();
  351. department.setId(depId);
  352. depIds.add(department);
  353. deps=departmentMapper.selectBysuperId(oo.getId());
  354. }
  355. List<AdminCustomerBo> list =null;
  356. //原sql计算
  357. // list=departmentMapper.AlldepCount(depIds,startTime, endTime);
  358. //新java计算
  359. list=AllDepCount(depIds,startTime,endTime,seniorstaff);
  360. for (AdminCustomerBo ad : list) {
  361. if (acb.getId().equals(ad.getDepId())){
  362. acb.getaList().add(ad);
  363. }
  364. }
  365. for (DepCountBo dep : deps) {
  366. dep.setList(iterationDeps(dep.getId(),list));
  367. for (AdminCustomerBo ad : list) {
  368. if (dep.getId().equals(ad.getDepId())){
  369. dep.getaList().add(ad);
  370. }
  371. sumCount(dep);
  372. }
  373. }
  374. acb.setList(deps);
  375. sumCount(acb);
  376. return acb;
  377. }
  378. private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime,Integer seniorStaff) {
  379. List<AdminCustomerBo> admins = adminMapper.selectByDeps(depIds,seniorStaff);
  380. if(!admins.isEmpty()){
  381. List<AdminCustomerBo> users = userMapper.selectNoChannelByaids(admins,startTime,endTime);
  382. List<AdminCustomerBo> users2 = userMapper.selectChannelByaids(admins,startTime,endTime);
  383. for (AdminCustomerBo admin : admins) {
  384. for (AdminCustomerBo user : users) {
  385. if (admin.getAid().equals(user.getAid())){
  386. admin.setUserCount(user.getUserCount());
  387. admin.setChannelCount(user.getChannelCount());
  388. admin.setSignCount(user.getSignCount());
  389. admin.setNewCount(user.getNewCount());
  390. admin.setChannelNewCount(user.getChannelNewCount());
  391. admin.setReceiveCount(user.getReceiveCount());
  392. break;
  393. }
  394. }
  395. for (AdminCustomerBo user : users2) {
  396. if (admin.getAid().equals(user.getAid())){
  397. admin.setCompleteCount(user.getCompleteCount());
  398. admin.setChannelCompleteCount(user.getChannelCompleteCount());
  399. break;
  400. }
  401. }
  402. pushAdminCount(admin);
  403. }
  404. }
  405. return admins;
  406. }
  407. private void pushAdminCount(AdminCustomerBo admin) {
  408. if (admin.getUserCount()==null) admin.setUserCount(0);
  409. if (admin.getChannelCount()==null) admin.setChannelCount(0);
  410. if (admin.getSignCount()==null) admin.setSignCount(0);
  411. if (admin.getNewCount()==null) admin.setNewCount(0);
  412. if (admin.getChannelNewCount()==null) admin.setChannelNewCount(0);
  413. if (admin.getReceiveCount()==null) admin.setReceiveCount(0);
  414. if (admin.getCompleteCount()==null) admin.setCompleteCount(0);
  415. if (admin.getChannelCompleteCount()==null) admin.setChannelCompleteCount(0);
  416. }
  417. //迭代获取所有部门与部门员工并计算出部门数量
  418. public List<DepCountBo> iterationDeps(String id,List<AdminCustomerBo> list) {
  419. List<DepCountBo> deps =departmentMapper.selectBysuperId(id);
  420. for (DepCountBo dep : deps) {
  421. dep.setList(iterationDeps(dep.getId(),list));
  422. for (AdminCustomerBo ad : list) {
  423. if (dep.getId().equals(ad.getDepId())){
  424. dep.getaList().add(ad);
  425. }
  426. }
  427. sumCount(dep);
  428. }
  429. return deps;
  430. }
  431. /**
  432. *
  433. * @param ab
  434. */
  435. public void sumCount(DepCountBo ab) {
  436. int completeCount=0,receiveCount=0,userCount=0,signCount=0,channelCount=0,newCount=0,channelNewCount=0,channelCompleteCount=0;
  437. if (ab.getList()!=null&&!ab.getList().isEmpty()) {
  438. for (DepCountBo a : ab.getList()) {
  439. if (a.getCompleteCount()!=null&& a.getCompleteCount()!=0) completeCount+=a.getCompleteCount();
  440. if (a.getReceiveCount()!=null&& a.getReceiveCount()!=0) receiveCount+=a.getReceiveCount();
  441. if (a.getUserCount()!=null&& a.getUserCount()!=0) userCount+=a.getUserCount();
  442. if (a.getSignCount()!=null&& a.getSignCount()!=0) signCount+=a.getSignCount();
  443. if (a.getChannelCount()!=null&& a.getChannelCount()!=0) channelCount+=a.getChannelCount();
  444. if (a.getNewCount()!=null&& a.getNewCount()!=0) newCount+=a.getNewCount();
  445. if (a.getChannelNewCount()!=null&& a.getChannelNewCount()!=0) channelNewCount+=a.getChannelNewCount();
  446. if (a.getChannelCompleteCount()!=null&& a.getChannelCompleteCount()!=0) channelCompleteCount+=a.getChannelCompleteCount();
  447. }
  448. }
  449. if (ab.getaList()!=null&&!ab.getaList().isEmpty()) {
  450. for (AdminCustomerBo a : ab.getaList()) {
  451. if (a.getCompleteCount()!=null&& a.getCompleteCount()!=0) completeCount+=a.getCompleteCount();
  452. if (a.getReceiveCount()!=null&& a.getReceiveCount()!=0) receiveCount+=a.getReceiveCount();
  453. if (a.getUserCount()!=null&& a.getUserCount()!=0) userCount+=a.getUserCount();
  454. if (a.getSignCount()!=null&& a.getSignCount()!=0) signCount+=a.getSignCount();
  455. if (a.getChannelCount()!=null&& a.getChannelCount()!=0) channelCount+=a.getChannelCount();
  456. if (a.getNewCount()!=null&& a.getNewCount()!=0) newCount+=a.getNewCount();
  457. if (a.getChannelNewCount()!=null&& a.getChannelNewCount()!=0) channelNewCount+=a.getChannelNewCount();
  458. if (a.getChannelCompleteCount()!=null&& a.getChannelCompleteCount()!=0) channelCompleteCount+=a.getChannelCompleteCount();
  459. }
  460. }
  461. ab.setCompleteCount(completeCount);
  462. ab.setReceiveCount(receiveCount);
  463. ab.setUserCount(userCount);
  464. ab.setSignCount(signCount);
  465. ab.setChannelCount(channelCount);
  466. ab.setNewCount(newCount);
  467. ab.setChannelNewCount(channelNewCount);
  468. ab.setChannelCompleteCount(channelCompleteCount);
  469. }
  470. @SuppressWarnings("unchecked")
  471. @Override
  472. public Pagination<AdminCustomerDetailBo> selectAdminCustomerList(String aid, String startTime, String endTime,Integer type,
  473. Integer pageSize, Integer pageNo) {
  474. Map<String, Object> params = new HashMap<String, Object>();
  475. if(pageSize==null||pageSize<0)pageSize=10;
  476. if(pageNo==null||pageNo<0)pageNo=1;
  477. if (StringUtils.isNotBlank(aid)) params.put("aid", aid);
  478. if (type==null) params.put("type", 0);
  479. else params.put("type", type);
  480. if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
  481. if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
  482. Pagination<AdminCustomerDetailBo> p =(Pagination<AdminCustomerDetailBo>)findPage("selectAdminCustomerDetailList", "selectAdminCustomerDetailCount", params, pageNo, pageSize);
  483. if (type == 2&& !TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  484. List<AdminCustomerDetailBo> list = (List<AdminCustomerDetailBo>) p.getList();
  485. for (AdminCustomerDetailBo out : list) {
  486. out.setContacts("***");
  487. out.setContactMobile("***");
  488. }
  489. }
  490. return p;
  491. }
  492. @Override
  493. public int updatePrivateBusinessTransfer(String inputId, String uid, String pid) {
  494. String aid=TokenManager.getAdminId();
  495. int i=userLockReleaseMapper.updatePrivateBusinessTransfer( inputId, uid, pid,aid);
  496. if (i>0) {
  497. List<BusinessListBo> l=userBusinessMapper.selectBusinessProjectByUAPid(uid, inputId, pid);
  498. if (l.isEmpty()) {
  499. UserBusiness ub=new UserBusiness();
  500. ub.setId(UUID.randomUUID().toString());
  501. ub.setAid(inputId);
  502. ub.setUid(uid);
  503. ub.setBusinessProjectId(pid);
  504. ub.setCustomerStatus(4);
  505. ub.setFollowSituation(5);
  506. ub.setRemarks("转交客户业务触发");
  507. userBusinessMapper.insertSelective(ub);
  508. }
  509. }
  510. return i;
  511. }
  512. }