2023-12-18 18:54:50 +08:00
|
|
|
package com.zcloud.service.xgf.impl;
|
|
|
|
|
|
|
|
import com.zcloud.entity.Page;
|
|
|
|
import com.zcloud.entity.PageData;
|
|
|
|
import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper;
|
|
|
|
import com.zcloud.mapper.datasource.xgf.XgfUserMapper;
|
2023-12-19 20:03:25 +08:00
|
|
|
import com.zcloud.service.bus.CorpInfoService;
|
|
|
|
import com.zcloud.service.system.DepartmentService;
|
2023-12-18 18:54:50 +08:00
|
|
|
import com.zcloud.service.xgf.XgfUserService;
|
2023-12-19 20:03:25 +08:00
|
|
|
import com.zcloud.util.*;
|
2023-12-18 18:54:50 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2023-12-19 15:01:44 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
2023-12-18 18:54:50 +08:00
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
2023-12-18 19:58:52 +08:00
|
|
|
import java.util.Arrays;
|
2023-12-18 18:54:50 +08:00
|
|
|
import java.util.List;
|
2023-12-19 15:01:44 +08:00
|
|
|
import java.util.Map;
|
|
|
|
import java.util.stream.Collectors;
|
2023-12-18 18:54:50 +08:00
|
|
|
|
|
|
|
@Service
|
|
|
|
public class XgfUserServiceImpl implements XgfUserService {
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private XgfUserMapper xgfUserMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private XgfUserDetailsMapper xgfUserDetailsMapper;
|
|
|
|
|
2023-12-19 20:03:25 +08:00
|
|
|
@Resource
|
|
|
|
private DepartmentService departmentService;
|
|
|
|
|
2023-12-19 15:01:44 +08:00
|
|
|
@Value("${preventionxgf.api.url}")
|
|
|
|
private String prevention_xgf_url;
|
|
|
|
|
2023-12-18 18:54:50 +08:00
|
|
|
@Override
|
|
|
|
public void save(PageData pd) throws Exception {
|
|
|
|
xgfUserMapper.save(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void saveDetail(PageData pd) throws Exception {
|
|
|
|
xgfUserDetailsMapper.save(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<PageData> list(Page page) throws Exception {
|
|
|
|
return xgfUserDetailsMapper.listPage(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Transactional
|
2023-12-19 20:03:25 +08:00
|
|
|
public void init(PageData request) throws Exception {
|
2023-12-18 18:54:50 +08:00
|
|
|
List<PageData> list = Warden.getList(request.getString("infoList"));
|
2023-12-19 20:03:25 +08:00
|
|
|
PageData condition = new PageData();
|
2023-12-18 18:54:50 +08:00
|
|
|
for (PageData x : list) {
|
2023-12-19 20:03:25 +08:00
|
|
|
if (StringUtils.isNotBlank(x.getString("USER_ID"))) {
|
|
|
|
condition.put("XGF_USER_ID", x.getString("USER_ID"));
|
|
|
|
PageData entity = xgfUserMapper.findById(condition);
|
|
|
|
if (entity == null || entity.size() <= 0) {
|
|
|
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
|
|
|
x.put("XGF_USER_DETAILS_ID", x.get("USER_ID"));
|
2023-12-21 19:55:08 +08:00
|
|
|
x.put("XGF_USER_NAME", x.get("NAME"));
|
2023-12-19 20:03:25 +08:00
|
|
|
x.put("VALID_FLAG", "1");
|
|
|
|
x.put("STATUS", "2");
|
|
|
|
x.put("CREATED_TIME", DateUtil.getTime());
|
|
|
|
x.put("OPERATOR_TIME", DateUtil.getTime());
|
2023-12-21 19:55:08 +08:00
|
|
|
x.put("IS_DELETE", "0");
|
|
|
|
x.put("CREATE_TIME", DateUtil.getTime());
|
2023-12-19 20:03:25 +08:00
|
|
|
condition.clear();
|
2023-12-20 19:51:15 +08:00
|
|
|
condition.put("DEPARTMENT_ID",x.get("MANAGER_DEPARTMENT_ID"));
|
2023-12-19 20:03:25 +08:00
|
|
|
PageData regDepartmentEntity = departmentService.getCorpDepartment(condition);
|
|
|
|
x.put("MANAGER_DEPARTMENT_NAME",regDepartmentEntity.get("NAME"));
|
|
|
|
xgfUserMapper.save(x);
|
|
|
|
xgfUserDetailsMapper.save(x);
|
|
|
|
} else {
|
|
|
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
|
|
|
x.put("XGF_USER_DETAILS_ID", x.get("USER_ID"));
|
2023-12-21 19:55:08 +08:00
|
|
|
x.put("IS_DELETE", "0");
|
|
|
|
x.put("CREATE_TIME", DateUtil.getTime());
|
2023-12-19 20:03:25 +08:00
|
|
|
x.put("OPERATOR_TIME", DateUtil.getTime());
|
|
|
|
condition.clear();
|
|
|
|
condition.put("DEPARTMENT_ID",x.get("MANAGER_DEPARTMENT_ID"));
|
|
|
|
PageData regDepartmentEntity = departmentService.getCorpDepartment(condition);
|
|
|
|
x.put("MANAGER_DEPARTMENT_NAME",regDepartmentEntity.get("NAME"));
|
2023-12-18 18:54:50 +08:00
|
|
|
|
2023-12-19 20:03:25 +08:00
|
|
|
x.put("ISDELETE", "0");
|
|
|
|
x.put("VALID_FLAG", "1");
|
|
|
|
x.put("STATUS", "2");
|
|
|
|
xgfUserMapper.edit(x);
|
|
|
|
xgfUserDetailsMapper.edit(x);
|
|
|
|
}
|
2023-12-18 18:54:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-18 19:58:52 +08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void approvalApplication(PageData request) throws Exception {
|
2023-12-19 15:01:44 +08:00
|
|
|
List<String> list = Arrays.asList(request.getString("xgf_user_ids").split(","));
|
2023-12-18 19:58:52 +08:00
|
|
|
|
|
|
|
PageData condition = new PageData();
|
|
|
|
condition.put("XGF_USER_IDS", list);
|
|
|
|
List<PageData> entities = xgfUserMapper.listByIds(condition);
|
|
|
|
for (PageData x : entities) {
|
2023-12-19 15:01:44 +08:00
|
|
|
x.put("VALID_FLAG", "0");
|
|
|
|
x.put("STATUS", "1");
|
2023-12-18 19:58:52 +08:00
|
|
|
xgfUserMapper.edit(x);
|
|
|
|
}
|
2023-12-19 15:01:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<PageData> flowlistPage(Page page) throws Exception {
|
|
|
|
return xgfUserMapper.flowlistPage(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
public void approve(PageData request) throws Exception {
|
|
|
|
List<PageData> _list = Warden.getList(request.getString("list"));
|
|
|
|
if (_list == null || _list.size() == 0) {
|
|
|
|
throw new RuntimeException("请求数据异常");
|
|
|
|
}
|
|
|
|
List<String> list = _list.stream().map(x -> x.getString("XGF_USER_ID")).collect(Collectors.toList());
|
|
|
|
PageData condition = new PageData();
|
|
|
|
for (String x : list) {
|
|
|
|
condition.put("XGF_USER_ID", x);
|
|
|
|
PageData entity = xgfUserMapper.findById(condition);
|
|
|
|
if (entity == null || entity.size() == 0) {
|
|
|
|
throw new RuntimeException("未找到该用户");
|
|
|
|
}
|
|
|
|
if ("1".equals(request.getString("STATUS"))) {
|
|
|
|
entity.put("STATUS", "0");
|
|
|
|
} else {
|
|
|
|
entity.put("STATUS", "2");
|
|
|
|
}
|
|
|
|
xgfUserMapper.edit(entity);
|
|
|
|
|
|
|
|
entity.put("USER_ID", condition.get("XGF_USER_ID"));
|
|
|
|
entity.put("STATUS", request.getString("STATUS"));
|
|
|
|
Map result = HttpClientService.doPost(prevention_xgf_url + "openApi/user/approve", entity);
|
|
|
|
if (result == null || !"succeed".equals(result.get("result"))) {
|
|
|
|
throw new RuntimeException("请求失败");
|
|
|
|
}
|
|
|
|
}
|
2023-12-18 19:58:52 +08:00
|
|
|
}
|
2023-12-20 19:51:15 +08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public PageData findInfo(PageData condition) {
|
|
|
|
return xgfUserMapper.getInfoById(condition);
|
|
|
|
}
|
2023-12-21 13:58:57 +08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<PageData> findRecordList(PageData condition) throws Exception {
|
|
|
|
return xgfUserMapper.findRecordList(condition);
|
|
|
|
}
|
2023-12-18 18:54:50 +08:00
|
|
|
}
|