|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.item.entity.product.vo.ProductInfoVo;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
|
|
@@ -28,12 +29,10 @@ import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
import com.fjhx.wms.entity.warehouse.po.Warehouse;
|
|
|
import com.fjhx.wms.service.warehouse.WarehouseService;
|
|
|
import com.obs.services.internal.ServiceException;
|
|
|
-import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
-import org.apache.poi.util.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -74,12 +73,12 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
|
|
|
public Page<SubscribeDetailVo> getPage(SubscribeDetailSelectDto dto) {
|
|
|
IWrapper<SubscribeDetail> wrapper = getWrapper();
|
|
|
//申购单号
|
|
|
- wrapper.like(ObjectUtil.isNotEmpty(dto.getCode()),"t2.code",dto.getCode());
|
|
|
+ wrapper.like(ObjectUtil.isNotEmpty(dto.getCode()), "t2.code", dto.getCode());
|
|
|
|
|
|
//申购时间
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()),"t2.create_time",dto.getBeginTime());
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()),"t2.create_time",dto.getEndTime());
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getSubscribeStatus()),"t2.subcribe_status",dto.getSubscribeStatus());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()), "t2.create_time", dto.getBeginTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()), "t2.create_time", dto.getEndTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getSubscribeStatus()), "t2.subcribe_status", dto.getSubscribeStatus());
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dto.getStatus())) {
|
|
|
wrapper.in("t1", SubscribeDetail::getStatus, Arrays.asList(dto.getStatus().split(",")));
|
|
@@ -87,21 +86,25 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
|
|
|
|
|
|
// 如果类型存在带入类型查询
|
|
|
List<ProductInfoVo> productList = productInfoService.getListByProductType(dto.getProductType(),
|
|
|
- dto.getDefinition(),
|
|
|
- dto.getProductName(),
|
|
|
- dto.getProductCode()
|
|
|
+ dto.getDefinition(),
|
|
|
+ dto.getProductName(),
|
|
|
+ dto.getProductCode()
|
|
|
);
|
|
|
if (ObjectUtil.isEmpty(productList)) {
|
|
|
return new Page<>();
|
|
|
}
|
|
|
List<Long> productIds = productList.stream().map(ProductInfoVo::getId).collect(Collectors.toList());
|
|
|
wrapper.in("t1", SubscribeDetail::getBussinessId, productIds);
|
|
|
- wrapper.like("t2", Subscribe::getCode, dto.getKeyword());
|
|
|
+ wrapper.keyword(dto.getKeyword(),
|
|
|
+ new SqlField("t2", Subscribe::getCode),
|
|
|
+ new SqlField("pi", ProductInfo::getCustomCode),
|
|
|
+ new SqlField("pi", ProductInfo::getName)
|
|
|
+ );
|
|
|
|
|
|
// 维多利亚扩展根据到货仓库id过滤
|
|
|
wrapper.eq("json_unquote(t2.victoriatourist_json -> '$.receiptWarehouseId')", dto.getReceiptWarehouseId());
|
|
|
- if(ObjectUtil.isNotEmpty(dto.getDeptId())) {
|
|
|
- wrapper.eq( "json_unquote(pi.victoriatourist_json -> '$.deptId')", dto.getDeptId().toString());
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getDeptId())) {
|
|
|
+ wrapper.eq("json_unquote(pi.victoriatourist_json -> '$.deptId')", dto.getDeptId().toString());
|
|
|
}
|
|
|
//待采购过滤掉指定状态 例如不要 99 作废
|
|
|
if (ObjectUtil.isNotEmpty(dto.getNeStatus())) {
|
|
@@ -180,7 +183,7 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
|
|
|
if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
json.put("receiptWarehouseName", warehousesMap.get(json.getLong("receiptWarehouseId")));
|
|
|
- subscribeDetailVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ subscribeDetailVo.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -259,7 +262,7 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
//存放申购统计详情数据
|
|
|
- List<Map<String,Object>> list = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
query.groupBy("pi.type");
|
|
@@ -270,42 +273,42 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
|
|
|
|
|
|
//计算申购笔合计数据
|
|
|
Integer amount = subscribeDetailVos.stream().map(SubscribeDetailVo::getCounts).reduce(Integer::sum).orElse(0);
|
|
|
- map.put("amount",amount);
|
|
|
+ map.put("amount", amount);
|
|
|
//计算申购货品种类合计数据
|
|
|
Integer typeAmount = subscribeDetailVos.stream().map(SubscribeDetailVo::getTypeCount).reduce(Integer::sum).orElse(0);
|
|
|
- map.put("typeAmount",typeAmount);
|
|
|
+ map.put("typeAmount", typeAmount);
|
|
|
//切换数据源
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
//获取产品类型字典数据
|
|
|
List<DictTenantDataVo> dictTenantDataVoList = getDict("product_type");
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
|
- if (ObjectUtil.isEmpty(dictTenantDataVoList)){
|
|
|
- throw new ServiceException("数据有误:产品没有配置产品类型字典,请先添加产品类型字典");
|
|
|
+ if (ObjectUtil.isEmpty(dictTenantDataVoList)) {
|
|
|
+ throw new ServiceException("数据有误:产品没有配置产品类型字典,请先添加产品类型字典");
|
|
|
}
|
|
|
|
|
|
//赋值笔数、货品种类数据
|
|
|
for (DictTenantDataVo dictTenantDataVo : dictTenantDataVoList) {
|
|
|
//设置初始值
|
|
|
- Map<String,Object> typeMap = new HashMap<>();
|
|
|
- typeMap.put("type",dictTenantDataVo.getDictValue());
|
|
|
- typeMap.put("count",0);
|
|
|
- typeMap.put("typeCount",0);
|
|
|
+ Map<String, Object> typeMap = new HashMap<>();
|
|
|
+ typeMap.put("type", dictTenantDataVo.getDictValue());
|
|
|
+ typeMap.put("count", 0);
|
|
|
+ typeMap.put("typeCount", 0);
|
|
|
|
|
|
//赋值
|
|
|
List<SubscribeDetailVo> subscribeDetailVoList = subscribeDetailVoMap.get(dictTenantDataVo.getDictKey());
|
|
|
- if (ObjectUtil.isNotEmpty(subscribeDetailVoList)){
|
|
|
- typeMap.put("count",subscribeDetailVoList.get(0).getCounts());
|
|
|
- typeMap.put("typeCount",subscribeDetailVoList.get(0).getTypeCount());
|
|
|
+ if (ObjectUtil.isNotEmpty(subscribeDetailVoList)) {
|
|
|
+ typeMap.put("count", subscribeDetailVoList.get(0).getCounts());
|
|
|
+ typeMap.put("typeCount", subscribeDetailVoList.get(0).getTypeCount());
|
|
|
}
|
|
|
list.add(typeMap);
|
|
|
}
|
|
|
- map.put("productTypeList",list);
|
|
|
+ map.put("productTypeList", list);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
//根据字典编码获取字典的数据
|
|
|
- private List<DictTenantDataVo> getDict(String code){
|
|
|
+ private List<DictTenantDataVo> getDict(String code) {
|
|
|
DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
dto.setDictCode(code);
|
|
|
return dictTenantDataService.getList(dto);
|