提交 5b5ae1fa authored 作者: 刘海泉's avatar 刘海泉

Merge remote-tracking branch 'origin/v30.2_break_contract_20241021' into dev_jdk17

package com.clx.performance.controller;
import com.clx.performance.param.pc.DealExceptionReportParam;
import com.clx.performance.service.OrderChildExceptionReportService;
import com.msl.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping(value="/pc/carrier/exceptionReport")
@Validated
@Tag(name = "承运端-异常上报")
@AllArgsConstructor
public class OrderChildExceptionReportController {
private final OrderChildExceptionReportService orderChildExceptionReportService;
@Deprecated
@Operation(summary = "异常上报处理", description = "<br>By:刘海泉")
public Result<?> updateDealExceptionReport(@RequestBody @Validated DealExceptionReportParam param) {
orderChildExceptionReportService.updateDealExceptionReport(param);
return Result.ok();
}
}
package com.clx.performance.controller.pc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.param.pc.DealExceptionReportParam;
import com.clx.performance.param.pc.PageExceptionReportParam;
import com.clx.performance.param.pc.TransferDriverBreakContractParam;
import com.clx.performance.service.OrderChildExceptionReportService;
import com.clx.performance.vo.pc.OrderChildExceptionReportVO;
import com.msl.common.base.PageData;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
@Slf4j
@RestController
@RequestMapping(value="/pc/carrier/exceptionReport")
@Validated
@Tag(name = "承运端-异常上报")
@AllArgsConstructor
public class OrderChildExceptionReportController {
private final OrderChildExceptionReportService orderChildExceptionReportService;
@Operation(summary = "异常上报处理", description = "<br>By:刘海泉")
@PostMapping(value = "updateDealExceptionReport")
public Result<Object> updateDealExceptionReport(@RequestBody @Validated DealExceptionReportParam param) {
orderChildExceptionReportService.updateDealExceptionReport(param);
return Result.ok();
}
@Operation(summary = "异常上报分页列表", description = "<br>By:刘海泉")
@PostMapping(value = "pageExceptionReport")
@UnitCovert(param = false)
public Result<PageData<OrderChildExceptionReportVO>> pageExceptionReport(@RequestBody @Validated PageExceptionReportParam param) {
Page<OrderChildExceptionReportVO> page = orderChildExceptionReportService.pageExceptionReport(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@Operation(summary = "导出异常上报分页列表", description = "<br>By:刘海泉")
@PostMapping(value = "exportExceptionReport")
public Result<Object> exportExceptionReport(@RequestBody @Validated PageExceptionReportParam param,
HttpServletResponse response) throws IOException {
SXSSFWorkbook workbook = orderChildExceptionReportService.exportExceptionReport(param);
response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE);
workbook.write(response.getOutputStream());
return Result.ok();
}
@Operation(summary = "异常上报详情接口", description = "<br>By:刘海泉")
@PostMapping(value = "getExceptionReport")
public Result<OrderChildExceptionReportVO> getExceptionReport(@RequestParam("id") @NotNull(message = "id不能为空") Integer id) {
return Result.ok(orderChildExceptionReportService.getExceptionReport(id));
}
@Operation(summary = "转司机违约", description = "<br>By:刘海泉")
@PostMapping(value = "transferDriverBreakContract")
public Result<Object> transferDriverBreakContract(@RequestBody @Validated TransferDriverBreakContractParam param) {
orderChildExceptionReportService.transferDriverBreakContract(param);
return Result.ok();
}
}
package com.clx.performance.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.PageExceptionReportParam;
import com.msl.common.dao.BaseDao;
import com.clx.performance.mapper.OrderChildExceptionReportMapper;
import com.clx.performance.model.OrderChildExceptionReport;
......@@ -11,4 +13,6 @@ import com.clx.performance.model.OrderChildExceptionReport;
*/
public interface OrderChildExceptionReportDao extends BaseDao<OrderChildExceptionReportMapper, OrderChildExceptionReport, Integer> {
OrderChildExceptionReport findByThirdReportNoAndSource(Integer source, String thirdReportNo);
IPage<OrderChildExceptionReport> pageExceptionReport(PageExceptionReportParam param);
}
package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.param.pc.PageExceptionReportParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import com.clx.performance.dao.OrderChildExceptionReportDao;
import com.clx.performance.mapper.OrderChildExceptionReportMapper;
import com.clx.performance.model.OrderChildExceptionReport;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import java.util.Objects;
/**
* @author kavin
* Date 2024-10-22
......@@ -21,4 +27,17 @@ public class OrderChildExceptionReportDaoImpl extends BaseDaoImpl<OrderChildExce
query.eq(OrderChildExceptionReport ::getThirdReportNo,thirdReportNo);
return baseMapper.selectOne(query);
}
@Override
public IPage<OrderChildExceptionReport> pageExceptionReport(PageExceptionReportParam param) {
LambdaQueryWrapper<OrderChildExceptionReport> query = new LambdaQueryWrapper<>();
query.eq(StringUtils.isNotBlank(param.getThirdReportNo()),OrderChildExceptionReport :: getThirdReportNo,param.getThirdReportNo());
query.eq(Objects.nonNull(param.getSource()),OrderChildExceptionReport ::getSource,param.getSource());
query.eq(Objects.nonNull(param.getStatus()),OrderChildExceptionReport ::getStatus,param.getStatus());
query.eq(StringUtils.isNotBlank(param.getChildNo()),OrderChildExceptionReport ::getChildNo,param.getChildNo());
query.eq(StringUtils.isNotBlank(param.getTruckNoOrMobile()),OrderChildExceptionReport ::getTruckNoOrMobile,param.getTruckNoOrMobile());
query.ge(StringUtils.isNotBlank(param.getBeginTime()),OrderChildExceptionReport ::getCreateTime,param.getBeginTime());
query.le(StringUtils.isNotBlank(param.getEndTime()),OrderChildExceptionReport ::getCreateTime,param.getEndTime());
return baseMapper.selectPage(Page.of(param.getPage(), param.getPageSize()),query);
}
}
......@@ -68,6 +68,10 @@ public class OrderChildExceptionReport implements HasKey<Integer> {
@Schema(description="异常上报时间")
private LocalDateTime reportTime;
@TableField("reason")
@Schema(description="异常原因描述")
private String reason;
@TableField("deal_user_code")
@Schema(description="处理人用户编码")
private Long dealUserCode;
......@@ -82,7 +86,7 @@ public class OrderChildExceptionReport implements HasKey<Integer> {
@TableField("deal_result")
@Schema(description="处理结果")
private String dealResult;
private Integer dealResult;
@TableField("transfer_driver_break_contract")
@Schema(description="是否转司机违约 1:是")
......
package com.clx.performance.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.open.sdk.request.action.*;
import com.clx.performance.param.pc.DealExceptionReportParam;
import com.clx.performance.param.pc.PageExceptionReportParam;
import com.clx.performance.param.pc.TransferDriverBreakContractParam;
import com.clx.performance.vo.pc.OrderChildExceptionReportVO;
import com.msl.common.result.Result;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
/**
* @author kavin
......@@ -23,4 +28,12 @@ public interface OrderChildExceptionReportService {
Result<Object> mslWithdrawExceptionReport(MslWithdrawExceptionReportAction action);
void updateDealExceptionReport(DealExceptionReportParam param);
Page<OrderChildExceptionReportVO> pageExceptionReport(PageExceptionReportParam param);
SXSSFWorkbook exportExceptionReport(PageExceptionReportParam param);
OrderChildExceptionReportVO getExceptionReport(Integer id);
void transferDriverBreakContract(TransferDriverBreakContractParam param);
}
......@@ -2,6 +2,8 @@ package com.clx.performance.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.open.sdk.callback.OpenCallBackClient;
import com.clx.open.sdk.callback.message.MslExceptionReportDealMessage;
import com.clx.open.sdk.callback.message.SmbExceptionReportDealMessage;
......@@ -17,9 +19,17 @@ import com.clx.performance.enums.SyncPlatformEnum;
import com.clx.performance.model.OrderChildExceptionReport;
import com.clx.performance.model.OrderChildExceptionReportDealLog;
import com.clx.performance.param.pc.DealExceptionReportParam;
import com.clx.performance.param.pc.PageExceptionReportParam;
import com.clx.performance.param.pc.TransferDriverBreakContractParam;
import com.clx.performance.service.OrderChildExceptionReportService;
import com.clx.performance.struct.OrderChildExceptionReportStruct;
import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.utils.excel.ExcelData;
import com.clx.performance.utils.excel.ExcelField;
import com.clx.performance.utils.excel.ExcelSheet;
import com.clx.performance.utils.excel.ExcelUtil;
import com.clx.performance.vo.pc.OrderChildExceptionReportVO;
import com.msl.common.base.Optional;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
import com.msl.common.utils.DateUtils;
......@@ -29,10 +39,12 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
......@@ -106,7 +118,7 @@ public class OrderChildExceptionReportServiceImpl implements OrderChildExceptio
report.setDealTime(LocalDateTime.now());
report.setDealUser(SyncPlatformEnum.Source.getNameByCode(source));
report.setStatus(CarrierExceptionReportEnum.Status.PROCESSED.getCode());
report.setDealResult(ExceptionReportEnum.DealResult.getNameByCode(breakContractParty));
report.setDealResult(breakContractParty);
orderChildExceptionReportDao.updateEntityByKey(report);
}
......@@ -199,7 +211,7 @@ public class OrderChildExceptionReportServiceImpl implements OrderChildExceptio
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
report.setStatus(CarrierExceptionReportEnum.Status.PROCESSED.getCode());
report.setDealTime(LocalDateTime.now());
report.setDealResult(ExceptionReportEnum.DealResult.CARRIER_BREAK_CONTRACT.getName());
report.setDealResult(ExceptionReportEnum.DealResult.CARRIER_BREAK_CONTRACT.getCode());
report.setDealUserCode(loginUserInfo.getUserNo());
report.setDealUser(loginUserInfo.getUserName());
......@@ -242,4 +254,98 @@ public class OrderChildExceptionReportServiceImpl implements OrderChildExceptio
}
}
@Override
public Page<OrderChildExceptionReportVO> pageExceptionReport(PageExceptionReportParam param) {
IPage<OrderChildExceptionReport> page = orderChildExceptionReportDao.pageExceptionReport(param);
return orderChildExceptionReportStruct.convertPage(page);
}
@Override
public SXSSFWorkbook exportExceptionReport(PageExceptionReportParam param) {
param.setPage(1);
param.setPageSize(1000000);
Page<OrderChildExceptionReportVO> page = pageExceptionReport(param);
List<OrderChildExceptionReportVO> list = page.getRecords();
// 组装表头
List<ExcelField> fieldList = new ArrayList<>();
fieldList.add(new ExcelField(0, "异常上报编号", "reportNo", 5000));
fieldList.add(new ExcelField(1, "三方异常上报编号", "thirdReportNo", 5000));
fieldList.add(new ExcelField(2, "来源", "sourceMsg", 5000));
fieldList.add(new ExcelField(3, "异常类别", "exceptionCategory", 5000));
fieldList.add(new ExcelField(4, "异常类型", "exceptionType", 5000));
fieldList.add(new ExcelField(5, "车牌号/手机号", "truckNoOrMobile", 5000));
fieldList.add(new ExcelField(6, "运单编号", "childNo", 5000));
fieldList.add(new ExcelField(7, "状态", "statusMsg", 5000));
fieldList.add(new ExcelField(8, "扣罚金额", "deductionAmount", 5000));
fieldList.add(new ExcelField(9, "异常上报时间", "reportTime", 5000));
fieldList.add(new ExcelField(10, "创建时间", "createTime", 5000));
fieldList.add(new ExcelField(11, "处理人", "dealUser", 5000));
fieldList.add(new ExcelField(11, "处理时间", "dealTime", 5000));
fieldList.add(new ExcelField(11, "处理结果", "dealResult", 5000));
fieldList.add(new ExcelField(11, "是否转司机违约", "transferDriverBreakContractMsg", 5000));
// 组装数据
List<List<ExcelData>> dataList = new ArrayList<>();
for (OrderChildExceptionReportVO vo : list) {
List<ExcelData> rowData = new ArrayList<>();
rowData.add(new ExcelData(vo.getReportNo(),"-"));
rowData.add(new ExcelData(vo.getThirdReportNo(),"-"));
rowData.add(new ExcelData(vo.getSourceMsg(), "-"));
rowData.add(new ExcelData(vo.getExceptionCategory(),"-"));
rowData.add(new ExcelData(vo.getExceptionType(),"-"));
rowData.add(new ExcelData(vo.getTruckNoOrMobile(),"-"));
rowData.add(new ExcelData(vo.getChildNo(),"-"));
rowData.add(new ExcelData(vo.getStatusMsg(),"-"));
rowData.add(new ExcelData(vo.getDeductionAmount(),"-"));
rowData.add(new ExcelData(vo.getReportTime(),"-"));
rowData.add(new ExcelData(vo.getCreateTime(),"-"));
rowData.add(new ExcelData(vo.getDealUser(),"-"));
rowData.add(new ExcelData(vo.getDealTime(),"-"));
rowData.add(new ExcelData(vo.getDealResultMsg(),"-"));
rowData.add(new ExcelData(vo.getTransferDriverBreakContractMsg(),"-"));
dataList.add(rowData);
}
ExcelSheet excelSheet = new ExcelSheet("异常上报处理", "异常上报处理", fieldList, dataList);
//创建excel
return ExcelUtil.create(excelSheet);
}
@Override
public OrderChildExceptionReportVO getExceptionReport(Integer id) {
OrderChildExceptionReport report = orderChildExceptionReportDao.getEntityByKey(id).orElseThrow(
ResultEnum.DATA_NOT_FIND);
OrderChildExceptionReportVO vo = orderChildExceptionReportStruct.convert(report);
Optional<OrderChildExceptionReportDealLog> limitOneByField = orderChildExceptionReportDealLogDao.getLimitOneByField(
OrderChildExceptionReportDealLog::getReportNo, report.getReportNo());
if(limitOneByField.isPresent()) {
OrderChildExceptionReportDealLog dealLog = limitOneByField.get();
vo.setVideoUrlList(JSON.parseArray(dealLog.getVideoUrl(),String.class));
vo.setPictureUrlList(JSON.parseArray(dealLog.getPictureUrl(),String.class));
}
return vo;
}
@Override
public void transferDriverBreakContract(TransferDriverBreakContractParam param) {
OrderChildExceptionReport report = orderChildExceptionReportDao.getEntityByKey(param.getId()).orElseThrow(
ResultEnum.DATA_NOT_FIND);
if(Objects.equals(report.getStatus(),CarrierExceptionReportEnum.Status.PROCESSED.getCode())
&& Objects.equals(report.getDealResult(),ExceptionReportEnum.DealResult.CARRIER_BREAK_CONTRACT.getCode())){
throw new ServiceSystemException(ResultEnum.DATA_ERROR);
}
//@TODO 创建司机违约记录
report.setTransferDriverBreakContract(1);
orderChildExceptionReportDao.updateEntityByKey(report);
}
}
package com.clx.performance.struct;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.open.sdk.request.action.MslSyncExceptionReportInfoAction;
import com.clx.open.sdk.request.action.SmbSyncExceptionReportInfoAction;
import com.clx.performance.model.OrderChildExceptionReport;
import com.clx.performance.vo.pc.OrderChildExceptionReportVO;
import com.msl.common.utils.DateStructUtil;
import com.msl.common.utils.DateUtils;
import org.mapstruct.Mapper;
......@@ -12,4 +15,8 @@ public interface OrderChildExceptionReportStruct {
OrderChildExceptionReport convertInfoSmbAction(SmbSyncExceptionReportInfoAction action);
OrderChildExceptionReport convertInfoMslAction(MslSyncExceptionReportInfoAction action);
Page<OrderChildExceptionReportVO> convertPage(IPage<OrderChildExceptionReport> page);
OrderChildExceptionReportVO convert(OrderChildExceptionReport report);
}
package com.clx.performance.param.pc;
import com.msl.common.base.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* @ClassName PageExceptionReportParam
* @Description
* @Author kavin
* @Date 2024/10/23 13:31
* @Version 1.0
*/
@Getter
@Setter
public class PageExceptionReportParam extends PageParam {
@Schema(description="三方异常上报编号")
private String thirdReportNo;
@Schema(description="来源 1:数煤宝 3:供应链")
private Integer source;
@Schema(description="运单编号")
private String childNo;
@Schema(description="车牌号/手机号")
private String truckNoOrMobile;
@Schema(description="状态:1:待处理 2:申诉中 3:已处理 4:已撤回")
private Integer status;
@Schema(description="开始时间")
private String beginTime;
@Schema(description="结束时间")
private String endTime;
}
package com.clx.performance.param.pc;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
/**
* @ClassName TransferDriverBreakContractParam
* @Description
* @Author kavin
* @Date 2024/10/23 14:39
* @Version 1.0
*/
@Getter
@Setter
public class TransferDriverBreakContractParam {
@NotNull(message = "异常记录ID不能为空")
@Schema(description = "异常记录ID")
private Integer id;
@NotBlank(message = "违约原因不能为空")
@Schema(description = "违约原因")
private String reason;
}
package com.clx.performance.vo.pc;
import com.clx.open.sdk.enums.ExceptionReportEnum;
import com.clx.performance.enums.CarrierExceptionReportEnum;
import com.clx.performance.enums.SyncPlatformEnum;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/**
* @author kavin
* Date 2024-10-22
* Time 10:38
*/
@Getter
@Setter
public class OrderChildExceptionReportVO {
private Integer id;
@Schema(description="异常上报编号")
private String reportNo;
@Schema(description="三方异常上报编号")
private String thirdReportNo;
@Schema(description="来源")
private Integer source;
@Schema(description="来源描述")
private String sourceMsg;
public String getSourceMsg(){
return SyncPlatformEnum.Source.getNameByCode(source);
}
@Schema(description="异常类别")
private String exceptionCategory;
@Schema(description="异常类型")
private String exceptionType;
@Schema(description="车牌号/手机号")
private String truckNoOrMobile;
@Schema(description="运单编号")
private String childNo;
@Schema(description="状态:1:待处理 2:申诉中 3:已处理 4:已撤回")
private Integer status;
@Schema(description="状态:1:待处理 2:申诉中 3:已处理 4:已撤回")
private String statusMsg;
public String getStatusMsg(){
return CarrierExceptionReportEnum.Status.getMsgByCode(status);
}
@Schema(description="扣罚金额")
@MoneyOutConvert
private BigDecimal deductionAmount;
@Schema(description="异常上报时间")
private String reportTime;
@Schema(description="异常描述")
private String reason;
@Schema(description="处理人用户编码")
private Long dealUserCode;
@Schema(description="处理人用户姓名")
private String dealUser;
@Schema(description="处理时间")
private String dealTime;
@Schema(description="处理结果 1:承运违约 2:承运不违约 ")
private Integer dealResult;
@Schema(description="处理结果 1:承运违约 2:承运不违约")
private String dealResultMsg;
@Schema(description="处理结果")
public String getDealResultMsg(){
return ExceptionReportEnum.DealResult.getNameByCode(dealResult);
}
@Schema(description="是否转司机违约 1:是")
private Integer transferDriverBreakContract;
@Schema(description="是否转司机违约 1:是")
private String transferDriverBreakContractMsg;
public String transferDriverBreakContractMsg(){
if(Objects.nonNull(transferDriverBreakContract)){
return "是";
}else{
return "-";
}
}
@Schema(description="创建时间")
private String createTime;
@Schema(description="图片")
private List<String> pictureUrlList;
@Schema(description="视频")
private List<String> videoUrlList;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论