Browse Source

修改类型转换时有,出错的情况

lwx_dev
erdanergou 2 years ago
parent
commit
0062682d30
  1. 5
      src/main/java/com/dreamchaser/depository_manage/EPSON/EPDM/EPDMSelectData.java
  2. 18
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  3. 4
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  4. 2
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  5. 2
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java
  6. 24
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  7. 4
      src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java
  8. 8
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  9. 3
      src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java
  10. 3
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java
  11. 11
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleTaskP.java
  12. 24
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  13. 2
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java
  14. 2
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java
  15. 34
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  16. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialTypeServiceImpl.java
  17. 22
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  18. 6
      src/main/java/com/dreamchaser/depository_manage/utils/DateUtil.java
  19. 2
      src/test/java/com/dreamchaser/depository_manage/BarChartTest.java
  20. 2
      src/test/java/com/dreamchaser/depository_manage/LineChartTest.java
  21. 6
      src/test/java/com/dreamchaser/depository_manage/SomeTest.java
  22. 6
      src/test/java/com/dreamchaser/depository_manage/SunburstChartTest.java

5
src/main/java/com/dreamchaser/depository_manage/EPSON/EPDM/EPDMSelectData.java

@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage.EPSON.EPDM;
import com.dreamchaser.depository_manage.EPSON.epsonException.EPDMException; import com.dreamchaser.depository_manage.EPSON.epsonException.EPDMException;
import com.dreamchaser.depository_manage.config.EPSON.EPDM.Global_MEDIA_EPDM; import com.dreamchaser.depository_manage.config.EPSON.EPDM.Global_MEDIA_EPDM;
import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.sun.jna.Memory; import com.sun.jna.Memory;
import com.sun.jna.Native; import com.sun.jna.Native;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
@ -110,11 +111,11 @@ public class EPDMSelectData extends EPDM{
data = Global_MEDIA_EPDM.epdm_select_data_int64.get(p.getInt(0)); data = Global_MEDIA_EPDM.epdm_select_data_int64.get(p.getInt(0));
break; break;
case 4: case 4:
data = Long.valueOf(Global_MEDIA_EPDM.epdm_select_data_int32.get(p.getInt(0))); data = ObjectFormatUtil.toLong(Global_MEDIA_EPDM.epdm_select_data_int32.get(p.getInt(0)));
break; break;
case 2: case 2:
default: default:
data = Long.valueOf(Global_MEDIA_EPDM.epdm_select_data_int16.get(p.getInt(0))); data = ObjectFormatUtil.toLong(Global_MEDIA_EPDM.epdm_select_data_int16.get(p.getInt(0)));
break; break;
} }
return data; return data;

18
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java

@ -337,10 +337,10 @@ public class DepositoryController {
for (int num = 0; num < months.size() - 1; num++) { for (int num = 0; num < months.size() - 1; num++) {
for (MaterialType materialType : materialTypeAll) { for (MaterialType materialType : materialTypeAll) {
Map<String, Object> parm = new HashMap<>(); Map<String, Object> parm = new HashMap<>();
parm.put("type", Integer.parseInt(type)); parm.put("type", ObjectFormatUtil.toInteger(type));
if (Integer.parseInt(type) == 1) { if (ObjectFormatUtil.toInteger(type) == 1) {
parm.put("state", "已入库"); parm.put("state", "已入库");
} else if (Integer.parseInt(type) == 2) { } else if (ObjectFormatUtil.toInteger(type) == 2) {
parm.put("state", "已出库"); parm.put("state", "已出库");
} }
parm.put("start", months.get(num + 1)); parm.put("start", months.get(num + 1));
@ -855,7 +855,7 @@ public class DepositoryController {
token = (String) request.getSession().getAttribute("userToken"); token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
Material materialById = materialService.findMaterialById(Integer.parseInt(mid)); Material materialById = materialService.findMaterialById(ObjectFormatUtil.toInteger(mid));
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("depositoryId", materialById.getDepositoryId()); param.put("depositoryId", materialById.getDepositoryId());
List<Depository> depositoryId = depositoryService.findDepositoryByCondition(param, userKey, token); List<Depository> depositoryId = depositoryService.findDepositoryByCondition(param, userKey, token);
@ -1576,7 +1576,7 @@ public class DepositoryController {
for (i = days.size() - 1; i > 0; i--) { for (i = days.size() - 1; i > 0; i--) {
// 遍历 Map并计算各仓库的入库数 // 遍历 Map并计算各仓库的入库数
// 获取一段时间内的库存额度 // 获取一段时间内的库存额度
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i), days.get(i - 1), Integer.parseInt(type), val); Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i), days.get(i - 1), ObjectFormatUtil.toInteger(type), val);
drCountbyDrName.add(depositoryRecordByDate1); drCountbyDrName.add(depositoryRecordByDate1);
} }
Collections.reverse(drCountbyDrName); Collections.reverse(drCountbyDrName);
@ -1661,7 +1661,7 @@ public class DepositoryController {
for (i = days.size() - 1; i > 0; i--) { for (i = days.size() - 1; i > 0; i--) {
// 遍历 Map并计算各仓库的入库数 // 遍历 Map并计算各仓库的入库数
// 获取一段时间内的库存额度 // 获取一段时间内的库存额度
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val); Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), ObjectFormatUtil.toInteger(type), val);
if ("2".equals(type)) { if ("2".equals(type)) {
depositoryRecordByDate1 = -depositoryRecordByDate1; depositoryRecordByDate1 = -depositoryRecordByDate1;
} }
@ -1825,10 +1825,10 @@ public class DepositoryController {
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("type", Integer.parseInt(type)); map.put("type", ObjectFormatUtil.toInteger(type));
if (Integer.parseInt(type) == 1) { if (ObjectFormatUtil.toInteger(type) == 1) {
map.put("state", "已入库"); map.put("state", "已入库");
} else if (Integer.parseInt(type) == 2) { } else if (ObjectFormatUtil.toInteger(type) == 2) {
map.put("state", "已出库"); map.put("state", "已出库");
} }
map.put("start", start); map.put("start", start);

4
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -193,7 +193,7 @@ public class DepositoryRecordController {
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId());
// 创建展示对象 // 创建展示对象
SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById); SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById);
simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getApplicantTime())));
simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark());
simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId());
simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname());
@ -987,7 +987,7 @@ public class DepositoryRecordController {
} }
} }
simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getApplicantTime())));
simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark());
simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId());
simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname());

2
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -1738,7 +1738,7 @@ public class MaterialController {
@PostMapping("/closeTreeChildren") @PostMapping("/closeTreeChildren")
public void closeTreeChildren(@RequestBody Map<String, Object> map, HttpServletRequest request) { public void closeTreeChildren(@RequestBody Map<String, Object> map, HttpServletRequest request) {
if (map.containsKey("mtId")) { if (map.containsKey("mtId")) {
Long mtId = Long.valueOf(map.get("mtId").toString()); Long mtId = ObjectFormatUtil.toLong(map.get("mtId").toString());
materialService.closeTreeChildren(mtId); materialService.closeTreeChildren(mtId);
} else { } else {
throw new MyException("缺少必要参数"); throw new MyException("缺少必要参数");

2
src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java

@ -135,7 +135,7 @@ public class MaterialTypeController {
for (MaterialType materialType : materialTypeByCondition) { for (MaterialType materialType : materialTypeByCondition) {
Long oldId = materialType.getOldId();// 获取当前物料id Long oldId = materialType.getOldId();// 获取当前物料id
RealDeleteSonDepository(oldId.toString()); // 递归查询物料类型 RealDeleteSonDepository(oldId.toString()); // 递归查询物料类型
materialTypeService.deleteMaterialTypeById(Integer.parseInt(oldId.toString())); // 删除物料类型 materialTypeService.deleteMaterialTypeById(ObjectFormatUtil.toInteger(oldId.toString())); // 删除物料类型
} }
} }

24
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -2049,7 +2049,7 @@ public class PageController {
} }
String balancePosterTime = recordP.getBalancePosterTime(); String balancePosterTime = recordP.getBalancePosterTime();
if (balancePosterTime != null && !"".equals(balancePosterTime) && !"0".equals(balancePosterTime)) { if (balancePosterTime != null && !"".equals(balancePosterTime) && !"0".equals(balancePosterTime)) {
recordP.setBalancePosterTime(DateUtil.TimeStampToDateTime(Long.valueOf(balancePosterTime))); recordP.setBalancePosterTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(balancePosterTime)));
} }
} }
@ -2072,8 +2072,8 @@ public class PageController {
} }
} }
recordP.setPCode(placeCode.toString()); recordP.setPCode(placeCode.toString());
recordP.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime()))); recordP.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getApplicantTime())));
recordP.setDepartmentheadTime(DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getDepartmentheadTime()))); recordP.setDepartmentheadTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getDepartmentheadTime())));
recordP.setDepositoryManagerName(depositoryManagerNames.toString()); recordP.setDepositoryManagerName(depositoryManagerNames.toString());
recordP.setBalancePosterName(balancePosterName.toString()); recordP.setBalancePosterName(balancePosterName.toString());
recordP.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); recordP.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
@ -2116,7 +2116,7 @@ public class PageController {
String airapproverTime = applicationInRecordPById.getAirapproverTime(); String airapproverTime = applicationInRecordPById.getAirapproverTime();
if (airapproverTime != null && !"".equals(airapproverTime)) { if (airapproverTime != null && !"".equals(airapproverTime)) {
airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime)); airapproverTime = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(airapproverTime));
applicationInRecordPById.setAirapproverTime(airapproverTime); applicationInRecordPById.setAirapproverTime(airapproverTime);
} }
@ -2145,7 +2145,7 @@ public class PageController {
// 如果不是组合 // 如果不是组合
UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token);
applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecordPById.getApplicantTime())));
if (applicationInRecordPById.getPrice() != null) { if (applicationInRecordPById.getPrice() != null) {
applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100);
} else { } else {
@ -2195,7 +2195,7 @@ public class PageController {
String airapproverTime = applicationInRecordPById.getAirapproverTime(); String airapproverTime = applicationInRecordPById.getAirapproverTime();
if (airapproverTime != null && !"".equals(airapproverTime)) { if (airapproverTime != null && !"".equals(airapproverTime)) {
airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime)); airapproverTime = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(airapproverTime));
applicationInRecordPById.setAirapproverTime(airapproverTime); applicationInRecordPById.setAirapproverTime(airapproverTime);
} }
@ -2225,7 +2225,7 @@ public class PageController {
// 如果不是组合 // 如果不是组合
UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token);
applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecordPById.getApplicantTime())));
if (applicationInRecordPById.getPrice() != null) { if (applicationInRecordPById.getPrice() != null) {
applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100);
} else { } else {
@ -2386,11 +2386,11 @@ public class PageController {
String[] split = balancePoster.split(","); String[] split = balancePoster.split(",");
for (String s : split) { for (String s : split) {
if (!"".equals(s)) { if (!"".equals(s)) {
UserByPort userByPort = PublicConfig.FindUserById(Integer.parseInt(s), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token);
balancePosterName.append(userByPort.getName()).append(","); balancePosterName.append(userByPort.getName()).append(",");
} }
} }
applicationOutRecordPById.setBalancePosterTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getBalancePosterTime()))); applicationOutRecordPById.setBalancePosterTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getBalancePosterTime())));
} else { } else {
applicationOutRecordPById.setBalancePosterTime(""); applicationOutRecordPById.setBalancePosterTime("");
} }
@ -2571,9 +2571,9 @@ public class PageController {
applicationOutRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationOutRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
applicationOutRecordPById.setDepartmentheadName(departmentHeadName.toString()); applicationOutRecordPById.setDepartmentheadName(departmentHeadName.toString());
applicationOutRecordPById.setDepositoryManagerName(depositoryManagerNames.toString()); applicationOutRecordPById.setDepositoryManagerName(depositoryManagerNames.toString());
applicationOutRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); applicationOutRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getApplicantTime())));
applicationOutRecordPById.setDepartmentheadTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getDepartmentheadTime()))); applicationOutRecordPById.setDepartmentheadTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getDepartmentheadTime())));
applicationOutRecordPById.setDepositoryManagerTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getDepositoryManagerTime()))); applicationOutRecordPById.setDepositoryManagerTime(DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getDepositoryManagerTime())));
applicationOutRecordPById.setPrice(sumPrice); applicationOutRecordPById.setPrice(sumPrice);
applicationOutRecordPById.setQuantity(sumQuantity); applicationOutRecordPById.setQuantity(sumQuantity);
applicationOutRecordPById.setMname(mname.toString()); applicationOutRecordPById.setMname(mname.toString());

4
src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java

@ -475,7 +475,7 @@ public class PlaceController {
// 如果当前位置为库位 // 如果当前位置为库位
// 获取当前库位 // 获取当前库位
Place place = placeService.findPlaceById(Integer.parseInt(locationByQrCode.getPid().toString())); Place place = placeService.findPlaceById(ObjectFormatUtil.toInteger(locationByQrCode.getPid().toString()));
PlaceP placeP = new PlaceP(place); PlaceP placeP = new PlaceP(place);
if (Integer.compare(0, placeP.getId()) == 0) { if (Integer.compare(0, placeP.getId()) == 0) {
@ -491,7 +491,7 @@ public class PlaceController {
// 如果当前位置为仓库 // 如果当前位置为仓库
// 获取当前仓库 // 获取当前仓库
Depository depository = depositoryService.findDepositoryById(Integer.parseInt(locationByQrCode.getDepositoryId().toString())); Depository depository = depositoryService.findDepositoryById(ObjectFormatUtil.toInteger(locationByQrCode.getDepositoryId().toString()));
result.put("flag", 2); result.put("flag", 2);
result.put("depository", depository); result.put("depository", depository);
} }

8
src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java

@ -350,7 +350,7 @@ public class QyWxOperationController {
s = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "jsapi_ticket_app"); s = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "jsapi_ticket_app");
if (s != null) { if (s != null) {
s1 = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "jsapi_ticket_enterprises"); s1 = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "jsapi_ticket_enterprises");
timestamp = Long.parseLong((String) Objects.requireNonNull(redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "timestamp"))); timestamp = ObjectFormatUtil.toLong((String) Objects.requireNonNull(redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "timestamp")));
url = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "url"); url = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "url");
noncestr = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "noncestr"); noncestr = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get("wms_QyWxScanQrCodeSignature", "noncestr");
} else { } else {
@ -584,10 +584,10 @@ public class QyWxOperationController {
// 如果已经获取到审批节点 // 如果已经获取到审批节点
// 获取当前审批节点处理时间 // 获取当前审批节点处理时间
long aLong = Long.parseLong(spTime); long aLong = ObjectFormatUtil.toLong(spTime);
// 获取之前节点的审批时间 // 获取之前节点的审批时间
long aLong1 = Long.parseLong(as_SpTime); long aLong1 = ObjectFormatUtil.toLong(as_SpTime);
if (aLong >= aLong1) { if (aLong >= aLong1) {
// 如果当前审批节点是最近处理 // 如果当前审批节点是最近处理
@ -625,7 +625,7 @@ public class QyWxOperationController {
boolean flagForLabel = true; // 默认为标签 boolean flagForLabel = true; // 默认为标签
// 获取当前的主订单 // 获取当前的主订单
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(Integer.parseInt(mainId)); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(mainId));
if (Integer.compare(applicationOutRecordPById.getFlagForOpenDepository(), 2) == 0) { if (Integer.compare(applicationOutRecordPById.getFlagForOpenDepository(), 2) == 0) {
// 如果是申请的开放仓库 // 如果是申请的开放仓库

3
src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java

@ -1,6 +1,7 @@
package com.dreamchaser.depository_manage.entity; package com.dreamchaser.depository_manage.entity;
import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP; import com.dreamchaser.depository_manage.pojo.MaterialAndPlaceForViewP;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -181,7 +182,7 @@ public class Inventory {
this.mid = mpv.getMid(); this.mid = mpv.getMid();
this.mname = mpv.getMname(); this.mname = mpv.getMname();
this.code = mpv.getMcode(); this.code = mpv.getMcode();
this.materialTypeId = Long.valueOf(mpv.getType_id()); this.materialTypeId = ObjectFormatUtil.toLong(mpv.getType_id());
this.typeName = mpv.getTname(); this.typeName = mpv.getTname();
this.version = mpv.getVersion(); this.version = mpv.getVersion();
this.quantity = mpv.getInventory().intValue(); this.quantity = mpv.getInventory().intValue();

3
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java

@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.pojo;
import com.dreamchaser.depository_manage.entity.ApplicationOutRecord; import com.dreamchaser.depository_manage.entity.ApplicationOutRecord;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -289,7 +290,7 @@ public class ApplicationOutRecordP {
this.constructionUnitId = aor.getConstructionUnitId(); this.constructionUnitId = aor.getConstructionUnitId();
this.constructionUnitName = aor.getConstructionUnitName(); this.constructionUnitName = aor.getConstructionUnitName();
this.adminorgId = aor.getAdminorgId(); this.adminorgId = aor.getAdminorgId();
this.outTime = aor.getOutTime() == null ? "" : DateUtil.TimeStampToDateTime(Long.valueOf(aor.getOutTime())); this.outTime = aor.getOutTime() == null ? "" : DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(aor.getOutTime()));
this.abstracts = aor.getAbstracts(); this.abstracts = aor.getAbstracts();
this.outType = aor.getOutType(); this.outType = aor.getOutType();
this.outTypeName = aor.getOutTypeName(); this.outTypeName = aor.getOutTypeName();

11
src/main/java/com/dreamchaser/depository_manage/pojo/SimpleTaskP.java

@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage.pojo;
import com.dreamchaser.depository_manage.entity.ApplicationInRecord; import com.dreamchaser.depository_manage.entity.ApplicationInRecord;
import com.dreamchaser.depository_manage.entity.ApplicationOutRecordMin; import com.dreamchaser.depository_manage.entity.ApplicationOutRecordMin;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data; import lombok.Data;
@ -47,7 +48,7 @@ public class SimpleTaskP {
* @param d 出库任务 * @param d 出库任务
*/ */
public SimpleTaskP(SimpleApplicationOutOrInRecordP d) { public SimpleTaskP(SimpleApplicationOutOrInRecordP d) {
this.id= Long.valueOf(d.getId().toString()); this.id= ObjectFormatUtil.toLong(d.getId().toString());
this.applicantTime = d.getApplicantTime(); this.applicantTime = d.getApplicantTime();
this.applicantName = d.getApplicantName(); this.applicantName = d.getApplicantName();
this.type = d.getType() == 1? "出库请求" : "入库请求"; this.type = d.getType() == 1? "出库请求" : "入库请求";
@ -67,15 +68,15 @@ public class SimpleTaskP {
} }
public SimpleTaskP(ApplicationOutRecordP aor,ApplicationOutRecordMinP aorm){ public SimpleTaskP(ApplicationOutRecordP aor,ApplicationOutRecordMinP aorm){
this.id = Long.valueOf(aorm.getDepositoryId().toString()); this.id = ObjectFormatUtil.toLong(aorm.getDepositoryId().toString());
this.code = aorm.getCode(); this.code = aorm.getCode();
this.applicantTime = DateUtil.TimeStampToDateTime(Long.valueOf(aor.getApplicantTime())); this.applicantTime = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(aor.getApplicantTime()));
this.applicantName = aor.getApplicantName(); this.applicantName = aor.getApplicantName();
this.type = "物料出库请求"; this.type = "物料出库请求";
} }
public SimpleTaskP(ApplicationOutRecordP aor){ public SimpleTaskP(ApplicationOutRecordP aor){
this.id = Long.valueOf(aor.getId()); this.id = ObjectFormatUtil.toLong(aor.getId());
this.code = aor.getCode(); this.code = aor.getCode();
this.applicantTime = aor.getApplicantTime(); this.applicantTime = aor.getApplicantTime();
this.applicantName = aor.getApplicantName(); this.applicantName = aor.getApplicantName();
@ -83,7 +84,7 @@ public class SimpleTaskP {
} }
public SimpleTaskP(ApplicationInRecordP aip) { public SimpleTaskP(ApplicationInRecordP aip) {
this.id = Long.valueOf(aip.getId()); this.id = ObjectFormatUtil.toLong(aip.getId());
this.code = aip.getCode(); this.code = aip.getCode();
this.applicantTime = aip.getApplicantTime(); this.applicantTime = aip.getApplicantTime();
this.applicantName = aip.getApplicantName(); this.applicantName = aip.getApplicantName();

24
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -84,7 +84,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("applyTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("applyTime", DateUtil.DateTimeToTimeStamp(simpleTime));
map.put("state", "待审核"); map.put("state", "待审核");
String mname = (String) map.get("mname"); String mname = (String) map.get("mname");
double quantity = Double.parseDouble((String) map.get("quantity")); double quantity = ObjectFormatUtil.toDouble((String) map.get("quantity"));
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("mname", mname); param.put("mname", mname);
List<Material> list = materialMapper.findMaterialByCondition(param); List<Material> list = materialMapper.findMaterialByCondition(param);
@ -118,7 +118,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer Inventory = depositoryMapper.getToDayInventoryByDName(temp); Integer Inventory = depositoryMapper.getToDayInventoryByDName(temp);
//构造单号 //构造单号
String code = createCode(depositoryRecordById.getDname(), "InOrderNumber", "in", ""); String code = createCode(depositoryRecordById.getDname(), "InOrderNumber", "in", "");
double quantity = Double.parseDouble((String) map.get("quantity")); double quantity = ObjectFormatUtil.toDouble((String) map.get("quantity"));
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
// 根据物料id查询物料 // 根据物料id查询物料
Material material = materialMapper.findMaterialById(mid); Material material = materialMapper.findMaterialById(mid);
@ -248,7 +248,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (placeId == null || "".equals(placeId) || "0".equals(placeId)) { if (placeId == null || "".equals(placeId) || "0".equals(placeId)) {
map.put("placeId", 0); map.put("placeId", 0);
} }
double quantity = Double.parseDouble((String) map.get("quantity")) * 100; double quantity = ObjectFormatUtil.toDouble((String) map.get("quantity")) * 100;
Long time = DateUtil.DateTimeToTimeStamp(DateUtil.getSimpleTime(new Date())); Long time = DateUtil.DateTimeToTimeStamp(DateUtil.getSimpleTime(new Date()));
map.put("applicantTime", time); map.put("applicantTime", time);
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
@ -596,7 +596,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
if (Double.compare(priceForYesterday, 0.0) != 0) { if (Double.compare(priceForYesterday, 0.0) != 0) {
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); ratioForPrice = (priceForToday - priceForYesterday) / ObjectFormatUtil.toDouble(Double.toString(priceForYesterday));
} }
BigDecimal bgForSum = new BigDecimal(ratioForCount); BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
@ -674,7 +674,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
ratioForCount = ((countForToday - countForYesterday) / countForYesterday); ratioForCount = ((countForToday - countForYesterday) / countForYesterday);
} }
if (Double.compare(priceForYesterday, 0.0) != 0) { if (Double.compare(priceForYesterday, 0.0) != 0) {
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); ratioForPrice = (priceForToday - priceForYesterday) / ObjectFormatUtil.toDouble(Double.toString(priceForYesterday));
} }
BigDecimal bgForSum = new BigDecimal(ratioForCount); BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
@ -1919,7 +1919,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if ("mt".equals(type.toString())) { if ("mt".equals(type.toString())) {
// 获取当前类型的管理员 // 获取当前类型的管理员
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString())); List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(ObjectFormatUtil.toLong(mtId.toString()));
for (RoleAndMaterialType mt : materialTypeIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
) { ) {
@ -2888,7 +2888,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer transferApply(Map<String, Object> map, UserByPort userByPort, String userKey, String token) { public Integer transferApply(Map<String, Object> map, UserByPort userByPort, String userKey, String token) {
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
double quantity = Double.parseDouble((String) map.get("quantity")); double quantity = ObjectFormatUtil.toDouble((String) map.get("quantity"));
Inventory material = materialMapper.findInventoryById(mid); Inventory material = materialMapper.findInventoryById(mid);
map.put("depositoryId", material.getDepositoryId()); map.put("depositoryId", material.getDepositoryId());
map.put("mid", mid); map.put("mid", mid);
@ -4523,7 +4523,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (ApplicationInRecord applicationInRecord : list) { for (ApplicationInRecord applicationInRecord : list) {
UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecord.getApplicantTime()));
applicationInRecord.setApplicantName(userByPortById.getName()); applicationInRecord.setApplicantName(userByPortById.getName());
applicationInRecord.setApplicantTime(time); applicationInRecord.setApplicantTime(time);
applicationInRecord.setApplyRemark(applicationInRecord.getApplyRemark() == null ? "" : applicationInRecord.getApplyRemark()); applicationInRecord.setApplyRemark(applicationInRecord.getApplyRemark() == null ? "" : applicationInRecord.getApplyRemark());
@ -4578,7 +4578,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationInRecordP> result = new ArrayList<>(); List<ApplicationInRecordP> result = new ArrayList<>();
for (ApplicationInRecord applicationInRecord : list) { for (ApplicationInRecord applicationInRecord : list) {
UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecord.getApplicantTime()));
applicationInRecord.setApplicantName(userByPortById.getName()); applicationInRecord.setApplicantName(userByPortById.getName());
applicationInRecord.setApplicantTime(time); applicationInRecord.setApplicantTime(time);
applicationInRecord.setApplyRemark(applicationInRecord.getApplyRemark() == null ? "" : applicationInRecord.getApplyRemark()); applicationInRecord.setApplyRemark(applicationInRecord.getApplyRemark() == null ? "" : applicationInRecord.getApplyRemark());
@ -4654,7 +4654,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationOutRecordP> result = new ArrayList<>(); List<ApplicationOutRecordP> result = new ArrayList<>();
for (ApplicationOutRecord record : list) { for (ApplicationOutRecord record : list) {
UserByPort userByPortById = PublicConfig.FindUserById(record.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(record.getApplicantTime()));
record.setApplicantName(userByPortById.getName()); record.setApplicantName(userByPortById.getName());
record.setApplicantTime(time); record.setApplicantTime(time);
record.setApplyRemark(record.getApplyRemark() == null ? "" : record.getApplyRemark()); record.setApplyRemark(record.getApplyRemark() == null ? "" : record.getApplyRemark());
@ -4733,7 +4733,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
continue; continue;
} }
UserByPort userByPortById = PublicConfig.FindUserById(recordP.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(recordP.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getApplicantTime()));
recordP.setApplicantName(userByPortById.getName()); recordP.setApplicantName(userByPortById.getName());
recordP.setApplicantTime(time); recordP.setApplicantTime(time);
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark());
@ -5042,7 +5042,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<Long> allMtByParent = null; List<Long> allMtByParent = null;
if (o != null) { if (o != null) {
String oldId = String.valueOf(o); String oldId = String.valueOf(o);
MaterialType mt = materialTypeMapper.findMaterialTypeByOldId(Long.valueOf(oldId)); MaterialType mt = materialTypeMapper.findMaterialTypeByOldId(ObjectFormatUtil.toLong(oldId));
allMtByParent = findChildForMaterialTypeByParent(mt); allMtByParent = findChildForMaterialTypeByParent(mt);
map.put("list", allMtByParent); map.put("list", allMtByParent);
} }

2
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java

@ -1027,7 +1027,7 @@ public class DepositoryServiceImpl implements DepositoryService {
// 定义开启线程数 // 定义开启线程数
int openThreadSize = 0; int openThreadSize = 0;
for (Depository depository : depositories) { for (Depository depository : depositories) {
if (("".equals(adminorg) || PublicConfig.roleAdminorgList.contains(Integer.parseInt(adminorg))) && !"21".equals(type)) { // 如果不按部门分类或是仓储中心人员且不是入库、库存转移,则全部加载 if (("".equals(adminorg) || PublicConfig.roleAdminorgList.contains(ObjectFormatUtil.toInteger(adminorg))) && !"21".equals(type)) { // 如果不按部门分类或是仓储中心人员且不是入库、库存转移,则全部加载
Future<Object> submit = completionService.submit(new PlaceTask(depository)); Future<Object> submit = completionService.submit(new PlaceTask(depository));
futureList.add(submit); futureList.add(submit);
openThreadSize++; openThreadSize++;

2
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -479,7 +479,7 @@ public class ExcelServiceImpl implements ExcelService {
if (outTime == null || "".equals(outTime)) { if (outTime == null || "".equals(outTime)) {
excelInfoByWrite.setOutTime(""); excelInfoByWrite.setOutTime("");
} else { } else {
excelInfoByWrite.setOutTime(DateUtil.TimeStampToDateTimeForDay(Long.valueOf(outTime))); excelInfoByWrite.setOutTime(DateUtil.TimeStampToDateTimeForDay(ObjectFormatUtil.toLong(outTime)));
} }
// 设置仓库名称 // 设置仓库名称
excelInfoByWrite.setDname(record.getDepositoryName()); excelInfoByWrite.setDname(record.getDepositoryName());

34
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -84,7 +84,7 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public Integer insertMaterial(Map<String, Object> map) { public Integer insertMaterial(Map<String, Object> map) {
if (map.containsKey("price")) { if (map.containsKey("price")) {
int price = (int) (Double.parseDouble(map.get("price").toString()) * 100); int price = (int) (ObjectFormatUtil.toDouble(map.get("price").toString()) * 100);
map.put("price", price); map.put("price", price);
} }
// 判断是否有保质期 // 判断是否有保质期
@ -121,7 +121,7 @@ public class MaterialServiceImpl implements MaterialService {
if (maxCode == null) { if (maxCode == null) {
newCode = String.format("%04d", 1); newCode = String.format("%04d", 1);
} else { } else {
newCode = String.format("%04d", Long.parseLong(maxCode) + 1); newCode = String.format("%04d", ObjectFormatUtil.toLong(maxCode) + 1);
} }
map.put("code", newCode); map.put("code", newCode);
@ -157,7 +157,7 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public Integer updateMaterial(Map<String, Object> map) { public Integer updateMaterial(Map<String, Object> map) {
if (map.containsKey("price")) { if (map.containsKey("price")) {
Double price = Double.parseDouble((String) map.get("price")) * 100; Double price = ObjectFormatUtil.toDouble((String) map.get("price")) * 100;
map.put("price", price); map.put("price", price);
} }
// 判断是否有保质期 // 判断是否有保质期
@ -623,7 +623,7 @@ public class MaterialServiceImpl implements MaterialService {
} }
//1年2月3天,后面为数目 //1年2月3天,后面为数目
material.setShelfLife(Long.valueOf(shelfLife.substring(1))); material.setShelfLife(ObjectFormatUtil.toLong(shelfLife.substring(1)));
} }
return material; return material;
} }
@ -1052,7 +1052,7 @@ public class MaterialServiceImpl implements MaterialService {
} }
material.setRemark(materialRemark + map.get("remark").toString()); material.setRemark(materialRemark + map.get("remark").toString());
} }
double quantity = Double.parseDouble(map.get("quantity").toString()); double quantity = ObjectFormatUtil.toDouble(map.get("quantity").toString());
double quantity_residue = 0; double quantity_residue = 0;
int splitInfoScaleQuantity = 0; int splitInfoScaleQuantity = 0;
SplitInfo baseSplitInfoForMid = null; SplitInfo baseSplitInfoForMid = null;
@ -1330,7 +1330,7 @@ public class MaterialServiceImpl implements MaterialService {
*/ */
@Override @Override
public List<Object> AddInitTreeMenus(Map<String, Object> map) { public List<Object> AddInitTreeMenus(Map<String, Object> map) {
Long mtId = Long.valueOf(map.get("mtId").toString()); Long mtId = ObjectFormatUtil.toLong(map.get("mtId").toString());
List<Object> result = new ArrayList<>(); List<Object> result = new ArrayList<>();
MaterialType mt = materialTypeMapper.findMaterialTypeByOldId(mtId); MaterialType mt = materialTypeMapper.findMaterialTypeByOldId(mtId);
List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(mt.getOldId()); List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(mt.getOldId());
@ -1367,7 +1367,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < objectList.size(); i++) { for (int i = 0; i < objectList.size(); i++) {
String s = objectList.get(i); String s = objectList.get(i);
JSONObject jsonObject = JSONObject.parseObject(s); JSONObject jsonObject = JSONObject.parseObject(s);
Long id = Long.valueOf(jsonObject.getString("id")); Long id = ObjectFormatUtil.toLong(jsonObject.getString("id"));
if (Long.compare(parentMt.getOldId(), id) == 0) { if (Long.compare(parentMt.getOldId(), id) == 0) {
if (mtLevel == 1) { if (mtLevel == 1) {
@ -1409,7 +1409,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < objectList.size(); i++) { for (int i = 0; i < objectList.size(); i++) {
String s = objectList.get(i); String s = objectList.get(i);
JSONObject jsonObject = JSONObject.parseObject(s); JSONObject jsonObject = JSONObject.parseObject(s);
Long id = Long.valueOf(jsonObject.getString("id")); Long id = ObjectFormatUtil.toLong(jsonObject.getString("id"));
if (Long.compare(id, parent.getOldId()) == 0) { if (Long.compare(id, parent.getOldId()) == 0) {
jsonObject = setTreeChildrenSpreadIsTrue(jsonObject, mt, mtLevel - 1, map); jsonObject = setTreeChildrenSpreadIsTrue(jsonObject, mt, mtLevel - 1, map);
} }
@ -1438,7 +1438,7 @@ public class MaterialServiceImpl implements MaterialService {
JSONArray children = jsonObject.getJSONArray("children"); JSONArray children = jsonObject.getJSONArray("children");
for (int i = 0; i < children.size(); i++) { for (int i = 0; i < children.size(); i++) {
JSONObject object = children.getJSONObject(i); JSONObject object = children.getJSONObject(i);
Long id = Long.valueOf(object.getString("id")); Long id = ObjectFormatUtil.toLong(object.getString("id"));
if (Long.compare(id, parent.getOldId()) == 0) { if (Long.compare(id, parent.getOldId()) == 0) {
JSONObject object1 = setTreeChildrenSpreadIsTrue(object, mt, level - 1, map); JSONObject object1 = setTreeChildrenSpreadIsTrue(object, mt, level - 1, map);
children.set(i, object1); children.set(i, object1);
@ -1544,7 +1544,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < objectList.size(); i++) { for (int i = 0; i < objectList.size(); i++) {
String s = objectList.get(i); String s = objectList.get(i);
JSONObject jsonObject = JSONObject.parseObject(s); JSONObject jsonObject = JSONObject.parseObject(s);
Long id = Long.valueOf(jsonObject.getString("id")); Long id = ObjectFormatUtil.toLong(jsonObject.getString("id"));
if (Long.compare(id, parentMt.getOldId()) == 0) { if (Long.compare(id, parentMt.getOldId()) == 0) {
// 如果是打开的顶级 // 如果是打开的顶级
JSONArray children = closeTree(jsonObject.getJSONArray("children"), mtLevel - 1, mt); JSONArray children = closeTree(jsonObject.getJSONArray("children"), mtLevel - 1, mt);
@ -1875,7 +1875,7 @@ public class MaterialServiceImpl implements MaterialService {
// 如果到当前等级 // 如果到当前等级
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i); JSONObject object = jsonArray.getJSONObject(i);
Long oId = Long.valueOf(object.getString("id")); Long oId = ObjectFormatUtil.toLong(object.getString("id"));
if (Long.compare(oId, mt.getOldId()) == 0) { if (Long.compare(oId, mt.getOldId()) == 0) {
// 如果是当前关闭类别 // 如果是当前关闭类别
object.remove("spread"); object.remove("spread");
@ -1888,7 +1888,7 @@ public class MaterialServiceImpl implements MaterialService {
} }
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i); JSONObject object = jsonArray.getJSONObject(i);
Long oId = Long.valueOf(object.getString("id")); Long oId = ObjectFormatUtil.toLong(object.getString("id"));
if (Long.compare(oId, parent.getOldId()) == 0) { if (Long.compare(oId, parent.getOldId()) == 0) {
// 如果是当前要关闭的父类 // 如果是当前要关闭的父类
JSONArray children = object.getJSONArray("children"); JSONArray children = object.getJSONArray("children");
@ -1926,11 +1926,11 @@ public class MaterialServiceImpl implements MaterialService {
// 获取当前树形菜单数据 // 获取当前树形菜单数据
JSONObject jsonObject = (JSONObject) childrenList.get(i); JSONObject jsonObject = (JSONObject) childrenList.get(i);
// 获取当前菜单id // 获取当前菜单id
Long id = Long.valueOf(jsonObject.getString("id")); Long id = ObjectFormatUtil.toLong(jsonObject.getString("id"));
// 如果当前类型id与菜单id一致 // 如果当前类型id与菜单id一致
if (Long.compare(somId, id) == 0) { if (Long.compare(somId, id) == 0) {
Long childrenId = Long.valueOf(stringObjectMap.get("id").toString()); Long childrenId = ObjectFormatUtil.toLong(stringObjectMap.get("id").toString());
if (Long.compare(childrenId, id) == 0) { if (Long.compare(childrenId, id) == 0) {
list.add(stringObjectMap); list.add(stringObjectMap);
} else { } else {
@ -1961,14 +1961,14 @@ public class MaterialServiceImpl implements MaterialService {
*/ */
public List<Object> updateTreeChildren(List<Object> childrenList, Map<String, Object> map, Integer level, Integer nowLevel) { public List<Object> updateTreeChildren(List<Object> childrenList, Map<String, Object> map, Integer level, Integer nowLevel) {
// 获取数据中的id // 获取数据中的id
Long somId = Long.valueOf(map.get("id").toString()); Long somId = ObjectFormatUtil.toLong(map.get("id").toString());
List<Object> children = new ArrayList<>(); List<Object> children = new ArrayList<>();
if (level - nowLevel == 0) { if (level - nowLevel == 0) {
// 如果不需要递归 // 如果不需要递归
for (int i = 0; i < childrenList.size(); i++) { for (int i = 0; i < childrenList.size(); i++) {
JSONObject o = (JSONObject) childrenList.get(i); JSONObject o = (JSONObject) childrenList.get(i);
// 获取当前子列表中的数据id // 获取当前子列表中的数据id
Long id = Long.valueOf(o.getString("id")); Long id = ObjectFormatUtil.toLong(o.getString("id"));
if (Long.compare(somId, id) == 0) { if (Long.compare(somId, id) == 0) {
// 如果当前数据需要进行修改 // 如果当前数据需要进行修改
children.add(map); children.add(map);
@ -1987,7 +1987,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < childrenList.size(); i++) { for (int i = 0; i < childrenList.size(); i++) {
JSONObject o = (JSONObject) childrenList.get(i); JSONObject o = (JSONObject) childrenList.get(i);
// 获取当前子列表中的数据id // 获取当前子列表中的数据id
Long id = Long.valueOf(o.getString("id")); Long id = ObjectFormatUtil.toLong(o.getString("id"));
if (Long.compare(id, parent.getOldId()) == 0) { if (Long.compare(id, parent.getOldId()) == 0) {
List<Object> objectList = updateTreeChildren(o.getJSONArray("children"), map, level, nowLevel + 1); List<Object> objectList = updateTreeChildren(o.getJSONArray("children"), map, level, nowLevel + 1);
o.put("children", objectList); o.put("children", objectList);

4
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialTypeServiceImpl.java

@ -44,12 +44,12 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
} }
Object oldId = map.get("oldId"); Object oldId = map.get("oldId");
if (oldId == null) { if (oldId == null) {
Long parentId = Long.valueOf(map.get("parentId").toString()); Long parentId = ObjectFormatUtil.toLong(map.get("parentId").toString());
MaterialType materialTypeById = materialTypeMapper.findMaterialTypeByOldId(parentId); MaterialType materialTypeById = materialTypeMapper.findMaterialTypeByOldId(parentId);
Integer size = 0; Integer size = 0;
String firstName = ""; String firstName = "";
if (materialTypeById == null) { if (materialTypeById == null) {
List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(Long.valueOf("0")); List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(ObjectFormatUtil.toLong("0"));
size = materialTypeByParent.size(); size = materialTypeByParent.size();
} else { } else {
List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(materialTypeById.getOldId()); List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(materialTypeById.getOldId());

22
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -130,7 +130,7 @@ public class QyWxOperationService {
TemplateCard_main_title main_title = new TemplateCard_main_title(); TemplateCard_main_title main_title = new TemplateCard_main_title();
// main_title.setTitle(applicant+"的出库申请"); // main_title.setTitle(applicant+"的出库申请");
main_title.setTitle(applicant.getName() + "的出库申请"); main_title.setTitle(applicant.getName() + "的出库申请");
main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationOutRecordPById.getApplicantTime())));
// 设置一级标题 // 设置一级标题
templateCard_button_interaction.setMain_title(main_title); templateCard_button_interaction.setMain_title(main_title);
@ -348,7 +348,7 @@ public class QyWxOperationService {
TemplateCard_main_title main_title = new TemplateCard_main_title(); TemplateCard_main_title main_title = new TemplateCard_main_title();
// main_title.setTitle(applicant+"的出库申请"); // main_title.setTitle(applicant+"的出库申请");
main_title.setTitle(originator.getName() + "的仓库盘点"); main_title.setTitle(originator.getName() + "的仓库盘点");
main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getCreateTime()))); main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(mainRecord.getCreateTime())));
// 设置一级标题 // 设置一级标题
templateCard_button_interaction.setMain_title(main_title); templateCard_button_interaction.setMain_title(main_title);
@ -585,7 +585,7 @@ public class QyWxOperationService {
TemplateCard_main_title main_title = new TemplateCard_main_title(); TemplateCard_main_title main_title = new TemplateCard_main_title();
// main_title.setTitle(applicant+"的出库申请"); // main_title.setTitle(applicant+"的出库申请");
main_title.setTitle("盘点记录处理"); main_title.setTitle("盘点记录处理");
main_title.setDesc("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getCreateTime()))); main_title.setDesc("发起时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(mainRecord.getCreateTime())));
// 设置一级标题 // 设置一级标题
templateCard_button_interaction.setMain_title(main_title); templateCard_button_interaction.setMain_title(main_title);
@ -752,7 +752,7 @@ public class QyWxOperationService {
// 设置content // 设置content
Map<String, String> markdown = new HashMap<>(); Map<String, String> markdown = new HashMap<>();
StringBuilder content = new StringBuilder("## `抄送信息:`%n"); StringBuilder content = new StringBuilder("## `抄送信息:`%n");
content.append(">### **" + applicant.getName() + "的出库申请** %n<font color='warning'>申请时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())) + "</font> %n"); content.append(">### **" + applicant.getName() + "的出库申请** %n<font color='warning'>申请时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getApplicantTime())) + "</font> %n");
content.append("%n---%n"); content.append("%n---%n");
for (ApplicationOutRecordMin recordMin : applicationOutRecordMinByParent) { for (ApplicationOutRecordMin recordMin : applicationOutRecordMinByParent) {
// 获取子订单信息 // 获取子订单信息
@ -1166,7 +1166,7 @@ public class QyWxOperationService {
// 设置主标题 // 设置主标题
TemplateCard_main_title main_title = new TemplateCard_main_title(); TemplateCard_main_title main_title = new TemplateCard_main_title();
main_title.setTitle(applicant.getName() + "的出库请求"); main_title.setTitle(applicant.getName() + "的出库请求");
main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(outRecordP.getApplicantTime()))); main_title.setDesc("申请时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(outRecordP.getApplicantTime())));
text_notice.setMain_title(main_title); text_notice.setMain_title(main_title);
// 卡片右上角更多操作按钮 // 卡片右上角更多操作按钮
@ -1749,7 +1749,7 @@ public class QyWxOperationService {
summary_info_name.setText("发起人:" + userToken.getName()); summary_info_name.setText("发起人:" + userToken.getName());
summary_info_name.setLang("zh_CN"); summary_info_name.setLang("zh_CN");
Approval_template_summary_info summary_info_time = new Approval_template_summary_info(); Approval_template_summary_info summary_info_time = new Approval_template_summary_info();
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getApplicantTime()))); summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(mainRecord.getApplicantTime())));
summary_info_time.setLang("zh_CN"); summary_info_time.setLang("zh_CN");
Approval_template_summary_info summary_info_department = new Approval_template_summary_info(); Approval_template_summary_info summary_info_department = new Approval_template_summary_info();
summary_info_department.setText("所在部门:" + portName); summary_info_department.setText("所在部门:" + portName);
@ -2394,7 +2394,7 @@ public class QyWxOperationService {
summary_info_name.setText("发起人:" + userToken.getName()); summary_info_name.setText("发起人:" + userToken.getName());
summary_info_name.setLang("zh_CN"); summary_info_name.setLang("zh_CN");
Approval_template_summary_info summary_info_time = new Approval_template_summary_info(); Approval_template_summary_info summary_info_time = new Approval_template_summary_info();
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getApplicantTime()))); summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(mainRecord.getApplicantTime())));
summary_info_time.setLang("zh_CN"); summary_info_time.setLang("zh_CN");
Approval_template_summary_info summary_info_department = new Approval_template_summary_info(); Approval_template_summary_info summary_info_department = new Approval_template_summary_info();
summary_info_department.setText("所在部门:" + portName); summary_info_department.setText("所在部门:" + portName);
@ -2672,7 +2672,7 @@ public class QyWxOperationService {
Map<String, Object> members_time = new HashMap<>(); Map<String, Object> members_time = new HashMap<>();
Map<String, String> contact_time = new HashMap<>(); Map<String, String> contact_time = new HashMap<>();
contact_time.put("type", "hour"); contact_time.put("type", "hour");
contact_time.put("s_timestamp", String.valueOf(Long.parseLong(minRecordList.get(0).getApplicantTime()) / 1000)); contact_time.put("s_timestamp", String.valueOf(ObjectFormatUtil.toLong(minRecordList.get(0).getApplicantTime()) / 1000));
members_time.put("date", contact_time); members_time.put("date", contact_time);
approval_template_apply_data_contents_time.setValue(members_time); approval_template_apply_data_contents_time.setValue(members_time);
@ -2856,7 +2856,7 @@ public class QyWxOperationService {
summary_info_name.setText("发起人:" + userByPort.getName()); summary_info_name.setText("发起人:" + userByPort.getName());
summary_info_name.setLang("zh_CN"); summary_info_name.setLang("zh_CN");
Approval_template_summary_info summary_info_time = new Approval_template_summary_info(); Approval_template_summary_info summary_info_time = new Approval_template_summary_info();
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(minRecordList.get(0).getApplicantTime()))); summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(minRecordList.get(0).getApplicantTime())));
summary_info_time.setLang("zh_CN"); summary_info_time.setLang("zh_CN");
Approval_template_summary_info summary_info_department = new Approval_template_summary_info(); Approval_template_summary_info summary_info_department = new Approval_template_summary_info();
summary_info_department.setText("所在部门:" + portName); summary_info_department.setText("所在部门:" + portName);
@ -3313,7 +3313,7 @@ public class QyWxOperationService {
summary_info_name.setText("发起人:" + userToken.getName()); summary_info_name.setText("发起人:" + userToken.getName());
summary_info_name.setLang("zh_CN"); summary_info_name.setLang("zh_CN");
Approval_template_summary_info summary_info_time = new Approval_template_summary_info(); Approval_template_summary_info summary_info_time = new Approval_template_summary_info();
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getCreateTime()))); summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(mainRecord.getCreateTime())));
summary_info_time.setLang("zh_CN"); summary_info_time.setLang("zh_CN");
Approval_template_summary_info summary_info_department = new Approval_template_summary_info(); Approval_template_summary_info summary_info_department = new Approval_template_summary_info();
summary_info_department.setText("所在部门:" + portName); summary_info_department.setText("所在部门:" + portName);
@ -3464,7 +3464,7 @@ public class QyWxOperationService {
// 获取发起人信息 // 获取发起人信息
if (aorp != null) { if (aorp != null) {
applicantId = aorp.getApplicantId(); applicantId = aorp.getApplicantId();
applicantTime = Long.valueOf(aorp.getApplicantTime()); applicantTime = ObjectFormatUtil.toLong(aorp.getApplicantTime());
tempMessageTitle = "出库审批"; tempMessageTitle = "出库审批";
} else if (stockTaking != null) { } else if (stockTaking != null) {
applicantId = stockTaking.getOriginator(); applicantId = stockTaking.getOriginator();

6
src/main/java/com/dreamchaser/depository_manage/utils/DateUtil.java

@ -14,8 +14,8 @@ import java.util.*;
public class DateUtil { public class DateUtil {
private static final SimpleDateFormat TIME_FORMAT =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat TIME_FORMAT =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final SimpleDateFormat DATE_FORMAT =new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat DATE_FORMAT =new SimpleDateFormat("yyyy-MM-dd");
public static final Long dayTime = Long.valueOf(86400000); // 一天的时长 public static final Long dayTime = ObjectFormatUtil.toLong(86400000); // 一天的时长
public static final Long warningTime = Long.valueOf(86400000 * 7); // 预定报警时间:7天 public static final Long warningTime = ObjectFormatUtil.toLong(86400000 * 7); // 预定报警时间:7天
/** /**
* 获取时间的字符串精确到s * 获取时间的字符串精确到s
* @param date 时间 * @param date 时间
@ -225,7 +225,7 @@ public class DateUtil {
cale.add(Calendar.MONTH, 1); cale.add(Calendar.MONTH, 1);
cale.set(Calendar.DAY_OF_MONTH, 0); cale.set(Calendar.DAY_OF_MONTH, 0);
Date lastDay = cale.getTime(); Date lastDay = cale.getTime();
return Long.parseLong(time) >= firstDay.getTime() && Long.parseLong(time) <= lastDay.getTime(); return ObjectFormatUtil.toLong(time) >= firstDay.getTime() && ObjectFormatUtil.toLong(time) <= lastDay.getTime();
} }
/** /**

2
src/test/java/com/dreamchaser/depository_manage/BarChartTest.java

@ -234,7 +234,7 @@ public class BarChartTest {
for (i = days.size() - 1; i > 0; i--) { for (i = days.size() - 1; i > 0; i--) {
// 遍历 Map并计算各仓库的入库数 // 遍历 Map并计算各仓库的入库数
// 获取一段时间内的库存额度 // 获取一段时间内的库存额度
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val); Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), ObjectFormatUtil.toInteger(type), val);
if("2".equals(type)){ if("2".equals(type)){
depositoryRecordByDate1 = -depositoryRecordByDate1; depositoryRecordByDate1 = -depositoryRecordByDate1;
} }

2
src/test/java/com/dreamchaser/depository_manage/LineChartTest.java

@ -164,7 +164,7 @@ public class LineChartTest {
for (i = days.size() - 1; i > 0; i--) { for (i = days.size() - 1; i > 0; i--) {
// 遍历 Map并计算各仓库的入库数 // 遍历 Map并计算各仓库的入库数
// 获取一段时间内的库存额度 // 获取一段时间内的库存额度
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val); Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), ObjectFormatUtil.toInteger(type), val);
drCountbyDrName.add(depositoryRecordByDate1); drCountbyDrName.add(depositoryRecordByDate1);
} }
map.put("data", drCountbyDrName); map.put("data", drCountbyDrName);

6
src/test/java/com/dreamchaser/depository_manage/SomeTest.java

@ -125,10 +125,10 @@ public class SomeTest {
// 如果已经获取到审批节点 // 如果已经获取到审批节点
// 获取当前审批节点处理时间 // 获取当前审批节点处理时间
long aLong = Long.parseLong(spTime); long aLong = ObjectFormatUtil.toLong(spTime);
// 获取之前节点的审批时间 // 获取之前节点的审批时间
long aLong1 = Long.parseLong(as_SpTime); long aLong1 = ObjectFormatUtil.toLong(as_SpTime);
if (aLong >= aLong1) { if (aLong >= aLong1) {
// 如果当前审批节点是最近处理 // 如果当前审批节点是最近处理
@ -164,7 +164,7 @@ public class SomeTest {
boolean flagForLabel = true; // 默认为标签 boolean flagForLabel = true; // 默认为标签
// 获取当前的主订单 // 获取当前的主订单
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(Integer.parseInt(mainId)); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(mainId));
if (Integer.compare(applicationOutRecordPById.getFlagForOpenDepository(), 2) == 0) { if (Integer.compare(applicationOutRecordPById.getFlagForOpenDepository(), 2) == 0) {
// 如果是申请的开放仓库 // 如果是申请的开放仓库

6
src/test/java/com/dreamchaser/depository_manage/SunburstChartTest.java

@ -150,10 +150,10 @@ public class SunburstChartTest {
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("type", Integer.parseInt(type)); map.put("type", ObjectFormatUtil.toInteger(type));
if (Integer.parseInt(type) == 1) { if (ObjectFormatUtil.toInteger(type) == 1) {
map.put("state", "已入库"); map.put("state", "已入库");
} else if (Integer.parseInt(type) == 2) { } else if (ObjectFormatUtil.toInteger(type) == 2) {
map.put("state", "已出库"); map.put("state", "已出库");
} }
map.put("start", start); map.put("start", start);

Loading…
Cancel
Save