|
|
@ -5,14 +5,21 @@ import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; |
|
|
|
import com.ruoyi.aftersales.domain.AftersalesComplaintNotice; |
|
|
|
import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO; |
|
|
|
import com.ruoyi.aftersales.mapper.AftersalesComplaintNoticeMapper; |
|
|
|
import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.system.domain.SysMakeorderBom; |
|
|
|
import com.ruoyi.warehouse.domain.WarehouseOutOrder; |
|
|
|
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; |
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; |
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -38,6 +45,12 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
@Autowired |
|
|
|
private AftersalesComplaintNoticeMapper complaintNoticeMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IAfterSalesShippingDeviceService afterSalesShippingDeviceService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WarehouseOutOrderMapper warehouseOutOrderMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询售后客诉通知单详情 |
|
|
|
* |
|
|
@ -61,10 +74,41 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
{ |
|
|
|
return aftersalesComplaintNoticeDetailMapper.selectAftersalesComplaintNoticeDetailList(aftersalesComplaintNoticeDetail); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出售后客诉通知单详情列表 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<AftersalesComplaintNoticeDetail> selectDetailListByNoticeCodes(String[] complaintNoticeCodes) { |
|
|
|
return aftersalesComplaintNoticeDetailMapper.selectDetailListByNoticeCodes(complaintNoticeCodes); |
|
|
|
List<AftersalesComplaintNoticeDetail> complaintNoticeDetailList = aftersalesComplaintNoticeDetailMapper.selectDetailListByNoticeCodes(complaintNoticeCodes); |
|
|
|
List<AftersalesComplaintNoticeDetail> exportDetailList = new ArrayList<>(); |
|
|
|
for (AftersalesComplaintNoticeDetail noticeDetail:complaintNoticeDetailList) { |
|
|
|
String snCodes = noticeDetail.getSnCode(); |
|
|
|
String[] snCodeArray = snCodes.split(","); |
|
|
|
List<AfterSalesShippingDevice> salesShippingDeviceList = afterSalesShippingDeviceService.selectShippingDeviceListBySnCode(snCodeArray); |
|
|
|
for (String snCode:snCodeArray) { |
|
|
|
AftersalesComplaintNoticeDetail exportDetail = new AftersalesComplaintNoticeDetail(); |
|
|
|
Optional<AfterSalesShippingDevice> matchingDevice = salesShippingDeviceList.stream() |
|
|
|
.filter(detail -> detail.getSnCode().equals(snCode)) |
|
|
|
.findFirst(); |
|
|
|
matchingDevice.ifPresent(detail -> { |
|
|
|
exportDetail.setCustomerId(noticeDetail.getCustomerId()); |
|
|
|
exportDetail.setCustomerName(noticeDetail.getCustomerName()); |
|
|
|
exportDetail.setDeviceModelCode(detail.getDeviceModelCode()); |
|
|
|
exportDetail.setDeviceModelName(detail.getMaterialName()); |
|
|
|
exportDetail.setMakeNo(detail.getSalesOrderCode()); |
|
|
|
exportDetail.setDeviceRunningNumber(detail.getDeviceRunningNumber()); |
|
|
|
exportDetail.setShippedGoodsSum(noticeDetail.getShippedGoodsSum()); |
|
|
|
exportDetail.setEnterpriseSum(1); |
|
|
|
exportDetail.setComplaintProblem(noticeDetail.getComplaintProblem()); |
|
|
|
exportDetail.setAdverseReportUrl(noticeDetail.getAdverseReportUrl()); |
|
|
|
exportDetail.setEmergencyDegree(noticeDetail.getEmergencyDegree()); |
|
|
|
exportDetail.setClosingProcedures(noticeDetail.getClosingProcedures()); |
|
|
|
exportDetail.setRemark(noticeDetail.getRemark()); |
|
|
|
}); |
|
|
|
exportDetailList.add(exportDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
return exportDetailList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -95,35 +139,43 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
complaintNoticeDetail.setCreateBy(loginName); |
|
|
|
complaintNoticeDetail.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
|
|
String makeNo = complaintNoticeDetail.getMakeNo(); |
|
|
|
//保存信息到AftersalesComplaintNotice数据表中
|
|
|
|
complaintNotice.setComplaintNoticeCode(newCode); |
|
|
|
complaintNotice.setCreateBy(loginName); |
|
|
|
complaintNotice.setCreateTime(new Date()); |
|
|
|
complaintNotice.setCreateTime(DateUtils.getNowDate()); |
|
|
|
complaintNotice.setMakeNo(complaintNoticeDetail.getMakeNo()); |
|
|
|
complaintNotice.setCustomerId(complaintNoticeDetail.getCustomerId()); |
|
|
|
complaintNotice.setCustomerName(complaintNoticeDetail.getCustomerName()); |
|
|
|
complaintNotice.setClosingProcedures("1"); |
|
|
|
complaintNotice.setEmergencyDegree(complaintNoticeDetail.getEmergencyDegree()); |
|
|
|
complaintNoticeMapper.insertAftersalesComplaintNotice(complaintNotice); |
|
|
|
if(complaintNoticeDetail.getAftersalesMaterialVOs()!=null){ |
|
|
|
complaintNotice.setMaterialSum(complaintNoticeDetail.getAftersalesMaterialVOs().size()); |
|
|
|
} |
|
|
|
|
|
|
|
List<AftersalesMaterialVO> aftersalesMaterialVOs = complaintNoticeDetail.getAftersalesMaterialVOs(); |
|
|
|
if (StringUtils.isEmpty(aftersalesMaterialVOs)){ |
|
|
|
return aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); |
|
|
|
} |
|
|
|
aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); |
|
|
|
}else{ |
|
|
|
for (AftersalesMaterialVO aftersalesMaterialVO : aftersalesMaterialVOs) { |
|
|
|
complaintNoticeDetail.setMaterialNo(aftersalesMaterialVO.getMaterialNo()); |
|
|
|
complaintNoticeDetail.setMaterialName(aftersalesMaterialVO.getMaterialName()); |
|
|
|
complaintNoticeDetail.setMaterialType(aftersalesMaterialVO.getMaterialType()); |
|
|
|
complaintNoticeDetail.setMaterialUnit(aftersalesMaterialVO.getMaterialUnit()); |
|
|
|
complaintNoticeDetail.setMaterialProcessMethod(aftersalesMaterialVO.getMaterialProcessMethod()); |
|
|
|
complaintNoticeDetail.setMaterialName(aftersalesMaterialVO.getMaterialName()); |
|
|
|
complaintNoticeDetail.setMaterialDescribe(aftersalesMaterialVO.getMaterialDescribe()); |
|
|
|
complaintNoticeDetail.setMaterialNo(aftersalesMaterialVO.getMaterialNo()); |
|
|
|
complaintNoticeDetail.setMaterialPhotourl(aftersalesMaterialVO.getMaterialPhotourl()); |
|
|
|
complaintNoticeDetail.setMaterialBrand(aftersalesMaterialVO.getMaterialBrand()); |
|
|
|
complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); |
|
|
|
complaintNoticeDetail.setSnCode(aftersalesMaterialVO.getSnCode()); |
|
|
|
complaintNoticeDetail.setClosingProcedures("1"); |
|
|
|
complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); |
|
|
|
complaintNoticeDetail.setAdverseReportUrl(aftersalesMaterialVO.getAdverseReportUrl()); |
|
|
|
// int totalQuantity = warehouseOutOrderMapper.sumOutOrderQuantityByMakeNo(makeNo);
|
|
|
|
complaintNoticeDetail.setShippedGoodsSum(aftersalesMaterialVO.getShippedGoodsSum()); |
|
|
|
complaintNotice.setEnterpriseSum(aftersalesMaterialVO.getShippedGoodsSum()); |
|
|
|
aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
complaintNoticeMapper.insertAftersalesComplaintNotice(complaintNotice); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
@ -142,7 +194,7 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
//更新主表内容
|
|
|
|
aftersalesComplaintNotice.setComplaintNoticeCode(aftersalesComplaintNoticeDetail.getComplaintNoticeCode()); |
|
|
|
aftersalesComplaintNotice.setUpdateBy(loginName); |
|
|
|
aftersalesComplaintNotice.setUpdateTime(new Date()); |
|
|
|
aftersalesComplaintNotice.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
aftersalesComplaintNotice.setMakeNo(aftersalesComplaintNoticeDetail.getMakeNo()); |
|
|
|
aftersalesComplaintNotice.setEmergencyDegree(aftersalesComplaintNoticeDetail.getEmergencyDegree()); |
|
|
|
aftersalesComplaintNotice.setRemark(aftersalesComplaintNoticeDetail.getRemark()); |
|
|
@ -166,7 +218,7 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
complaintNoticeDetail.setCreateBy(aftersalesComplaintNoticeDetail.getCreateBy()); |
|
|
|
complaintNoticeDetail.setCreateTime(aftersalesComplaintNoticeDetail.getCreateTime()); |
|
|
|
complaintNoticeDetail.setUpdateBy(loginName); |
|
|
|
complaintNoticeDetail.setUpdateTime(new Date()); |
|
|
|
complaintNoticeDetail.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
complaintNoticeDetail.setCustomerId(aftersalesComplaintNoticeDetail.getCustomerId()); |
|
|
|
complaintNoticeDetail.setCustomerName(aftersalesComplaintNoticeDetail.getCustomerName()); |
|
|
|
complaintNoticeDetail.setEmergencyDegree(aftersalesComplaintNoticeDetail.getEmergencyDegree()); |
|
|
@ -183,6 +235,8 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); |
|
|
|
complaintNoticeDetail.setSnCode(aftersalesMaterialVO.getSnCode()); |
|
|
|
complaintNoticeDetail.setAdverseReportUrl(aftersalesMaterialVO.getAdverseReportUrl()); |
|
|
|
complaintNoticeDetail.setShippedGoodsSum(aftersalesMaterialVO.getShippedGoodsSum()); |
|
|
|
complaintNoticeDetail.setClosingProcedures("1"); |
|
|
|
aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); |
|
|
|
} |
|
|
|
return 1; |
|
|
@ -261,6 +315,8 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo |
|
|
|
aftersalesMaterialVO.setMaterialUnit(complaintNoticeDetail.getMaterialUnit()); |
|
|
|
aftersalesMaterialVO.setMaterialType(complaintNoticeDetail.getMaterialType()); |
|
|
|
aftersalesMaterialVO.setComplaintProblem(complaintNoticeDetail.getComplaintProblem()); |
|
|
|
aftersalesMaterialVO.setShippedGoodsSum(complaintNoticeDetail.getShippedGoodsSum()); |
|
|
|
aftersalesMaterialVO.setEmergencyDegree(complaintNoticeDetail.getEmergencyDegree()); |
|
|
|
aftersalesMaterialVO.setSnCode(complaintNoticeDetail.getSnCode()); |
|
|
|
aftersalesMaterialVO.setAdverseReportUrl(complaintNoticeDetail.getAdverseReportUrl()); |
|
|
|
aftersalesMaterialVOs.add(aftersalesMaterialVO); |
|
|
|