|
|
@@ -29,6 +29,7 @@ import com.fs.hisStore.vo.*;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -58,7 +59,9 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
private TokenService tokenService;
|
|
|
|
|
|
@Autowired
|
|
|
+ @Qualifier("erpOrderServiceImpl")
|
|
|
IErpOrderService erpOrderService;
|
|
|
+
|
|
|
@Autowired
|
|
|
IFsStorePaymentScrmService paymentService;
|
|
|
|
|
|
@@ -274,16 +277,10 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
@Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/healthExportItems")
|
|
|
public AjaxResult exportItems1(FsStoreOrderParam param) {
|
|
|
- if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
- param.setBeginTime(null);
|
|
|
- param.setEndTime(null);
|
|
|
- }
|
|
|
+ normalizeExportParam(param);
|
|
|
if (fsStoreOrderService.isEntityNull(param)){
|
|
|
return AjaxResult.error("请筛选数据导出");
|
|
|
}
|
|
|
- if(!StringUtils.isEmpty(param.getCreateTimeRange())){
|
|
|
- param.setCreateTimeList(param.getCreateTimeRange().split("--"));
|
|
|
- }
|
|
|
if(!StringUtils.isEmpty(param.getPayTimeRange())){
|
|
|
param.setPayTimeList(param.getPayTimeRange().split("--"));
|
|
|
}
|
|
|
@@ -295,6 +292,62 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
}
|
|
|
param.setIsHealth("1");
|
|
|
List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
|
|
|
+ if ("北京卓美".equals(signProjectName)) {
|
|
|
+ List<FsStoreOrderItemExportZMVO> zmvoList = list.stream()
|
|
|
+ .map(vo -> {
|
|
|
+ FsStoreOrderItemExportZMVO zmvo = new FsStoreOrderItemExportZMVO();
|
|
|
+ try {
|
|
|
+ BeanUtil.copyProperties(vo, zmvo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return zmvo;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (zmvoList != null) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ for (FsStoreOrderItemExportZMVO vo : zmvoList) {
|
|
|
+ if("2".equals(vo.getOrderType())){
|
|
|
+ vo.setOrderTypeStr("直播订单" );
|
|
|
+ }else{
|
|
|
+ vo.setOrderTypeStr("商城订单" );
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(vo.getJsonInfo())){
|
|
|
+ try {
|
|
|
+ StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vo.getUserPhone() != null) {
|
|
|
+ String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
|
|
|
+ vo.setUserPhone(phone);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
+ try {
|
|
|
+ StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
+ BeanUtil.copyProperties(orderProductDTO, vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*")) && !Objects.isNull(vo.getCost())) {
|
|
|
+ vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getNum())));
|
|
|
+ } else {
|
|
|
+ vo.setPayPostage(BigDecimal.ZERO);
|
|
|
+ vo.setPayDelivery(BigDecimal.ZERO);
|
|
|
+ vo.setCost(BigDecimal.ZERO);
|
|
|
+ vo.setFPrice(BigDecimal.ZERO);
|
|
|
+ vo.setBarCode("");
|
|
|
+ vo.setCateName("");
|
|
|
+ vo.setBankTransactionId("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExcelUtil<FsStoreOrderItemExportZMVO> util = new ExcelUtil<FsStoreOrderItemExportZMVO>(FsStoreOrderItemExportZMVO.class);
|
|
|
+ return util.exportExcel(zmvoList, "订单明细数据");
|
|
|
+ }
|
|
|
//对手机号脱敏
|
|
|
if (list != null) {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
@@ -331,16 +384,10 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
@Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/healthExportItemsDetails")
|
|
|
public AjaxResult healthExportItemsDetails(FsStoreOrderParam param) {
|
|
|
- if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
|
|
|
- param.setBeginTime(null);
|
|
|
- param.setEndTime(null);
|
|
|
- }
|
|
|
+ normalizeExportParam(param);
|
|
|
if (fsStoreOrderService.isEntityNull(param)){
|
|
|
return AjaxResult.error("请筛选数据导出");
|
|
|
}
|
|
|
- if(!StringUtils.isEmpty(param.getCreateTimeRange())){
|
|
|
- param.setCreateTimeList(param.getCreateTimeRange().split("--"));
|
|
|
- }
|
|
|
if(!StringUtils.isEmpty(param.getPayTimeRange())){
|
|
|
param.setPayTimeList(param.getPayTimeRange().split("--"));
|
|
|
}
|
|
|
@@ -369,6 +416,11 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
if (zmvoList != null) {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
for (FsStoreOrderItemExportZMVO vo : zmvoList) {
|
|
|
+ if ("2".equals(vo.getOrderType())) {
|
|
|
+ vo.setOrderTypeStr("直播订单");
|
|
|
+ }else {
|
|
|
+ vo.setOrderTypeStr("商城订单");
|
|
|
+ }
|
|
|
if (!StringUtils.isEmpty(vo.getJsonInfo())) {
|
|
|
try {
|
|
|
StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
|
|
|
@@ -377,9 +429,10 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
|
|
|
- vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
|
|
|
+ vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getNum())));
|
|
|
} else {
|
|
|
vo.setPayPostage(BigDecimal.ZERO);
|
|
|
+ vo.setPayDelivery(BigDecimal.ZERO);
|
|
|
vo.setCost(BigDecimal.ZERO);
|
|
|
vo.setFPrice(BigDecimal.ZERO);
|
|
|
vo.setBarCode("");
|
|
|
@@ -456,6 +509,23 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
return util.importTemplateExcel("订单发货导入模板");
|
|
|
}
|
|
|
|
|
|
+ /** 统一处理导出接口的 GET 参数,与 healthList 的 POST 参数逻辑一致 */
|
|
|
+ private void normalizeExportParam(FsStoreOrderParam param) {
|
|
|
+ if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())) {
|
|
|
+ param.setBeginTime(null);
|
|
|
+ param.setEndTime(null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(param.getCreateTimeRange())) {
|
|
|
+ param.setCreateTimeList(param.getCreateTimeRange().split("--"));
|
|
|
+ }
|
|
|
+ // GET 请求时 orderCodes 可能无法正确绑定,用 orderCodeList(逗号分隔)转 orderCodes
|
|
|
+ if ((param.getOrderCodes() == null || param.getOrderCodes().isEmpty())
|
|
|
+ && StringUtils.isNotBlank(param.getOrderCodeList())) {
|
|
|
+ String[] arr = param.getOrderCodeList().split("[,,\\s]+");
|
|
|
+ param.setOrderCodes(new ArrayList<>(Arrays.asList(arr)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 检查文件是否为有效的Excel文件
|
|
|
private boolean isValidExcelFile(String fileName) {
|
|
|
for (String ext : ALLOWED_EXCEL_EXTENSIONS) {
|
|
|
@@ -528,14 +598,23 @@ public class FsStoreHealthOrderScrmController extends BaseController {
|
|
|
param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
|
|
|
}
|
|
|
param.setIsHealth("1");
|
|
|
- List<FsStoreOrderDeliveryNoteExportVO> storeOrderDeliveryNoteExportVOList=fsStoreOrderService.getDeliveryNote(param);
|
|
|
- ExcelUtil<FsStoreOrderDeliveryNoteExportVO> util = new ExcelUtil<>(FsStoreOrderDeliveryNoteExportVO.class);
|
|
|
- //通过商品ID获取关键字
|
|
|
- String firstKeyword = storeOrderDeliveryNoteExportVOList.stream()
|
|
|
- .map(FsStoreOrderDeliveryNoteExportVO::getKeyword)
|
|
|
- .findFirst()
|
|
|
- .orElse("无订单");
|
|
|
- String fileName="077AC"+firstKeyword+new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
|
- return util.exportExcel(storeOrderDeliveryNoteExportVOList, fileName);
|
|
|
+ try {
|
|
|
+ List<FsStoreOrderDeliveryNoteExportVO> storeOrderDeliveryNoteExportVOList=fsStoreOrderService.getDeliveryNote(param);
|
|
|
+ if(storeOrderDeliveryNoteExportVOList == null || storeOrderDeliveryNoteExportVOList.isEmpty()){
|
|
|
+ return AjaxResult.error("没有可导出的发货单数据");
|
|
|
+ }
|
|
|
+ ExcelUtil<FsStoreOrderDeliveryNoteExportVO> util = new ExcelUtil<>(FsStoreOrderDeliveryNoteExportVO.class);
|
|
|
+ //通过商品ID获取关键字
|
|
|
+ String firstKeyword = storeOrderDeliveryNoteExportVOList.stream()
|
|
|
+ .map(FsStoreOrderDeliveryNoteExportVO::getKeyword)
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .findFirst()
|
|
|
+ .orElse("无订单");
|
|
|
+ String fileName="077AC"+firstKeyword+new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
|
+ return util.exportExcel(storeOrderDeliveryNoteExportVOList, fileName);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("导出发货单失败:" + e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|