|
|
|
@ -1,43 +1,27 @@ |
|
|
|
package com.dreamchaser.depository_manage.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.dreamchaser.depository_manage.config.JM_3DES; |
|
|
|
import com.dreamchaser.depository_manage.config.PortConfig; |
|
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
|
import com.dreamchaser.depository_manage.security.bean.UserToken; |
|
|
|
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; |
|
|
|
import com.dreamchaser.depository_manage.security.pool.UserKeyAndTokenPool; |
|
|
|
import com.dreamchaser.depository_manage.service.*; |
|
|
|
import com.dreamchaser.depository_manage.utils.*; |
|
|
|
import com.sun.org.apache.xpath.internal.operations.Mod; |
|
|
|
import javafx.geometry.Pos; |
|
|
|
import org.apache.commons.codec.digest.DigestUtils; |
|
|
|
import org.apache.commons.lang.RandomStringUtils; |
|
|
|
import org.apache.http.protocol.HTTP; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.mobile.device.Device; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
import javax.servlet.ServletException; |
|
|
|
import javax.servlet.http.Cookie; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpSession; |
|
|
|
import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.Instant; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
/** |
|
|
|
* 专门用来展示页面的controller |
|
|
|
@ -84,22 +68,6 @@ public class PageController { |
|
|
|
private StockTakingService stockTakingService; |
|
|
|
|
|
|
|
|
|
|
|
public static JSONObject Captcha(HttpServletRequest request) { |
|
|
|
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); |
|
|
|
String url = PortConfig.external_url_6666 + "/base/captcha"; |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, param, HTTP.UTF_8, userByPort); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/") |
|
|
|
public ModelAndView Init(HttpServletRequest request) { |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
@ -126,7 +94,7 @@ public class PageController { |
|
|
|
@GetMapping("/login") |
|
|
|
public ModelAndView login(HttpServletRequest request) { |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
JSONObject captcha = Captcha(request); |
|
|
|
JSONObject captcha = LinkInterfaceUtil.Captcha(request); |
|
|
|
String picPath = (String) captcha.get("picPath"); |
|
|
|
String captchaid = (String) captcha.get("captchaid"); |
|
|
|
mv.addObject("picPath", picPath); |
|
|
|
@ -666,13 +634,15 @@ public class PageController { |
|
|
|
public ModelAndView chart_in() { |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
mv.setViewName("pages/chart/chart-in"); |
|
|
|
mv.addObject("depositories", depositoryService.findDepositoryAll()); |
|
|
|
mv.addObject("reviewers", userService.findReviewers()); |
|
|
|
mv.addObject("materials", materialService.findMaterialAll()); |
|
|
|
mv.addObject("InCount", depositoryRecordService.CalculateAllCount(1, "已入库")); |
|
|
|
mv.addObject("allInCount", depositoryRecordService.CalculateAllCount(1, "")); |
|
|
|
mv.addObject("InPrice", depositoryRecordService.CalculateAllPrice(1, "已入库")); |
|
|
|
mv.addObject("allInPrice", depositoryRecordService.CalculateAllPrice(1, "")); |
|
|
|
// 转入物料数量
|
|
|
|
mv.addObject("InCount", depositoryRecordService.CalculateAllApplicationInCount()); |
|
|
|
|
|
|
|
// 转入物料总额
|
|
|
|
mv.addObject("allInCount", depositoryRecordService.CalculateAllApplicationInCount()); |
|
|
|
// 购入物料数量
|
|
|
|
mv.addObject("InPrice", depositoryRecordService.CalculateAllApplicationInPrice()); |
|
|
|
// 购入物料总额
|
|
|
|
mv.addObject("allInPrice", depositoryRecordService.CalculateAllApplicationInPrice()); |
|
|
|
return mv; |
|
|
|
} |
|
|
|
|
|
|
|
@ -731,62 +701,13 @@ public class PageController { |
|
|
|
return mv; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询用户 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static List<UserByPort> FindUserByMap(Map<String, Object> map, UserByPort userToken) { |
|
|
|
String url = PortConfig.external_url + "/staff/archiveslist"; |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userToken); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
JSONArray list = (JSONArray) data.get("list"); |
|
|
|
List<UserByPort> result = new ArrayList<>(); |
|
|
|
if (list == null) { |
|
|
|
list = new JSONArray(); |
|
|
|
} |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) list.get(i), UserByPort.class); |
|
|
|
result.add(userByPort); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static UserByPort FindUserById(Integer id, UserByPort userToken) { |
|
|
|
String url = PortConfig.external_url + "/staff/archivescont"; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("id", id); |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userToken); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
UserByPort userByPort = JSONObject.toJavaObject(data, UserByPort.class); |
|
|
|
return userByPort; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/user_add") |
|
|
|
public ModelAndView user_add(Integer userId, HttpServletRequest request) { |
|
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
mv.setViewName("pages/user/user-add"); |
|
|
|
UserByPort userByPort = FindUserById(userId, userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userToken); |
|
|
|
UserByPortP userByPortP = new UserByPortP(userByPort); |
|
|
|
mv.addObject("userByPort", userByPortP); |
|
|
|
mv.addObject("roles", roleService.findAllRole()); |
|
|
|
@ -802,7 +723,7 @@ public class PageController { |
|
|
|
RoleAndDepository roleAndDepositoryById = roleService.findRoleAndDepositoryById(id); |
|
|
|
UserByPortP userByPortP = null; |
|
|
|
if (roleAndDepositoryById != null) { |
|
|
|
UserByPort userByPort = FindUserById(roleAndDepositoryById.getUserId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryById.getUserId(), userToken); |
|
|
|
userByPortP = new UserByPortP(userByPort); |
|
|
|
userByPortP.setRolename(roleAndDepositoryById.getRoleName()); |
|
|
|
userByPortP.setDepositoryName(roleAndDepositoryById.getDepositoryName()); |
|
|
|
@ -822,8 +743,8 @@ public class PageController { |
|
|
|
mv.setViewName("pages/post/postRole_edit"); |
|
|
|
Map<String, Object> userParam = new HashMap<>(); |
|
|
|
userParam.put("position", id); |
|
|
|
List<UserByPort> userByPortList = PageController.FindUserByMap(userParam, userToken); |
|
|
|
Post postById = findPostById(id, userToken); |
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken); |
|
|
|
Post postById = LinkInterfaceUtil.findPostById(id, userToken); |
|
|
|
PostP pp = new PostP(postById); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("depositoryId", depositoryId); |
|
|
|
@ -846,7 +767,7 @@ public class PageController { |
|
|
|
mv.addObject("depositories", depositoryService.findDepositoryAll()); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("number", id.toString()); |
|
|
|
UserByPort userByPort = FindUserByMap(map, userToken).get(0); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserByMap(map, userToken).get(0); |
|
|
|
mv.addObject("user", userByPort); |
|
|
|
return mv; |
|
|
|
} |
|
|
|
@ -863,7 +784,7 @@ public class PageController { |
|
|
|
|
|
|
|
mv.addObject("record", depositoryRecordById); |
|
|
|
Integer cid = depositoryRecordById.getCid(); |
|
|
|
List<AdministrationP> postList = findCompanyBySuperior(cid.toString(), userToken); |
|
|
|
List<AdministrationP> postList = LinkInterfaceUtil.findCompanyBySuperior(cid.toString(), userToken); |
|
|
|
List<AdministrationP> administrationPList = findAllCompany(userToken); |
|
|
|
// 部门列表
|
|
|
|
mv.addObject("postList", postList); |
|
|
|
@ -1084,13 +1005,13 @@ public class PageController { |
|
|
|
sumPrice += (materialById.getPrice()); |
|
|
|
} |
|
|
|
// 申请人
|
|
|
|
UserByPort userByPort = FindUserById(recordP.getApplicantId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userToken); |
|
|
|
// 部门负责人
|
|
|
|
String departmentheads = recordP.getDepartmenthead(); |
|
|
|
String[] split = departmentheads.split(","); |
|
|
|
StringBuilder departmentHeadName = new StringBuilder(); |
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
UserByPort departmenthead = FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken); |
|
|
|
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken); |
|
|
|
departmentHeadName.append(departmenthead.getName()).append(","); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1104,7 +1025,7 @@ public class PageController { |
|
|
|
String depositoryManagerNames = ""; |
|
|
|
for (int i = 0; i < depositoryManagerId.length; i++) { |
|
|
|
Integer managerid = ObjectFormatUtil.toInteger(depositoryManagerId[i]); |
|
|
|
UserByPort user = FindUserById(managerid, userToken); |
|
|
|
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userToken); |
|
|
|
depositoryManager.add(user); |
|
|
|
depositoryManagerNames += user.getName() + ","; |
|
|
|
} |
|
|
|
@ -1133,7 +1054,7 @@ public class PageController { |
|
|
|
mv.setViewName("pages/application/form-step-look"); |
|
|
|
if (id != null) { |
|
|
|
ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id); |
|
|
|
UserByPort userByPort = FindUserById(applicationInRecordPById.getApplicantId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userToken); |
|
|
|
applicationInRecordPById.setApplicantName(userByPort.getName()); |
|
|
|
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); |
|
|
|
applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); |
|
|
|
@ -1161,7 +1082,7 @@ public class PageController { |
|
|
|
// 获取出库库位
|
|
|
|
Place placeById = placeService.findPlaceById(recordMin.getPlaceId()); |
|
|
|
// 获取处理人
|
|
|
|
UserByPort userByPort = FindUserById(recordMin.getCheckId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMin.getCheckId(), userToken); |
|
|
|
// 设置处理人姓名
|
|
|
|
recordMinP.setCheckerName(userByPort.getName()); |
|
|
|
recordMinP.setDepositoryName(depository.getDname()); |
|
|
|
@ -1231,7 +1152,7 @@ public class PageController { |
|
|
|
if (checkId != null) { |
|
|
|
// 如果当前子订单已经处理
|
|
|
|
// 获取当前处理人
|
|
|
|
UserByPort disposer = FindUserById(checkId, userToken); |
|
|
|
UserByPort disposer = LinkInterfaceUtil.FindUserById(checkId, userToken); |
|
|
|
outDisposer.append(disposer.getName() + ","); |
|
|
|
recordMinP.setCheckerName(disposer.getName()); |
|
|
|
} else { |
|
|
|
@ -1247,7 +1168,7 @@ public class PageController { |
|
|
|
recordMinPList.add(recordMinP); |
|
|
|
} |
|
|
|
// 申请人
|
|
|
|
UserByPort userByPort = FindUserById(applicationOutRecordPById.getApplicantId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userToken); |
|
|
|
// 部门负责人
|
|
|
|
String departmentHead = applicationOutRecordPById.getDepartmenthead(); |
|
|
|
String[] split = departmentHead.split(","); |
|
|
|
@ -1257,7 +1178,7 @@ public class PageController { |
|
|
|
} |
|
|
|
StringBuilder departmentHeadName = new StringBuilder(); |
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
UserByPort departmenthead = FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken); |
|
|
|
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken); |
|
|
|
departmentHeadName.append(departmenthead.getName()).append(","); |
|
|
|
} |
|
|
|
// 仓储中心负责人
|
|
|
|
@ -1270,7 +1191,7 @@ public class PageController { |
|
|
|
String depositoryManagerNames = ""; |
|
|
|
for (int i = 0; i < depositoryManagerId.length; i++) { |
|
|
|
Integer managerid = ObjectFormatUtil.toInteger(depositoryManagerId[i]); |
|
|
|
UserByPort user = FindUserById(managerid, userToken); |
|
|
|
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userToken); |
|
|
|
depositoryManager.add(user); |
|
|
|
depositoryManagerNames += user.getName(); |
|
|
|
} |
|
|
|
@ -1311,7 +1232,7 @@ public class PageController { |
|
|
|
stp.setCreateTime(DateUtil.TimeStampToDateTime(stockTaking.getCreateTime())); |
|
|
|
|
|
|
|
// 获取申请人
|
|
|
|
UserByPort userByPort = FindUserById(stockTaking.getOriginator(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken); |
|
|
|
// 设置盘点发起人姓名
|
|
|
|
stp.setOriginatorName(userByPort.getName()); |
|
|
|
|
|
|
|
@ -1323,7 +1244,7 @@ public class PageController { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort manager = FindUserById(ObjectFormatUtil.toInteger(s), userToken); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken); |
|
|
|
managerName.append(manager.getName() + ","); |
|
|
|
} |
|
|
|
stp.setDepartmentManagerName(managerName.toString()); |
|
|
|
@ -1390,7 +1311,7 @@ public class PageController { |
|
|
|
|
|
|
|
|
|
|
|
// 获取申请人
|
|
|
|
UserByPort userByPort = FindUserById(stockTaking.getOriginator(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken); |
|
|
|
// 设置盘点发起人姓名
|
|
|
|
stp.setOriginatorName(userByPort.getName()); |
|
|
|
|
|
|
|
@ -1402,7 +1323,7 @@ public class PageController { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort manager = FindUserById(ObjectFormatUtil.toInteger(s), userToken); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken); |
|
|
|
managerName.append(manager.getName() + ","); |
|
|
|
} |
|
|
|
stp.setDepartmentManagerName(managerName.toString()); |
|
|
|
@ -1534,7 +1455,7 @@ public class PageController { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
Administration administration = JSONObject.toJavaObject(data, Administration.class); |
|
|
|
String SuperiorName = getCompany(administration.getSuperior(), userByPort).getName(); |
|
|
|
String SuperiorName = LinkInterfaceUtil.getCompany(administration.getSuperior(), userByPort).getName(); |
|
|
|
mv.addObject("record", administration); |
|
|
|
mv.addObject("SuperiorName", SuperiorName); |
|
|
|
} else { |
|
|
|
@ -1543,53 +1464,6 @@ public class PageController { |
|
|
|
return mv; |
|
|
|
} |
|
|
|
|
|
|
|
public static Administration getCompany(Integer id, UserByPort userByPort) { |
|
|
|
String url = PortConfig.external_url + "/org/getgovcont"; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("id", id); |
|
|
|
map.put("idstr", id.toString()); |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userByPort); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
Administration administration = JSONObject.toJavaObject(data, Administration.class); |
|
|
|
return administration; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static List<AdministrationP> findCompanyBySuperior(String superior, UserByPort userByPort) { |
|
|
|
String url = PortConfig.external_url + "/org/govlist"; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("superior", superior); |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userByPort); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
JSONArray list = (JSONArray) data.get("list"); |
|
|
|
if (list == null) { |
|
|
|
list = new JSONArray(); |
|
|
|
} |
|
|
|
Integer total = ObjectFormatUtil.toInteger(data.get("total")); |
|
|
|
List<AdministrationP> administrationPList = new ArrayList<>(); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
Administration administration = JSONObject.toJavaObject((JSONObject) list.get(i), Administration.class); |
|
|
|
AdministrationP administrationP = new AdministrationP(administration); |
|
|
|
administrationPList.add(administrationP); |
|
|
|
} |
|
|
|
return administrationPList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/findCompanyByParentId") |
|
|
|
public ModelAndView findCompanyByParentId(Integer parentId,Integer level, HttpServletRequest request) { |
|
|
|
@ -1598,7 +1472,7 @@ public class PageController { |
|
|
|
if (parentId != null) { |
|
|
|
mv.addObject("parentId", parentId); |
|
|
|
mv.addObject("level", level+1); |
|
|
|
List<AdministrationP> administrationPList = findCompanyBySuperior(parentId.toString(), userToken); |
|
|
|
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(parentId.toString(), userToken); |
|
|
|
if (administrationPList.size() > 0) { |
|
|
|
mv.addObject("administrationPList", administrationPList); |
|
|
|
mv.setViewName("pages/company/company-out"); |
|
|
|
@ -1655,7 +1529,7 @@ public class PageController { |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
mv.setViewName("pages/post/post-view"); |
|
|
|
if (id != null) { |
|
|
|
Post object = findPostById(id, userToken); |
|
|
|
Post object = LinkInterfaceUtil.findPostById(id, userToken); |
|
|
|
mv.addObject("record", object); |
|
|
|
} else { |
|
|
|
throw new MyException("缺少必要参数!"); |
|
|
|
@ -1663,25 +1537,6 @@ public class PageController { |
|
|
|
return mv; |
|
|
|
} |
|
|
|
|
|
|
|
public static Post findPostById(Integer id, UserByPort userByPort) { |
|
|
|
String url = PortConfig.external_url + "/org/getpositioncont"; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("id", id); |
|
|
|
map.put("idstr", id.toString()); |
|
|
|
String jsonString = JSONObject.toJSONString(map); |
|
|
|
JSONObject paramObject = JSONObject.parseObject(jsonString); |
|
|
|
String post = null; |
|
|
|
try { |
|
|
|
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userByPort); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post); |
|
|
|
JSONObject data = (JSONObject) jsonObject.get("data"); |
|
|
|
Post object = JSONObject.toJavaObject(data, Post.class); |
|
|
|
return object; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/findPostByParentId") |
|
|
|
public ModelAndView findPostByParentId(Integer parentId, HttpServletRequest request) { |
|
|
|
@ -1731,7 +1586,7 @@ public class PageController { |
|
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
mv.setViewName("pages/post/postRole_add"); |
|
|
|
Post postById = findPostById(id, userToken); |
|
|
|
Post postById = LinkInterfaceUtil.findPostById(id, userToken); |
|
|
|
mv.addObject("post", postById); |
|
|
|
mv.addObject("roles", roleService.findAllRole()); |
|
|
|
mv.addObject("depositories", depositoryService.findDepositoryAll()); |
|
|
|
@ -1948,7 +1803,7 @@ public class PageController { |
|
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
|
ModelAndView mv = new ModelAndView(); |
|
|
|
// 获取仓储中心详情
|
|
|
|
Administration company = PageController.getCompany(361, userToken); |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(361, userToken); |
|
|
|
// 获取仓储中心负责人
|
|
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, userToken); |
|
|
|
StringBuilder departmentHeadName = new StringBuilder(); |
|
|
|
|