|
|
|
|
@ -6,8 +6,10 @@ import com.nov.KgLowDurable.mapper.UserMapper; |
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.*; |
|
|
|
|
import com.nov.KgLowDurable.pojo.vo.*; |
|
|
|
|
import com.nov.KgLowDurable.service.*; |
|
|
|
|
import com.nov.KgLowDurable.util.HttpUtils; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.http.util.EntityUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
|
@ -17,7 +19,9 @@ import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -51,8 +55,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
//
|
|
|
|
|
// String resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://192.168.198.1:8105",
|
|
|
|
|
// "/dsTasking/processAuthorized",
|
|
|
|
|
// "http://10.90.100.231:8132",
|
|
|
|
|
// "/AES/decryptAndGetUser",
|
|
|
|
|
// "GET",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys
|
|
|
|
|
@ -64,7 +68,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
// 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(); |
|
|
|
|
@ -161,33 +165,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
if (formId == null || formId <= 0) { |
|
|
|
|
throw new IllegalArgumentException("表单ID必须大于0"); |
|
|
|
|
} |
|
|
|
|
log.info("模拟获取审批人,参数: deptId={}, type={}, formId={}", mainErDepartment, type, 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://10.90.100.231:8132",
|
|
|
|
|
// "/ld-person-form/getApprove",
|
|
|
|
|
// "GET",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys
|
|
|
|
|
// ).getEntity()
|
|
|
|
|
// );
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
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://10.90.100.231:8132", |
|
|
|
|
"/ld-person-form/getApprove", |
|
|
|
|
"GET", |
|
|
|
|
headers, |
|
|
|
|
querys |
|
|
|
|
).getEntity() |
|
|
|
|
); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
// 1.解析模拟数据
|
|
|
|
|
JSONObject obj = JSON.parseObject(MOCK_APPROVAL_DATA); |
|
|
|
|
JSONObject obj = JSON.parseObject(resp); |
|
|
|
|
|
|
|
|
|
if (!"200".equals(obj.getString("code")) || !obj.getBooleanValue("success")) { |
|
|
|
|
String message = obj.getString("message"); |
|
|
|
|
@ -293,64 +296,59 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void submitApproval(String json) { |
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = null;
|
|
|
|
|
// try {
|
|
|
|
|
// resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doPost(
|
|
|
|
|
// "http://10.90.100.231:8132",
|
|
|
|
|
// "/qywx/applySubmit",
|
|
|
|
|
// "POST",
|
|
|
|
|
// headers,
|
|
|
|
|
// querys,
|
|
|
|
|
// json
|
|
|
|
|
// ).getEntity()
|
|
|
|
|
// );
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
Map<String, String> headers = new HashMap<String, String>() {{ |
|
|
|
|
put("Content-Type", "application/json"); |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
Map<String, String> querys = new HashMap<String, String>() {{ |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
String resp = null; |
|
|
|
|
try { |
|
|
|
|
resp = EntityUtils.toString( |
|
|
|
|
HttpUtils.doPost( |
|
|
|
|
"http://10.90.100.231:8132", |
|
|
|
|
"/qywx/applySubmit", |
|
|
|
|
"POST", |
|
|
|
|
headers, |
|
|
|
|
querys, |
|
|
|
|
json |
|
|
|
|
).getEntity() |
|
|
|
|
); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<GroupVO> getOutGroupName() { |
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = null;
|
|
|
|
|
// try {
|
|
|
|
|
// resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://10.90.100.231:8132",
|
|
|
|
|
// "/ld-person-form/getOutGroupName",
|
|
|
|
|
// "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"));
|
|
|
|
|
// }
|
|
|
|
|
Map<String, String> headers = new HashMap<String, String>() {{ |
|
|
|
|
put("Content-Type", "application/json"); |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
String resp = "{\"success\":true,\"message\":\"获取所有可出库分组名称成功\",\"code\":200,\"result\":[{\"groupIds\":\"44\",\"groupName\":\"B分组\"},{\"groupIds\":null,\"groupName\":\"自由出库\"}],\"timestamp\":1768356690213}"; |
|
|
|
|
Map<String, String> querys = new HashMap<String, String>() {{ |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
String resp = null; |
|
|
|
|
try { |
|
|
|
|
resp = EntityUtils.toString( |
|
|
|
|
HttpUtils.doGet( |
|
|
|
|
"http://10.90.100.231:8132", |
|
|
|
|
"/ld-person-form/getOutGroupName", |
|
|
|
|
"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")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<GroupVO> list = obj.getJSONArray("result").toJavaList(GroupVO.class); |
|
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
|
throw new RuntimeException("解析失败: " + obj.getString("message")); |
|
|
|
|
@ -360,35 +358,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<GroupMaterialVO> getGroupMaterial(String groupName, String departmentId) { |
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
// put("Content-Type", "application/json");
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> querys = new HashMap<String, String>() {{
|
|
|
|
|
// put("groupName",groupName);
|
|
|
|
|
// }};
|
|
|
|
|
//
|
|
|
|
|
// String resp = null;
|
|
|
|
|
// try {
|
|
|
|
|
// resp = EntityUtils.toString(
|
|
|
|
|
// HttpUtils.doGet(
|
|
|
|
|
// "http://10.90.100.231:8132",
|
|
|
|
|
// "/ld-person-form/getGroupMaterial",
|
|
|
|
|
// "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"));
|
|
|
|
|
// }
|
|
|
|
|
Map<String, String> headers = new HashMap<String, String>() {{ |
|
|
|
|
put("Content-Type", "application/json"); |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
String resp = "{\"success\":true,\"message\":\"获取物资需求清单成功\",\"code\":200,\"result\":{\"groupName\":\"A分组\",\"totalMaterials\":2,\"totalApplyNum\":6,\"year\":\"2026\",\"materials\":[{\"materialName\":\"A1复印纸\",\"unit\":null,\"model\":null,\"materialCode\":\"03001\",\"remark\":\"胶水\",\"materialId\":\"53\",\"applyNum\":4,\"picture\":null},{\"materialName\":\"文件夹1\",\"unit\":null,\"model\":null,\"materialCode\":\"03001\",\"remark\":\"文件夹\",\"materialId\":\"1\",\"applyNum\":2,\"picture\":null}],\"quarter\":\"1\"},\"timestamp\":1768352459318}"; |
|
|
|
|
Map<String, String> querys = new HashMap<String, String>() {{ |
|
|
|
|
put("groupName",groupName); |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
String resp = null; |
|
|
|
|
try { |
|
|
|
|
resp = EntityUtils.toString( |
|
|
|
|
HttpUtils.doGet( |
|
|
|
|
"http://10.90.100.231:8132", |
|
|
|
|
"/ld-person-form/getGroupMaterial", |
|
|
|
|
"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")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GroupResultVO result = JSON.parseObject( |
|
|
|
|
obj.getJSONObject("result").toString(), |
|
|
|
|
|