Browse Source

工单代码提交

master
汤建军 5 months ago
parent
commit
473e9d1924
  1. 4
      blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/AftersalesWorkOrderVO.java
  2. 137
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java
  3. 15
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/excel/AftersalesWorkOrderExcel.java
  4. 9
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.java
  5. 106
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml
  6. 12
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesWorkOrderService.java
  7. 118
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java
  8. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

4
blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/AftersalesWorkOrderVO.java

@ -36,6 +36,10 @@ public class AftersalesWorkOrderVO extends AftersalesWorkOrderEntity {
* 工单名称
*/
private String workOrderTypeName;
/**
* 工单名称
*/
private String workOrderStatusName;
/**
* 提货名称

137
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java

@ -16,14 +16,19 @@
*/
package com.logpm.aftersales.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.aftersales.dto.AftersalesWorkOrderDTO;
import com.logpm.aftersales.dto.AftersalesWorkOrderListExcelDTO;
import com.logpm.aftersales.entity.AftersalesAppealEntity;
import com.logpm.aftersales.entity.AftersalesSettlementEntity;
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.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import io.swagger.annotations.Api;
@ -31,6 +36,8 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.servlet.ServletOutputStream;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
@ -43,7 +50,6 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.User;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.aftersales.entity.AftersalesWorkOrderEntity;
import com.logpm.aftersales.vo.AftersalesWorkOrderVO;
import com.logpm.aftersales.excel.AftersalesWorkOrderExcel;
import com.logpm.aftersales.wrapper.AftersalesWorkOrderWrapper;
@ -54,7 +60,11 @@ import org.springblade.core.excel.util.ExcelUtil;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
/**
@ -73,6 +83,8 @@ public class AftersalesWorkOrderController extends BladeController {
private final IAftersalesWorkOrderService aftersalesWorkOrderService;
private final IBasicdataWarehouseClient warehouseClient;
private final IAftersalesCompletionRecordService aftersalesCompletionRecordService;
private final IAftersalesPersonResponsibleService aftersalesPersonResponsibleService;
private final IAftersaleSurveyRecordService aftersaleSurveyRecordService;
/**
* 客服异常工单 详情
@ -719,6 +731,125 @@ public class AftersalesWorkOrderController extends BladeController {
/**
* 导出数据
*
*/
@GetMapping("/exportWorkOrder1")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入aftersalesWorkOrder")
public void newExportWorkOrder(@ApiIgnore @RequestParam Map<String, Object> aftersalesWorkOrder, BladeUser bladeUser, HttpServletResponse response) {
List<List<String>> basicTitle = aftersalesWorkOrderService.basicTitleBuild();
//查询数据
List<AftersalesWorkOrderVO> exportData = aftersalesWorkOrderService.getBasicExportData(aftersalesWorkOrder);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!exportData.isEmpty()) {
List<List<String>> dataList = new ArrayList<>();
for (AftersalesWorkOrderVO exportDatum : exportData) {
List<String> 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,null);
data.add(16,null);
//查询此工单是否存在有责任方如果存在有责任方完善表头
List<AftersalesPersonResponsibleEntity> entityList = aftersalesPersonResponsibleService.list(Wrappers.<AftersalesPersonResponsibleEntity>query().lambda()
.eq(AftersalesPersonResponsibleEntity::getWordOrderId, exportDatum.getId())
.eq(AftersalesPersonResponsibleEntity::getTypesOf, "1")
);
if (!entityList.isEmpty()) {
handleResponsibility(basicTitle,entityList,data);
}
dataList.add(data);
}
ServletOutputStream os = null;
try {
os = response.getOutputStream();
ExcelWriter excelWriter = EasyExcel.write(os).build();
WriteSheet sheet = EasyExcel.writerSheet()
// 这里放入动态头
.head(basicTitle)
// 当然这里数据也可以用 List<List<String>> 去传入
.build();
excelWriter.write(dataList,sheet);
excelWriter.finish();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private void handleResponsibility(List<List<String>> basicTitle, List<AftersalesPersonResponsibleEntity> entityList, List<String> data) {
Long wordOrderId = entityList.get(0).getWordOrderId();
//查询最新消息
List<AftersaleSurveyRecordEntity> recordEntities = aftersaleSurveyRecordService.list(Wrappers.<AftersaleSurveyRecordEntity>query().lambda()
.eq(AftersaleSurveyRecordEntity::getWorkOrderId, wordOrderId)
.orderByDesc(AftersaleSurveyRecordEntity::getCreateTime)
);
if (!recordEntities.isEmpty()) {
if (!basicTitle.contains(Arrays.asList("最新消息回复内容")) ){
List<String> head5 = new ArrayList<>(Arrays.asList("最新消息回复内容"));
basicTitle.add(basicTitle.size(),head5);
basicTitle.add(head5);
}
data.add(recordEntities.get(0).getContent());
}
int aa = 0;
Map<Long, List<AftersalesPersonResponsibleEntity>> listMap = entityList.stream().collect(Collectors.groupingBy(AftersalesPersonResponsibleEntity::getWordOrderId));
for (Long l : listMap.keySet()) {
List<AftersalesPersonResponsibleEntity> 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<String> head1 = new ArrayList<>(Arrays.asList("责任方"+(i+1)));
basicTitle.add(basicTitle.size(),head1);
}
if (!basicTitle.contains(Arrays.asList("责任人"+(i+1)))) {
List<String> head2 = new ArrayList<>(Arrays.asList("责任人"+(i+1)));
basicTitle.add(basicTitle.size(),head2);
}
if (!basicTitle.contains(Arrays.asList("三方责任人"+(i+1)))) {
List<String> head3 = new ArrayList<>(Arrays.asList("三方责任人"+(i+1)));
basicTitle.add(basicTitle.size(),head3);
}
if (!basicTitle.contains(Arrays.asList("金额"+(i+1)))) {
List<String> head4 = new ArrayList<>(Arrays.asList("金额"+(i+1)));
basicTitle.add(basicTitle.size(),head4);
}
}
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());
}
}
@GetMapping("/exportAllWorkOrder")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入aftersalesWorkOrder")

15
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/excel/AftersalesWorkOrderExcel.java

@ -56,6 +56,14 @@ public class AftersalesWorkOrderExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("发现节点")
private String discoveryNodeName;
/**
* 工单发起仓
*/
@ColumnWidth(20)
@ExcelProperty("工单发起仓")
private String warehouseName;
@ExcelIgnore //发现节点
private String discoveryNode;
/**
@ -83,6 +91,13 @@ public class AftersalesWorkOrderExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("订单自编号")
private String orderCode;
/**
* 订单自编号
*/
@ColumnWidth(20)
@ExcelProperty("包条码")
private String packageCode;
/**
* 一级品类
*/

9
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.java

@ -29,6 +29,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 客服异常工单 Mapper 接口
@ -117,4 +118,12 @@ public interface AftersalesWorkOrderMapper extends BaseMapper<AftersalesWorkOrde
* @return
*/
List<AftersalesWorkOrderExcel> exportAllListOwn(@Param("param")AftersalesWorkOrderEntity workOrderEntity,@Param("ids")List<Long> ids);
/**
* 查询导出基础部分数据
* @param workOrderDTO
* @param ids
* @return
*/
List<AftersalesWorkOrderVO> getBasicExportData(@Param("param") AftersalesWorkOrderDTO workOrderDTO, List<Long> ids);
}

106
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml

@ -1041,6 +1041,112 @@
group by lawo.id
ORDER BY lawo.create_time DESC
</select>
<select id="getBasicExportData" resultType="com.logpm.aftersales.vo.AftersalesWorkOrderVO">
SELECT DISTINCT
lawo.id,
CASE
lawo.work_order_type
WHEN 1 THEN
'货损'
WHEN 2 THEN
'少货'
WHEN 3 THEN
'窜货'
WHEN 4 THEN
'加急'
WHEN 5 THEN
'其他' ELSE '未知类型'
END workOrderTypeName,
CASE
lawo.discovery_node
WHEN 1 THEN
'提货环节'
WHEN 2 THEN
'发货环节'
WHEN 3 THEN
'干线卸车环节'
WHEN 4 THEN
'库内作业环节'
WHEN 5 THEN
'配送装车环节'
WHEN 6 THEN
'配送签收环节'
WHEN 7 THEN
'安装环节'
WHEN 7 THEN
'其他' ELSE '未知节点'
END discoveryNodeName,
lawo.work_order_number,
t.waybill_number AS waybillNumber,
t.order_code AS orderCode,
t.package_code AS packageCode,
t.brand_name AS brandName,
lawo.waybill_mall,
t.`first` AS `first`,
CASE
lawo.work_order_status
WHEN '10' THEN '待处理'
WHEN '20' THEN '处理中'
WHEN '30' THEN '已处理'
WHEN '40' THEN '待审核'
WHEN '50' THEN '已审核'
WHEN '60' THEN '超时未处理'
WHEN '70' THEN '客服介入中'
WHEN '80' THEN '仲裁中'
WHEN '90' THEN '理赔金额未出'
WHEN '21' THEN '处理结果已提交'
WHEN '100' THEN '申述中'
WHEN '110' THEN '已结束' ELSE '未知状态'
END workOrderStatusName,
lawo.processed_by,
GROUP_CONCAT(DISTINCT laprr.business_name) AS businessName,
lawo.create_time,
(lawo.create_time + INTERVAL 2 DAY) AS endCreateTime,
lawo.update_time,
GROUP_CONCAT(DISTINCT lapr.result_type) AS resultTypes,
IFNULL( sum( lapr.money ), 0 ) AS totalAmountNum,
lawo.ceator,
IF(lawo.work_order_status = '80',lawo.update_time,'') AS '完结时间',
IF(lawo.work_order_status = '100','是','否') AS '是否申述',
lawo.process_number,
IF(lawo.work_order_status = '100',(SELECT CASE types_of
WHEN 0 THEN '待处理'
WHEN 1 THEN '成立'
WHEN 2 THEN '驳回'
WHEN 3 THEN '取消'
ELSE
'未知审核状态'
END aaa
FROM logpm_aftersales_appeal WHERE word_order_id = lawo.id AND is_deleted = 0 AND types_of != 3 ORDER BY create_time DESC LIMIT 1),'未申述') AS '申述状态'
FROM
logpm_aftersales_work_order lawo
LEFT JOIN logpm_aftersales_processor lap ON lawo.id = lap.work_order_id
AND lap.types_of = '2'
AND lap.conditions IN ( 1, 2 )
LEFT JOIN logpm_aftersales_completion_record lacr ON lacr.work_order_id = lawo.id
AND lacr.is_deleted = '0'
LEFT JOIN (SELECT
a.id,
group_concat( DISTINCT b.`first` SEPARATOR ',' ) AS `first`,
group_concat( DISTINCT b.secondary SEPARATOR ',' ) AS secondary,
group_concat( DISTINCT b.brand_name SEPARATOR ',' ) AS brand_name,
group_concat( DISTINCT b.package_code SEPARATOR ',' ) AS package_code,
group_concat( DISTINCT b.order_code SEPARATOR ',' ) AS order_code,
group_concat( DISTINCT b.waybill_number SEPARATOR ',' ) AS waybill_number
FROM
logpm_aftersales_work_order AS a
LEFT JOIN logpm_aftersales_abnormal_package AS b ON a.id = b.work_order_id
WHERE
a.is_deleted = 0
AND b.is_deleted = 0
GROUP BY
a.id) AS t ON t.id = lawo.id
LEFT JOIN logpm_aftersales_processing_results AS lapr ON lapr.work_order_id = lawo.id AND lapr.is_deleted = 0
LEFT JOIN logpm_aftersales_person_responsible AS laprr ON laprr.word_order_id = lawo.id
group by lawo.id
ORDER BY lawo.create_time DESC
</select>
<update id="updateFinanceTime">

12
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesWorkOrderService.java

@ -307,4 +307,16 @@ public interface IAftersalesWorkOrderService extends BaseService<AftersalesWorkO
*/
List<AftersalesWorkOrderExcel> exportWorkOrder(Map<String, Object> aftersalesWorkOrder);
/**
* 构建导出基础字段
* @return
*/
List<List<String>> basicTitleBuild();
/**
* 查询导出基础数据
* @param aftersalesWorkOrder
* @return
*/
List<AftersalesWorkOrderVO> getBasicExportData(Map<String, Object> aftersalesWorkOrder);
}

118
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java

@ -368,6 +368,16 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
}
}
baseMapper.insert(aftersalesWorkOrder);
//保存一个自己的处理方数据
AftersalesProcessorEntity aftersalesProcessorEntity = new AftersalesProcessorEntity();
aftersalesProcessorEntity.setConditions("1");
aftersalesProcessorEntity.setTypesOf("3");
aftersalesProcessorEntity.setBusinessId(myCurrentWarehouse.getId());
aftersalesProcessorEntity.setBusinessName(myCurrentWarehouse.getName());
aftersalesProcessorEntity.setWarehouseId(myCurrentWarehouse.getId());
aftersalesProcessorEntity.setWorkOrderId(aftersalesWorkOrder.getId());
aftersalesProcessorEntity.setProcessingStatus("5");
aftersalesProcessorService.save(aftersalesProcessorEntity);
} else {
//修改
// if (ObjectUtil.isNotNull(aftersalesWorkOrder.getUnPpackageEntityList())) {
@ -1305,6 +1315,7 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
// List<AftersalesProcessorVO> processorVOS = new ArrayList<>();
List<AftersalesProcessorEntity> list = aftersalesProcessorService.list(Wrappers.<AftersalesProcessorEntity>query().lambda()
.eq(AftersalesProcessorEntity::getWorkOrderId, aftersalesWorkOrder.getId())
.ne(AftersalesProcessorEntity::getTypesOf, "3")
.apply("conditions in (1,2)")
);
//需要待回复的处理方
@ -2642,6 +2653,113 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
}
@Override
public List<List<String>> basicTitleBuild() {
List<List<String>> title = new ArrayList<>();
List<String> head0 = new ArrayList<>(Arrays.asList("异常类型"));
title.add(0,head0);
List<String> head1 = new ArrayList<>(Arrays.asList("发现节点"));
title.add(1,head1);
List<String> head2 = new ArrayList<>(Arrays.asList("工单创建仓"));
title.add(2,head2);
List<String> head3 = new ArrayList<>(Arrays.asList("工单号"));
title.add(3,head3);
List<String> head4 = new ArrayList<>(Arrays.asList("运单号"));
title.add(4,head4);
List<String> head5 = new ArrayList<>(Arrays.asList("订单自编号"));
title.add(5,head5);
List<String> head6 = new ArrayList<>(Arrays.asList("包条码"));
title.add(6,head6);
List<String> head7 = new ArrayList<>(Arrays.asList("品牌"));
title.add(7,head7);
List<String> head8 = new ArrayList<>(Arrays.asList("运单商场"));
title.add(8,head8);
List<String> head9= new ArrayList<>(Arrays.asList("一级品类"));
title.add(9,head9);
List<String> head10 = new ArrayList<>(Arrays.asList("工单状态"));
title.add(10,head10);
List<String> head11 = new ArrayList<>(Arrays.asList("工单处理方"));
title.add(11,head11);
List<String> head12 = new ArrayList<>(Arrays.asList("工单创建时间"));
title.add(12,head12);
List<String> head13= new ArrayList<>(Arrays.asList("工单最晚处理时间"));
title.add(13,head13);
List<String> head14= new ArrayList<>(Arrays.asList("工单最新处理时间"));
title.add(14,head14);
List<String> head15= new ArrayList<>(Arrays.asList("是否超时"));
title.add(15,head15);
List<String> head16= new ArrayList<>(Arrays.asList("营业部处理客服"));
title.add(16,head16);
return title;
}
@Override
public List<AftersalesWorkOrderVO> getBasicExportData(Map<String, Object> aftersalesWorkOrder) {
String o = (String) aftersalesWorkOrder.get("ids");
List<Long> ids = null;
if (!Objects.isNull(o)) {
ids = Func.toLongList((String) aftersalesWorkOrder.get("ids"));
}
//查询用户角色信息
BladeUser user = AuthUtil.getUser();
String roleName = user.getRoleName();
//查询客服岗位
List<DictBiz> warehouseType = DictBizCache.getList("after_sales_visits");
if (warehouseType.isEmpty()) {
throw new ServiceException("注意,注意!售后访问字典未配置!请配置!");
}
List<String> roleList = Arrays.asList(user.getRoleName().split(","));
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (!roleList.isEmpty()) {
Optional<DictBiz> matchingDictBiz = warehouseType.stream()
.filter(i -> roleList.contains(i.getDictValue()))
.findFirst();
Object workOrderStatus = aftersalesWorkOrder.get("workOrderStatus");
if (matchingDictBiz.isPresent()) {
String dictValue = matchingDictBiz.get().getDictKey();
switch (dictValue) {
case "1": // 客服经理
updateWorkOrderForManager(aftersalesWorkOrder, workOrderStatus);
break;
case "2": // 营业部客服
if (Objects.isNull(myCurrentWarehouse)){
//营业部客服未选择仓库进行作业
throw new ServiceException("请选择仓库");
}
updateWorkOrderForSales(aftersalesWorkOrder, workOrderStatus);
break;
case "3": // 职能客服
updateWorkOrderForFunctional(aftersalesWorkOrder, workOrderStatus, user.getUserId());
break;
}
} else {
updateWorkOrderForOthers(aftersalesWorkOrder, workOrderStatus);
}
}else {
throw new CustomerException("当前登录人无工单操作权限!!!");
}
AftersalesWorkOrderDTO workOrderDTO = JSONObject.parseObject(JSONObject.toJSONString(aftersalesWorkOrder), AftersalesWorkOrderDTO.class);
List<AftersalesWorkOrderVO> exportData = baseMapper.getBasicExportData(workOrderDTO,ids);
return exportData;
}
/**
* 判断是否是客服角色
* @param user

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -3290,6 +3290,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List<Long> ids = parcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList());
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.in(DistributionLoadscanAbnormalEntity::getPackageId, ids)
.eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, "2")
);
if (!abnormalEntities.isEmpty()) {
//判断此包件的异常是否是当前扫描车次和客户

Loading…
Cancel
Save