Commit 9ab13fec authored by 周亚武's avatar 周亚武

小程序接口更新

parent e4035525
...@@ -5,17 +5,25 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,17 +5,25 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.Result;
import com.mortals.xhx.busiz.applets.req.CompanyReq; import com.mortals.xhx.busiz.applets.req.CompanyReq;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.company.model.CompanyPatentEntity; import com.mortals.xhx.module.company.model.CompanyPatentEntity;
import com.mortals.xhx.module.company.model.CompanyPatentQuery; import com.mortals.xhx.module.company.model.CompanyPatentQuery;
import com.mortals.xhx.module.company.model.CompanyProductQuery;
import com.mortals.xhx.module.company.model.CompanyQuery; import com.mortals.xhx.module.company.model.CompanyQuery;
import com.mortals.xhx.module.company.service.CompanyPatentService; import com.mortals.xhx.module.company.service.CompanyPatentService;
import com.mortals.xhx.module.company.service.CompanyProductService;
import com.mortals.xhx.module.company.service.CompanyService; import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.labels.model.LabelsQuery; import com.mortals.xhx.module.labels.model.LabelsQuery;
import com.mortals.xhx.module.labels.service.LabelsService; import com.mortals.xhx.module.labels.service.LabelsService;
import com.mortals.xhx.module.product.model.ProductCategoryQuery;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -23,9 +31,11 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -23,9 +31,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
...@@ -44,6 +54,9 @@ public class CompanyApiController extends AbstractBaseController<CompanyReq>{ ...@@ -44,6 +54,9 @@ public class CompanyApiController extends AbstractBaseController<CompanyReq>{
private CompanyPatentService companyPatentService; private CompanyPatentService companyPatentService;
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Autowired
private CompanyProductService companyProductService;
/** /**
* 公司标注列表 * 公司标注列表
...@@ -95,12 +108,15 @@ public class CompanyApiController extends AbstractBaseController<CompanyReq>{ ...@@ -95,12 +108,15 @@ public class CompanyApiController extends AbstractBaseController<CompanyReq>{
CompanyPatentQuery companyPatentQuery = new CompanyPatentQuery(); CompanyPatentQuery companyPatentQuery = new CompanyPatentQuery();
companyPatentQuery.setCompanyId(companyReq.getCompanyId()); companyPatentQuery.setCompanyId(companyReq.getCompanyId());
ProductQuery productQuery = new ProductQuery(); CompanyProductQuery companyProductQuery = new CompanyProductQuery();
productQuery.setCompanyId(String.valueOf(companyReq.getCompanyId())); companyProductQuery.setCompanyId(companyReq.getCompanyId());
ProductEntity productEntity = new ProductEntity();
productEntity.setCompanyId(String.valueOf(companyReq.getCompanyId()));
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("patentList",companyPatentService.find(companyPatentQuery)); data.put("patentList",companyPatentService.find(companyPatentQuery));
data.put("productList",productService.find(productQuery)); data.put("productList",productService.getProductEntitiesByCompanyId(productEntity,companyProductService.find(companyProductQuery)));
rest.setData(data); rest.setData(data);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
......
...@@ -71,9 +71,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{ ...@@ -71,9 +71,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{
StaffEntity staffEntity = staffService.get(staffReq.getId()); StaffEntity staffEntity = staffService.get(staffReq.getId());
if(staffEntity != null){ if(staffEntity != null){
rest.setData(staffEntity); rest.setData(staffEntity);
}else {
rest = Rest.fail("未查到该员工");
} }
// else {
// rest = Rest.fail("未查到该员工");
// }
}else { }else {
rest = Rest.fail("缺少id"); rest = Rest.fail("缺少id");
...@@ -103,9 +104,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{ ...@@ -103,9 +104,10 @@ public class StaffApiController extends AbstractBaseController<StaffReq>{
StaffRecordEntity staffRecordEntity = staffRecordService.get(staffReq.getId()); StaffRecordEntity staffRecordEntity = staffRecordService.get(staffReq.getId());
if(staffRecordEntity != null){ if(staffRecordEntity != null){
rest.setData(staffRecordEntity); rest.setData(staffRecordEntity);
}else {
rest = Rest.fail("未查到记录");
} }
// else {
// rest = Rest.fail("未查到记录");
// }
}else { }else {
rest = Rest.fail("缺少id"); rest = Rest.fail("缺少id");
......
package com.mortals.xhx.module.product.service; package com.mortals.xhx.module.product.service;
import com.mortals.framework.service.ICRUDCacheService; import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.company.model.CompanyProductEntity;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.dao.ProductDao; import com.mortals.xhx.module.product.dao.ProductDao;
import java.util.List;
/** /**
* ProductService * ProductService
* *
...@@ -14,4 +18,6 @@ import com.mortals.xhx.module.product.dao.ProductDao; ...@@ -14,4 +18,6 @@ import com.mortals.xhx.module.product.dao.ProductDao;
public interface ProductService extends ICRUDCacheService<ProductEntity,Long> { public interface ProductService extends ICRUDCacheService<ProductEntity,Long> {
ProductDao getDao(); ProductDao getDao();
List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList);
} }
\ No newline at end of file
package com.mortals.xhx.module.product.service.impl; package com.mortals.xhx.module.product.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.category.model.CategoryEntity; import com.mortals.xhx.module.category.model.CategoryEntity;
import com.mortals.xhx.module.category.model.CategoryQuery;
import com.mortals.xhx.module.category.service.CategoryService; import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.company.model.CompanyEntity; import com.mortals.xhx.module.company.model.CompanyEntity;
import com.mortals.xhx.module.company.model.CompanyProductEntity; import com.mortals.xhx.module.company.model.CompanyProductEntity;
...@@ -16,7 +14,6 @@ import com.mortals.xhx.module.company.service.CompanyService; ...@@ -16,7 +14,6 @@ import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.product.model.*; import com.mortals.xhx.module.product.model.*;
import com.mortals.xhx.module.product.service.ProductCategoryService; import com.mortals.xhx.module.product.service.ProductCategoryService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.xhx.module.product.dao.ProductDao; import com.mortals.xhx.module.product.dao.ProductDao;
...@@ -111,7 +108,8 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -111,7 +108,8 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
return productEntityResult; return productEntityResult;
} }
private List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList) { @Override
public List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList) {
List<ProductEntity> productList = companyProducList.stream().map(item -> { List<ProductEntity> productList = companyProducList.stream().map(item -> {
ProductEntity productEntity = this.getCache(item.getProductId().toString()); ProductEntity productEntity = this.getCache(item.getProductId().toString());
if (!ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(productEntity)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment