|
@@ -181,7 +181,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
json.put("deptId", json.getString("deptId"));
|
|
|
|
|
|
- record.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ record.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
|
|
|
return page;
|
|
@@ -231,7 +231,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
List<Long> customerIds = new ArrayList<>();
|
|
|
for (ProductInfoVo record : records) {
|
|
|
ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
- if(ObjectUtil.isNotEmpty(productInfoEhsdJson.getCustomerId())) {
|
|
|
+ if (ObjectUtil.isNotEmpty(productInfoEhsdJson.getCustomerId())) {
|
|
|
customerIds.add(Long.parseLong(productInfoEhsdJson.getCustomerId()));
|
|
|
}
|
|
|
}
|
|
@@ -239,9 +239,13 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
Map<Long, String> customerMap = customerService.mapKV(Customer::getId, Customer::getName, q -> q.in(Customer::getId, customerIds));
|
|
|
for (ProductInfoVo record : records) {
|
|
|
ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
- String customerName = customerMap.get(Long.parseLong(productInfoEhsdJson.getCustomerId()));
|
|
|
- productInfoEhsdJson.setCustomerName(customerName);
|
|
|
- record.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson,JSONWriter.Feature.WriteLongAsString));
|
|
|
+
|
|
|
+ String customerId = productInfoEhsdJson.getCustomerId();
|
|
|
+ if (ObjectUtil.isNotEmpty(customerId)) {
|
|
|
+ String customerName = customerMap.get(Long.parseLong(customerId));
|
|
|
+ productInfoEhsdJson.setCustomerName(customerName);
|
|
|
+ }
|
|
|
+ record.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -262,27 +266,27 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
JSONObject json = JSONObject.parseObject(result.getVictoriatouristJson());
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
- if(ObjectUtil.isNotEmpty(json) && ObjectUtil.isNotEmpty(json.getJSONArray("productCombinationList"))){
|
|
|
+ if (ObjectUtil.isNotEmpty(json) && ObjectUtil.isNotEmpty(json.getJSONArray("productCombinationList"))) {
|
|
|
JSONArray productCombinationList = json.getJSONArray("productCombinationList");
|
|
|
- for (int i=0;i<productCombinationList.size();i++) {
|
|
|
+ for (int i = 0; i < productCombinationList.size(); i++) {
|
|
|
JSONObject item = productCombinationList.getJSONObject(i);
|
|
|
ids.add(item.getLong("linkProductId"));
|
|
|
}
|
|
|
- if(ObjectUtil.isNotEmpty(ids)){
|
|
|
+ if (ObjectUtil.isNotEmpty(ids)) {
|
|
|
List<ProductInfo> productInfoList = this.listByIds(ids);
|
|
|
Map<Long, ProductInfo> productInfoMap = productInfoList.stream().collect(Collectors.toMap(ProductInfo::getId, Function.identity()));
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
- for (int i=0;i<productCombinationList.size();i++) {
|
|
|
+ for (int i = 0; i < productCombinationList.size(); i++) {
|
|
|
JSONObject item = productCombinationList.getJSONObject(i);
|
|
|
ProductInfo productInfo1 = productInfoMap.get(item.getLong("linkProductId"));
|
|
|
- if(ObjectUtil.isNotEmpty(productInfo1)) {
|
|
|
- item.put("code",productInfo1.getCode());
|
|
|
- item.put("customCode",productInfo1.getCustomCode());
|
|
|
- item.put("name",productInfo1.getName());
|
|
|
+ if (ObjectUtil.isNotEmpty(productInfo1)) {
|
|
|
+ item.put("code", productInfo1.getCode());
|
|
|
+ item.put("customCode", productInfo1.getCustomCode());
|
|
|
+ item.put("name", productInfo1.getName());
|
|
|
}
|
|
|
jsonArray.add(item);
|
|
|
}
|
|
|
- json.put("productCombinationList",jsonArray);
|
|
|
+ json.put("productCombinationList", jsonArray);
|
|
|
result.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
}
|
|
@@ -328,7 +332,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
productInfoEhsdJson.setCustomerId("0");
|
|
|
productInfoEhsdJson.setType("1");
|
|
|
}
|
|
|
- productInfoDto.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ productInfoDto.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
|
|
|
|
|
|
|
|
|
productInfoDto.setCode(CodeEnum.PRODUCT.getCode());
|
|
@@ -357,7 +361,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
productInfoEhsdJson.setNetWeight(newProductInfoEhsdJson.getNetWeight());
|
|
|
|
|
|
productInfo.setRemark(productInfoDto.getRemark());
|
|
|
- productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
|
|
|
this.updateById(productInfo);
|
|
|
|
|
|
ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId());
|
|
@@ -375,7 +379,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
Customer customer = customerService.getById(productInfoEhsdJson.getCustomerId());
|
|
|
if (ObjectUtil.isNotEmpty(customer)) {
|
|
|
productInfoEhsdJson.setCustomerName(customer.getName());
|
|
|
- result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -446,7 +450,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
}
|
|
|
productInfoEhsdJson.setOuterPackMethod(String.join(",", split));
|
|
|
}
|
|
|
- productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
|
|
|
productInfoList.add(productInfo);
|
|
|
}
|
|
|
saveBatch(productInfoList);
|
|
@@ -460,7 +464,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
json.put("deptId", SecurityUtils.getDeptId());
|
|
|
- productInfoDto.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ productInfoDto.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
}
|
|
|
add(productInfoDto);
|
|
|
}
|
|
@@ -516,8 +520,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<ProductInfoVo> getListByProductType(Integer productType, Integer definition,String productName,String productCode) {
|
|
|
- return baseMapper.getListByProductType(productType, definition,productName,productCode);
|
|
|
+ public List<ProductInfoVo> getListByProductType(Integer productType, Integer definition, String productName, String productCode) {
|
|
|
+ return baseMapper.getListByProductType(productType, definition, productName, productCode);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -531,7 +535,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
String victoriatouristJson = productInfo.getVictoriatouristJson();
|
|
|
JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
|
|
|
json.put("deptId", productInfoDto.getDeptId());
|
|
|
- productInfo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ productInfo.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
updateById(productInfo);
|
|
|
}
|
|
|
|
|
@@ -734,6 +738,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
|
|
|
* 产品统计
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -745,9 +750,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
* 产品库统计(根据产品库类型进行分类统计)
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String,Object> productInfoStatistics(ProductInfoSelectDto dto) {
|
|
|
+ public Map<String, Object> productInfoStatistics(ProductInfoSelectDto dto) {
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
@@ -760,30 +765,30 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
Integer amount = productInfos.stream().map(productInfo -> productInfo.getCount()).reduce(Integer::sum).orElse(0);
|
|
|
|
|
|
- map.put("amount",amount);
|
|
|
+ map.put("amount", amount);
|
|
|
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
List<DictTenantDataVo> dictTenantDataVoList = getDict("product_type");
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
- if (dictTenantDataVoList.size()==0){
|
|
|
+ if (dictTenantDataVoList.size() == 0) {
|
|
|
throw new ServiceException("数据异常:产品没有设置产品类型字典,请先添加");
|
|
|
}
|
|
|
|
|
|
for (DictTenantDataVo dictTenantDataVo : dictTenantDataVoList) {
|
|
|
Map typeMap = new HashMap();
|
|
|
|
|
|
- typeMap.put("type",dictTenantDataVo.getDictValue());
|
|
|
- typeMap.put("count",0);
|
|
|
+ typeMap.put("type", dictTenantDataVo.getDictValue());
|
|
|
+ typeMap.put("count", 0);
|
|
|
|
|
|
|
|
|
List<ProductInfo> productInfoList = productInfoMap.get(dictTenantDataVo.getDictKey());
|
|
|
- if (CollectionUtils.isNotEmpty(productInfoList)){
|
|
|
- typeMap.put("count",productInfoList.get(0).getCount());
|
|
|
+ if (CollectionUtils.isNotEmpty(productInfoList)) {
|
|
|
+ typeMap.put("count", productInfoList.get(0).getCount());
|
|
|
}
|
|
|
list.add(typeMap);
|
|
|
|
|
|
}
|
|
|
- map.put("typeList",list);
|
|
|
+ map.put("typeList", list);
|
|
|
return map;
|
|
|
}
|
|
|
|