@ -10,8 +10,14 @@ import com.win.framework.common.pojo.PageResult;
import com.win.framework.datapermission.core.util.DataPermissionUtils ;
import com.win.framework.datapermission.core.util.DataPermissionUtils ;
import com.win.module.wms.controller.rule.vo.* ;
import com.win.module.wms.controller.rule.vo.* ;
import com.win.module.wms.convert.rule.RuleConvert ;
import com.win.module.wms.convert.rule.RuleConvert ;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO ;
import com.win.module.wms.dal.dataobject.location.LocationDO ;
import com.win.module.wms.dal.dataobject.rule.RuleDO ;
import com.win.module.wms.dal.dataobject.rule.RuleDO ;
import com.win.module.wms.dal.dataobject.supplier.SupplierDO ;
import com.win.module.wms.dal.mysql.itembasic.ItembasicMapper ;
import com.win.module.wms.dal.mysql.location.LocationMapper ;
import com.win.module.wms.dal.mysql.rule.RuleMapper ;
import com.win.module.wms.dal.mysql.rule.RuleMapper ;
import com.win.module.wms.dal.mysql.supplier.SupplierMapper ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.validation.annotation.Validated ;
import org.springframework.validation.annotation.Validated ;
@ -33,10 +39,16 @@ public class RuleServiceImpl implements RuleService {
@Resource
@Resource
private RuleMapper ruleMapper ;
private RuleMapper ruleMapper ;
@Resource
private ItembasicMapper itembasicMapper ;
@Resource
private SupplierMapper supplierMapper ;
@Resource
private LocationMapper locationMapper ;
@Override
@Override
public Long createRule ( RuleCreateReqVO createReqVO ) {
public Long createRule ( RuleCreateReqVO createReqVO ) {
validateRuleForCreateOrUpdate ( createReqVO . getId ( ) , createReqVO . getStrategyCode ( ) , createReqVO . getPriority ( ) ) ;
validateRuleForCreateOrUpdate ( createReqVO . getId ( ) , createReqVO . getStrategyCode ( ) , createReqVO . getPriority ( ) ) ;
// 插入
// 插入
RuleDO rule = RuleConvert . INSTANCE . convert ( createReqVO ) ;
RuleDO rule = RuleConvert . INSTANCE . convert ( createReqVO ) ;
validateRule ( rule ) ;
validateRule ( rule ) ;
@ -46,24 +58,24 @@ public class RuleServiceImpl implements RuleService {
}
}
public void validateRule ( RuleDO rule ) {
public void validateRule ( RuleDO rule ) {
RuleDO RuleDO = existRuleDO ( rule ) ;
RuleDO RuleDO = existRuleDO ( rule ) ;
if ( RuleDO ! = null ) {
if ( RuleDO ! = null ) {
throw exception ( RULE_PRIORITY_EXISTS ) ;
throw exception ( RULE_PRIORITY_EXISTS ) ;
}
}
}
}
public RuleDO existRuleDO ( RuleDO rule ) {
public RuleDO existRuleDO ( RuleDO rule ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , rule . getStrategyCode ( ) ) ;
queryWrapper . eq ( "strategy_code" , rule . getStrategyCode ( ) ) ;
queryWrapper . eq ( "priority" , rule . getPriority ( ) ) ;
queryWrapper . eq ( "priority" , rule . getPriority ( ) ) ;
return ruleMapper . selectOne ( queryWrapper ) ;
return ruleMapper . selectOne ( queryWrapper ) ;
}
}
@Override
@Override
public void updateRule ( RuleUpdateReqVO updateReqVO ) {
public void updateRule ( RuleUpdateReqVO updateReqVO ) {
// 校验存在
// 校验存在
validateRuleForCreateOrUpdate ( updateReqVO . getId ( ) , updateReqVO . getStrategyCode ( ) , updateReqVO . getPriority ( ) ) ;
validateRuleForCreateOrUpdate ( updateReqVO . getId ( ) , updateReqVO . getStrategyCode ( ) , updateReqVO . getPriority ( ) ) ;
// 更新
// 更新
RuleDO updateObj = RuleConvert . INSTANCE . convert ( updateReqVO ) ;
RuleDO updateObj = RuleConvert . INSTANCE . convert ( updateReqVO ) ;
ruleMapper . updateById ( updateObj ) ;
ruleMapper . updateById ( updateObj ) ;
@ -76,6 +88,7 @@ public class RuleServiceImpl implements RuleService {
// 删除
// 删除
ruleMapper . deleteById ( id ) ;
ruleMapper . deleteById ( id ) ;
}
}
@Override
@Override
public PageResult < RuleDO > getRuleSenior ( CustomConditions conditions ) {
public PageResult < RuleDO > getRuleSenior ( CustomConditions conditions ) {
return ruleMapper . selectSenior ( conditions ) ;
return ruleMapper . selectSenior ( conditions ) ;
@ -96,11 +109,13 @@ public class RuleServiceImpl implements RuleService {
public PageResult < RuleDO > getRulePage ( RulePageReqVO pageReqVO ) {
public PageResult < RuleDO > getRulePage ( RulePageReqVO pageReqVO ) {
return ruleMapper . selectPage ( pageReqVO ) ;
return ruleMapper . selectPage ( pageReqVO ) ;
}
}
@Override
@Override
public List < RuleDO > getRuleList ( CustomConditions conditions ) {
public List < RuleDO > getRuleList ( CustomConditions conditions ) {
return ruleMapper . selectSeniorList ( conditions ) ;
return ruleMapper . selectSeniorList ( conditions ) ;
}
}
private void validateRuleForCreateOrUpdate ( Long id , String strategyCode , Integer priority ) {
private void validateRuleForCreateOrUpdate ( Long id , String strategyCode , Integer priority ) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils . executeIgnore ( ( ) - > {
DataPermissionUtils . executeIgnore ( ( ) - > {
validateRuleExists ( id ) ;
validateRuleExists ( id ) ;
@ -109,6 +124,7 @@ public class RuleServiceImpl implements RuleService {
validatePriority ( priority ) ;
validatePriority ( priority ) ;
} ) ;
} ) ;
}
}
@VisibleForTesting
@VisibleForTesting
private void validateRuleExists ( Long id ) {
private void validateRuleExists ( Long id ) {
if ( id = = null ) {
if ( id = = null ) {
@ -125,6 +141,7 @@ public class RuleServiceImpl implements RuleService {
throw exception ( RULE_STRATEGYCODE_NOT_EXISTS ) ;
throw exception ( RULE_STRATEGYCODE_NOT_EXISTS ) ;
}
}
}
}
@VisibleForTesting
@VisibleForTesting
private void validatePriority ( Integer priority ) {
private void validatePriority ( Integer priority ) {
if ( priority = = null ) {
if ( priority = = null ) {
@ -133,29 +150,26 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO deliverGoods ( String supplierType , String supplier Code , String weekday ) {
public RuleRespVO deliverGoods ( String supplierCode , String weekday ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S001" ) ;
queryWrapper . eq ( "strategy_code" , "S001" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
//condition为空是默认规则,直接返回
//condition为空是默认规则,直接返回
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierType ! = null & & ! supplierType . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierType" , supplierType ) ;
}
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
}
if ( weekday ! = null & & ! weekday . isEmpty ( ) ) {
if ( weekday ! = null & & ! weekday . isEmpty ( ) ) {
params . put ( "Weekday" , weekday ) ;
params . put ( "Weekday" , weekday ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -163,26 +177,23 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO deliveryGoods ( String supplierType , String supplier Code ) {
public RuleRespVO deliveryGoods ( String supplierCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S002" ) ;
queryWrapper . eq ( "strategy_code" , "S002" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
//condition为空是默认规则,直接返回
//condition为空是默认规则,直接返回
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierType ! = null & & ! supplierType . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierType" , supplierType ) ;
}
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -195,18 +206,18 @@ public class RuleServiceImpl implements RuleService {
queryWrapper . eq ( "strategy_code" , "S003" ) ;
queryWrapper . eq ( "strategy_code" , "S003" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -214,25 +225,22 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO inspectSplit ( String supplierType , String item Code ) {
public RuleRespVO inspectSplit ( String supplierCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S004" ) ;
queryWrapper . eq ( "strategy_code" , "S004" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierType ! = null & & ! supplierType . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierType" , supplierType ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -240,58 +248,46 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO grounding ( String supplierCode , String customerCode , String abcClass , String itemType , String itemGroup , String project , String itemCode , String inventoryStatus , String storageType , String transactionType , String weight , String area , String volume ) {
public RuleRespVO grounding ( String supplierCode , String customerCode , String itemCode , String inventoryStatus , String storageType , String transactionType , String weight , String area , String volume ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S005" ) ;
queryWrapper . eq ( "strategy_code" , "S005" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierType" , supplierCode ) ;
params . put ( "SupplierType" , supplierCode ) ;
}
}
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
params . put ( "CustomerCode" , customerCode ) ;
params . put ( "CustomerCode" , customerCode ) ;
}
}
if ( abcClass ! = null & & ! abcClass . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "AbcClass" , abcClass ) ;
}
if ( itemType ! = null & & ! itemType . isEmpty ( ) ) {
params . put ( "ItemType" , itemType ) ;
}
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( project ! = null & & ! project . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( inventoryStatus ! = null & & ! inventoryStatus . isEmpty ( ) ) {
if ( inventoryStatus ! = null & & ! inventoryStatus . isEmpty ( ) ) {
params . put ( "InventoryStatus" , inventoryStatus ) ;
params . put ( "InventoryStatus" , inventoryStatus ) ;
}
}
if ( storageType ! = null & & ! storageType . isEmpty ( ) ) {
if ( storageType ! = null & & ! storageType . isEmpty ( ) ) {
params . put ( "StorageType" , storageType ) ;
params . put ( "StorageType" , storageType ) ;
}
}
if ( transactionType ! = null & & ! transactionType . isEmpty ( ) ) {
if ( transactionType ! = null & & ! transactionType . isEmpty ( ) ) {
params . put ( "TransactionType" , transactionType ) ;
params . put ( "TransactionType" , transactionType ) ;
}
}
if ( weight ! = null & & ! weight . isEmpty ( ) ) {
if ( weight ! = null & & ! weight . isEmpty ( ) ) {
params . put ( "Weight" , weight ) ;
params . put ( "Weight" , weight ) ;
}
}
if ( area ! = null & & ! area . isEmpty ( ) ) {
if ( area ! = null & & ! area . isEmpty ( ) ) {
params . put ( "Area" , area ) ;
params . put ( "Area" , area ) ;
}
}
if ( volume ! = null & & ! volume . isEmpty ( ) ) {
if ( volume ! = null & & ! volume . isEmpty ( ) ) {
params . put ( "Volume" , volume ) ;
params . put ( "Volume" , volume ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -299,40 +295,25 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO storageCapacity ( String itemGroup , String project , String itemCode , String warehouseCode , String areaCode , String locationGroup Code , String locationCode ) {
public RuleRespVO storageCapacity ( String itemCode , String locationCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S006" ) ;
queryWrapper . eq ( "strategy_code" , "S006" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( project ! = null & & ! project . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( warehouseCode ! = null & & ! warehouseCode . isEmpty ( ) ) {
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "WarehouseCode" , warehouseCode ) ;
}
if ( areaCode ! = null & & ! areaCode . isEmpty ( ) ) {
params . put ( "AreaCode" , areaCode ) ;
}
if ( locationGroupCode ! = null & & ! locationGroupCode . isEmpty ( ) ) {
params . put ( "LocationGroupCode" , locationGroupCode ) ;
}
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "LocationCode" , locationCode ) ;
params . put ( "LocationCode" , locationCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -340,49 +321,37 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO offShelf ( String supplierCode , String customerCode , String abcClass , String itemType , String itemGroup , String project , String itemCode , String inventoryStatus , String storageType , String transactionType ) {
public RuleRespVO offShelf ( String supplierCode , String customerCode , String itemCode , String inventoryStatus , String storageType , String transactionType ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S007" ) ;
queryWrapper . eq ( "strategy_code" , "S007" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
}
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
params . put ( "CustomerCode" , customerCode ) ;
params . put ( "CustomerCode" , customerCode ) ;
}
}
if ( abcClass ! = null & & ! abcClass . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "AbcClass" , abcClass ) ;
}
if ( itemType ! = null & & ! itemType . isEmpty ( ) ) {
params . put ( "ItemType" , itemType ) ;
}
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( project ! = null & & ! project . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( inventoryStatus ! = null & & ! inventoryStatus . isEmpty ( ) ) {
if ( inventoryStatus ! = null & & ! inventoryStatus . isEmpty ( ) ) {
params . put ( "InventoryStatus" , inventoryStatus ) ;
params . put ( "InventoryStatus" , inventoryStatus ) ;
}
}
if ( storageType ! = null & & ! storageType . isEmpty ( ) ) {
if ( storageType ! = null & & ! storageType . isEmpty ( ) ) {
params . put ( "StorageType" , storageType ) ;
params . put ( "StorageType" , storageType ) ;
}
}
if ( transactionType ! = null & & ! transactionType . isEmpty ( ) ) {
if ( transactionType ! = null & & ! transactionType . isEmpty ( ) ) {
params . put ( "TransactionType" , transactionType ) ;
params . put ( "TransactionType" , transactionType ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -390,37 +359,25 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO replenishment ( String itemGroup , String project , String itemCode , String warehouseCode , String areaCode , String locationGroup Code , String locationCode ) {
public RuleRespVO replenishment ( String itemCode , String locationCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S008" ) ;
queryWrapper . eq ( "strategy_code" , "S008" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( project ! = null & & ! project . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( warehouseCode ! = null & & ! warehouseCode . isEmpty ( ) ) {
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "WarehouseCode" , warehouseCode ) ;
}
if ( areaCode ! = null & & ! areaCode . isEmpty ( ) ) {
params . put ( "AreaCode" , areaCode ) ;
}
if ( locationGroupCode ! = null & & ! locationGroupCode . isEmpty ( ) ) {
params . put ( "LocationGroupCode" , locationGroupCode ) ;
}
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "LocationCode" , locationCode ) ;
params . put ( "LocationCode" , locationCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -428,58 +385,37 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO management ( String supplierCode , String customerCode , String abcClass , String itemType , String itemGroup , String project , String itemCode , String warehouseCode , String areaCode , String locationGroup Code , String locationCode , String ignoreListOfItem , String ignoreListOfLocation ) {
public RuleRespVO management ( String supplierCode , String customerCode , String itemCode , String locationCode , String ignoreListOfItem , String ignoreListOfLocation ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S009" ) ;
queryWrapper . eq ( "strategy_code" , "S009" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
}
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
params . put ( "CustomerCode" , customerCode ) ;
params . put ( "CustomerCode" , customerCode ) ;
}
}
if ( abcClass ! = null & & ! abcClass . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "AbcClass" , abcClass ) ;
}
if ( itemType ! = null & & ! itemType . isEmpty ( ) ) {
params . put ( "ItemType" , itemType ) ;
}
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( project ! = null & & ! project . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( warehouseCode ! = null & & ! warehouseCode . isEmpty ( ) ) {
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "WarehouseCode" , warehouseCode ) ;
}
if ( areaCode ! = null & & ! areaCode . isEmpty ( ) ) {
params . put ( "AreaCode" , areaCode ) ;
}
if ( locationGroupCode ! = null & & ! locationGroupCode . isEmpty ( ) ) {
params . put ( "LocationGroupCode" , locationGroupCode ) ;
}
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "LocationCode" , locationCode ) ;
params . put ( "LocationCode" , locationCode ) ;
}
}
if ( ignoreListOfItem ! = null & & ! ignoreListOfItem . isEmpty ( ) ) {
if ( ignoreListOfItem ! = null & & ! ignoreListOfItem . isEmpty ( ) ) {
params . put ( "IgnoreListOfItem" , ignoreListOfItem ) ;
params . put ( "IgnoreListOfItem" , ignoreListOfItem ) ;
}
}
if ( ignoreListOfLocation ! = null & & ! ignoreListOfLocation . isEmpty ( ) ) {
if ( ignoreListOfLocation ! = null & & ! ignoreListOfLocation . isEmpty ( ) ) {
params . put ( "IgnoreListOfLocation" , ignoreListOfLocation ) ;
params . put ( "IgnoreListOfLocation" , ignoreListOfLocation ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -487,40 +423,28 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO batch ( String supplierCode , String customerCode , String abcClass , String itemType , String itemGroup , String project , String itemCode ) {
public RuleRespVO batch ( String supplierCode , String customerCode , String itemCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S010" ) ;
queryWrapper . eq ( "strategy_code" , "S010" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
if ( supplierCode ! = null & & ! supplierCode . isEmpty ( ) ) {
params . put ( "SupplierCode" , supplierCode ) ;
params . put ( "SupplierCode" , supplierCode ) ;
}
}
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
if ( customerCode ! = null & & ! customerCode . isEmpty ( ) ) {
params . put ( "CustomerCode" , customerCode ) ;
params . put ( "CustomerCode" , customerCode ) ;
}
}
if ( abcClass ! = null & & ! abcClass . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "AbcClass" , abcClass ) ;
}
if ( itemType ! = null & & ! itemType . isEmpty ( ) ) {
params . put ( "ItemType" , itemType ) ;
}
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( project ! = null & & ! project . isEmpty ( ) ) {
params . put ( "Project" , project ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -529,31 +453,22 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO warehouseStorage ( String warehouseCode , String areaCode , String locationGroupCode , String locationCode ) {
public RuleRespVO warehouseStorage ( String locationCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S011" ) ;
queryWrapper . eq ( "strategy_code" , "S011" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
if ( warehouseCode ! = null & & ! warehouseCode . isEmpty ( ) ) {
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "WarehouseCode" , warehouseCode ) ;
}
if ( areaCode ! = null & & ! areaCode . isEmpty ( ) ) {
params . put ( "AreaCode" , areaCode ) ;
}
if ( locationGroupCode ! = null & & ! locationGroupCode . isEmpty ( ) ) {
params . put ( "LocationGroupCode" , locationGroupCode ) ;
}
if ( locationCode ! = null & & ! locationCode . isEmpty ( ) ) {
params . put ( "LocationCode" , locationCode ) ;
params . put ( "LocationCode" , locationCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -561,29 +476,23 @@ public class RuleServiceImpl implements RuleService {
}
}
@Override
@Override
public RuleRespVO applianceCapacity ( String containerType , String itemGroup , String projectCode , String item Code ) {
public RuleRespVO applianceCapacity ( String containerType , String itemCode ) {
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
QueryWrapper < RuleDO > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "strategy_code" , "S012" ) ;
queryWrapper . eq ( "strategy_code" , "S012" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
queryWrapper . orderByDesc ( "priority" ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
List < RuleDO > ruleDOList = ruleMapper . selectList ( queryWrapper ) ;
for ( RuleDO ruleDO : ruleDOList ) {
for ( RuleDO ruleDO : ruleDOList ) {
String condition = ruleDO . getCondition ( ) ;
String condition = ruleDO . getCondition ( ) ;
if ( condition = = null | | condition . isEmpty ( ) ) {
if ( condition = = null | | condition . isEmpty ( ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
JSONArray conditionArray = JSONUtil . parseArray ( condition ) ;
Map < String , String > params = new HashMap < > ( ) ;
Map < String , String > params = new HashMap < > ( ) ;
params . put ( "ContainerType" , containerType ) ;
params . put ( "ContainerType" , containerType ) ;
if ( itemGroup ! = null & & ! itemGroup . isEmpty ( ) ) {
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemGroup" , itemGroup ) ;
}
if ( projectCode ! = null & & ! projectCode . isEmpty ( ) ) {
params . put ( "ProjectCode" , projectCode ) ;
}
if ( itemCode ! = null & & ! itemCode . isEmpty ( ) ) {
params . put ( "ItemCode" , itemCode ) ;
params . put ( "ItemCode" , itemCode ) ;
}
}
if ( this . forEachParams ( params , conditionArray ) ) {
if ( this . forEachParams ( params , conditionArray ) ) {
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
return RuleConvert . INSTANCE . convert ( ruleDO ) ;
}
}
}
}
@ -592,14 +501,13 @@ public class RuleServiceImpl implements RuleService {
@Override
@Override
public List < HashMap < String , Object > > getPrecisionStrategyByItemCodes ( PrecisionStrategyReqVO reqVO ) {
public List < HashMap < String , Object > > getPrecisionStrategyByItemCodes ( PrecisionStrategyReqVO reqVO ) {
List < HashMap < String , Object > > list = new ArrayList < > ( ) ;
List < HashMap < String , Object > > list = new ArrayList < > ( ) ;
for ( String code : reqVO . getItemCodes ( ) ) {
for ( String code : reqVO . getItemCodes ( ) ) {
HashMap < String , Object > map = new HashMap < > ( ) ;
HashMap < String , Object > map = new HashMap < > ( ) ;
RuleRespVO RespVO = management ( null , null , null , null , null , null , code , null , null ,
RuleRespVO RespVO = management ( null , null , code , reqVO . getLocationCode ( ) , null , null ) ;
null , reqVO . getLocationCode ( ) , null , null ) ;
JSONObject entries = JSONUtil . parseObj ( RespVO . getConfiguration ( ) ) ;
JSONObject entries = JSONUtil . parseObj ( RespVO . getConfiguration ( ) ) ;
map . put ( "ManagementPrecision" , entries . get ( "ManagementPrecision" ) ) ;
map . put ( "ManagementPrecision" , entries . get ( "ManagementPrecision" ) ) ;
map . put ( "itemCode" , code ) ;
map . put ( "itemCode" , code ) ;
list . add ( map ) ;
list . add ( map ) ;
}
}
return list ;
return list ;
@ -607,18 +515,39 @@ public class RuleServiceImpl implements RuleService {
/ * *
/ * *
* 循环校验参数
* 循环校验参数
*
* @param params 参数
* @param params 参数
* @param conditionArray 条件json数组
* @param conditionArray 条件json数组
* @return
* @return
* /
* /
private boolean forEachParams ( Map < String , String > params , JSONArray conditionArray ) {
private boolean forEachParams ( Map < String , String > params , JSONArray conditionArray ) {
Map < String , String > paramsMap = new HashMap < > ( ) ;
boolean result1 = false ;
boolean result1 = false ;
for ( int i = 0 ; i < conditionArray . size ( ) ; i + + ) {
//填充参数
JSONObject conditionObject = conditionArray . getJSONObject ( i ) ;
for ( String key : params . keySet ( ) ) {
for ( String key : params . keySet ( ) ) {
if ( key . equals ( conditionObject . get ( "ParamCode" ) ) & & conditionObject . get ( "ParamCode" ) ! = null ) {
if ( "SupplierCode" . equals ( key ) ) {
SupplierDO supplierDO = supplierMapper . selectByCode ( params . get ( key ) ) ;
paramsMap . put ( "SupplierType" , supplierDO . getType ( ) ) ;
} else if ( "ItemCode" . equals ( key ) ) {
ItembasicDO itembasicDO = itembasicMapper . selectByCode ( params . get ( key ) ) ;
paramsMap . put ( "AbcClass" , itembasicDO . getAbcClass ( ) ) ;
paramsMap . put ( "ItemType" , itembasicDO . getType ( ) ) ;
paramsMap . put ( "ItemGroup" , itembasicDO . getItemGroup ( ) ) ;
paramsMap . put ( "Project" , itembasicDO . getProject ( ) ) ;
} else if ( "LocationCode" . equals ( key ) ) {
LocationDO locationDO = locationMapper . selectByCode ( params . get ( key ) ) ;
paramsMap . put ( "WarehouseCode" , locationDO . getWarehouseCode ( ) ) ;
paramsMap . put ( "AreaCode" , locationDO . getAreaCode ( ) ) ;
paramsMap . put ( "LocationGroupCode" , locationDO . getLocationGroupCode ( ) ) ;
}
paramsMap . put ( key , params . get ( key ) ) ;
}
for ( int i = 0 ; i < conditionArray . size ( ) ; i + + ) {
JSONObject conditionObject = conditionArray . getJSONObject ( i ) ;
for ( String key : paramsMap . keySet ( ) ) {
if ( key . equals ( conditionObject . get ( "ParamCode" ) ) & & conditionObject . get ( "ParamCode" ) ! = null ) {
boolean result2 = this . checkCondition ( conditionObject , key , params . get ( key ) ) ;
boolean result2 = this . checkCondition ( conditionObject , key , params . get ( key ) ) ;
if ( ! result2 ) {
if ( ! result2 ) {
result1 = false ;
result1 = false ;
break ;
break ;
} else {
} else {
@ -632,56 +561,57 @@ public class RuleServiceImpl implements RuleService {
/ * *
/ * *
* 判断条件
* 判断条件
*
* @param conditionObject 条件json
* @param conditionObject 条件json
* @param paramCode 条件key
* @param paramCode 条件key
* @param paramValue 条件value
* @param paramValue 条件value
* @return
* @return
* /
* /
private boolean checkCondition ( JSONObject conditionObject , String paramCode , String paramValue ) {
private boolean checkCondition ( JSONObject conditionObject , String paramCode , String paramValue ) {
if ( conditionObject . get ( "ParamCode" ) . equals ( paramCode ) ) {
if ( conditionObject . get ( "ParamCode" ) . equals ( paramCode ) ) {
String operator = conditionObject . get ( "Operator" ) . toString ( ) ;
String operator = conditionObject . get ( "Operator" ) . toString ( ) ;
String value = conditionObject . get ( "Value" ) . toString ( ) ;
String value = conditionObject . get ( "Value" ) . toString ( ) ;
if ( paramValue ! = null & & ! paramValue . isEmpty ( ) ) {
if ( paramValue ! = null & & ! paramValue . isEmpty ( ) ) {
if ( operator . equals ( "==" ) ) {
if ( operator . equals ( "==" ) ) {
if ( value . equals ( paramValue ) ) {
if ( value . equals ( paramValue ) ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( "!=" ) ) {
} else if ( operator . equals ( "!=" ) ) {
if ( ! value . equals ( paramValue ) ) {
if ( ! value . equals ( paramValue ) ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( ">" ) ) {
} else if ( operator . equals ( ">" ) ) {
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
if ( value1 . compareTo ( value2 ) > 0 ) {
if ( value1 . compareTo ( value2 ) > 0 ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( "<" ) ) {
} else if ( operator . equals ( "<" ) ) {
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
if ( value1 . compareTo ( value2 ) < 0 ) {
if ( value1 . compareTo ( value2 ) < 0 ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( ">=" ) ) {
} else if ( operator . equals ( ">=" ) ) {
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
if ( value1 . compareTo ( value2 ) > = 0 ) {
if ( value1 . compareTo ( value2 ) > = 0 ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( "<=" ) ) {
} else if ( operator . equals ( "<=" ) ) {
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value1 = new BigDecimal ( paramValue ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
BigDecimal value2 = new BigDecimal ( value ) ;
if ( value1 . compareTo ( value2 ) < = 0 ) {
if ( value1 . compareTo ( value2 ) < = 0 ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( "IN" ) ) {
} else if ( operator . equals ( "IN" ) ) {
List < String > valueList = Arrays . asList ( value . split ( "," ) ) ;
List < String > valueList = Arrays . asList ( value . split ( "," ) ) ;
if ( valueList . contains ( paramValue ) ) {
if ( valueList . contains ( paramValue ) ) {
return true ;
return true ;
}
}
} else if ( operator . equals ( "NOT IN" ) ) {
} else if ( operator . equals ( "NOT IN" ) ) {
List < String > valueList = Arrays . asList ( value . split ( "," ) ) ;
List < String > valueList = Arrays . asList ( value . split ( "," ) ) ;
if ( ! valueList . contains ( paramValue ) ) {
if ( ! valueList . contains ( paramValue ) ) {
return true ;
return true ;
}
}
}
}