|
@@ -11,7 +11,11 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
+import org.jeecg.modules.afterCode.entity.AfterComplaintProduct;
|
|
|
+import org.jeecg.modules.afterCode.service.IAfterComplaintProductService;
|
|
|
import org.jeecg.modules.baseCode.service.ISerialPatternService;
|
|
|
+import org.jeecg.modules.cuspCode.entity.CuspSupplierProfile;
|
|
|
+import org.jeecg.modules.cuspCode.service.ICuspSupplierProfileService;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -60,9 +64,13 @@ public class AfterComplaintController {
|
|
|
private IAfterComplaintService afterComplaintService;
|
|
|
@Autowired
|
|
|
private IAfterComplaintShipService afterComplaintShipService;
|
|
|
+ @Autowired
|
|
|
+ private IAfterComplaintProductService afterComplaintProductService;
|
|
|
@Autowired
|
|
|
private ISerialPatternService serialPatternService;
|
|
|
-
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierProfileService cuspSupplierProfileService;
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -126,7 +134,7 @@ public class AfterComplaintController {
|
|
|
}
|
|
|
|
|
|
afterComplaint.setDeal("未处理");
|
|
|
- afterComplaintService.saveMain(afterComplaint, afterComplaintPage.getAfterComplaintShipList());
|
|
|
+ afterComplaintService.saveMain(afterComplaint, afterComplaintPage.getAfterComplaintShipList(), afterComplaintPage.getAfterComplaintProductList());
|
|
|
return Result.OK("添加成功!");
|
|
|
}
|
|
|
|
|
@@ -147,14 +155,34 @@ public class AfterComplaintController {
|
|
|
if(afterComplaintEntity==null) {
|
|
|
return Result.error("未找到对应数据");
|
|
|
}
|
|
|
- if(afterComplaintEntity.getAcceptanceTime() !=null){
|
|
|
- afterComplaint.setAcceptanceTime(new Date());
|
|
|
+
|
|
|
+ String supplierName = "";
|
|
|
+ if(StringUtils.isNotBlank(afterComplaintPage.getPkSupplier())){
|
|
|
+ for(String o:afterComplaintPage.getPkSupplier().split(",")){
|
|
|
+ CuspSupplierProfile ent = cuspSupplierProfileService.getById(o);
|
|
|
+ if(ent !=null){
|
|
|
+ if(StringUtils.isBlank(supplierName)){
|
|
|
+ supplierName = ent.getName();
|
|
|
+ }else{
|
|
|
+ supplierName = supplierName+","+ent.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ afterComplaint.setSupplierName(supplierName);
|
|
|
}
|
|
|
- afterComplaint.setDealTime(new Date());
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- afterComplaint.setDealman(sysUser.getUsername());
|
|
|
|
|
|
- afterComplaintService.updateMain(afterComplaint, afterComplaintPage.getAfterComplaintShipList());
|
|
|
+ if(StringUtils.isNotBlank(afterComplaintPage.getDeal())){
|
|
|
+ if(afterComplaint.getDealTime() == null){
|
|
|
+ afterComplaint.setDealTime(new Date());
|
|
|
+ }
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ afterComplaint.setDealman(sysUser.getUsername());
|
|
|
+ if(afterComplaint.getAcceptanceTime() == null){
|
|
|
+ afterComplaint.setAcceptanceTime(new Date());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ afterComplaintService.updateMain(afterComplaint, afterComplaintPage.getAfterComplaintShipList(), afterComplaintPage.getAfterComplaintProductList());
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
|
|
@@ -368,86 +396,104 @@ public class AfterComplaintController {
|
|
|
return Result.OK(afterComplaintShipList);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param afterComplaint
|
|
|
- */
|
|
|
- @RequiresPermissions("afterCode:after_complaint:exportXls")
|
|
|
- @RequestMapping(value = "/exportXls")
|
|
|
- public ModelAndView exportXls(HttpServletRequest request, AfterComplaint afterComplaint) {
|
|
|
- // Step.1 组装查询条件查询数据
|
|
|
- QueryWrapper<AfterComplaint> queryWrapper = QueryGenerator.initQueryWrapper(afterComplaint, request.getParameterMap());
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
-
|
|
|
- //配置选中数据查询条件
|
|
|
- String selections = request.getParameter("selections");
|
|
|
- if(oConvertUtils.isNotEmpty(selections)) {
|
|
|
- List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
- queryWrapper.in("id",selectionList);
|
|
|
- }
|
|
|
- //Step.2 获取导出数据
|
|
|
- List<AfterComplaint> afterComplaintList = afterComplaintService.list(queryWrapper);
|
|
|
-
|
|
|
- // Step.3 组装pageList
|
|
|
- List<AfterComplaintPage> pageList = new ArrayList<AfterComplaintPage>();
|
|
|
- for (AfterComplaint main : afterComplaintList) {
|
|
|
- AfterComplaintPage vo = new AfterComplaintPage();
|
|
|
- BeanUtils.copyProperties(main, vo);
|
|
|
- List<AfterComplaintShip> afterComplaintShipList = afterComplaintShipService.selectByMainId(main.getId());
|
|
|
- vo.setAfterComplaintShipList(afterComplaintShipList);
|
|
|
- pageList.add(vo);
|
|
|
- }
|
|
|
-
|
|
|
- // Step.4 AutoPoi 导出Excel
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, "客户投诉列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, AfterComplaintPage.class);
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("客户投诉数据", "导出人:"+sysUser.getRealname(), "客户投诉"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
- return mv;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequiresPermissions("afterCode:after_complaint:importExcel")
|
|
|
- @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
- public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
- Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
- for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
- // 获取上传文件对象
|
|
|
- MultipartFile file = entity.getValue();
|
|
|
- ImportParams params = new ImportParams();
|
|
|
- params.setTitleRows(2);
|
|
|
- params.setHeadRows(1);
|
|
|
- params.setNeedSave(true);
|
|
|
- try {
|
|
|
- List<AfterComplaintPage> list = ExcelImportUtil.importExcel(file.getInputStream(), AfterComplaintPage.class, params);
|
|
|
- for (AfterComplaintPage page : list) {
|
|
|
- AfterComplaint po = new AfterComplaint();
|
|
|
- BeanUtils.copyProperties(page, po);
|
|
|
- afterComplaintService.saveMain(po, page.getAfterComplaintShipList());
|
|
|
- }
|
|
|
- return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- return Result.error("文件导入失败:"+e.getMessage());
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- file.getInputStream().close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return Result.OK("文件导入失败!");
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "客户投诉-产品通过主表ID查询")
|
|
|
+ @ApiOperation(value="客户投诉-产品主表ID查询", notes="客户投诉-产品-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryAfterComplaintProductByMainId")
|
|
|
+ public Result<List<AfterComplaintProduct>> queryAfterComplaintProductListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
+ List<AfterComplaintProduct> afterComplaintProductList = afterComplaintProductService.selectByMainId(id);
|
|
|
+ return Result.OK(afterComplaintProductList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param afterComplaint
|
|
|
+ */
|
|
|
+ @RequiresPermissions("afterCode:after_complaint:exportXls")
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, AfterComplaint afterComplaint) {
|
|
|
+ // Step.1 组装查询条件查询数据
|
|
|
+ QueryWrapper<AfterComplaint> queryWrapper = QueryGenerator.initQueryWrapper(afterComplaint, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ //配置选中数据查询条件
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
+ if(oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ queryWrapper.in("id",selectionList);
|
|
|
+ }
|
|
|
+ //Step.2 获取导出数据
|
|
|
+ List<AfterComplaint> afterComplaintList = afterComplaintService.list(queryWrapper);
|
|
|
+
|
|
|
+ // Step.3 组装pageList
|
|
|
+ List<AfterComplaintPage> pageList = new ArrayList<AfterComplaintPage>();
|
|
|
+ for (AfterComplaint main : afterComplaintList) {
|
|
|
+ AfterComplaintPage vo = new AfterComplaintPage();
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ List<AfterComplaintShip> afterComplaintShipList = afterComplaintShipService.selectByMainId(main.getId());
|
|
|
+ vo.setAfterComplaintShipList(afterComplaintShipList);
|
|
|
+ List<AfterComplaintProduct> afterComplaintProductList = afterComplaintProductService.selectByMainId(main.getId());
|
|
|
+ vo.setAfterComplaintProductList(afterComplaintProductList);
|
|
|
+ pageList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Step.4 AutoPoi 导出Excel
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "客户投诉列表");
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, AfterComplaintPage.class);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("客户投诉数据", "导出人:"+sysUser.getRealname(), "客户投诉"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequiresPermissions("afterCode:after_complaint:importExcel")
|
|
|
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
+ Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
+ for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
+ // 获取上传文件对象
|
|
|
+ MultipartFile file = entity.getValue();
|
|
|
+ ImportParams params = new ImportParams();
|
|
|
+ params.setTitleRows(2);
|
|
|
+ params.setHeadRows(1);
|
|
|
+ params.setNeedSave(true);
|
|
|
+ try {
|
|
|
+ List<AfterComplaintPage> list = ExcelImportUtil.importExcel(file.getInputStream(), AfterComplaintPage.class, params);
|
|
|
+ for (AfterComplaintPage page : list) {
|
|
|
+ AfterComplaint po = new AfterComplaint();
|
|
|
+ BeanUtils.copyProperties(page, po);
|
|
|
+ afterComplaintService.saveMain(po, page.getAfterComplaintShipList(),page.getAfterComplaintProductList());
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ return Result.error("文件导入失败:"+e.getMessage());
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ file.getInputStream().close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|