diff --git a/src/main/java/com/dreamchaser/depository_manage/config/PortConfig.java b/src/main/java/com/dreamchaser/depository_manage/config/PortConfig.java new file mode 100644 index 00000000..a9b96789 --- /dev/null +++ b/src/main/java/com/dreamchaser/depository_manage/config/PortConfig.java @@ -0,0 +1,13 @@ +package com.dreamchaser.depository_manage.config; + +import lombok.Data; + +@Data +public class PortConfig { + // 接口地址 + public static String external_url = "http://172.20.2.87:39168"; +// public static String external_url = "http://127.0.0.1:39168"; + public static String external_url_6666 = "http://172.20.2.87:6666"; +// public static String external_url_6666 = "http://127.0.0.1:6666"; + +} diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java b/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java index 8746c6d5..5efbcb3b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java @@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.dreamchaser.depository_manage.config.PortConfig; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.*; @@ -26,6 +27,7 @@ import java.util.Map; @RestController @RequestMapping("/company") public class CompanyController { + @Autowired CompanyService companyService; @@ -42,8 +44,7 @@ public class CompanyController { */ @PostMapping("/allCompanyByParent") public RestResponse findCompanyByNoParent(@RequestParam Mapmap){ - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; + String url = PortConfig.external_url +"/org/govlist"; Object page = map.get("page"); Object pagesize = map.get("pagesize"); String superior = (String) map.get("superior"); @@ -85,8 +86,7 @@ public class CompanyController { */ @PostMapping("/companyByCondition") public RestResponse findcompanyByCondition(@RequestParam Map map){ - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; + String url = PortConfig.external_url + "/org/govlist"; if(map.containsKey("state")){ Object state = map.get("state"); map.put("state",ObjectFormatUtil.toInteger(state)); @@ -119,10 +119,14 @@ public class CompanyController { return new RestResponse(list,total,200); } + /** + * 获取所有岗位 + * @param map + * @return + */ @PostMapping("/allPostByOrganization") public RestResponse allPostByParent(@RequestParam Map map) { - String url = "http://172.20.2.87:39168/org/positionlist"; -// String url = "http://127.0.0.1:39168/org/positionlist"; + String url = PortConfig.external_url + "/org/positionlist"; Object page = map.get("page"); Object pagesize = map.get("pagesize"); map.put("page",ObjectFormatUtil.toInteger(page)); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java index 3a28a601..1ab66324 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java @@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.dreamchaser.depository_manage.config.PortConfig; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.*; @@ -424,8 +425,7 @@ public class DepositoryController { */ public static Map findAdministration(){ Map map = new HashMap<>(); - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; + String url = PortConfig.external_url +"/org/govlist"; String superior = "313"; map.put("superior",superior); map.put("state",1); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index abef435b..dbe6a6fd 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.dreamchaser.depository_manage.config.PortConfig; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.*; @@ -17,14 +18,13 @@ import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import netscape.javascript.JSObject; import org.apache.http.protocol.HTTP; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.TimeUnit; /** * 仓库记录 @@ -37,8 +37,14 @@ public class DepositoryRecordController { private DepositoryRecordService depositoryRecordService; @Autowired private DepositoryService depositoryService; + + @Autowired + private MaterialService materialService; + @Autowired private CompanyService companyService; + @Autowired + private RedisTemplate redisTemplate; @@ -50,6 +56,7 @@ public class DepositoryRecordController { } return new RestResponse(list,depositoryRecordService.findCountByCondition(map),200); } + @GetMapping("/myApply") public RestResponse findDepositoryInAndOutRecordPByCondition(@RequestParam Map map,HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -99,6 +106,7 @@ public class DepositoryRecordController { } + // 入库申请 @PostMapping("/applicationIn") public RestResponse insertApplicationInRecord(@RequestBody Map map, HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -112,6 +120,7 @@ public class DepositoryRecordController { } + // 查看入库申请 @GetMapping("/applicationInView") public RestResponse findApplicationInRecordByCondition(@RequestParam Map map){ List list = depositoryRecordService.findApplicationInRecordPByCondition(map); @@ -121,6 +130,7 @@ public class DepositoryRecordController { return new RestResponse(list,depositoryRecordService.findApplicationInRecordPCountByCondition(map),200); } + // 查看出库申请 @GetMapping("/applicationOutView") public RestResponse findApplicationOutRecordByCondition(@RequestParam Map map){ List list = depositoryRecordService.findApplicationOutRecordPByCondition(map); @@ -143,6 +153,54 @@ public class DepositoryRecordController { throw new MyException("所需请求参数缺失!"); } } + + /** + * 将选中的材料暂存到redis中 + * @param map + * @param request + * @return + */ + @PostMapping("/addApplicationToRedis") + public RestResponse addApplicationToRedis(@RequestBody Map map,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + List mids = (List) map.get("mids"); + List depositoryIds = (List) map.get("depositoryIds"); + List nowmids = redisTemplate.opsForList().range("mids"+userToken.getId(), 0, -1); + List nowdepositoryIds = redisTemplate.opsForList().range("depositoryIds"+userToken.getId(), 0, -1); + for (int i = 0; i < mids.size(); i++) { + if(nowmids.contains(mids.get(i))){ + continue; + } + redisTemplate.opsForList().leftPush("mids"+userToken.getId(), mids.get(i)); + redisTemplate.opsForList().leftPush("depositoryIds"+userToken.getId(), depositoryIds.get(i)); + + } + redisTemplate.expire("mids"+userToken.getId(),24 * 60 * 60, TimeUnit.SECONDS); + redisTemplate.expire("depositoryIds"+userToken.getId(),24 * 60 * 60, TimeUnit.SECONDS); + return CrudUtil.postHandle(1,1); + } + + /** + * 将选中的材料从redis中删除 + * @param map + * @param request + * @return + */ + @PostMapping("/deleteApplicationToRedis") + public RestResponse deleteApplicationToRedis(@RequestBody Map map,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + List mids = (List) map.get("mids"); + List depositoryIds = (List) map.get("depositoryIds"); + for (int i = 0; i < mids.size(); i++) { + redisTemplate.opsForList().remove("mids"+userToken.getId(),1,mids.get(i)); + } + for (int i = 0; i < depositoryIds.size(); i++) { + redisTemplate.opsForList().remove("depositoryIds"+userToken.getId(),1,depositoryIds.get(i)); + } + return CrudUtil.postHandle(1,1); + } + +// 审核 @PutMapping("/review") public RestResponse review(@RequestBody Map map, HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -153,6 +211,8 @@ public class DepositoryRecordController { return new RestResponse("",666,new StatusInfo("出库失败","当前存储位库存不足,请重新选择")); } } + +// 库存转移 @PutMapping("/transfer") public RestResponse transfer(@RequestBody Map map, HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -164,6 +224,7 @@ public class DepositoryRecordController { return CrudUtil.postHandle(depositoryRecordService.transferApply(map),1); } +// 删除入库记录 @PostMapping("deleteApplicationInRecord") public RestResponse deleteApplicationInRecord(@RequestBody Map map){ if (map.containsKey("id")){ @@ -177,6 +238,7 @@ public class DepositoryRecordController { } } +// 删除出库记录 @PostMapping("deleteApplicationOutRecord") public RestResponse deleteApplicationOutRecord(@RequestBody Map map){ if (map.containsKey("id")){ @@ -190,6 +252,7 @@ public class DepositoryRecordController { } } + // 出库申请 @PostMapping("/applicationOut") public RestResponse insertApplicationOutRecord(@RequestBody Map map, HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -198,7 +261,120 @@ public class DepositoryRecordController { map.put("departmenthead",departmentHeadByUser.getId()); return CrudUtil.postHandle(depositoryRecordService.insertApplicationOutRecord(map),1); } + /** + * 自动生成出入库订单 + * @param map + * @return + */ + @GetMapping("/applicant_multi_create") + public RestResponse applicantMultiCreate(@RequestParam Map map,HttpServletRequest request){ + Integer page = ObjectFormatUtil.toInteger(map.get("page")); + Integer pagesize = ObjectFormatUtil.toInteger(map.get("size")); + Integer start = (page - 1) * pagesize; + Integer end = page * 10; + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + Long size = redisTemplate.boundListOps("mids"+userToken.getId()).size(); + if(end > size){ + end = ObjectFormatUtil.toInteger(size); + } + List list = new ArrayList<>(); + for (int i = start; i < end; i++) { + Integer mid =ObjectFormatUtil.toInteger(redisTemplate.opsForList().index("mids"+userToken.getId(),i)); + Integer depositoryId =ObjectFormatUtil.toInteger(redisTemplate.opsForList().index("depositoryIds"+userToken.getId(),i)); + Material materialById = materialService.findMaterialById(mid); + Depository depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + ApplicationModel ap = new ApplicationModel(); + ap.setDepositoryId(depositoryId); + ap.setDepositoryName(depositoryRecordById.getDname()); + ap.setMid(mid); + ap.setVersion(materialById.getVersion()); + ap.setMname(materialById.getMname()); + ap.setCode(materialById.getCode()); + ap.setApplicant(userToken.getId()); + ap.setQuantity(1.0); + list.add(ap); + } + return new RestResponse(list,ObjectFormatUtil.toInteger(size),200); + } + + /** + * 构造出入库表单 + * @param map + * @param request + * @return + */ + @PostMapping("/createMultiApplication") + public RestResponse createMultiApplication(@RequestBody Map map,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); + map.put("quantity",quantity.toString()); + map.put("applicantId",userToken.getId()); + String type = (String) map.get("type"); + Integer success = 0; + if("in".equals(type)){ + success += depositoryRecordService.applicationIn(map); + }else if("out".equals(type)){ + UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); + map.put("departmenthead",departmentHeadByUser.getId()); + success += depositoryRecordService.insertApplicationOutRecord(map); + } + if(success == 0){ + return new RestResponse("",666,new StatusInfo("申请失败","超出最大存储容量")); + } + return CrudUtil.postHandle(success,1); + } + /** + * 构造多个出入库表单 + * @param map + * @param request + * @return + */ + @PostMapping("/createMultiApplications") + public RestResponse createMultiApplications(@RequestBody Map map,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + String type = (String) map.get("type"); + Integer success = 0; + List mids = (List) map.get("mids"); + List depositoryIds = (List) map.get("depositoryIds"); + List quantitys = (List) map.get("quantitys"); + List applyRemarks = (List) map.get("applyRemarks"); + if("in".equals(type)){ + for (int i = 0; i < mids.size(); i++) { + Integer mid = mids.get(i); + Integer depositoryId = depositoryIds.get(i); + Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); + String quantity = integer.toString(); + String applyRemark = applyRemarks.get(i); + Map inRecord = new HashMap<>(); + inRecord.put("applicantId",userToken.getId()); + inRecord.put("mid",mid); + inRecord.put("depositoryId",depositoryId); + inRecord.put("quantity",quantity); + inRecord.put("applyRemark",applyRemark); + success += depositoryRecordService.applicationIn(inRecord); + } + }else if("out".equals(type)){ + for (int i = 0; i < mids.size(); i++) { + Integer mid = mids.get(i); + Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); + String quantity = integer.toString(); + String applyRemark = applyRemarks.get(i); + Map outRecord = new HashMap<>(); + outRecord.put("quantity",quantity); + outRecord.put("mid",mid); + outRecord.put("applicantId",userToken.getId()); + outRecord.put("applyRemark",applyRemark); + UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); + outRecord.put("departmenthead",departmentHeadByUser.getId()); + success += depositoryRecordService.insertApplicationOutRecord(outRecord); + } + } + if(success == 0){ + return new RestResponse("",666,new StatusInfo("申请失败","超出最大存储容量")); + } + return CrudUtil.postHandle(success,mids.size()); + } /** * 获取当前登录用户的部门负责人 @@ -206,8 +382,7 @@ public class DepositoryRecordController { * @return */ public static UserByPort findDepartmentHeadByUser(UserByPort user){ - String url = "http://172.20.2.87:39168/org/positionlist"; -// String url = "http://127.0.0.1:39168/org/positionlist"; + String url = PortConfig.external_url + "/org/positionlist"; Integer maindeparment = user.getMaindeparment(); Map map = new HashMap<>(); map.put("organization",maindeparment.toString()); @@ -233,4 +408,6 @@ public class DepositoryRecordController { return userByPort; } + + } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java index dcf3f11b..bafdfa77 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -1,13 +1,17 @@ package com.dreamchaser.depository_manage.controller; +import com.dreamchaser.depository_manage.entity.Depository; import com.dreamchaser.depository_manage.entity.Material; import com.dreamchaser.depository_manage.entity.MaterialType; import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.MaterialP; import com.dreamchaser.depository_manage.pojo.RestResponse; +import com.dreamchaser.depository_manage.pojo.RoleAndDepository; import com.dreamchaser.depository_manage.security.bean.UserToken; +import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.MaterialService; +import com.dreamchaser.depository_manage.service.RoleService; import com.dreamchaser.depository_manage.utils.CrudUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.sun.mail.imap.protocol.ID; @@ -15,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author Dreamchaser @@ -30,6 +31,12 @@ public class MaterialController { @Autowired MaterialService materialService; + @Autowired + RoleService roleService; + + @Autowired + DepositoryService depositoryService; + /** * 根据材料进行查询 * @param map @@ -41,6 +48,22 @@ public class MaterialController { return new RestResponse(materialPByCondition,materialService.findCountByCondition(map),200); } + @GetMapping("/findInventory") + public RestResponse findInventory(@RequestParam Map map,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + List depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId()); + List materialPByCondition = materialService.findMaterialPByCondition(map); + List list = new ArrayList<>(); + for (RoleAndDepository roleAndDepository : depositoryAndRole) { + for (MaterialP materialP : materialPByCondition) { + if (Objects.equals(materialP.getDepositoryId(), roleAndDepository.getDepositoryId())) { + list.add(materialP); + } + } + } + return new RestResponse(list,materialService.findCountByCondition(map),200); + } + /** * 添加一条材料记录 * @param map @@ -125,13 +148,22 @@ public class MaterialController { } @GetMapping("/findMatrialByCode") - public RestResponse findMatrialByCode(@RequestParam(value = "code") String code){ + public RestResponse findMatrialByCode(@RequestParam(value = "code") String code,HttpServletRequest request){ + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString()); Map param = new HashMap<>(); if("".equals(code)){ return new RestResponse(null,1,200); } param.put("code",code); - List materialPByCondition = materialService.findMaterialPByCondition(param); + List materialPByCondition = new ArrayList<>(); + for (int i = 0; i < depositoryByAdminorg.size(); i++) { + param.put("depositoryId",depositoryByAdminorg.get(i).getId()); + materialPByCondition = materialService.findMaterialPByCondition(param); + if(materialPByCondition.size() > 0){ + break; + } + } MaterialP mp = null; if(materialPByCondition.size() > 0){ mp = materialPByCondition.get(0); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index c72dd028..3e825d9e 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -3,6 +3,7 @@ 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.PortConfig; import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.*; @@ -63,8 +64,7 @@ public class PageController { public static JSONObject Captcha(){ - String url = "http://172.20.2.87:6666/base/captcha"; -// String url = "http://127.0.0.1:6666/base/captcha"; + String url = PortConfig.external_url_6666 + "/base/captcha"; JSONObject param = new JSONObject(); String post = null; try { @@ -122,8 +122,7 @@ public class PageController { @ResponseBody public Map index_menus(@RequestParam("uid") String uid) { //定义链接地址 - String url = "http://172.20.2.87:6666/system_authorizing/obtain_authorization"; -// String url = "http://127.0.0.1:6666/system_authorizing/obtain_authorization"; + String url = PortConfig.external_url_6666 + "/system_authorizing/obtain_authorization"; Map param = new HashMap<>(); param.put("system", "cangchu"); String jsonString = JSONObject.toJSONString(param); @@ -462,17 +461,35 @@ public class PageController { return mv; } + @GetMapping("/application_multi") + public ModelAndView application_multi(){ + ModelAndView mv = new ModelAndView(); + mv.setViewName("pages/application/application_multi"); + return mv; + } + @GetMapping("/application_in_back") public ModelAndView applicationIn(Integer mid,Integer depositoryId){ ModelAndView mv = new ModelAndView(); - Material materialById = materialService.findMaterialById(mid); - Depository depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + Material materialById = new Material(); + Depository depositoryRecordById = new Depository(); + if(mid != null && depositoryId != null){ + materialById = materialService.findMaterialById(mid); + depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + } mv.addObject("materialById",materialById); mv.addObject("depository",depositoryRecordById); mv.setViewName("pages/application/application-in_back"); return mv; } + @GetMapping("/application_in_multi") + public ModelAndView applicationInMulti(){ + ModelAndView mv = new ModelAndView(); + mv.setViewName("pages/application/application-in_back"); + return mv; + } + @GetMapping("/application_out") public ModelAndView application_out() { ModelAndView mv = new ModelAndView(); @@ -483,6 +500,18 @@ public class PageController { return mv; } + @GetMapping("/application_out_back") + public ModelAndView application_out_back(Integer mid) { + ModelAndView mv = new ModelAndView(); + mv.setViewName("pages/application/application-out_back"); + Material materialById = new Material(); + if(mid != null) { + materialById = materialService.findMaterialById(mid); + } + mv.addObject("materialById",materialById); + return mv; + } + @GetMapping("/application_transfer") public ModelAndView application_transfer() { ModelAndView mv = new ModelAndView(); @@ -629,8 +658,7 @@ public class PageController { * @return */ public static List FindUserByMap(Map map) { - String url = "http://172.20.2.87:39168/staff/archiveslist"; -// String url = "http://127.0.0.1:39168/staff/archiveslist"; + String url = PortConfig.external_url + "/staff/archiveslist"; String jsonString = JSONObject.toJSONString(map); JSONObject paramObject = JSONObject.parseObject(jsonString); String post = null; @@ -654,8 +682,7 @@ public class PageController { } public static UserByPort FindUserById(Integer id) { - String url = "http://172.20.2.87:39168/staff/archivescont"; -// String url = "http://127.0.0.1:39168/staff/archivescont"; + String url = PortConfig.external_url + "/staff/archivescont"; Map map = new HashMap<>(); map.put("id", id); String jsonString = JSONObject.toJSONString(map); @@ -989,8 +1016,7 @@ public class PageController { public List findAllCompany() { - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; + String url = PortConfig.external_url + "/org/govlist"; Map map = new HashMap<>(); map.put("superior", "313"); String jsonString = JSONObject.toJSONString(map); @@ -1039,8 +1065,7 @@ public class PageController { @GetMapping("/company_detail") public ModelAndView company_detail(Integer id) { - String url = "http://172.20.2.87:39168/org/getgovcont"; -// String url = "http://127.0.0.1:39168/org/getgovcont"; + String url = PortConfig.external_url + "/org/getgovcont"; Map map = new HashMap<>(); ModelAndView mv = new ModelAndView(); mv.setViewName("pages/company/company_edit"); @@ -1068,8 +1093,7 @@ public class PageController { } public static Administration getCompany(Integer id) { - String url = "http://172.20.2.87:39168/org/getgovcont"; -// String url = "http://127.0.0.1:39168/org/getgovcont"; + String url = PortConfig.external_url + "/org/getgovcont"; Map map = new HashMap<>(); map.put("id", id); map.put("idstr", id.toString()); @@ -1090,8 +1114,7 @@ public class PageController { public static List findCompanyBySuperior(String superior) { - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; + String url = PortConfig.external_url + "/org/govlist"; Map map = new HashMap<>(); map.put("superior", superior); String jsonString = JSONObject.toJSONString(map); @@ -1121,8 +1144,6 @@ public class PageController { @GetMapping("/findCompanyByParentId") public ModelAndView findCompanyByParentId(Integer parentId) { ModelAndView mv = new ModelAndView(); - String url = "http://172.20.2.87:39168/org/govlist"; -// String url = "http://127.0.0.1:39168/org/govlist"; if (parentId != null) { mv.addObject("parentId", parentId); List administrationPList = findCompanyBySuperior(parentId.toString()); @@ -1140,8 +1161,7 @@ public class PageController { @GetMapping("/findPostByOrganization") public ModelAndView findPostByOrganization(Integer organization) { - String url = "http://172.20.2.87:39168/org/positionlist"; -// String url = "http://127.0.0.1:39168/org/positionlist"; + String url = PortConfig.external_url + "/org/positionlist"; ModelAndView mv = new ModelAndView(); mv.setViewName("pages/post/post-out"); mv.addObject("parentId", organization); @@ -1190,8 +1210,7 @@ public class PageController { } public static Post findPostById(Integer id) { - String url = "http://172.20.2.87:39168/org/getpositioncont"; -// String url = "http://127.0.0.1:39168/org/getpositioncont"; + String url = PortConfig.external_url + "/org/getpositioncont"; Map map = new HashMap<>(); map.put("id", id); map.put("idstr", id.toString()); @@ -1212,8 +1231,7 @@ public class PageController { @GetMapping("/findPostByParentId") public ModelAndView findPostByParentId(Integer parentId) { - String url = "http://172.20.2.87:39168/org/positionlist"; -// String url = "http://127.0.0.1:39168/org/positionlist"; + String url = PortConfig.external_url + "/org/positionlist"; ModelAndView mv = new ModelAndView(); if (parentId != null) { Map map = new HashMap<>(); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java b/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java index 41c4159f..26b9e6b2 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/UserController.java @@ -3,6 +3,7 @@ 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.PortConfig; import com.dreamchaser.depository_manage.entity.Depository; import com.dreamchaser.depository_manage.entity.User; import com.dreamchaser.depository_manage.entity.UserByPort; @@ -151,8 +152,7 @@ public class UserController { */ @PostMapping("/login") public RestResponse login(@RequestBody Map map, HttpServletRequest request) { - String url = "http://172.20.2.87:6666/base/login"; -// String url = "http://127.0.0.1:6666/base/login"; + String url = PortConfig.external_url_6666 +"/base/login"; String jsonString = JSONObject.toJSONString(map); JSONObject paramObject = JSONObject.parseObject(jsonString); String post = null; @@ -230,8 +230,7 @@ public class UserController { */ @PostMapping("/sys/findUsers") public RestResponse findUsersByPort(@RequestParam Map map) { - String url = "http://172.20.2.87:39168/staff/archiveslist"; -// String url = "http://127.0.0.1:39168/staff/archiveslist"; + String url = PortConfig.external_url + "/staff/archiveslist"; if(map.containsKey("company")){ map.put("company",ObjectFormatUtil.toInteger(map.get("company"))); } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index 5eb7a250..df6af285 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -60,7 +60,7 @@ - id,depository_id,mname,quantity,price,type_id,state,tname,dname,version,amounts ,unit ,texture,code,depositoryCode,depository_id + id,depository_id,mname,quantity,price,type_id,state,tname,dname,version,amounts ,unit ,texture,code,depositoryCode - - - +
+ +
+
- +
- +
- +
- +
-
- -
- -
-
-
@@ -104,6 +94,99 @@ var $ = layui.$, form = layui.form, step = layui.step; + $("#code").blur(function () { + var code = $(this).val(); + $.ajax({ + url: "/material/findMatrialByCode?code=" + code, + type: "get", + dataType: 'json', + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + if(d == null){ + layer.msg("没有该编码,请确认是否输入正确"); + $("#openSonByMaterial").val(""); + $("#mid").val(""); + }else{ + $("#openSonByMaterial").val(d.mname); + $("#mid").val(d.id); + } + } + }); + }); + + $("#openSonByMaterial").blur(function () { + var data = $(this).val(); + var req = {}; + req.mname = data; + $.ajax({ + url: "/material/findMaterialByCondition", + type: "post", + dataType: 'json', + data:JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success: function (d) { + if(d.count > 1){ + layer.msg("请点击右侧搜索确定物品"); + $("#mid").val(""); + $("#code").val(""); + return false; + }else if(d.count === 0){ + layer.msg("没有该物品,请确认输入是否正确"); + $("#mid").val(""); + $("#code").val(""); + return false; + } + else{ + var material = d.data[0]; + $("#openSonByMaterial").val(material.mname) + $("#mid").val(material.id); + $("#code").val(material.code); + } + } + }); + }) + + $('#openSonByDepository').on('click', function () { + layer.open({ + type: 2, + title: '弹窗内容', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['800px', '500px'], + content: '/selectDepository?type=2', + }); + }); + + + $('#selectMaterial').on('click', function () { + var mname = $("#openSonByMaterial").val(); + layer.open({ + type: 2, + title: '弹窗内容', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['800px', '500px'], + content: '/selectMaterial?mname='+mname+'&type=2', + end: function () { + var mid = $("#mid").val(); + $.ajax({ + url: "/material/findMatrialById?mid=" + mid, + type: "get", + dataType: 'json', + contentType: "application/json;charset=utf-8", + success: function (d) { + var code = d.data.code + $("#code").val(code) + + } + }); + + } + }); + }); step.render({ elem: '#stepForm', filter: 'stepForm', @@ -122,10 +205,8 @@ form.on('submit(formStep)', function (data) { data=data.field; - data.type=2; - data.state=0; $.ajax({ - url:"/depositoryRecord/depositoryRecord", + url:"/depositoryRecord/applicationOut", type:'post', dataType:'json', contentType: "application/json;charset=utf-8", @@ -159,25 +240,6 @@ return false; }); - form.on('select(mname)',function (data){ - // $.ajax({ - // url:"/repository/find_depository?mid="+data.value, - // type:'get', - // dataType:'json', - // contentType: "application/json;charset=utf-8", - // success:function(d){ - // $('#formId').val(d.data.id) - // console.log(d.name) - // // layui.use(['form'],function() { - // // var form=layui.form; - // // form.render(); - // // }); - // } - // }) - console.log(data.attr) - }) - - $('.pre').click(function () { step.pre('#stepForm'); }); diff --git a/src/main/resources/templates/pages/application/application-review.html b/src/main/resources/templates/pages/application/application-review.html index 4b80816c..db7f5a85 100644 --- a/src/main/resources/templates/pages/application/application-review.html +++ b/src/main/resources/templates/pages/application/application-review.html @@ -218,7 +218,12 @@ success:function(data){ layer.close(this.layerIndex); if(data.status >= 300){ - layer.msg(data.statusInfo.detail,function () { + layer.msg(data.statusInfo.detail, + { + icon: 2, + time:300 + }, + function () { window.location = '/ApplicationOutView?id='+req.id; });//失败的表情 diff --git a/src/main/resources/templates/pages/application/application-transfer.html b/src/main/resources/templates/pages/application/application-transfer.html index 34f7e29c..a45af69b 100644 --- a/src/main/resources/templates/pages/application/application-transfer.html +++ b/src/main/resources/templates/pages/application/application-transfer.html @@ -22,12 +22,20 @@
+
+ + +
+ +
+
+
- - +
@@ -112,6 +120,61 @@ var $ = layui.$, form = layui.form, step = layui.step; + $("#code").blur(function () { + var code = $(this).val(); + $.ajax({ + url: "/material/findMatrialByCode?code=" + code, + type: "get", + dataType: 'json', + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + if(d == null){ + layer.msg("没有该编码,请确认是否输入正确"); + $("#openSonByMaterial").val(""); + $("#mid").val(""); + $("#code").val(""); + }else{ + $("#openSonByMaterial").val(d.mname); + $("#mid").val(d.id); + } + } + }); + }); + + $("#openSonByMaterial").blur(function () { + var data = $(this).val(); + var req = {}; + req.mname = data; + $.ajax({ + url: "/material/findMaterialByCondition", + type: "post", + dataType: 'json', + data:JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success: function (d) { + if(d.count > 1){ + layer.msg("请点击右侧搜索确定物品"); + $("#mid").val(""); + $("#code").val(""); + return false; + }else if(d.count === 0){ + layer.msg("没有该物品,请确认输入是否正确"); + $("#mid").val(""); + $("#code").val(""); + $("#openSonByMaterial").val(""); + return false; + } + else{ + var material = d.data[0]; + $("#openSonByMaterial").val(material.mname) + $("#mid").val(material.id); + $("#code").val(material.code); + } + } + }); + }); + $('#openSonByDepository').on('click', function(){ layer.open({ @@ -125,6 +188,34 @@ }); }); + $('#selectMaterial').on('click', function () { + var mname = $("#openSonByMaterial").val(); + layer.open({ + type: 2, + title: '弹窗内容', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['800px', '500px'], + content: '/selectMaterial?mname='+mname+'&type=2', + end: function () { + var mid = $("#mid").val(); + $.ajax({ + url: "/material/findMatrialById?mid=" + mid, + type: "get", + dataType: 'json', + contentType: "application/json;charset=utf-8", + success: function (d) { + var code = d.data.code + $("#code").val(code) + + } + }); + + } + }); + }); + step.render({ elem: '#stepForm', filter: 'stepForm', diff --git a/src/main/resources/templates/pages/application/application_in_multi.html b/src/main/resources/templates/pages/application/application_in_multi.html new file mode 100644 index 00000000..d181256b --- /dev/null +++ b/src/main/resources/templates/pages/application/application_in_multi.html @@ -0,0 +1,202 @@ + + + + + 分步表单 + + + + + + + + +
+
+ + +
+ + + +
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/pages/application/application_multi.html b/src/main/resources/templates/pages/application/application_multi.html new file mode 100644 index 00000000..abde3f39 --- /dev/null +++ b/src/main/resources/templates/pages/application/application_multi.html @@ -0,0 +1,273 @@ + + + + + layui + + + + + + + + +
+
+ + + +
+ +
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/pages/company/company-out.html b/src/main/resources/templates/pages/company/company-out.html index 9c0421c2..76379523 100644 --- a/src/main/resources/templates/pages/company/company-out.html +++ b/src/main/resources/templates/pages/company/company-out.html @@ -116,7 +116,7 @@ limit: 10, page: true, skin: 'line', - one:function () { + done:function () { $("[data-field='id']").css('display','none'); } }); diff --git a/src/main/resources/templates/pages/depository/table-in.html b/src/main/resources/templates/pages/depository/table-in.html index 71954b17..d0d02b71 100644 --- a/src/main/resources/templates/pages/depository/table-in.html +++ b/src/main/resources/templates/pages/depository/table-in.html @@ -192,36 +192,43 @@ for (i=0,len=data.length;i= 300){ - layer.msg(data.statusInfo.message);//失败的表情 - return; - }else{ - layer.msg("删除成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }); - //执行搜索重载 - table.reload('currentTableId', { - url: '/depositoryRecord/applicationInView', - page: { - curr: 1 + if(req.ids.length > 0) { + layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { + $.ajax({ + url: '/depositoryRecord/deleteApplicationInRecord', + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + return; + } else { + layer.msg("删除成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }); + //执行搜索重载 + table.reload('currentTableId', { + url: '/depositoryRecord/applicationInView', + page: { + curr: 1 + } + }, 'data'); + return false; } - }, 'data'); - return false; - } - } - }) + } + }) + }) + }else{ + layer.msg("未选中记录,请确认!"); + return false; + } } }); @@ -253,7 +260,7 @@ layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: '/depositoryRecord/deleteApplicationInRecord', - type: 'delete', + type: 'post', dataType:'json', contentType: "application/json;charset=utf-8", data:JSON.stringify(req), diff --git a/src/main/resources/templates/pages/depository/table-out.html b/src/main/resources/templates/pages/depository/table-out.html index 547e292f..099dc61f 100644 --- a/src/main/resources/templates/pages/depository/table-out.html +++ b/src/main/resources/templates/pages/depository/table-out.html @@ -204,36 +204,43 @@ for (i=0,len=data.length;i= 300){ - layer.msg(data.statusInfo.message);//失败的表情 - return; - }else{ - layer.msg("删除成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }); - //执行搜索重载 - table.reload('currentTableId', { - url: '/depositoryRecord/applicationOutView', - page: { - curr: 1 + if(req.ids.length > 0) { + layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { + $.ajax({ + url: '/depositoryRecord/deleteApplicationOutRecord', + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + return; + } else { + layer.msg("删除成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }); + //执行搜索重载 + table.reload('currentTableId', { + url: '/depositoryRecord/applicationOutView', + page: { + curr: 1 + } + }, 'data'); + return false; } - }, 'data'); - return false; - } - } - }) + } + }) + }); + }else{ + layer.msg("未选中记录,请确认!"); + return false; + } } }); @@ -264,7 +271,7 @@ layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: 'depositoryRecord/deleteApplicationOutRecord', - type: 'delete', + type: 'post', dataType:'json', contentType: "application/json;charset=utf-8", data:JSON.stringify(req), diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index 271dade9..08941a4d 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -51,6 +51,13 @@
+ +
+ +
+ + + +
+
+ + + + + \ No newline at end of file diff --git a/target/classes/templates/pages/application/application_multi.html b/target/classes/templates/pages/application/application_multi.html new file mode 100644 index 00000000..abde3f39 --- /dev/null +++ b/target/classes/templates/pages/application/application_multi.html @@ -0,0 +1,273 @@ + + + + + layui + + + + + + + + +
+
+ + + +
+ +
+
+ + + + + \ No newline at end of file diff --git a/target/classes/templates/pages/company/company-out.html b/target/classes/templates/pages/company/company-out.html index 9c0421c2..76379523 100644 --- a/target/classes/templates/pages/company/company-out.html +++ b/target/classes/templates/pages/company/company-out.html @@ -116,7 +116,7 @@ limit: 10, page: true, skin: 'line', - one:function () { + done:function () { $("[data-field='id']").css('display','none'); } }); diff --git a/target/classes/templates/pages/depository/table-in.html b/target/classes/templates/pages/depository/table-in.html index 71954b17..d0d02b71 100644 --- a/target/classes/templates/pages/depository/table-in.html +++ b/target/classes/templates/pages/depository/table-in.html @@ -192,36 +192,43 @@ for (i=0,len=data.length;i= 300){ - layer.msg(data.statusInfo.message);//失败的表情 - return; - }else{ - layer.msg("删除成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }); - //执行搜索重载 - table.reload('currentTableId', { - url: '/depositoryRecord/applicationInView', - page: { - curr: 1 + if(req.ids.length > 0) { + layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { + $.ajax({ + url: '/depositoryRecord/deleteApplicationInRecord', + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + return; + } else { + layer.msg("删除成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }); + //执行搜索重载 + table.reload('currentTableId', { + url: '/depositoryRecord/applicationInView', + page: { + curr: 1 + } + }, 'data'); + return false; } - }, 'data'); - return false; - } - } - }) + } + }) + }) + }else{ + layer.msg("未选中记录,请确认!"); + return false; + } } }); @@ -253,7 +260,7 @@ layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: '/depositoryRecord/deleteApplicationInRecord', - type: 'delete', + type: 'post', dataType:'json', contentType: "application/json;charset=utf-8", data:JSON.stringify(req), diff --git a/target/classes/templates/pages/depository/table-out.html b/target/classes/templates/pages/depository/table-out.html index 547e292f..099dc61f 100644 --- a/target/classes/templates/pages/depository/table-out.html +++ b/target/classes/templates/pages/depository/table-out.html @@ -204,36 +204,43 @@ for (i=0,len=data.length;i= 300){ - layer.msg(data.statusInfo.message);//失败的表情 - return; - }else{ - layer.msg("删除成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }); - //执行搜索重载 - table.reload('currentTableId', { - url: '/depositoryRecord/applicationOutView', - page: { - curr: 1 + if(req.ids.length > 0) { + layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { + $.ajax({ + url: '/depositoryRecord/deleteApplicationOutRecord', + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + return; + } else { + layer.msg("删除成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }); + //执行搜索重载 + table.reload('currentTableId', { + url: '/depositoryRecord/applicationOutView', + page: { + curr: 1 + } + }, 'data'); + return false; } - }, 'data'); - return false; - } - } - }) + } + }) + }); + }else{ + layer.msg("未选中记录,请确认!"); + return false; + } } }); @@ -264,7 +271,7 @@ layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: 'depositoryRecord/deleteApplicationOutRecord', - type: 'delete', + type: 'post', dataType:'json', contentType: "application/json;charset=utf-8", data:JSON.stringify(req), diff --git a/target/classes/templates/pages/depository/table-stock.html b/target/classes/templates/pages/depository/table-stock.html index 271dade9..08941a4d 100644 --- a/target/classes/templates/pages/depository/table-stock.html +++ b/target/classes/templates/pages/depository/table-stock.html @@ -51,6 +51,13 @@ + +