Browse Source

修改记录接口,调整规则接口

master
刘忱 2 years ago
parent
commit
ee8036e3eb
  1. 11
      win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/TrendsApi.java
  2. 8
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/api/trends/TrendsApiImpl.java
  3. 11
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/issueRequest/IssueRequestMainService.java
  4. 26
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itembasic/ItembasicServiceImpl.java
  5. 328
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java

11
win-module-infra/win-module-infra-api/src/main/java/com/win/module/infra/api/trends/TrendsApi.java

@ -1,15 +1,16 @@
package com.win.module.infra.api.trends;
import com.win.module.infra.api.trends.dto.TrendsCreateReqDTO;
import javax.validation.Valid;
import com.win.module.infra.enums.TrendsTypeEnum;
public interface TrendsApi {
/**
* 创建动态记录
* @param createDTO
* @param tableId 表数据id
* @param tableName 表名
* @param content 内容
* @param trendsTypeEnum com.win.module.infra.enums.TrendsTypeEnum枚举
*/
void createTrends(@Valid TrendsCreateReqDTO createDTO);
void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum);
}

8
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/api/trends/TrendsApiImpl.java

@ -1,6 +1,7 @@
package com.win.module.infra.api.trends;
import com.win.module.infra.api.trends.dto.TrendsCreateReqDTO;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.infra.mq.producer.trends.TrendsProducer;
import com.win.module.infra.service.trends.TrendsService;
import org.springframework.stereotype.Service;
@ -24,7 +25,12 @@ public class TrendsApiImpl implements TrendsApi {
private TrendsService trendsService;
@Override
public void createTrends(TrendsCreateReqDTO createDTO) {
public void createTrends(Long tableId, String tableName, String content, TrendsTypeEnum trendsTypeEnum) {
TrendsCreateReqDTO createDTO = new TrendsCreateReqDTO();
createDTO.setTableId(tableId);
createDTO.setTableName(tableName);
createDTO.setType(trendsTypeEnum.getType());
createDTO.setContent(content);
trendsService.createTrends(createDTO);
//TrendsMessage trendsMessage = TrendsConvert.INSTANCE.convertMessage(createDTO);
//trendsProducer.sendMessage(trendsMessage);

11
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/issueRequest/IssueRequestMainService.java

@ -1,14 +1,13 @@
package com.win.module.wms.service.issueRequest;
import java.util.*;
import javax.validation.*;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.controller.issueRequest.vo.*;
import com.win.module.wms.controller.purchasereturnRequest.vo.PurchasereturnRequestImportErrorVO;
import com.win.module.wms.controller.purchasereturnRequest.vo.PurchasereturnRequestMainCreateReqVO;
import com.win.module.wms.dal.dataobject.issueRequest.IssueRequestMainDO;
import com.win.framework.common.pojo.PageResult;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 发料申请主 Service 接口

26
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itembasic/ItembasicServiceImpl.java

@ -4,13 +4,11 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.annotations.VisibleForTesting;
import com.win.framework.common.exception.ServiceException;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.datapermission.core.util.DataPermissionUtils;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.api.trends.dto.TrendsCreateReqDTO;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.wms.controller.itembasic.vo.*;
import com.win.module.wms.convert.itembasic.ItembasicConvert;
@ -50,7 +48,7 @@ public class ItembasicServiceImpl implements ItembasicService {
// 插入
ItembasicDO itembasic = ItembasicConvert.INSTANCE.convert(createReqVO);
itembasicMapper.insert(itembasic);
trendsApi.createTrends(this.newTrendsCreateReqDTO(itembasic.getId(), "增加了物品基本信息", TrendsTypeEnum.CREATE));
trendsApi.createTrends(itembasic.getId(), "basicItembasic", "增加了物品基本信息", TrendsTypeEnum.CREATE);
// 返回
return itembasic.getId();
}
@ -63,7 +61,7 @@ public class ItembasicServiceImpl implements ItembasicService {
,updateReqVO.getValidityDays(),updateReqVO.getAvailable());
// 更新
ItembasicDO itembasic = this.getItembasic(updateReqVO.getId());
trendsApi.createTrends(this.newTrendsCreateReqDTO(updateReqVO.getId(), itembasic.toString(), TrendsTypeEnum.UPDATE));
trendsApi.createTrends(updateReqVO.getId(), "basicItembasic", itembasic.toString(), TrendsTypeEnum.UPDATE);
ItembasicDO updateObj = ItembasicConvert.INSTANCE.convert(updateReqVO);
itembasicMapper.updateById(updateObj);
}
@ -72,7 +70,7 @@ public class ItembasicServiceImpl implements ItembasicService {
public void updateItembasicStatus(ItembasicUpdateReqVO updateReqVO) {
// 校验存在
ItembasicDO updateObj = validateItembasicExists(updateReqVO.getId());
trendsApi.createTrends(this.newTrendsCreateReqDTO(updateObj.getId(), "状态由" + updateObj.getStatus() + "改为" + updateReqVO.getStatus(), TrendsTypeEnum.UPDATE_STATUS));
trendsApi.createTrends(updateObj.getId(), "basicItembasic", "状态由" + updateObj.getStatus() + "改为" + updateReqVO.getStatus(), TrendsTypeEnum.UPDATE_STATUS);
// 更新
updateObj.setId(updateReqVO.getId());
updateObj.setStatus(updateReqVO.getStatus());
@ -85,7 +83,7 @@ public class ItembasicServiceImpl implements ItembasicService {
ItembasicDO itembasic = validateItembasicExists(id);
// 删除
itembasicMapper.deleteById(id);
trendsApi.createTrends(this.newTrendsCreateReqDTO(id, itembasic.toString(), TrendsTypeEnum.DELETE));
trendsApi.createTrends(id, "basicItembasic", itembasic.toString(), TrendsTypeEnum.DELETE);
}
@Override
@ -358,20 +356,4 @@ public class ItembasicServiceImpl implements ItembasicService {
}
}
/**
* 构建操作流水对象
* @param id
* @param content
* @param trendsTypeEnum
* @return
*/
private TrendsCreateReqDTO newTrendsCreateReqDTO(Long id, String content, TrendsTypeEnum trendsTypeEnum) {
TrendsCreateReqDTO trendsCreateReqDTO = new TrendsCreateReqDTO();
trendsCreateReqDTO.setTableName("basicItembasic");
trendsCreateReqDTO.setTableId(id);
trendsCreateReqDTO.setType(trendsTypeEnum.getType());
trendsCreateReqDTO.setContent(content);
return trendsCreateReqDTO;
}
}

328
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java

@ -130,9 +130,15 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierType", supplierType);
params.put("SupplierCode", supplierCode);
params.put("Weekday", weekday);
if(supplierType != null && !supplierType.isEmpty()) {
params.put("SupplierType", supplierType);
}
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierCode", supplierCode);
}
if(weekday != null && !weekday.isEmpty()) {
params.put("Weekday", weekday);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -154,8 +160,12 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierType", supplierType);
params.put("SupplierCode", supplierCode);
if(supplierType != null && !supplierType.isEmpty()) {
params.put("SupplierType", supplierType);
}
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierCode", supplierCode);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -177,7 +187,9 @@ public class RuleServiceImpl implements RuleService {
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierCode", supplierCode);
params.put("ItemCode", itemCode);
if(itemCode != null && !itemCode.isEmpty()) {
params.put("ItemCode", itemCode);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -198,8 +210,12 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierType", supplierType);
params.put("ItemCode", itemCode);
if(supplierType != null && !supplierType.isEmpty()) {
params.put("SupplierType", supplierType);
}
if(itemCode != null && !itemCode.isEmpty()) {
params.put("ItemCode", itemCode);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -220,19 +236,45 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierType", supplierCode);
params.put("CustomerCode", customerCode);
params.put("AbcClass", abcClass);
params.put("ItemType", itemType);
params.put("ItemGroup", itemGroup);
params.put("Project", project);
params.put("ItemCode", itemCode);
params.put("InventoryStatus", inventoryStatus);
params.put("StorageType", storageType);
params.put("TransactionType", transactionType);
params.put("Weight", weight);
params.put("Area", area);
params.put("Volume", volume);
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierType", supplierCode);
}
if(customerCode != null && !customerCode.isEmpty()) {
params.put("CustomerCode", customerCode);
}
if(abcClass != null && !abcClass.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);
}
if(inventoryStatus != null && !inventoryStatus.isEmpty()) {
params.put("InventoryStatus", inventoryStatus);
}
if(storageType != null && !storageType.isEmpty()) {
params.put("StorageType", storageType);
}
if(transactionType != null && !transactionType.isEmpty()) {
params.put("TransactionType", transactionType);
}
if(weight != null && !weight.isEmpty()) {
params.put("Weight", weight);
}
if(area != null && !area.isEmpty()) {
params.put("Area", area);
}
if(volume != null && !volume.isEmpty()) {
params.put("Volume", volume);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -253,13 +295,27 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("ItemGroup", itemGroup);
params.put("Project", project);
params.put("ItemCode", itemCode);
params.put("WarehouseCode", warehouseCode);
params.put("AreaCode", areaCode);
params.put("LocationGroupCode", locationGroupCode);
params.put("LocationCode", locationCode);
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);
}
if(warehouseCode != null && !warehouseCode.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);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -280,16 +336,36 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierCode", supplierCode);
params.put("CustomerCode", customerCode);
params.put("AbcClass", abcClass);
params.put("ItemType", itemType);
params.put("ItemGroup", itemGroup);
params.put("Project", project);
params.put("ItemCode", itemCode);
params.put("InventoryStatus", inventoryStatus);
params.put("StorageType", storageType);
params.put("TransactionType", transactionType);
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierCode", supplierCode);
}
if(customerCode != null && !customerCode.isEmpty()) {
params.put("CustomerCode", customerCode);
}
if(abcClass != null && !abcClass.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);
}
if(inventoryStatus != null && !inventoryStatus.isEmpty()) {
params.put("InventoryStatus", inventoryStatus);
}
if(storageType != null && !storageType.isEmpty()) {
params.put("StorageType", storageType);
}
if(transactionType != null && !transactionType.isEmpty()) {
params.put("TransactionType", transactionType);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -310,12 +386,24 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("Project", project);
params.put("ItemCode", itemCode);
params.put("WarehouseCode", warehouseCode);
params.put("AreaCode", areaCode);
params.put("LocationGroupCode", locationGroupCode);
params.put("LocationCode", locationCode);
if(project != null && !project.isEmpty()) {
params.put("Project", project);
}
if(itemCode != null && !itemCode.isEmpty()) {
params.put("ItemCode", itemCode);
}
if(warehouseCode != null && !warehouseCode.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);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -336,19 +424,45 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierCode", supplierCode);
params.put("CustomerCode", customerCode);
params.put("AbcClass", abcClass);
params.put("ItemType", itemType);
params.put("ItemGroup", itemGroup);
params.put("Project", project);
params.put("ItemCode", itemCode);
params.put("WarehouseCode", warehouseCode);
params.put("AreaCode", areaCode);
params.put("LocationGroupCode", locationGroupCode);
params.put("LocationCode", locationCode);
params.put("IgnoreListOfItem", ignoreListOfItem);
params.put("IgnoreListOfLocation", ignoreListOfLocation);
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierCode", supplierCode);
}
if(customerCode != null && !customerCode.isEmpty()) {
params.put("CustomerCode", customerCode);
}
if(abcClass != null && !abcClass.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);
}
if(warehouseCode != null && !warehouseCode.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);
}
if(ignoreListOfItem != null && !ignoreListOfItem.isEmpty()) {
params.put("IgnoreListOfItem", ignoreListOfItem);
}
if(ignoreListOfLocation != null && !ignoreListOfLocation.isEmpty()) {
params.put("IgnoreListOfLocation", ignoreListOfLocation);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -369,13 +483,27 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("SupplierCode", supplierCode);
params.put("CustomerCode", customerCode);
params.put("AbcClass", abcClass);
params.put("ItemType", itemType);
params.put("ItemGroup", itemGroup);
params.put("Project", project);
params.put("ItemCode", itemCode);
if(supplierCode != null && !supplierCode.isEmpty()) {
params.put("SupplierCode", supplierCode);
}
if(customerCode != null && !customerCode.isEmpty()) {
params.put("CustomerCode", customerCode);
}
if(abcClass != null && !abcClass.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);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -396,10 +524,18 @@ public class RuleServiceImpl implements RuleService {
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("WarehouseCode", warehouseCode);
params.put("AreaCode", areaCode);
params.put("LocationGroupCode", locationGroupCode);
params.put("LocationCode", locationCode);
if(warehouseCode != null && !warehouseCode.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);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -421,9 +557,15 @@ public class RuleServiceImpl implements RuleService {
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> params = new HashMap<>();
params.put("ContainerType", containerType);
params.put("ItemGroup", itemGroup);
params.put("ProjectCode", projectCode);
params.put("ItemCode", itemCode);
if(itemGroup != null && !itemGroup.isEmpty()) {
params.put("ItemGroup", itemGroup);
}
if(projectCode != null && !projectCode.isEmpty()) {
params.put("ProjectCode", projectCode);
}
if(itemCode != null && !itemCode.isEmpty()) {
params.put("ItemCode", itemCode);
}
if(this.forEachParams(params, conditionArray)) {
return RuleConvert.INSTANCE.convert(ruleDO);
}
@ -465,56 +607,56 @@ public class RuleServiceImpl implements RuleService {
String value = conditionObject.get("Value").toString();
if(paramValue != null && paramValue.isEmpty()) {
if(operator.equals("==")) {
if(!value.equals(paramValue)) {
return false;
if(value.equals(paramValue)) {
return true;
}
} else if(operator.equals("!=")) {
if(value.equals(paramValue)) {
return false;
if(!value.equals(paramValue)) {
return true;
}
} else if(operator.equals(">")) {
BigDecimal value1 = new BigDecimal(paramValue);
BigDecimal value2 = new BigDecimal(value);
if(value1.compareTo(value2) <= 0) {
return false;
if(value1.compareTo(value2) > 0) {
return true;
}
} else if(operator.equals("<")) {
BigDecimal value1 = new BigDecimal(paramValue);
BigDecimal value2 = new BigDecimal(value);
if(value1.compareTo(value2) >= 0) {
return false;
if(value1.compareTo(value2) < 0) {
return true;
}
} else if(operator.equals(">=")) {
BigDecimal value1 = new BigDecimal(paramValue);
BigDecimal value2 = new BigDecimal(value);
if(value1.compareTo(value2) < 0) {
return false;
if(value1.compareTo(value2) >= 0) {
return true;
}
} else if(operator.equals("<=")) {
BigDecimal value1 = new BigDecimal(paramValue);
BigDecimal value2 = new BigDecimal(value);
if(value1.compareTo(value2) > 0) {
return false;
if(value1.compareTo(value2) <= 0) {
return true;
}
} else if(operator.equals("IN")) {
List<String> valueList = Arrays.asList(value.split(","));
if(!valueList.contains(paramValue)) {
return false;
if(valueList.contains(paramValue)) {
return true;
}
} else if(operator.equals("NOT IN")) {
List<String> valueList = Arrays.asList(value.split(","));
if(valueList.contains(paramValue)) {
return false;
if(!valueList.contains(paramValue)) {
return true;
}
}
}
if(operator.equals("NULL")) {
return paramValue == null || paramValue.isEmpty();
} else if(operator.equals("NOT NULL")) {
return paramValue != null && !paramValue.isEmpty();
}
//if(operator.equals("NULL")) {
// return paramValue == null || paramValue.isEmpty();
//} else if(operator.equals("NOT NULL")) {
// return paramValue != null && !paramValue.isEmpty();
//}
}
return true;
return false;
}
}

Loading…
Cancel
Save