|
|
|
@ -1,24 +1,18 @@ |
|
|
|
|
package org.jeecg.modules.demo.zyaccessories.controller; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
import org.jeecg.modules.demo.accessories.entity.ZyAccessories; |
|
|
|
|
import org.jeecg.modules.demo.accessories.service.IZyAccessoriesService; |
|
|
|
|
import org.jeecg.modules.demo.fabric.service.IZyFabricService; |
|
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccDetailVO; |
|
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccessories; |
|
|
|
|
import org.jeecg.modules.demo.zyaccessories.mapper.ZyStyleAccessoriesMapper; |
|
|
|
@ -29,22 +23,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.zystylefabric.entity.ZyStyleFabricDetailVo; |
|
|
|
|
import org.jeecg.modules.zystylefabric.mapper.ZyStyleFabricMapper; |
|
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams; |
|
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
@ -88,35 +73,25 @@ public class ZyStyleAccessoriesController extends JeecgController<ZyStyleAccesso |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
//zyStyleAccessories.getAccessNum() 辅料编号 查询参数 只有查询的时候才会有
|
|
|
|
|
// List<ZyAccessories> accessories = new ArrayList<>();
|
|
|
|
|
// if (StringUtils.hasText(zyStyleAccessories.getAccessNum())) {
|
|
|
|
|
// LambdaQueryWrapper<ZyAccessories> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
|
// queryWrapper2.like(ZyAccessories::getNums, zyStyleAccessories.getAccessNum());
|
|
|
|
|
// accessories.addAll(zyAccessoriesService.list());
|
|
|
|
|
// }
|
|
|
|
|
List<ZyAccessories> accessories = new ArrayList<>(); |
|
|
|
|
if (StringUtils.hasText(zyStyleAccessories.getAccessNum())) { |
|
|
|
|
accessories.addAll(zyAccessoriesService.list(new LambdaQueryWrapper<ZyAccessories>().like(ZyAccessories::getNums, zyStyleAccessories.getAccessNum()))); |
|
|
|
|
} |
|
|
|
|
QueryWrapper<ZyStyleAccessories> queryWrapper = QueryGenerator.initQueryWrapper(zyStyleAccessories, req.getParameterMap()); |
|
|
|
|
Page<ZyStyleAccessories> page = new Page<ZyStyleAccessories>(pageNo, pageSize); |
|
|
|
|
IPage<ZyStyleAccessories> pageList = zyStyleAccessoriesService.page(page, queryWrapper); |
|
|
|
|
IPage<ZyStyleAccessories> pageList = zyStyleAccessoriesService.page(new Page<>(pageNo, pageSize), queryWrapper); |
|
|
|
|
List<ZyStyleAccessories> listRecords = pageList.getRecords(); |
|
|
|
|
|
|
|
|
|
// if (!ObjectUtils.isEmpty(accessories) && !ObjectUtils.isEmpty(listRecords)) {
|
|
|
|
|
// for (ZyAccessories zy : accessories) {
|
|
|
|
|
// listRecords.stream()
|
|
|
|
|
// .filter(ZyStyleAccessories -> ZyStyleAccessories.getAccessoriesId().equals(zy.getId()))
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
for (ZyStyleAccessories zy : listRecords) { |
|
|
|
|
String typeName = zyStyleFabricMapper.getTypeName(zy.getStyleId()); |
|
|
|
|
String num = zyStyleFabricMapper.getAccessoriesNumById(zy.getAccessoriesId()); |
|
|
|
|
if (StringUtils.hasText(typeName)) { |
|
|
|
|
zy.setTypeName(typeName); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.hasText(num)) { |
|
|
|
|
zy.setAccessNum(num); |
|
|
|
|
} |
|
|
|
|
if (!ObjectUtils.isEmpty(accessories) && !ObjectUtils.isEmpty(listRecords)) { |
|
|
|
|
List<ZyStyleAccessories> list = new ArrayList<>(); |
|
|
|
|
accessories.forEach(zy -> listRecords.stream().filter(ZyStyleAccess -> ZyStyleAccess.getAccessoriesId().equals(zy.getId())).forEachOrdered(list::add)); |
|
|
|
|
pageList.setRecords(list.stream().distinct().collect(Collectors.toList()));//去重
|
|
|
|
|
} |
|
|
|
|
pageList.getRecords().forEach(zyStyleAccess -> { |
|
|
|
|
String typeName = zyStyleFabricMapper.getTypeName(zyStyleAccess.getStyleId()); |
|
|
|
|
String num = zyStyleFabricMapper.getAccessoriesNumById(zyStyleAccess.getAccessoriesId()); |
|
|
|
|
if (StringUtils.hasText(typeName)) zyStyleAccess.setTypeName(typeName); |
|
|
|
|
if (StringUtils.hasText(num)) zyStyleAccess.setAccessNum(num); |
|
|
|
|
}); |
|
|
|
|
return Result.OK(pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|