|
|
|
@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.dreamchaser.depository_manage.config.PublicConfig; |
|
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
|
import com.dreamchaser.depository_manage.entity.Depository; |
|
|
|
import com.dreamchaser.depository_manage.entity.MaterialType; |
|
|
|
import com.dreamchaser.depository_manage.entity.UserByPort; |
|
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|
|
|
@ -98,21 +99,38 @@ public class OtherTest { |
|
|
|
return JSONObject.parseObject(JSONObject.toJSONString(map), UserByPort.class); |
|
|
|
} |
|
|
|
|
|
|
|
Depository findParentDepository(Depository depository, List<Depository> depositoryList) { |
|
|
|
for (Depository d : depositoryList |
|
|
|
) { |
|
|
|
if (Integer.compare(depository.getParentId(), d.getId()) == 0) { |
|
|
|
if (Integer.compare(0, d.getParentId()) == 0) { |
|
|
|
return d; |
|
|
|
} else { |
|
|
|
return findParentDepository(d, depositoryList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void someTest(){ |
|
|
|
List<MaterialType> materialTypeByNames = materialTypeService.findMaterialTypeByName("安全阀"); |
|
|
|
|
|
|
|
Long oldId = null; |
|
|
|
List<Long> parentOldIdList = new ArrayList<>(); |
|
|
|
List<Long> OldIdList = new ArrayList<>(); |
|
|
|
for (MaterialType materialType : materialTypeByNames) { |
|
|
|
parentOldIdList.add(materialType.getParentId()); |
|
|
|
OldIdList.add(materialType.getOldId()); |
|
|
|
} |
|
|
|
System.out.println(parentOldIdList); |
|
|
|
System.out.println(OldIdList); |
|
|
|
System.out.println(CollectionUtils.subtract(OldIdList,parentOldIdList)); |
|
|
|
boolean flag = true; |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(28); |
|
|
|
Depository depositoryTop = depositoryById; |
|
|
|
if (Integer.compare(depositoryById.getParentId(), 0) != 0) { |
|
|
|
// 如果不是
|
|
|
|
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll(); |
|
|
|
depositoryTop = findParentDepository(depositoryById, depositoryAll); |
|
|
|
} |
|
|
|
|
|
|
|
if (!depositoryTop.getDname().contains("前置仓")) { |
|
|
|
// 如果不是前置仓下的仓库
|
|
|
|
flag = false; |
|
|
|
} |
|
|
|
System.out.println(flag); |
|
|
|
System.out.println(depositoryById); |
|
|
|
System.out.println(depositoryTop); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|