|
|
|
|
@ -3,28 +3,22 @@ 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.Department; |
|
|
|
|
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.IDepartmentService; |
|
|
|
|
import com.nov.KgLowDurable.service.ILdApproveService; |
|
|
|
|
import com.nov.KgLowDurable.service.IUserService; |
|
|
|
|
import com.nov.KgLowDurable.util.HttpUtils; |
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.*; |
|
|
|
|
import com.nov.KgLowDurable.pojo.vo.*; |
|
|
|
|
import com.nov.KgLowDurable.service.*; |
|
|
|
|
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; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 服务实现类 |
|
|
|
|
@ -44,6 +38,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
@Autowired |
|
|
|
|
IDepartmentService departmentService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public UserInfoVO getUserInfo() throws Exception { |
|
|
|
|
// Map<String, String> headers = new HashMap<String, String>() {{
|
|
|
|
|
@ -322,5 +317,87 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU |
|
|
|
|
// 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"));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
String resp = "{\"success\":true,\"message\":\"获取所有可出库分组名称成功\",\"code\":200,\"result\":[{\"groupIds\":\"44\",\"groupName\":\"B分组\"},{\"groupIds\":null,\"groupName\":\"自由出库\"}],\"timestamp\":1768356690213}"; |
|
|
|
|
JSONObject obj = JSON.parseObject(resp); |
|
|
|
|
|
|
|
|
|
List<GroupVO> list = obj.getJSONArray("result").toJavaList(GroupVO.class); |
|
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
|
throw new RuntimeException("解析失败: " + obj.getString("message")); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@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"));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
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}"; |
|
|
|
|
JSONObject obj = JSON.parseObject(resp); |
|
|
|
|
|
|
|
|
|
GroupResultVO result = JSON.parseObject( |
|
|
|
|
obj.getJSONObject("result").toString(), |
|
|
|
|
GroupResultVO.class |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
List<GroupMaterialVO> materialVOList = result.getMaterials(); |
|
|
|
|
|
|
|
|
|
return materialVOList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|