|
@@ -6,17 +6,19 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
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.customer.entity.customer.po.Customer;
|
|
|
+import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.item.entity.product.dto.ProductInfoDto;
|
|
|
import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
|
|
|
import com.fjhx.item.entity.product.po.ProductClassify;
|
|
|
import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfoEhsdJson;
|
|
|
import com.fjhx.item.entity.product.vo.ProductInfoVo;
|
|
|
import com.fjhx.item.mapper.product.ProductInfoMapper;
|
|
|
import com.fjhx.item.service.product.ProductClassifyService;
|
|
@@ -33,14 +35,12 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
+import com.ruoyi.system.utils.UserUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -61,6 +61,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
private ProductClassifyService productClassifyService;
|
|
|
@Autowired
|
|
|
private ISysDeptService sysDeptService;
|
|
|
+ @Autowired
|
|
|
+ private CustomerService customerService;
|
|
|
|
|
|
@Autowired
|
|
|
private DictTenantDataService dictTenantDataService;
|
|
@@ -168,6 +170,84 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public Page<ProductInfoVo> getCustomerProductList(ProductInfoSelectDto dto) {
|
|
|
+ IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.status')", 0);//状态 启用
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.assessStatus')", 3);//评估状态 具备
|
|
|
+// wrapper.ne("json_unquote(pi.ehsd_json -> '$.customerId')", 0);//客户id不等于0
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.type')", 2);//客户产品
|
|
|
+ //根据产品名称/产品编号过滤
|
|
|
+ wrapper.like("pi", ProductInfo::getCode, dto.getCode());
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getName())) {
|
|
|
+ wrapper.and(q -> q.like("pi", ProductInfo::getName, dto.getName()))
|
|
|
+ .or().like("json_unquote(pi.ehsd_json -> '$.englishName')", dto.getName());
|
|
|
+ }
|
|
|
+ //根据产品分类id过滤
|
|
|
+ wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
|
|
|
+ //客户名称过滤
|
|
|
+ wrapper.like("c.name", dto.getCustomerName());
|
|
|
+
|
|
|
+ Page<ProductInfoVo> page = baseMapper.getCustomerProductList(dto.getPage(), wrapper);
|
|
|
+ List<ProductInfoVo> records = page.getRecords();
|
|
|
+ //赋值客户名称
|
|
|
+ List<Long> customerIds = new ArrayList<>();
|
|
|
+ for (ProductInfoVo record : records) {
|
|
|
+ ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
+ customerIds.add(productInfoEhsdJson.getCustomerId());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(customerIds)) {
|
|
|
+ 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(productInfoEhsdJson.getCustomerId());
|
|
|
+ productInfoEhsdJson.setCustomerName(customerName);
|
|
|
+ record.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //赋值创建人名称
|
|
|
+ UserUtil.assignmentNickName(page.getRecords(), ProductInfo::getCreateUser, ProductInfoVo::setCreateUserName);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<ProductInfoVo> getConditionProductList(ProductInfoSelectDto dto) {
|
|
|
+ IWrapper<ProductInfo> wrapper = getWrapper();
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.status')", 0);//状态 启用
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.assessStatus')", 3);//评估状态 具备
|
|
|
+// wrapper.eq("json_unquote(pi.ehsd_json -> '$.customerId')", 0);//客户id等于0
|
|
|
+ wrapper.eq("json_unquote(pi.ehsd_json -> '$.type')", 1);//公司产品
|
|
|
+ //根据产品名称/产品编号过滤
|
|
|
+ wrapper.like("pi", ProductInfo::getCode, dto.getCode());
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getName())) {
|
|
|
+ wrapper.and(q -> q.like("pi", ProductInfo::getName, dto.getName()))
|
|
|
+ .or().like("json_unquote(pi.ehsd_json -> '$.englishName')", dto.getName());
|
|
|
+ }
|
|
|
+ //根据产品分类id过滤
|
|
|
+ wrapper.eq("pi", ProductInfo::getProductClassifyId, dto.getProductClassifyId());
|
|
|
+
|
|
|
+ Page<ProductInfoVo> page = baseMapper.getCustomerProductList(dto.getPage(), wrapper);
|
|
|
+ List<ProductInfoVo> records = page.getRecords();
|
|
|
+ //赋值客户名称
|
|
|
+ List<Long> customerIds = new ArrayList<>();
|
|
|
+ for (ProductInfoVo record : records) {
|
|
|
+ ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(record.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
+ customerIds.add(productInfoEhsdJson.getCustomerId());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(customerIds)) {
|
|
|
+ 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(productInfoEhsdJson.getCustomerId());
|
|
|
+ productInfoEhsdJson.setCustomerName(customerName);
|
|
|
+ record.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //赋值创建人名称
|
|
|
+ UserUtil.assignmentNickName(page.getRecords(), ProductInfo::getCreateUser, ProductInfoVo::setCreateUserName);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public ProductInfoVo detail(Long id) {
|
|
|
ProductInfo ProductInfo = this.getById(id);
|
|
|
ProductInfoVo result = BeanUtil.toBean(ProductInfo, ProductInfoVo.class);
|
|
@@ -187,6 +267,57 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
@DSTransactional
|
|
|
@Override
|
|
|
+ public void addByEhsd(ProductInfoDto productInfoDto) {
|
|
|
+ //赋值初始状态
|
|
|
+ ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(productInfoDto.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
+ productInfoEhsdJson.setStatus(0);
|
|
|
+ productInfoEhsdJson.setAssessStatus(3);
|
|
|
+ if (ObjectUtil.isEmpty(productInfoEhsdJson.getCustomerId())) {
|
|
|
+ //如果客户id为空就赋值为0 公司产品
|
|
|
+ productInfoEhsdJson.setCustomerId(0l);
|
|
|
+ }
|
|
|
+ productInfoDto.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
|
|
|
+
|
|
|
+ // 赋值产品编号
|
|
|
+ productInfoDto.setCode(CodeEnum.PRODUCT.getCode());
|
|
|
+ // 排除名称重复
|
|
|
+ this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), "产品名称重复");
|
|
|
+ this.save(productInfoDto);
|
|
|
+ //图片列表
|
|
|
+ ObsFileUtil.saveFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
|
|
|
+ //附件列表
|
|
|
+ ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId(), 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public void editByEhsd(ProductInfoDto productInfoDto) {
|
|
|
+ // 禁止产品编号修改
|
|
|
+ productInfoDto.setCode(null);
|
|
|
+ // 排除名称重复
|
|
|
+ this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), productInfoDto.getId(), "产品名称重复");
|
|
|
+ this.updateById(productInfoDto);
|
|
|
+ ObsFileUtil.editFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
|
|
|
+ ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId(), 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ProductInfoVo detailByEhsd(Long id) {
|
|
|
+ ProductInfo ProductInfo = this.getById(id);
|
|
|
+ ProductInfoVo result = BeanUtil.toBean(ProductInfo, ProductInfoVo.class);
|
|
|
+
|
|
|
+ ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(result.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
+ //赋值客户名称
|
|
|
+ Customer customer = customerService.getById(productInfoEhsdJson.getCustomerId());
|
|
|
+ productInfoEhsdJson.setCustomerName(customer.getName());
|
|
|
+ result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
|
|
|
+ //赋值创建人名称
|
|
|
+ UserUtil.assignmentNickName(Arrays.asList(result), ProductInfoVo::getCreateUser, ProductInfoVo::setCreateUserName);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
public void addByWdly(ProductInfoDto productInfoDto) {
|
|
|
//处理维多利亚扩展
|
|
|
String victoriatouristJson = productInfoDto.getVictoriatouristJson();
|
|
@@ -255,19 +386,20 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
/**
|
|
|
* 产品统计(数据看板-产品分析页面)
|
|
|
+ *
|
|
|
* @param productInfoDto
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Object> productStatistics(ProductInfoDto productInfoDto) {
|
|
|
if (ObjectUtil.isEmpty(productInfoDto) && ObjectUtil.isEmpty(productInfoDto.getBeginTime())
|
|
|
- && StringUtils.isNotEmpty(productInfoDto.getEndTime())){
|
|
|
- throw new ServiceException("参数缺失:开始时间,结束时间不能为null");
|
|
|
+ && StringUtils.isNotEmpty(productInfoDto.getEndTime())) {
|
|
|
+ throw new ServiceException("参数缺失:开始时间,结束时间不能为null");
|
|
|
}
|
|
|
//存放产品统计数据
|
|
|
- Map map =new HashMap();
|
|
|
+ Map map = new HashMap();
|
|
|
|
|
|
//存放产品类型数据
|
|
|
- List<Map<String,Object>> typeList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> typeList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
QueryWrapper<ProductInfo> query = Wrappers.<ProductInfo>query();
|
|
@@ -275,10 +407,10 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
query.groupBy("type");
|
|
|
//查询每个类型的总计
|
|
|
List<ProductInfo> productInfos = baseMapper.selectList(query);
|
|
|
- Map<String, List<ProductInfo>> productInfoTotalMap= productInfos.stream().collect(Collectors.groupingBy(ProductInfo::getType));
|
|
|
+ Map<String, List<ProductInfo>> productInfoTotalMap = productInfos.stream().collect(Collectors.groupingBy(ProductInfo::getType));
|
|
|
|
|
|
- query.ge("DATE_FORMAT(create_time,'%Y-%m-%d')",productInfoDto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(create_time,'%Y-%m-%d')",productInfoDto.getEndTime());
|
|
|
+ query.ge("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
|
|
|
+ query.le("DATE_FORMAT(create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
|
|
|
//查询每个类型的新增数量
|
|
|
List<ProductInfo> productInfoList = baseMapper.selectList(query);
|
|
|
Map<String, List<ProductInfo>> productInfoTypeMap = productInfoList.stream().collect(Collectors.groupingBy(ProductInfo::getType));
|
|
@@ -287,53 +419,54 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
//总计
|
|
|
Integer total = productInfos.stream().map(ProductInfo::getCount).reduce(Integer::sum).orElse(0);
|
|
|
|
|
|
- map.put("newTotal",newTotal);
|
|
|
- map.put("total",total);
|
|
|
+ map.put("newTotal", newTotal);
|
|
|
+ map.put("total", total);
|
|
|
|
|
|
//获取产品类型的字典数据
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
List<DictTenantDataVo> dictTenantDataVoList = getDict("product_type");
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
|
- if (ObjectUtil.isEmpty(dictTenantDataVoList)){
|
|
|
+ if (ObjectUtil.isEmpty(dictTenantDataVoList)) {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
for (DictTenantDataVo dictTenantDataVo : dictTenantDataVoList) {
|
|
|
//存放每个类型的新增与总计
|
|
|
- Map<String,Object> map1 = new HashMap<>();
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
//设置初使值
|
|
|
- map1.put("type",dictTenantDataVo.getDictKey());
|
|
|
- map1.put("typeNewTotal",0);
|
|
|
- map1.put("typeTotal",0);
|
|
|
+ map1.put("type", dictTenantDataVo.getDictKey());
|
|
|
+ map1.put("typeNewTotal", 0);
|
|
|
+ map1.put("typeTotal", 0);
|
|
|
|
|
|
//赋值新增的款数
|
|
|
List<ProductInfo> productInfoNewList = productInfoTypeMap.get(dictTenantDataVo.getDictKey());
|
|
|
if (ObjectUtil.isNotEmpty(productInfoNewList)) {
|
|
|
- map1.put("typeNewTotal",productInfoNewList.get(0).getCount());
|
|
|
+ map1.put("typeNewTotal", productInfoNewList.get(0).getCount());
|
|
|
}
|
|
|
|
|
|
//赋值类型总计
|
|
|
List<ProductInfo> productInfoTotalList = productInfoTotalMap.get(dictTenantDataVo.getDictKey());
|
|
|
- if (ObjectUtil.isNotEmpty(productInfoTotalList)){
|
|
|
- map1.put("typeTotal",productInfoTotalList.get(0).getCount());
|
|
|
+ if (ObjectUtil.isNotEmpty(productInfoTotalList)) {
|
|
|
+ map1.put("typeTotal", productInfoTotalList.get(0).getCount());
|
|
|
}
|
|
|
typeList.add(map1);
|
|
|
}
|
|
|
- map.put("typeList",typeList);
|
|
|
+ map.put("typeList", typeList);
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 产品分布(数据看板-产品分析页面)
|
|
|
+ *
|
|
|
* @param productInfoDto
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ProductInfo> productDistribution(ProductInfoDto productInfoDto) {
|
|
|
if (ObjectUtil.isEmpty(productInfoDto) && ObjectUtil.isEmpty(productInfoDto.getBeginTime())
|
|
|
- && StringUtils.isNotEmpty(productInfoDto.getEndTime())){
|
|
|
- throw new ServiceException("参数缺失:开始时间,结束时间不能为null");
|
|
|
+ && StringUtils.isNotEmpty(productInfoDto.getEndTime())) {
|
|
|
+ throw new ServiceException("参数缺失:开始时间,结束时间不能为null");
|
|
|
}
|
|
|
QueryWrapper<ProductInfo> query = Wrappers.<ProductInfo>query();
|
|
|
query.select("count(*) count,type");
|
|
@@ -345,39 +478,41 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
/**
|
|
|
* 产品类型排行(数据看板-产品分析页面)
|
|
|
+ *
|
|
|
* @param productInfoDto
|
|
|
*/
|
|
|
@Override
|
|
|
public Page<ProductInfoVo> productTypeRanking(ProductInfoSelectDto productInfoDto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')",productInfoDto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')",productInfoDto.getEndTime());
|
|
|
- query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()),"bc.buy_country_id",productInfoDto.getCountryId());
|
|
|
- sort(query,productInfoDto);
|
|
|
+ query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
|
|
|
+ query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
|
|
|
+ query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()), "bc.buy_country_id", productInfoDto.getCountryId());
|
|
|
+ sort(query, productInfoDto);
|
|
|
query.groupBy("pi.type");
|
|
|
- Page<ProductInfoVo> productInfoVos = baseMapper.productTypeRanking(productInfoDto.getPage(),query);
|
|
|
+ Page<ProductInfoVo> productInfoVos = baseMapper.productTypeRanking(productInfoDto.getPage(), query);
|
|
|
return productInfoVos;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 产品排行(数据看板-产品分析页面)
|
|
|
+ *
|
|
|
* @param productInfoDto
|
|
|
*/
|
|
|
@Override
|
|
|
public Page<ProductInfoVo> productRanking(ProductInfoSelectDto productInfoDto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')",productInfoDto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')",productInfoDto.getEndTime());
|
|
|
- query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()),"bc.buy_country_id",productInfoDto.getCountryId());
|
|
|
- sort(query,productInfoDto);
|
|
|
+ query.ge("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getBeginTime());
|
|
|
+ query.le("DATE_FORMAT(pc.create_time,'%Y-%m-%d')", productInfoDto.getEndTime());
|
|
|
+ query.eq(ObjectUtil.isNotEmpty(productInfoDto.getCountryId()), "bc.buy_country_id", productInfoDto.getCountryId());
|
|
|
+ sort(query, productInfoDto);
|
|
|
query.groupBy("pi.name");
|
|
|
- Page<ProductInfoVo> productInfoVos = baseMapper.productRanking(productInfoDto.getPage(),query);
|
|
|
+ Page<ProductInfoVo> productInfoVos = baseMapper.productRanking(productInfoDto.getPage(), query);
|
|
|
return productInfoVos;
|
|
|
}
|
|
|
|
|
|
|
|
|
//根据字典编码获取字典的数据
|
|
|
- private List<DictTenantDataVo> getDict(String code){
|
|
|
+ private List<DictTenantDataVo> getDict(String code) {
|
|
|
DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
dto.setDictCode(code);
|
|
|
List<DictTenantDataVo> dictTenantDataServiceList = dictTenantDataService.getList(dto);
|
|
@@ -385,17 +520,17 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
}
|
|
|
|
|
|
//排序(添加排序条件)
|
|
|
- private void sort( QueryWrapper<Object> query,ProductInfoSelectDto productInfoDto){
|
|
|
- if (productInfoDto.getOrderBy() ==10){//正序
|
|
|
- query.orderByAsc(productInfoDto.getSort() ==10,"contractQuantity");
|
|
|
- query.orderByAsc(productInfoDto.getSort() ==20,"contractAmount");
|
|
|
- query.orderByAsc(productInfoDto.getSort() ==30,"purchaseQuantity");
|
|
|
- query.orderByAsc(productInfoDto.getSort() ==40,"purchaseAmount");
|
|
|
- }else if (productInfoDto.getOrderBy() == 20){//倒序
|
|
|
- query.orderByDesc(productInfoDto.getSort() ==10,"contractQuantity");
|
|
|
- query.orderByDesc(productInfoDto.getSort() ==20,"contractAmount");
|
|
|
- query.orderByDesc(productInfoDto.getSort() ==30,"purchaseQuantity");
|
|
|
- query.orderByDesc(productInfoDto.getSort() ==40,"purchaseAmount");
|
|
|
+ private void sort(QueryWrapper<Object> query, ProductInfoSelectDto productInfoDto) {
|
|
|
+ if (productInfoDto.getOrderBy() == 10) {//正序
|
|
|
+ query.orderByAsc(productInfoDto.getSort() == 10, "contractQuantity");
|
|
|
+ query.orderByAsc(productInfoDto.getSort() == 20, "contractAmount");
|
|
|
+ query.orderByAsc(productInfoDto.getSort() == 30, "purchaseQuantity");
|
|
|
+ query.orderByAsc(productInfoDto.getSort() == 40, "purchaseAmount");
|
|
|
+ } else if (productInfoDto.getOrderBy() == 20) {//倒序
|
|
|
+ query.orderByDesc(productInfoDto.getSort() == 10, "contractQuantity");
|
|
|
+ query.orderByDesc(productInfoDto.getSort() == 20, "contractAmount");
|
|
|
+ query.orderByDesc(productInfoDto.getSort() == 30, "purchaseQuantity");
|
|
|
+ query.orderByDesc(productInfoDto.getSort() == 40, "purchaseAmount");
|
|
|
}
|
|
|
}
|
|
|
|