|
|
|
|
package com.nov.KgLowDurable.service.Impl;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.nov.KgLowDurable.mapper.UserMapper;
|
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.LdApprove;
|
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.Role;
|
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.User;
|
|
|
|
|
import com.nov.KgLowDurable.pojo.vo.UserInfoVO;
|
|
|
|
|
import com.nov.KgLowDurable.service.ILdApproveService;
|
|
|
|
|
import com.nov.KgLowDurable.service.IUserService;
|
|
|
|
|
import com.nov.KgLowDurable.util.HttpUtils;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 服务实现类
|
|
|
|
|
* @author liweidong
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
UserMapper userMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
ILdApproveService ldApproveService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public UserInfoVO getUserInfo() throws Exception {
|
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// put("taskId", "1");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://192.168.198.1:8105",
|
|
|
|
|
// "/dsTasking/processAuthorized",
|
|
|
|
|
// "GET",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys
|
|
|
|
|
// ).getEntity()
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// JSONObject obj = JSON.parseObject(resp);
|
|
|
|
|
//
|
|
|
|
|
// if (!"200".equals(obj.getString("code"))) {
|
|
|
|
|
// throw new RuntimeException("失败: " + obj.getString("message"));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// UserInfoVO data = JSON.toJavaObject(obj.getJSONObject("data"), UserInfoVO.class);
|
|
|
|
|
|
|
|
|
|
UserInfoVO data = new UserInfoVO();
|
|
|
|
|
data.setUserId("AnXinghe");
|
|
|
|
|
data.setName("安星河");
|
|
|
|
|
data.setDepartment("中国民用航空青岛空中交通管理站/实业公司/IT事业部");
|
|
|
|
|
data.setGender("男");
|
|
|
|
|
data.setPhone("13526109603");
|
|
|
|
|
data.setRoleNames("普通用户,超级管理员");
|
|
|
|
|
data.setMainErDepartment("12");
|
|
|
|
|
data.setMainErDepartmentName("实业公司");
|
|
|
|
|
Role role = new Role();
|
|
|
|
|
role.setId(1L);
|
|
|
|
|
role.setRoleCode("admin");
|
|
|
|
|
role.setRoleName("超级管理员");
|
|
|
|
|
List<Role> roleList = new ArrayList<>();
|
|
|
|
|
roleList.add(role);
|
|
|
|
|
data.setRolelist(roleList);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean getApprover(String mainErDepartment, String type,Long formId) {
|
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// put("type",type);
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = null;
|
|
|
|
|
// try {
|
|
|
|
|
// resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://192.168.198.1:8105",
|
|
|
|
|
// "/dsTasking/processAuthorized",
|
|
|
|
|
// "GET",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys
|
|
|
|
|
// ).getEntity()
|
|
|
|
|
// );
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// JSONObject obj = JSON.parseObject(resp);
|
|
|
|
|
//
|
|
|
|
|
// if (!"200".equals(obj.getString("code"))) {
|
|
|
|
|
// throw new RuntimeException("失败: " + obj.getString("message"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// ApproverUser approverUser = JSON.toJavaObject(obj.getJSONObject("data"), ApproverUser.class);
|
|
|
|
|
LdApprove ldApprove = new LdApprove();
|
|
|
|
|
ldApprove.setFormId(formId.intValue());
|
|
|
|
|
ldApprove.setUserId("LiuXu");
|
|
|
|
|
ldApprove.setUserName("刘旭");
|
|
|
|
|
ldApprove.setLevel("1");
|
|
|
|
|
ldApprove.setStatus("0");
|
|
|
|
|
ldApprove.setOptTime(LocalDateTime.now());
|
|
|
|
|
ldApprove.setType(type);
|
|
|
|
|
boolean save = ldApproveService.save(ldApprove);
|
|
|
|
|
return save;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public User getDeptApprove(String department) {
|
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// put("deptId",department);
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = null;
|
|
|
|
|
// try {
|
|
|
|
|
// resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://10.90.100.231:8132",
|
|
|
|
|
// "/lowDurableTest/ld-approver/getDeptApprove",
|
|
|
|
|
// "GET",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys
|
|
|
|
|
// ).getEntity()
|
|
|
|
|
// );
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// JSONObject obj = JSON.parseObject(resp);
|
|
|
|
|
//
|
|
|
|
|
// if (!"200".equals(obj.getString("code"))) {
|
|
|
|
|
// throw new RuntimeException("失败: " + obj.getString("message"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// UserInfoVO approverUser = JSON.toJavaObject(obj.getJSONObject("data"), UserInfoVO.class);
|
|
|
|
|
User user = new User();
|
|
|
|
|
user.setUserId("负责人ID");
|
|
|
|
|
user.setName("负责人名称");
|
|
|
|
|
return user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<User> getUserByDeptId(String departmentId) {
|
|
|
|
|
return userMapper.selectByDepartmentId(departmentId);
|
|
|
|
|
}
|
|
|
|
|
}
|