diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java index 7eaf72913..d385763bd 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java @@ -26,9 +26,7 @@ import com.logpm.aftersales.dto.AftersalesWorkOrderDTO; import com.logpm.aftersales.dto.AftersalesWorkOrderListExcelDTO; import com.logpm.aftersales.entity.*; import com.logpm.aftersales.excel.AftersalesWorkOrderImporter; -import com.logpm.aftersales.service.IAftersaleSurveyRecordService; -import com.logpm.aftersales.service.IAftersalesCompletionRecordService; -import com.logpm.aftersales.service.IAftersalesPersonResponsibleService; +import com.logpm.aftersales.service.*; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import io.swagger.annotations.Api; @@ -54,7 +52,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.aftersales.vo.AftersalesWorkOrderVO; import com.logpm.aftersales.excel.AftersalesWorkOrderExcel; import com.logpm.aftersales.wrapper.AftersalesWorkOrderWrapper; -import com.logpm.aftersales.service.IAftersalesWorkOrderService; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.excel.util.ExcelUtil; @@ -62,12 +59,17 @@ import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; import java.io.IOException; +import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; +import static io.vertx.sqlclient.data.NullValue.LocalDateTime; + /** * 客服异常工单 控制器 * @@ -86,6 +88,7 @@ public class AftersalesWorkOrderController extends BladeController { private final IAftersalesCompletionRecordService aftersalesCompletionRecordService; private final IAftersalesPersonResponsibleService aftersalesPersonResponsibleService; private final IAftersaleSurveyRecordService aftersaleSurveyRecordService; + private final IAftersalesCompletionRecipientService aftersalesCompletionRecipientService; /** * 客服异常工单 详情 @@ -97,6 +100,7 @@ public class AftersalesWorkOrderController extends BladeController { AftersalesWorkOrderEntity detail = aftersalesWorkOrderService.getOne(Condition.getQueryWrapper(aftersalesWorkOrder)); return R.data(AftersalesWorkOrderWrapper.build().entityVO(detail)); } + /** * 客服异常工单 分页 */ @@ -105,14 +109,14 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperation(value = "分页", notes = "传入aftersalesWorkOrder") public R> list(@ApiIgnore @RequestParam Map aftersalesWorkOrder, Query query) { BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { aftersalesWorkOrder.put("warehouseId", myCurrentWarehouse.getId()); } - try{ + try { IPage pages = aftersalesWorkOrderService.page(Condition.getPage(query), Condition.getQueryWrapper(aftersalesWorkOrder, AftersalesWorkOrderEntity.class)); return R.data(AftersalesWorkOrderWrapper.build().pageVO(pages)); - }catch (Exception e ){ - log.error("工单查询系统异常》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("工单查询系统异常》》》{}", e.getMessage()); return R.fail("系统异常!"); } @@ -125,12 +129,12 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "查询异常工单完整数据集合", notes = "传入aftersalesWorkOrder") public R> getListOwn(@ApiIgnore @RequestParam Map aftersalesWorkOrder, Query query) { - log.info("异常工单查询参数》》》{}",aftersalesWorkOrder); - try{ + log.info("异常工单查询参数》》》{}", aftersalesWorkOrder); + try { IPage pages = aftersalesWorkOrderService.pageListOwn(aftersalesWorkOrder, Condition.getPage(query)); return R.data(pages); - }catch (Exception e){ - log.error("工单查询系统异常》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("工单查询系统异常》》》{}", e.getMessage()); return R.fail("系统异常!"); } @@ -143,17 +147,17 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "查询异常工单理赔信息", notes = "传入aftersalesWorkOrder") public R> getListSettlement(@ApiIgnore @RequestParam Map aftersalesWorkOrder, Query query) { - log.info("查询理赔参数》》》{}",aftersalesWorkOrder); + log.info("查询理赔参数》》》{}", aftersalesWorkOrder); BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ - aftersalesWorkOrder.put("business_id",myCurrentWarehouse.getId()); - aftersalesWorkOrder.put("business_name",myCurrentWarehouse.getName()); + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { + aftersalesWorkOrder.put("business_id", myCurrentWarehouse.getId()); + aftersalesWorkOrder.put("business_name", myCurrentWarehouse.getName()); } - try{ + try { IPage pages = aftersalesWorkOrderService.getListSettlement(aftersalesWorkOrder, Condition.getPage(query)); return R.data(pages); - }catch(Exception e){ - log.error("查询异常工单理赔信息>>{}",e.getMessage()); + } catch (Exception e) { + log.error("查询异常工单理赔信息>>{}", e.getMessage()); return R.fail("系统异常"); } @@ -166,24 +170,24 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "营业部提交异常工单处理结果", notes = "传入aftersalesWorkOrder") public R addProcessingResults(@RequestBody AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { - log.info("营业部提交异常工单处理结果》》》{}",aftersalesWorkOrderDTO); - if(ObjectUtils.isNull( aftersalesWorkOrderDTO.getId())){ - throw new ServiceException("异常工单ID不能为空"); - } - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getAftersalesProcessingResultsDTO())){ - throw new ServiceException("异常工单处理结果不能为空"); - } - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getResultIdentification())){ - throw new ServiceException("异常工单处理结果标识不能为空!!"); - } - try { - return R.status(aftersalesWorkOrderService.addProcessingResults(aftersalesWorkOrderDTO)); - }catch (ServiceException s){ - return R.fail(s.getMessage()); - }catch(Exception e){ - log.error("营业部提交异常工单处理结果>>>{}",e.getMessage()); - return R.fail("系统异常!!"); - } + log.info("营业部提交异常工单处理结果》》》{}", aftersalesWorkOrderDTO); + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())) { + throw new ServiceException("异常工单ID不能为空"); + } + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getAftersalesProcessingResultsDTO())) { + throw new ServiceException("异常工单处理结果不能为空"); + } + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getResultIdentification())) { + throw new ServiceException("异常工单处理结果标识不能为空!!"); + } + try { + return R.status(aftersalesWorkOrderService.addProcessingResults(aftersalesWorkOrderDTO)); + } catch (ServiceException s) { + return R.fail(s.getMessage()); + } catch (Exception e) { + log.error("营业部提交异常工单处理结果>>>{}", e.getMessage()); + return R.fail("系统异常!!"); + } } @@ -222,15 +226,14 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "查询客服人员信息", notes = "传入aftersalesWorkOrder") public R> listUser() { - try{ - List list = aftersalesWorkOrderService.getCustomerServicePersonnel(); + try { + List list = aftersalesWorkOrderService.getCustomerServicePersonnel(); return R.data(list); - }catch(ServiceException s){ - log.error("查询客服人员信息>>>>{}",s.getMessage()); + } catch (ServiceException s) { + log.error("查询客服人员信息>>>>{}", s.getMessage()); return R.fail(s.getMessage()); - } - catch(Exception e){ - log.error("查询客服人员信息>>>>{}",e.getMessage()); + } catch (Exception e) { + log.error("查询客服人员信息>>>>{}", e.getMessage()); return R.fail("系统异常!!"); } @@ -245,21 +248,21 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperation(value = "新增调查记录", notes = "传入aftersaleSurveyRecord") public R savaSurveyRecord(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { log.info("回复添加接口》》》{}", aftersalesWorkOrderDTO); - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getSurveyRecordDTO())){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getSurveyRecordDTO())) { throw new ServiceException("调查数据不能为空"); } - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())) { throw new ServiceException("异常工单ID不能为空"); } - try{ - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getSurveyRecordDTO().getContent())){ + try { + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getSurveyRecordDTO().getContent())) { throw new ServiceException("内容不能为空!!"); } return R.status(aftersalesWorkOrderService.savaSurveyRecord(aftersalesWorkOrderDTO)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error(">新增调查记录>>{}",e.getMessage()); + } catch (Exception e) { + log.error(">新增调查记录>>{}", e.getMessage()); return R.fail("系统异常!!"); } } @@ -273,14 +276,14 @@ public class AftersalesWorkOrderController extends BladeController { public R getSurveyRecord(AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { log.info("查询调查记录》》》{}", aftersalesWorkOrderDTO); - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())) { throw new ServiceException("异常工单ID不能为空"); } - try{ + try { AftersalesWorkOrderVO list = aftersalesWorkOrderService.getSurveyRecord(aftersalesWorkOrderDTO); return R.data(list); - }catch(Exception e){ - log.error("查询调查记录>>>{}",e.getMessage()); + } catch (Exception e) { + log.error("查询调查记录>>>{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -296,14 +299,14 @@ public class AftersalesWorkOrderController extends BladeController { public R getTrackRecord(AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { log.info("查询全部跟踪记录》》》{}", aftersalesWorkOrderDTO); - if(ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getId())) { throw new ServiceException("异常工单ID不能为空"); } - try{ + try { AftersalesWorkOrderVO list = aftersalesWorkOrderService.getTrackRecord(aftersalesWorkOrderDTO); return R.data(list); - }catch (Exception e){ - log.error("查询全部跟踪记录>>>{}",e.getMessage()); + } catch (Exception e) { + log.error("查询全部跟踪记录>>>{}", e.getMessage()); return R.fail("系统异常!!!"); } } @@ -317,10 +320,10 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperation(value = "查询营业部责任人人员信息", notes = "传入aftersalesWorkOrder") public R> getBusinessDepartmentUser(Long warehouseId) { try { - List list = aftersalesWorkOrderService.getBusinessDepartmentUser(warehouseId); + List list = aftersalesWorkOrderService.getBusinessDepartmentUser(warehouseId); return R.data(list); - }catch(Exception e){ - log.error("查询营业部责任人人员信息》》{}",e.getMessage()); + } catch (Exception e) { + log.error("查询营业部责任人人员信息》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -333,20 +336,20 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "客服异常工单 异常工单分配处理客服信息", notes = "传入aftersalesWorkOrder") public R updateAssignCustomerService(@RequestBody AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { - log.info("异常工单分配处理客服信息>>>{}",aftersalesWorkOrderDTO.toString()); - if(ObjectUtils.isNull( aftersalesWorkOrderDTO.getAssignList() )){ + log.info("异常工单分配处理客服信息>>>{}", aftersalesWorkOrderDTO.toString()); + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getAssignList())) { return R.fail("请选择指派的工单 !"); } - if(ObjectUtils.isNull( aftersalesWorkOrderDTO.getCustomerServiceId() ) || ObjectUtils.isNull( aftersalesWorkOrderDTO.getCustomerServiceName() )){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getCustomerServiceId()) || ObjectUtils.isNull(aftersalesWorkOrderDTO.getCustomerServiceName())) { return R.fail("请填写客服信息 !"); } - try{ + try { R r = aftersalesWorkOrderService.updateAssignCustomerService(aftersalesWorkOrderDTO); return R.success("提交成功!"); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("异常工单分配处理客服信息》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("异常工单分配处理客服信息》》》{}", e.getMessage()); return R.fail("系统异常!!"); } @@ -359,27 +362,26 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 2) @ApiOperation(value = "客服异常工单 异常工单仲裁 分配处理客服信息", notes = "传入aftersalesWorkOrder") public R updateAssignArbitrateService(@RequestBody AftersalesWorkOrderDTO aftersalesWorkOrderDTO) { - log.info("异常工单仲裁 分配处理客服信息>>>{}",aftersalesWorkOrderDTO.toString()); - if(ObjectUtils.isNull( aftersalesWorkOrderDTO.getAssignList() )){ + log.info("异常工单仲裁 分配处理客服信息>>>{}", aftersalesWorkOrderDTO.toString()); + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getAssignList())) { return R.fail("请选择指派的工单 !"); } - if(ObjectUtils.isNull( aftersalesWorkOrderDTO.getCustomerServiceId() ) || ObjectUtils.isNull( aftersalesWorkOrderDTO.getCustomerServiceName() )){ + if (ObjectUtils.isNull(aftersalesWorkOrderDTO.getCustomerServiceId()) || ObjectUtils.isNull(aftersalesWorkOrderDTO.getCustomerServiceName())) { return R.fail("请填写客服信息 !"); } try { R r = aftersalesWorkOrderService.updateAssignArbitrateService(aftersalesWorkOrderDTO); return R.success("提交成功!"); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("异常工单仲裁 分配处理客服信息>>{}",e.getMessage()); + } catch (Exception e) { + log.error("异常工单仲裁 分配处理客服信息>>{}", e.getMessage()); return R.fail("系统异常!!"); } } - /** * 客服异常工单 自定义分页 */ @@ -411,10 +413,10 @@ public class AftersalesWorkOrderController extends BladeController { public R addCompletionEnd(@Valid @RequestBody List aftersalesWorkOrder) { try { return R.status(aftersalesWorkOrderService.addCompletionEnd(aftersalesWorkOrder)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("客服完结处理>>>{}",e.getMessage()); + } catch (Exception e) { + log.error("客服完结处理>>>{}", e.getMessage()); return R.fail("系统异常!!"); } @@ -427,18 +429,18 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 4) @ApiOperation(value = "异常工单 修改完结处理", notes = "传入aftersalesWorkOrder") public R updateCompletionEnd(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("修改完结处理>>>{}",aftersalesWorkOrder.toString()); - if(ObjectUtils.isNull(aftersalesWorkOrder.getId())){ + log.info("修改完结处理>>>{}", aftersalesWorkOrder.toString()); + if (ObjectUtils.isNull(aftersalesWorkOrder.getId())) { throw new ServiceException("异常工单ID不能为空!"); } try { return R.status(aftersalesWorkOrderService.updateCompletionEnd(aftersalesWorkOrder)); - } catch (ServiceException s){ + } catch (ServiceException s) { s.printStackTrace(); return R.fail(s.getMessage()); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); - log.error("修改完结处理》》》{}",e.getMessage()); + log.error("修改完结处理》》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -451,20 +453,20 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入aftersalesAppeal") public R update(@Valid @RequestBody AftersalesAppealEntity aftersalesAppeal) { - log.info("客服操作确定修改》》》》{}",aftersalesAppeal); - if(ObjectUtils.isNull(aftersalesAppeal.getId())){ + log.info("客服操作确定修改》》》》{}", aftersalesAppeal); + if (ObjectUtils.isNull(aftersalesAppeal.getId())) { throw new ServiceException("申述ID不能为空!!"); } - if(ObjectUtils.isNull(aftersalesAppeal.getWorkOrderId())){ + if (ObjectUtils.isNull(aftersalesAppeal.getWorkOrderId())) { throw new ServiceException("异常工单ID不能为空!!"); } try { return R.status(aftersalesWorkOrderService.updateByIdAppel(aftersalesAppeal)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("客服操作确定修改》》》{}",e.getMessage()); - return R.fail("系统错误:"+e.getMessage()); + } catch (Exception e) { + log.error("客服操作确定修改》》》{}", e.getMessage()); + return R.fail("系统错误:" + e.getMessage()); } } @@ -475,15 +477,15 @@ public class AftersalesWorkOrderController extends BladeController { @GetMapping("/getProcessingResults") @ApiOperationSupport(order = 4) @ApiOperation(value = "客服异常工单 查询详情全部信息数据", notes = "传入aftersalesWorkOrder") - public R getProcessingResults(AftersalesWorkOrderDTO aftersalesWorkOrder) { - if(ObjectUtils.isNull(aftersalesWorkOrder.getId())){ + public R getProcessingResults(AftersalesWorkOrderDTO aftersalesWorkOrder) { + if (ObjectUtils.isNull(aftersalesWorkOrder.getId())) { return R.fail("异常工单ID不能为空!!"); } try { AftersalesWorkOrderVO workOrderVO = aftersalesWorkOrderService.getProcessingResults(aftersalesWorkOrder); return R.data(workOrderVO); - }catch (Exception e){ - log.error("查询详情全部信息数据》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("查询详情全部信息数据》》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -495,20 +497,20 @@ public class AftersalesWorkOrderController extends BladeController { @PostMapping("/arbitrate") @ApiOperationSupport(order = 5) @ApiOperation(value = "申请仲裁", notes = "传入aftersalesWorkOrder") - public R updateArbitrate (@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("申请仲裁>>>>{}",aftersalesWorkOrder); - if(ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getAssignList().isEmpty()){ + public R updateArbitrate(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { + log.info("申请仲裁>>>>{}", aftersalesWorkOrder); + if (ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getAssignList().isEmpty()) { throw new ServiceException("数据不能为空!!"); } - if(ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getReasonRemarks().isEmpty()){ + if (ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getReasonRemarks().isEmpty()) { throw new ServiceException("申请理由不能为空!!"); } try { return R.status(aftersalesWorkOrderService.updateArbitrate(aftersalesWorkOrder)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("申请仲裁》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("申请仲裁》》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -521,16 +523,16 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "客服异常工单 客服仲裁完结操作", notes = "传入aftersalesWorkOrder") public R addArbitrateEnd(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("客服仲裁完结操作》》》{}",aftersalesWorkOrder); - if(ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getAssignList().isEmpty()){ + log.info("客服仲裁完结操作》》》{}", aftersalesWorkOrder); + if (ObjectUtils.isNull(aftersalesWorkOrder) || aftersalesWorkOrder.getAssignList().isEmpty()) { throw new ServiceException("数据不能为空!!"); } try { return R.status(aftersalesWorkOrderService.addArbitrateEnd(aftersalesWorkOrder)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("客服仲裁完结操作》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("客服仲裁完结操作》》》{}", e.getMessage()); return R.fail("系统异常!!"); } @@ -543,11 +545,11 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入aftersalesWorkOrder") public R update(@Valid @RequestBody AftersalesWorkOrderEntity aftersalesWorkOrder) { - log.info("修改参数》》》{}",aftersalesWorkOrder.toString()); + log.info("修改参数》》》{}", aftersalesWorkOrder.toString()); try { return R.status(aftersalesWorkOrderService.updateById(aftersalesWorkOrder)); - }catch (Exception e){ - log.error("工单修改异常》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("工单修改异常》》》{}", e.getMessage()); return R.fail("系统异常!!"); } } @@ -559,15 +561,15 @@ public class AftersalesWorkOrderController extends BladeController { @PostMapping("/updateArbitrateStatus") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入aftersalesWorkOrder") - public R updateArbitrateStatus (@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("修改参数》》》{}",aftersalesWorkOrder.toString()); - if(ObjectUtils.isNull(aftersalesWorkOrder) || ObjectUtils.isNull( aftersalesWorkOrder.getAssignList())){ + public R updateArbitrateStatus(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { + log.info("修改参数》》》{}", aftersalesWorkOrder.toString()); + if (ObjectUtils.isNull(aftersalesWorkOrder) || ObjectUtils.isNull(aftersalesWorkOrder.getAssignList())) { throw new ServiceException("参数不全assignList!"); } try { return R.status(aftersalesWorkOrderService.updateArbitrateStatus(aftersalesWorkOrder)); - }catch (Exception e){ - log.error("工单修改异常》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("工单修改异常》》》{}", e.getMessage()); return R.fail("系统异常!!"); } } @@ -579,16 +581,16 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入aftersalesWorkOrder") public R updateManagerConfirmed(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("客服经理确定数据》》》{}",aftersalesWorkOrder.toString()); - if(aftersalesWorkOrder.getAssignList().isEmpty()){ + log.info("客服经理确定数据》》》{}", aftersalesWorkOrder.toString()); + if (aftersalesWorkOrder.getAssignList().isEmpty()) { throw new ServiceException("确定工单ID不能为空!!"); } try { - return R.status( aftersalesWorkOrderService.updateManagerConfirmed(aftersalesWorkOrder) ); - }catch (ServiceException s){ + return R.status(aftersalesWorkOrderService.updateManagerConfirmed(aftersalesWorkOrder)); + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("客服经理确定数据》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("客服经理确定数据》》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -601,16 +603,16 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改订单状态", notes = "传入aftersalesWorkOrder") public R updateWorkOrderStatus(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("修改参数》》》{}",aftersalesWorkOrder.toString()); - if(aftersalesWorkOrder.getAssignList().isEmpty()){ + log.info("修改参数》》》{}", aftersalesWorkOrder.toString()); + if (aftersalesWorkOrder.getAssignList().isEmpty()) { throw new ServiceException("修改工单数据ID不能为空!!"); } try { return R.status(aftersalesWorkOrderService.updateWorkOrderStatus(aftersalesWorkOrder)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("批量修改工单状态为已处理>>{}",e.getMessage()); + } catch (Exception e) { + log.error("批量修改工单状态为已处理>>{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -623,16 +625,16 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入aftersalesWorkOrder") public R getUpdateWorkList(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("修改 钉钉流程号、审核人、审核日期,财务理赔入账日期、操作人》》》{}",aftersalesWorkOrder); - if(ObjectUtils.isNull( aftersalesWorkOrder.getAssignList())){ + log.info("修改 钉钉流程号、审核人、审核日期,财务理赔入账日期、操作人》》》{}", aftersalesWorkOrder); + if (ObjectUtils.isNull(aftersalesWorkOrder.getAssignList())) { return R.fail("更新的异常工单不能为空!!"); } - try{ + try { return aftersalesWorkOrderService.getUpdateWorkList(aftersalesWorkOrder); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("填写钉钉流程号异常》》{}",e.getMessage()); + } catch (Exception e) { + log.error("填写钉钉流程号异常》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -645,48 +647,47 @@ public class AftersalesWorkOrderController extends BladeController { @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入aftersalesWorkOrder") public R submit(@Valid @RequestBody AftersalesWorkOrderDTO aftersalesWorkOrder) { - log.info("工单创建的数据{}",aftersalesWorkOrder.toString()); - if(ObjectUtils.isNull( aftersalesWorkOrder.getId()) ){ + log.info("工单创建的数据{}", aftersalesWorkOrder.toString()); + if (ObjectUtils.isNull(aftersalesWorkOrder.getId())) { //新增 - if(ObjectUtils.isNull( aftersalesWorkOrder.getOrderCode()) ){ + if (ObjectUtils.isNull(aftersalesWorkOrder.getOrderCode())) { throw new ServiceException("订单自编号未填!"); } } try { aftersalesWorkOrder.setInitiationIdentification("PC"); return R.status(aftersalesWorkOrderService.saveOrUpdateOwn(aftersalesWorkOrder)); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - } catch (Exception e){ - log.error("工单提交异常》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("工单提交异常》》》{}", e.getMessage()); return R.fail(e.getMessage()); } } - /** * 客服异常工单 仓库查询待处理的异常工单 */ @GetMapping("/pendingWorkOrder") @ApiOperationSupport(order = 6) @ApiOperation(value = "处理方 仓库查询待处理的异常工单", notes = "传入aftersalesWorkOrder") - public R getPendingWorkOrder(@RequestParam Map aftersalesWorkOrder,Query query) { + public R getPendingWorkOrder(@RequestParam Map aftersalesWorkOrder, Query query) { AftersalesWorkOrderDTO aftersalesWorkOrderDTO = JSONObject.parseObject(JSONObject.toJSONString(aftersalesWorkOrder), AftersalesWorkOrderDTO.class); - log.info("处理方 仓库查询待处理的异常工单{}",aftersalesWorkOrder.toString()); + log.info("处理方 仓库查询待处理的异常工单{}", aftersalesWorkOrder.toString()); BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNotNull(myCurrentWarehouse)){ + if (ObjectUtils.isNotNull(myCurrentWarehouse)) { aftersalesWorkOrderDTO.setWarehouseId(myCurrentWarehouse.getId()); } try { - IPage list= aftersalesWorkOrderService.getPendingWorkOrder(aftersalesWorkOrderDTO,Condition.getPage(query)); + IPage list = aftersalesWorkOrderService.getPendingWorkOrder(aftersalesWorkOrderDTO, Condition.getPage(query)); return R.data(list); - }catch (ServiceException s){ + } catch (ServiceException s) { return R.fail(s.getMessage()); - }catch (Exception e){ - log.error("仓库查询待处理的异常工单》》》{}",e.getMessage()); + } catch (Exception e) { + log.error("仓库查询待处理的异常工单》》》{}", e.getMessage()); return R.fail("系统异常!!!"); } @@ -705,7 +706,6 @@ public class AftersalesWorkOrderController extends BladeController { /** * 导出数据 - * */ @GetMapping("/export-aftersalesWorkOrder") @ApiOperationSupport(order = 9) @@ -718,7 +718,6 @@ public class AftersalesWorkOrderController extends BladeController { /** * 导出数据 - * */ @GetMapping("/exportWorkOrder") @ApiOperationSupport(order = 9) @@ -731,19 +730,14 @@ public class AftersalesWorkOrderController extends BladeController { } - /** * 处理中导出数据 - * */ @GetMapping("/exportWorkOrder0") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入aftersalesWorkOrder") public void allExportWorkOrder(@ApiIgnore @RequestParam Map aftersalesWorkOrder, BladeUser bladeUser, HttpServletResponse response) { List> basicTitle = aftersalesWorkOrderService.basicTitleBuild(); - //查询数据 - List head1 = new ArrayList<>(Arrays.asList("总部处理客服")); - basicTitle.add(head1); List head2 = new ArrayList<>(Arrays.asList("处理结果")); basicTitle.add(head2); List head3 = new ArrayList<>(Arrays.asList("理赔金额")); @@ -756,6 +750,7 @@ public class AftersalesWorkOrderController extends BladeController { basicTitle.add(head6); List head7 = new ArrayList<>(Arrays.asList("钉钉号")); basicTitle.add(head7); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); List exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -763,30 +758,33 @@ public class AftersalesWorkOrderController extends BladeController { List> dataList = new ArrayList<>(); for (AftersalesWorkOrderVO exportDatum : exportData) { List data = new ArrayList<>(); - data.add(0,exportDatum.getWorkOrderTypeName()); - data.add(1,exportDatum.getDiscoveryNodeName()); - data.add(2,exportDatum.getWarehouseName()); - data.add(3,exportDatum.getWorkOrderNumber()); - data.add(4,exportDatum.getWaybillNumber()); - data.add(5,exportDatum.getOrderCode()); - data.add(6,exportDatum.getPackageCode()); - data.add(7,exportDatum.getBrandName()); - data.add(8,exportDatum.getWaybillMall()); - data.add(9,exportDatum.getFirst()); - data.add(10,exportDatum.getWorkOrderStatusName()); - data.add(11,exportDatum.getBusinessName()); - data.add(12,sdf.format(exportDatum.getCreateTime())); - data.add(13,sdf.format(exportDatum.getEndCreateTime())); - data.add(14,Objects.isNull(exportDatum.getUpdateTime())?"":sdf.format(exportDatum.getUpdateTime())); - data.add(15,""); - data.add(16,exportDatum.getCustomerServiceName()); - data.add(17,exportDatum.getHeadquartersName()); - data.add(18,exportDatum.getResultTypes()); - data.add(19,exportDatum.getTotalAmountNum()); - data.add(20,exportDatum.getCompleteTime()); - data.add(21,exportDatum.getIsAppeal()); - data.add(22,exportDatum.getAppealStatusName()); - data.add(23,exportDatum.getProcessNumber()); + data.add(0, exportDatum.getWorkOrderTypeName()); + data.add(1, exportDatum.getDiscoveryNodeName()); + data.add(2, exportDatum.getWarehouseName()); + data.add(3, exportDatum.getWorkOrderNumber()); + data.add(4, exportDatum.getWaybillNumber()); + data.add(5, exportDatum.getOrderCode()); + data.add(6, exportDatum.getPackageCode()); + data.add(7, exportDatum.getBrandName()); + data.add(8, exportDatum.getWaybillMall()); + data.add(9, exportDatum.getFirst()); + data.add(10, exportDatum.getWorkOrderStatusName()); + data.add(11, exportDatum.getBusinessName()); + data.add(12, sdf.format(exportDatum.getCreateTime())); + data.add(13, sdf.format(exportDatum.getEndCreateTime())); + data.add(14, Objects.isNull(exportDatum.getUpdateTime()) ? "" : sdf.format(exportDatum.getUpdateTime())); + Date createTime = exportDatum.getCreateTime(); + Date updateTime = Objects.isNull(exportDatum.getUpdateTime()) ? new Date() : exportDatum.getUpdateTime(); + int a = (int) ((updateTime.getTime() - createTime.getTime()) / (1000 * 3600 * 24)); + data.add(15, a > 2 ? "是" : "否"); + data.add(16, exportDatum.getCustomerServiceName()); + data.add(17, exportDatum.getHeadquartersName()); + data.add(18, exportDatum.getResultTypes()); + data.add(19, exportDatum.getTotalAmountNum()); + data.add(20, exportDatum.getCompleteTime()); + data.add(21, exportDatum.getIsAppeal()); + data.add(22, exportDatum.getAppealStatusName()); + data.add(23, exportDatum.getProcessNumber()); //查询此工单是否存在有责任方如果存在有责任方完善表头 // List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() // .eq(AftersalesPersonResponsibleEntity::getWordOrderId, exportDatum.getId()) @@ -807,7 +805,7 @@ public class AftersalesWorkOrderController extends BladeController { .head(basicTitle) // 当然这里数据也可以用 List> 去传入 .build(); - excelWriter.write(dataList,sheet); + excelWriter.write(dataList, sheet); excelWriter.finish(); } catch (IOException e) { throw new RuntimeException(e); @@ -819,7 +817,6 @@ public class AftersalesWorkOrderController extends BladeController { /** * 处理中导出数据 - * */ @GetMapping("/exportWorkOrder1") @ApiOperationSupport(order = 9) @@ -831,33 +828,40 @@ public class AftersalesWorkOrderController extends BladeController { List exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (!exportData.isEmpty()) { + List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() + .in(AftersalesPersonResponsibleEntity::getWordOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") + ); + Map> personResponsibleMap = null; + if (!entityList.isEmpty()) { + personResponsibleMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId)); + handlePersonResponsibleTitle(basicTitle, personResponsibleMap); + } List> dataList = new ArrayList<>(); for (AftersalesWorkOrderVO exportDatum : exportData) { List data = new ArrayList<>(); - data.add(0,exportDatum.getWorkOrderTypeName()); - data.add(1,exportDatum.getDiscoveryNodeName()); - data.add(2,exportDatum.getWarehouseName()); - data.add(3,exportDatum.getWorkOrderNumber()); - data.add(4,exportDatum.getWaybillNumber()); - data.add(5,exportDatum.getOrderCode()); - data.add(6,exportDatum.getPackageCode()); - data.add(7,exportDatum.getBrandName()); - data.add(8,exportDatum.getWaybillMall()); - data.add(9,exportDatum.getFirst()); - data.add(10,exportDatum.getWorkOrderStatusName()); - data.add(11,exportDatum.getBusinessName()); - data.add(12,sdf.format(exportDatum.getCreateTime())); - data.add(13,sdf.format(exportDatum.getEndCreateTime())); - data.add(14,Objects.isNull(exportDatum.getUpdateTime())?"":sdf.format(exportDatum.getUpdateTime())); - data.add(15,""); - data.add(16,""); - //查询此工单是否存在有责任方如果存在有责任方完善表头 - List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() - .eq(AftersalesPersonResponsibleEntity::getWordOrderId, exportDatum.getId()) - .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") - ); - if (!entityList.isEmpty()) { - handleResponsibility(basicTitle,entityList,data); + data.add(0, exportDatum.getWorkOrderTypeName()); + data.add(1, exportDatum.getDiscoveryNodeName()); + data.add(2, exportDatum.getWarehouseName()); + data.add(3, exportDatum.getWorkOrderNumber()); + data.add(4, exportDatum.getWaybillNumber()); + data.add(5, exportDatum.getOrderCode()); + data.add(6, exportDatum.getPackageCode()); + data.add(7, exportDatum.getBrandName()); + data.add(8, exportDatum.getWaybillMall()); + data.add(9, exportDatum.getFirst()); + data.add(10, exportDatum.getWorkOrderStatusName()); + data.add(11, exportDatum.getBusinessName()); + data.add(12, sdf.format(exportDatum.getCreateTime())); + data.add(13, sdf.format(exportDatum.getEndCreateTime())); + data.add(14, Objects.isNull(exportDatum.getUpdateTime()) ? "" : sdf.format(exportDatum.getUpdateTime())); + Date createTime = exportDatum.getCreateTime(); + Date updateTime = Objects.isNull(exportDatum.getUpdateTime()) ? new Date() : exportDatum.getUpdateTime(); + int a = (int) ((updateTime.getTime() - createTime.getTime()) / (1000 * 3600 * 24)); + data.add(15, a > 2 ? "是" : "否"); + data.add(16, exportDatum.getCustomerServiceName()); + if (personResponsibleMap!= null && Objects.isNull(personResponsibleMap.get(exportDatum.getId()))) { + handleResponsibility(basicTitle, entityList, data); } dataList.add(data); } @@ -871,7 +875,7 @@ public class AftersalesWorkOrderController extends BladeController { .head(basicTitle) // 当然这里数据也可以用 List> 去传入 .build(); - excelWriter.write(dataList,sheet); + excelWriter.write(dataList, sheet); excelWriter.finish(); } catch (IOException e) { throw new RuntimeException(e); @@ -883,7 +887,6 @@ public class AftersalesWorkOrderController extends BladeController { /** * 处理中导出数据 - * */ @GetMapping("/exportWorkOrder2") @ApiOperationSupport(order = 9) @@ -898,35 +901,44 @@ public class AftersalesWorkOrderController extends BladeController { List exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (!exportData.isEmpty()) { + List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() + .in(AftersalesPersonResponsibleEntity::getWordOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") + ); + Map> personResponsibleMap = null; + if (!entityList.isEmpty()) { + personResponsibleMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId)); + handlePersonResponsibleTitle(basicTitle, personResponsibleMap); + } List> dataList = new ArrayList<>(); for (AftersalesWorkOrderVO exportDatum : exportData) { List data = new ArrayList<>(); - data.add(0,exportDatum.getWorkOrderTypeName()); - data.add(1,exportDatum.getDiscoveryNodeName()); - data.add(2,exportDatum.getWarehouseName()); - data.add(3,exportDatum.getWorkOrderNumber()); - data.add(4,exportDatum.getWaybillNumber()); - data.add(5,exportDatum.getOrderCode()); - data.add(6,exportDatum.getPackageCode()); - data.add(7,exportDatum.getBrandName()); - data.add(8,exportDatum.getWaybillMall()); - data.add(9,exportDatum.getFirst()); - data.add(10,exportDatum.getWorkOrderStatusName()); - data.add(11,exportDatum.getBusinessName()); - data.add(12,sdf.format(exportDatum.getCreateTime())); - data.add(13,sdf.format(exportDatum.getEndCreateTime())); - data.add(14,Objects.isNull(exportDatum.getUpdateTime())?"":sdf.format(exportDatum.getUpdateTime())); - data.add(15,""); - data.add(16,""); - data.add(17,exportDatum.getResultTypes()); - data.add(18,exportDatum.getTotalAmountNum()); + data.add(0, exportDatum.getWorkOrderTypeName()); + data.add(1, exportDatum.getDiscoveryNodeName()); + data.add(2, exportDatum.getWarehouseName()); + data.add(3, exportDatum.getWorkOrderNumber()); + data.add(4, exportDatum.getWaybillNumber()); + data.add(5, exportDatum.getOrderCode()); + data.add(6, exportDatum.getPackageCode()); + data.add(7, exportDatum.getBrandName()); + data.add(8, exportDatum.getWaybillMall()); + data.add(9, exportDatum.getFirst()); + data.add(10, exportDatum.getWorkOrderStatusName()); + data.add(11, exportDatum.getBusinessName()); + data.add(12, sdf.format(exportDatum.getCreateTime())); + data.add(13, sdf.format(exportDatum.getEndCreateTime())); + data.add(14, Objects.isNull(exportDatum.getUpdateTime()) ? "" : sdf.format(exportDatum.getUpdateTime())); + Date createTime = exportDatum.getCreateTime(); + Date updateTime = Objects.isNull(exportDatum.getUpdateTime()) ? new Date() : exportDatum.getUpdateTime(); + int a = (int) ((updateTime.getTime() - createTime.getTime()) / (1000 * 3600 * 24)); + data.add(15, a > 2 ? "是" : "否"); + data.add(16, ""); + data.add(17, exportDatum.getResultTypes()); + data.add(18, exportDatum.getTotalAmountNum()); //查询此工单是否存在有责任方如果存在有责任方完善表头 - List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() - .eq(AftersalesPersonResponsibleEntity::getWordOrderId, exportDatum.getId()) - .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") - ); - if (!entityList.isEmpty()) { - handleResponsibility(basicTitle,entityList,data); + + if (personResponsibleMap!= null && !Objects.isNull(personResponsibleMap.get(exportDatum.getId()))) { + handleResponsibility(basicTitle, personResponsibleMap.get(exportDatum.getId()), data); } dataList.add(data); } @@ -940,7 +952,7 @@ public class AftersalesWorkOrderController extends BladeController { .head(basicTitle) // 当然这里数据也可以用 List> 去传入 .build(); - excelWriter.write(dataList,sheet); + excelWriter.write(dataList, sheet); excelWriter.finish(); } catch (IOException e) { throw new RuntimeException(e); @@ -950,19 +962,14 @@ public class AftersalesWorkOrderController extends BladeController { } - /** * 处理中导出数据 - * */ @GetMapping("/exportWorkOrder3") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入aftersalesWorkOrder") public void processingCompletedExportWorkOrder(@ApiIgnore @RequestParam Map aftersalesWorkOrder, BladeUser bladeUser, HttpServletResponse response) { List> basicTitle = aftersalesWorkOrderService.basicTitleBuild(); - //查询数据 - List head1 = new ArrayList<>(Arrays.asList("营业部处理客服")); - basicTitle.add(head1); List head2 = new ArrayList<>(Arrays.asList("处理结果")); basicTitle.add(head2); List head3 = new ArrayList<>(Arrays.asList("理赔金额")); @@ -970,36 +977,45 @@ public class AftersalesWorkOrderController extends BladeController { List exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (!exportData.isEmpty()) { + List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() + .in(AftersalesPersonResponsibleEntity::getWordOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") + ); + Map> personResponsibleMap = null; + if (!entityList.isEmpty()) { + personResponsibleMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId)); + handlePersonResponsibleTitle(basicTitle, personResponsibleMap); + } List> dataList = new ArrayList<>(); for (AftersalesWorkOrderVO exportDatum : exportData) { List data = new ArrayList<>(); - data.add(0,exportDatum.getWorkOrderTypeName()); - data.add(1,exportDatum.getDiscoveryNodeName()); - data.add(2,exportDatum.getWarehouseName()); - data.add(3,exportDatum.getWorkOrderNumber()); - data.add(4,exportDatum.getWaybillNumber()); - data.add(5,exportDatum.getOrderCode()); - data.add(6,exportDatum.getPackageCode()); - data.add(7,exportDatum.getBrandName()); - data.add(8,exportDatum.getWaybillMall()); - data.add(9,exportDatum.getFirst()); - data.add(10,exportDatum.getWorkOrderStatusName()); - data.add(11,exportDatum.getBusinessName()); - data.add(12,sdf.format(exportDatum.getCreateTime())); - data.add(13,sdf.format(exportDatum.getEndCreateTime())); - data.add(14,Objects.isNull(exportDatum.getUpdateTime())?"":sdf.format(exportDatum.getUpdateTime())); - data.add(15,""); - data.add(16,exportDatum.getCustomerServiceName()); - data.add(17,exportDatum.getHeadquartersName()); - data.add(18,exportDatum.getResultTypes()); - data.add(19,exportDatum.getTotalAmountNum()); + data.add(0, exportDatum.getWorkOrderTypeName()); + data.add(1, exportDatum.getDiscoveryNodeName()); + data.add(2, exportDatum.getWarehouseName()); + data.add(3, exportDatum.getWorkOrderNumber()); + data.add(4, exportDatum.getWaybillNumber()); + data.add(5, exportDatum.getOrderCode()); + data.add(6, exportDatum.getPackageCode()); + data.add(7, exportDatum.getBrandName()); + data.add(8, exportDatum.getWaybillMall()); + data.add(9, exportDatum.getFirst()); + data.add(10, exportDatum.getWorkOrderStatusName()); + data.add(11, exportDatum.getBusinessName()); + data.add(12, sdf.format(exportDatum.getCreateTime())); + data.add(13, sdf.format(exportDatum.getEndCreateTime())); + data.add(14, Objects.isNull(exportDatum.getUpdateTime()) ? "" : sdf.format(exportDatum.getUpdateTime())); + Date createTime = exportDatum.getCreateTime(); + Date updateTime = Objects.isNull(exportDatum.getUpdateTime()) ? new Date() : exportDatum.getUpdateTime(); + int a = (int) ((updateTime.getTime() - createTime.getTime()) / (1000 * 3600 * 24)); + data.add(15, a > 2 ? "是" : "否"); + data.add(16, exportDatum.getCustomerServiceName()); + data.add(17, exportDatum.getHeadquartersName()); + data.add(18, exportDatum.getResultTypes()); + data.add(19, exportDatum.getTotalAmountNum()); //查询此工单是否存在有责任方如果存在有责任方完善表头 - List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() - .eq(AftersalesPersonResponsibleEntity::getWordOrderId, exportDatum.getId()) - .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") - ); - if (!entityList.isEmpty()) { - handleResponsibility(basicTitle,entityList,data); + + if (personResponsibleMap!= null && !Objects.isNull(personResponsibleMap.get(exportDatum.getId()))) { + handleResponsibility(basicTitle, personResponsibleMap.get(exportDatum.getId()), data); } dataList.add(data); } @@ -1013,7 +1029,7 @@ public class AftersalesWorkOrderController extends BladeController { .head(basicTitle) // 当然这里数据也可以用 List> 去传入 .build(); - excelWriter.write(dataList,sheet); + excelWriter.write(dataList, sheet); excelWriter.finish(); } catch (IOException e) { throw new RuntimeException(e); @@ -1022,62 +1038,291 @@ public class AftersalesWorkOrderController extends BladeController { } - private void handleResponsibility(List> basicTitle, List entityList, List data) { - Long wordOrderId = entityList.get(0).getWordOrderId(); - //查询最新消息 - List recordEntities = aftersaleSurveyRecordService.list(Wrappers.query().lambda() - .eq(AftersaleSurveyRecordEntity::getWorkOrderId, wordOrderId) - .orderByDesc(AftersaleSurveyRecordEntity::getCreateTime) - ); - if (!recordEntities.isEmpty()) { - int size = 0; - if (!basicTitle.contains(Arrays.asList("最新消息回复内容")) ){ - List head5 = new ArrayList<>(Arrays.asList("最新消息回复内容")); - size = basicTitle.size(); - basicTitle.add(size,head5); - - }else { - size = basicTitle.indexOf(Arrays.asList("最新消息回复内容")); + + /** + * 完结导出 + */ + @GetMapping("/exportWorkOrder4") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "导出数据", notes = "传入aftersalesWorkOrder") + public void endExportWorkOrder(@ApiIgnore @RequestParam Map aftersalesWorkOrder, BladeUser bladeUser, HttpServletResponse response) { + List> basicTitle = aftersalesWorkOrderService.basicTitleBuild(); + //查询数据 + List head2 = new ArrayList<>(Arrays.asList("处理结果")); + basicTitle.add(head2); + List head3 = new ArrayList<>(Arrays.asList("理赔金额")); + basicTitle.add(head3); + basicTitle.add(Arrays.asList("最新消息回复内容")); + List exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (!exportData.isEmpty()) { + //查询最新消息 + List recordEntities = aftersaleSurveyRecordService.list(Wrappers.query().lambda() + .eq(AftersaleSurveyRecordEntity::getWorkOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + .orderByDesc(AftersaleSurveyRecordEntity::getCreateTime) + ); + //查询此工单是否存在有责任方如果存在有责任方完善表头 + List entityList = aftersalesPersonResponsibleService.list(Wrappers.query().lambda() + .in(AftersalesPersonResponsibleEntity::getWordOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + .eq(AftersalesPersonResponsibleEntity::getTypesOf, "1") + ); + Map> personResponsibleMap = null; + Map> completionRecordleMap = null; + Map> completionRecipientleMap = null; + if (!entityList.isEmpty()) { + personResponsibleMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId)); + handlePersonResponsibleTitle(basicTitle, personResponsibleMap); + } + //查询赔款方 + List aftersalesCompletionRecordEntityList = aftersalesCompletionRecordService.list(Wrappers.query().lambda() + .in(AftersalesCompletionRecordEntity::getWorkOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + ); + if (!aftersalesCompletionRecordEntityList.isEmpty()) { + completionRecordleMap = aftersalesCompletionRecordEntityList.stream().collect(Collectors.groupingBy(AftersalesCompletionRecordEntity::getWorkOrderId)); + handlePersonCompletionRecordTitle(basicTitle, completionRecordleMap); + } + List aftersalesCompletionRecipientEntityList = aftersalesCompletionRecipientService.list(Wrappers.query().lambda() + .in(AftersalesCompletionRecipientEntity::getWorkOrderId, exportData.stream().map(AftersalesWorkOrderVO::getId).collect(Collectors.toList())) + ); + if (!aftersalesCompletionRecipientEntityList.isEmpty()) { + completionRecipientleMap = aftersalesCompletionRecipientEntityList.stream().collect(Collectors.groupingBy(AftersalesCompletionRecipientEntity::getWorkOrderId)); + handlePersonCompletionRecipientTitle(basicTitle, completionRecipientleMap); + + } + + List> dataList = new ArrayList<>(); + for (AftersalesWorkOrderVO exportDatum : exportData) { + List data = new ArrayList<>(); + data.add(0, exportDatum.getWorkOrderTypeName()); + data.add(1, exportDatum.getDiscoveryNodeName()); + data.add(2, exportDatum.getWarehouseName()); + data.add(3, exportDatum.getWorkOrderNumber()); + data.add(4, exportDatum.getWaybillNumber()); + data.add(5, exportDatum.getOrderCode()); + data.add(6, exportDatum.getPackageCode()); + data.add(7, exportDatum.getBrandName()); + data.add(8, exportDatum.getWaybillMall()); + data.add(9, exportDatum.getFirst()); + data.add(10, exportDatum.getWorkOrderStatusName()); + data.add(11, exportDatum.getBusinessName()); + data.add(12, sdf.format(exportDatum.getCreateTime())); + data.add(13, sdf.format(exportDatum.getEndCreateTime())); + data.add(14, Objects.isNull(exportDatum.getUpdateTime()) ? "" : sdf.format(exportDatum.getUpdateTime())); + Date createTime = exportDatum.getCreateTime(); + Date updateTime = Objects.isNull(exportDatum.getUpdateTime()) ? new Date() : exportDatum.getUpdateTime(); + int a = (int) ((updateTime.getTime() - createTime.getTime()) / (1000 * 3600 * 24)); + data.add(15, a > 2 ? "是" : "否"); + data.add(16, exportDatum.getCustomerServiceName()); + data.add(17, exportDatum.getHeadquartersName()); + data.add(18, exportDatum.getResultTypes()); + data.add(19, exportDatum.getTotalAmountNum()); + + if (personResponsibleMap!=null){ + if (!Objects.isNull(personResponsibleMap.get(exportDatum.getId()))) { + handleResponsibility(basicTitle, personResponsibleMap.get(exportDatum.getId()), data); + } + } + if (completionRecordleMap!=null){ + if (!Objects.isNull(completionRecordleMap.get(exportDatum.getId()))) { + handleCompletionRecord(basicTitle, completionRecordleMap.get(exportDatum.getId()), data); + } + } + + if (completionRecipientleMap!=null){ + if (!Objects.isNull(completionRecipientleMap.get(exportDatum.getId()))) { + handleCompletionRecipientEntity(basicTitle, completionRecipientleMap.get(exportDatum.getId()), data); + } + } + + dataList.add(data); + } + ServletOutputStream os = null; + try { + os = response.getOutputStream(); + ExcelWriter excelWriter = EasyExcel.write(os).build(); + + WriteSheet sheet = EasyExcel.writerSheet() + // 这里放入动态头 + .head(basicTitle) + // 当然这里数据也可以用 List> 去传入 + .build(); + excelWriter.write(dataList, sheet); + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + } + + + private void handlePersonCompletionRecipientTitle(List> basicTitle, Map> listMap) { + + int aa = 0; + for (Long l : listMap.keySet()) { + List aftersalesCompletionRecipientEntities = listMap.get(l); + aa = Math.max(aa, aftersalesCompletionRecipientEntities.size()); + } + for (int i = 0; i < aa; i++) { + if (!basicTitle.contains(Arrays.asList("受款方" + (i + 1)))) { + List head1 = new ArrayList<>(Arrays.asList("受款方" + (i + 1))); + basicTitle.add(basicTitle.size(), head1); + } + if (!basicTitle.contains(Arrays.asList("受款原因" + (i + 1)))) { + List head2 = new ArrayList<>(Arrays.asList("受款原因" + (i + 1))); + basicTitle.add(basicTitle.size(), head2); + } + if (!basicTitle.contains(Arrays.asList("受款金额" + (i + 1)))) { + List head3 = new ArrayList<>(Arrays.asList("受款金额" + (i + 1))); + basicTitle.add(basicTitle.size(), head3); } - data.add(size,recordEntities.get(0).getContent()); } + if (!basicTitle.contains(Arrays.asList("受款方金额总和"))) { + List head4 = new ArrayList<>(Arrays.asList("受款方金额总和")); + basicTitle.add(basicTitle.size(), head4); + } + } + + private void handlePersonCompletionRecordTitle(List> basicTitle, Map> listMap) { int aa = 0; - Map> listMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId)); for (Long l : listMap.keySet()) { + List aftersalesCompletionRecordEntities = listMap.get(l); + aa = Math.max(aa, aftersalesCompletionRecordEntities.size()); + } + for (int i = 0; i < aa; i++) { + if (!basicTitle.contains(Arrays.asList("赔款方" + (i + 1)))) { + List head1 = new ArrayList<>(Arrays.asList("赔款方" + (i + 1))); + basicTitle.add(basicTitle.size(), head1); + } + if (!basicTitle.contains(Arrays.asList("赔款原因" + (i + 1)))) { + List head2 = new ArrayList<>(Arrays.asList("赔款原因" + (i + 1))); + basicTitle.add(basicTitle.size(), head2); + } + if (!basicTitle.contains(Arrays.asList("赔款金额" + (i + 1)))) { + List head3 = new ArrayList<>(Arrays.asList("赔款金额" + (i + 1))); + basicTitle.add(basicTitle.size(), head3); + } + + } + if (!basicTitle.contains(Arrays.asList("赔款方金额总和"))) { + List head4 = new ArrayList<>(Arrays.asList("赔款方金额总和")); + basicTitle.add(basicTitle.size(), head4); + } + + } + + private void handlePersonResponsibleTitle(List> basicTitle, Map> listMap) { + int aa = 0; + for (Long l : listMap.keySet()) { List aftersalesPersonResponsibleEntities = listMap.get(l); aa = Math.max(aa, aftersalesPersonResponsibleEntities.size()); } for (int i = 0; i < aa; i++) { - if (!basicTitle.contains(Arrays.asList("责任方"+(i+1)))) { - List head1 = new ArrayList<>(Arrays.asList("责任方"+(i+1))); - basicTitle.add(basicTitle.size(),head1); + if (!basicTitle.contains(Arrays.asList("责任方" + (i + 1)))) { + List head1 = new ArrayList<>(Arrays.asList("责任方" + (i + 1))); + basicTitle.add(basicTitle.size(), head1); } - if (!basicTitle.contains(Arrays.asList("责任人"+(i+1)))) { - List head2 = new ArrayList<>(Arrays.asList("责任人"+(i+1))); - basicTitle.add(basicTitle.size(),head2); + if (!basicTitle.contains(Arrays.asList("责任人" + (i + 1)))) { + List head2 = new ArrayList<>(Arrays.asList("责任人" + (i + 1))); + basicTitle.add(basicTitle.size(), head2); } - if (!basicTitle.contains(Arrays.asList("三方责任人"+(i+1)))) { - List head3 = new ArrayList<>(Arrays.asList("三方责任人"+(i+1))); - basicTitle.add(basicTitle.size(),head3); + if (!basicTitle.contains(Arrays.asList("三方责任人" + (i + 1)))) { + List head3 = new ArrayList<>(Arrays.asList("三方责任人" + (i + 1))); + basicTitle.add(basicTitle.size(), head3); } - if (!basicTitle.contains(Arrays.asList("金额"+(i+1)))) { - List head4 = new ArrayList<>(Arrays.asList("金额"+(i+1))); - basicTitle.add(basicTitle.size(),head4); + if (!basicTitle.contains(Arrays.asList("金额" + (i + 1)))) { + List head4 = new ArrayList<>(Arrays.asList("金额" + (i + 1))); + basicTitle.add(basicTitle.size(), head4); } + } + if (!basicTitle.contains(Arrays.asList("责任方金额总和"))) { + List head4 = new ArrayList<>(Arrays.asList("责任方金额总和")); + basicTitle.add(basicTitle.size(), head4); + } + } + + private void handleResponsibility(List> basicTitle, List entityList, List data) { +// Long wordOrderId = entityList.get(0).getWordOrderId(); + BigDecimal bigDecimal = BigDecimal.ZERO; + for (int i = 0; i < entityList.size(); i++) { + int index = basicTitle.indexOf(Arrays.asList("责任方"+ (i + 1))); + int i1 = index - data.size(); + for (int i2 = 0; i2 < i1; i2++) { + data.add(""); + } + data.add(basicTitle.indexOf(Arrays.asList("责任方" + (i + 1))), entityList.get(i).getBusinessName()); + data.add(basicTitle.indexOf(Arrays.asList("责任人" + (i + 1))), entityList.get(i).getPersonResponsibleName()); + data.add(basicTitle.indexOf(Arrays.asList("三方责任人" + (i + 1))), entityList.get(i).getTripartite()); + data.add(basicTitle.indexOf(Arrays.asList("金额" + (i + 1))), entityList.get(i).getResponsibilityRatio()); + bigDecimal = bigDecimal.add(new BigDecimal(entityList.get(i).getResponsibilityRatio())); } + int index = basicTitle.indexOf(Arrays.asList("责任方金额总和")); + int i1 = index - data.size(); + if (index > data.size()) { + for (int i = 0; i < i1; i++) { + data.add(""); + } + } + data.add(basicTitle.indexOf(Arrays.asList("责任方金额总和")), String.valueOf(bigDecimal)); + + } + private void handleCompletionRecord(List> basicTitle, List entityList, List data) { + BigDecimal responsibleMoney = BigDecimal.ZERO; for (int i = 0; i < entityList.size(); i++) { - data.add(entityList.get(i).getBusinessName()); - data.add(entityList.get(i).getPersonResponsibleName()); - data.add(entityList.get(i).getTripartite()); - data.add(entityList.get(i).getResponsibilityRatio()); + int i1 = basicTitle.indexOf(Arrays.asList("赔款方" + (i + 1))); + if (i1>data.size()){ + int i2 = i1 - data.size(); + for (int i3 = 0; i3 < i2; i3++) { + data.add(""); + } + } + data.add(basicTitle.indexOf(Arrays.asList("赔款方" + (i + 1))), entityList.get(i).getIndemnitor()); + data.add(basicTitle.indexOf(Arrays.asList("赔款原因" + (i + 1))), entityList.get(i).getReason()); + BigDecimal money = entityList.get(i).getMoney(); + data.add(basicTitle.indexOf(Arrays.asList("赔款金额" + (i + 1))), String.valueOf(responsibleMoney)); + responsibleMoney = responsibleMoney.add(money); + } + int i1 = basicTitle.indexOf(Arrays.asList("赔款方金额总和" )); + if (i1>data.size()){ + int i2 = i1 - data.size(); + for (int i3 = 0; i3 < i2; i3++) { + data.add(""); + } } + data.add(basicTitle.indexOf(Arrays.asList("赔款方金额总和")), String.valueOf(responsibleMoney)); + } + + private void handleCompletionRecipientEntity(List> basicTitle, List entityList, List data) { + BigDecimal recipientMoney = BigDecimal.ZERO; + for (int i = 0; i < entityList.size(); i++) { + int i1 = basicTitle.indexOf(Arrays.asList("受款方" + (i + 1))); + if (i1>data.size()){ + int i2 = i1 - data.size(); + for (int i3 = 0; i3 < i2; i3++) { + data.add(""); + } + } + data.add(basicTitle.indexOf(Arrays.asList("受款方" + (i + 1))), entityList.get(i).getRecipient()); + data.add(basicTitle.indexOf(Arrays.asList("受款原因" + (i + 1))), entityList.get(i).getReasonReceivingPayment()); + BigDecimal money = entityList.get(i).getMoney(); + recipientMoney = recipientMoney.add(money); + data.add(basicTitle.indexOf(Arrays.asList("受款金额" + (i + 1))), String.valueOf(recipientMoney)); + } + int i1 = basicTitle.indexOf(Arrays.asList("受款方金额总和" )); + if (i1>data.size()){ + int i2 = i1 - data.size(); + for (int i3 = 0; i3 < i2; i3++) { + data.add(""); + } + } + data.add(basicTitle.indexOf(Arrays.asList("受款方金额总和")), String.valueOf(recipientMoney)); } @@ -1115,18 +1360,18 @@ public class AftersalesWorkOrderController extends BladeController { } /** - * 写入财务入账时间 + * 写入财务入账时间 */ @PostMapping("/updateFinanceTime") @ApiOperationSupport(order = 13) @ApiOperation(value = "写入财务入账时间", notes = "传入aftersalesWorkOrder") - public R updateFinanceTime(@Valid @RequestBody AftersalesWorkOrderVO aftersalesWorkOrderVO ) { + public R updateFinanceTime(@Valid @RequestBody AftersalesWorkOrderVO aftersalesWorkOrderVO) { - if (aftersalesWorkOrderVO.getIds() != null || aftersalesWorkOrderVO.getIds()!= ""){ - log.info("写入财务入账时间{},操作人{}",aftersalesWorkOrderVO.getEntryTime(),aftersalesWorkOrderVO.getOperator()); - return R.data(aftersalesWorkOrderService.updateFinanceTime(aftersalesWorkOrderVO.getIds(),aftersalesWorkOrderVO.getEntryTime(),aftersalesWorkOrderVO.getOperator())); - }else { - log.error("写入财务入账时间》》》{}",aftersalesWorkOrderVO); + if (aftersalesWorkOrderVO.getIds() != null || aftersalesWorkOrderVO.getIds() != "") { + log.info("写入财务入账时间{},操作人{}", aftersalesWorkOrderVO.getEntryTime(), aftersalesWorkOrderVO.getOperator()); + return R.data(aftersalesWorkOrderService.updateFinanceTime(aftersalesWorkOrderVO.getIds(), aftersalesWorkOrderVO.getEntryTime(), aftersalesWorkOrderVO.getOperator())); + } else { + log.error("写入财务入账时间》》》{}", aftersalesWorkOrderVO); return R.fail("系统异常!!!"); } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml index 2d89f589a..52f7589b1 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml @@ -133,6 +133,9 @@ and lawo.create_time between #{param.startCreateTime} and #{param.endCreateTime} + + and lawo.ceator like concat('%', #{param.ceator },'%') + and lawo.work_order_status = #{param.workOrderStatusNameS } and lawo.id = #{param.id } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java index 4a08ede96..021c0ba93 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java @@ -944,21 +944,21 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl warehouseIds = new ArrayList<>(); - if (!Objects.isNull(myCurrentWarehouse)){ - if (myCurrentWarehouse.getName().equals("职能中心仓")){ + if (!Objects.isNull(myCurrentWarehouse)) { + if (myCurrentWarehouse.getName().equals("职能中心仓")) { List warehouseList = warehouseClient.getMyWarehouseList(); if (!warehouseList.isEmpty()) { warehouseIds.addAll(warehouseList.stream().map(BasicdataWarehouseEntity::getId).collect(Collectors.toList())); } - }else { + } else { warehouseIds.add(myCurrentWarehouse.getId()); } - }else { + } else { //获取当前人所有仓权限信息 List warehouseIds1 = warehouseClient.getWarehouseIds(); if (!warehouseIds1.isEmpty()) { @@ -970,7 +970,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl iPage = baseMapper.pageListOwn(page, workOrderEntity,warehouseIds); + IPage iPage = baseMapper.pageListOwn(page, workOrderEntity, warehouseIds); if (iPage.getRecords().isEmpty()) { log.error(">>>>>>>>>>>>>>>>>>查询工单列表为空"); IPage data = AftersalesWorkOrderWrapper.build().pageVO(iPage); @@ -1717,7 +1717,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl surveyRecordEntity.setProcessorId(aftersalesProcessorEntity.getId())); surveyRecordEntity.setAddDepartment(myCurrentWarehouse.getDepartmentName()); surveyRecordEntity.setProcessingResults(surveyRecordEntity.getContent()); - if (!Objects.isNull(surveyRecordDTO.getPictureUrl())){ + if (!Objects.isNull(surveyRecordDTO.getPictureUrl())) { surveyRecordEntity.setPictureUrl(surveyRecordDTO.getPictureUrl()); } } else { @@ -1909,7 +1909,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl> roleNames = sysClient.getRoleNames(user.getRoleId()); if (!roleNames.getData().isEmpty()) { boolean contains = roleNames.getData().contains("仓库客服"); - if (!contains){ + if (!contains) { throw new ServiceException("当前登录人无操作权限"); } } @@ -1928,7 +1928,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl list1 = new ArrayList<>(); if (ObjectUtils.isNotNull(processorEntityList)) { AftersalesProcessorVO processorVO = new AftersalesProcessorVO(); - processorEntityList.forEach(f->{ + processorEntityList.forEach(f -> { BeanUtil.copyProperties(f, processorVO); list1.add(processorVO); }); @@ -2648,7 +2648,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl list = baseMapper.exportAllListOwn(workOrderEntity,ids); + List list = baseMapper.exportAllListOwn(workOrderEntity, ids); return list; @@ -2677,53 +2677,55 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl> basicTitleBuild() { List> title = new ArrayList<>(); List head0 = new ArrayList<>(Arrays.asList("异常类型")); - title.add(0,head0); + title.add(0, head0); List head1 = new ArrayList<>(Arrays.asList("发现节点")); - title.add(1,head1); + title.add(1, head1); List head2 = new ArrayList<>(Arrays.asList("工单创建仓")); - title.add(2,head2); + title.add(2, head2); List head3 = new ArrayList<>(Arrays.asList("工单号")); - title.add(3,head3); + title.add(3, head3); List head4 = new ArrayList<>(Arrays.asList("运单号")); - title.add(4,head4); + title.add(4, head4); List head5 = new ArrayList<>(Arrays.asList("订单自编号")); - title.add(5,head5); + title.add(5, head5); List head6 = new ArrayList<>(Arrays.asList("包条码")); - title.add(6,head6); + title.add(6, head6); List head7 = new ArrayList<>(Arrays.asList("品牌")); - title.add(7,head7); + title.add(7, head7); List head8 = new ArrayList<>(Arrays.asList("运单商场")); - title.add(8,head8); + title.add(8, head8); - List head9= new ArrayList<>(Arrays.asList("一级品类")); - title.add(9,head9); + List head9 = new ArrayList<>(Arrays.asList("一级品类")); + title.add(9, head9); List head10 = new ArrayList<>(Arrays.asList("工单状态")); - title.add(10,head10); + title.add(10, head10); List head11 = new ArrayList<>(Arrays.asList("工单处理方")); - title.add(11,head11); + title.add(11, head11); List head12 = new ArrayList<>(Arrays.asList("工单创建时间")); - title.add(12,head12); + title.add(12, head12); - List head13= new ArrayList<>(Arrays.asList("工单最晚处理时间")); - title.add(13,head13); + List head13 = new ArrayList<>(Arrays.asList("工单最晚处理时间")); + title.add(13, head13); - List head14= new ArrayList<>(Arrays.asList("工单最新处理时间")); - title.add(14,head14); + List head14 = new ArrayList<>(Arrays.asList("工单最新处理时间")); + title.add(14, head14); - List head15= new ArrayList<>(Arrays.asList("是否超时")); - title.add(15,head15); + List head15 = new ArrayList<>(Arrays.asList("是否超时")); + title.add(15, head15); - List head16= new ArrayList<>(Arrays.asList("营业部处理客服")); - title.add(16,head16); + List head16 = new ArrayList<>(Arrays.asList("营业部处理客服")); + title.add(16, head16); + List head17 = new ArrayList<>(Arrays.asList("总部处理客服")); + title.add(17, head17); return title; } @@ -2757,7 +2759,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl warehouseIds = new ArrayList<>(); - if (!Objects.isNull(myCurrentWarehouse)){ - if (myCurrentWarehouse.getName().equals("职能中心仓")){ + if (!Objects.isNull(myCurrentWarehouse)) { + if (myCurrentWarehouse.getName().equals("职能中心仓")) { List warehouseList = warehouseClient.getMyWarehouseList(); if (!warehouseList.isEmpty()) { warehouseIds.addAll(warehouseList.stream().map(BasicdataWarehouseEntity::getId).collect(Collectors.toList())); } - }else { + } else { warehouseIds.add(myCurrentWarehouse.getId()); } - }else { + } else { //获取当前人所有仓权限信息 List warehouseIds1 = warehouseClient.getWarehouseIds(); if (!warehouseIds1.isEmpty()) { @@ -2798,18 +2800,19 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl exportData = baseMapper.getBasicExportData(workOrderDTO,ids,warehouseIds); + List exportData = baseMapper.getBasicExportData(workOrderDTO, ids, warehouseIds); return exportData; } /** * 判断是否是客服角色 + * * @param user * @return */ - private boolean judgeIsCustomerService(BladeUser user){ + private boolean judgeIsCustomerService(BladeUser user) { String roleName = user.getRoleName(); - if (!Objects.isNull(roleName)){ + if (!Objects.isNull(roleName)) { List roleList = Arrays.asList(user.getRoleName().split(",")); List warehouseType = DictBizCache.getList("after_sales_visits"); Optional matchingDictBiz = warehouseType.stream() @@ -2819,7 +2822,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); + map.put("定制品集合", spaclOrderList); map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum()); // 通过预约单查询预约下面的订单 --1 或者 库存品 --2 @@ -7867,6 +7870,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(DistributionReservationStockarticleEntity::getReservationId, distributionReservationEntity.getId()); lambdaQueryWrapper.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, 2); + lambdaQueryWrapper.orderByAsc(DistributionReservationStockarticleEntity::getStockArticleCode); distributionReservationStockarticleEntityList = distributionReservationStockarticleService.list(lambdaQueryWrapper); log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 订单总数 {}", distributionReservationStockarticleEntityList.size()); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index a90b342b4..92cde5887 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -2557,6 +2557,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl parcelListEntities = distributionParcelListService.list(Wrappers.query().lambda() .in(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcodes()) .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) + .ne(DistributionParcelListEntity::getIsTransfer, 0) ); DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); if (Func.isEmpty(deliveryListEntity)) {