|
@@ -19,22 +19,25 @@ import com.fs.company.service.ICompanyMoneyLogsService;
|
|
import com.fs.company.vo.CompanyStoreOrderMoneyLogsVO;
|
|
import com.fs.company.vo.CompanyStoreOrderMoneyLogsVO;
|
|
import com.fs.erp.domain.ErpDeliverys;
|
|
import com.fs.erp.domain.ErpDeliverys;
|
|
import com.fs.erp.domain.ErpOrderQuery;
|
|
import com.fs.erp.domain.ErpOrderQuery;
|
|
|
|
+import com.fs.erp.dto.ErpDeliverysRequest;
|
|
|
|
+import com.fs.erp.dto.ErpDeliverysResponse;
|
|
import com.fs.erp.dto.ErpOrderQueryRequert;
|
|
import com.fs.erp.dto.ErpOrderQueryRequert;
|
|
import com.fs.erp.dto.ErpOrderQueryResponse;
|
|
import com.fs.erp.dto.ErpOrderQueryResponse;
|
|
|
|
+import com.fs.erp.dto.df.BspOrderResponse;
|
|
|
|
+import com.fs.erp.dto.df.DFConfigVo;
|
|
import com.fs.erp.service.IErpOrderService;
|
|
import com.fs.erp.service.IErpOrderService;
|
|
import com.fs.framework.web.service.TokenService;
|
|
import com.fs.framework.web.service.TokenService;
|
|
import com.fs.his.config.FsSysConfig;
|
|
import com.fs.his.config.FsSysConfig;
|
|
import com.fs.his.domain.*;
|
|
import com.fs.his.domain.*;
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
import com.fs.his.dto.StoreOrderExpressExportDTO;
|
|
import com.fs.his.dto.StoreOrderExpressExportDTO;
|
|
|
|
+import com.fs.his.dto.TracesDTO;
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
import com.fs.his.param.FsFollowMsgParam;
|
|
import com.fs.his.param.FsFollowMsgParam;
|
|
import com.fs.his.param.FsStoreOrderParam;
|
|
import com.fs.his.param.FsStoreOrderParam;
|
|
import com.fs.his.param.FsStoreOrderSalesParam;
|
|
import com.fs.his.param.FsStoreOrderSalesParam;
|
|
import com.fs.his.param.FsStoreOrderSetErpPhoneParam;
|
|
import com.fs.his.param.FsStoreOrderSetErpPhoneParam;
|
|
-import com.fs.his.service.IFsExportTaskService;
|
|
|
|
-import com.fs.his.service.IFsExpressService;
|
|
|
|
-import com.fs.his.service.IFsStoreService;
|
|
|
|
|
|
+import com.fs.his.service.*;
|
|
import com.fs.his.utils.ConfigUtil;
|
|
import com.fs.his.utils.ConfigUtil;
|
|
import com.fs.his.vo.*;
|
|
import com.fs.his.vo.*;
|
|
import com.fs.system.domain.SysConfig;
|
|
import com.fs.system.domain.SysConfig;
|
|
@@ -49,7 +52,6 @@ import com.fs.common.annotation.Log;
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.controller.BaseController;
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
import com.fs.common.enums.BusinessType;
|
|
import com.fs.common.enums.BusinessType;
|
|
-import com.fs.his.service.IFsStoreOrderService;
|
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -90,8 +92,19 @@ public class FsStoreOrderController extends BaseController
|
|
@Qualifier("wdtErpOrderServiceImpl")
|
|
@Qualifier("wdtErpOrderServiceImpl")
|
|
private IErpOrderService wdtOrderService;
|
|
private IErpOrderService wdtOrderService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier("hzOMSErpOrderServiceImpl")
|
|
|
|
+ private IErpOrderService hzOMSErpOrderService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier("dfOrderServiceImpl")
|
|
|
|
+ private IErpOrderService dfOrderService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
SysConfigMapper sysConfigMapper;
|
|
SysConfigMapper sysConfigMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFsStoreOrderDfService fsStoreOrderDfService;
|
|
/**
|
|
/**
|
|
* 查询订单列表
|
|
* 查询订单列表
|
|
*/
|
|
*/
|
|
@@ -369,6 +382,12 @@ public class FsStoreOrderController extends BaseController
|
|
} else if (erpType == 2){
|
|
} else if (erpType == 2){
|
|
//旺店通
|
|
//旺店通
|
|
erpOrderService = wdtOrderService;
|
|
erpOrderService = wdtOrderService;
|
|
|
|
+ } else if (erpType == 3){
|
|
|
|
+ //
|
|
|
|
+ erpOrderService = hzOMSErpOrderService;
|
|
|
|
+ } else if (erpType == 4){
|
|
|
|
+ //代服
|
|
|
|
+ erpOrderService = dfOrderService;
|
|
}
|
|
}
|
|
return erpOrderService;
|
|
return erpOrderService;
|
|
|
|
|
|
@@ -483,22 +502,58 @@ public class FsStoreOrderController extends BaseController
|
|
@ApiOperation("批量创建ERP订单")
|
|
@ApiOperation("批量创建ERP订单")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:createErpOrder')")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:createErpOrder')")
|
|
@PostMapping(value = "/batchCreateErpOrder")
|
|
@PostMapping(value = "/batchCreateErpOrder")
|
|
- public R batchCreateErpOrder(@RequestBody List<Long> orderIds)
|
|
|
|
|
|
+ public R batchCreateErpOrder(@RequestBody FsStoreOrderSetErpPhoneParam param)
|
|
{
|
|
{
|
|
- if (orderIds != null && !orderIds.isEmpty()) {
|
|
|
|
- orderIds.forEach(orderId->{
|
|
|
|
- try {
|
|
|
|
- fsStoreOrderService.createOmsOrder(orderId);
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+ String loginAccount = param.getLoginAccount();
|
|
|
|
+ if (StringUtils.isBlank(loginAccount)){
|
|
|
|
+ return R.error("未选择推送erp账户");
|
|
|
|
+ }
|
|
|
|
+ FsStoreOrderDf df = getDFInfo(loginAccount);
|
|
|
|
+ if (df.getLoginAccount() == null){
|
|
|
|
+ return R.error("未查询到所选erp账户");
|
|
|
|
+ }
|
|
|
|
+ List<Long> orderIds = param.getOrderIds();
|
|
|
|
+ if (orderIds == null || orderIds.isEmpty()) {
|
|
|
|
+ if (param.getUserPhoneMk() != null && !param.getUserPhoneMk().isEmpty()) {
|
|
|
|
+ param.setUserPhone(encryptPhone(param.getUserPhoneMk()));
|
|
|
|
+ }
|
|
|
|
+ List<FsStoreOrderListVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
|
|
|
|
+ orderIds = list.stream().map(FsStoreOrderListVO::getOrderId).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ if (orderIds.isEmpty()){
|
|
|
|
+ return R.ok();
|
|
}
|
|
}
|
|
|
|
+ orderIds.forEach(orderId->{
|
|
|
|
+ try {
|
|
|
|
+ df.setOrderId(orderId);
|
|
|
|
+ fsStoreOrderDfService.insertFsStoreOrderDf(df);
|
|
|
|
+ fsStoreOrderService.createOmsOrder(orderId);
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ });
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private FsStoreOrderDf getDFInfo(String loginAccount) {
|
|
|
|
+ //查询订单账户 判断是否存在该订单账户
|
|
|
|
+ List<DFConfigVo> erpAccounts = fsStoreOrderService.getErpAccount();
|
|
|
|
+ FsStoreOrderDf df = new FsStoreOrderDf();
|
|
|
|
+ for (DFConfigVo erpAccount : erpAccounts) {
|
|
|
|
+ if (loginAccount.equals(erpAccount.getLoginAccount())){
|
|
|
|
+ //添加df记录
|
|
|
|
+ df.setAppKey(erpAccount.getDfAppKey());
|
|
|
|
+ df.setAppSecret(erpAccount.getDfAppsecret());
|
|
|
|
+ df.setLoginAccount(loginAccount);
|
|
|
|
+ df.setMonthlyCard(erpAccount.getMonthlyCard());
|
|
|
|
+ df.setStatus(0);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return df;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Log(title = "冻结/解冻", businessType = BusinessType.UPDATE)
|
|
@Log(title = "冻结/解冻", businessType = BusinessType.UPDATE)
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:editTuiMoney')")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:editTuiMoney')")
|
|
@GetMapping(value = "/editTuiMoney/{id}")
|
|
@GetMapping(value = "/editTuiMoney/{id}")
|
|
@@ -535,7 +590,12 @@ public class FsStoreOrderController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:syncExpress')")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:syncExpress')")
|
|
@GetMapping(value = "/syncExpress/{id}")
|
|
@GetMapping(value = "/syncExpress/{id}")
|
|
public R syncExpress(@PathVariable("id") Long id) {
|
|
public R syncExpress(@PathVariable("id") Long id) {
|
|
- return fsStoreOrderService.syncExpress(id);
|
|
|
|
|
|
+ IErpOrderService erpService = getErpService();
|
|
|
|
+ if (erpService!=null && erpService == dfOrderService){
|
|
|
|
+ return fsStoreOrderService.syncDfExpress(id);
|
|
|
|
+ } else {
|
|
|
|
+ return fsStoreOrderService.syncExpress(id);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:sendMsg')")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:sendMsg')")
|
|
@@ -556,34 +616,41 @@ public class FsStoreOrderController extends BaseController
|
|
@GetMapping(value = "/getExpress/{id}")
|
|
@GetMapping(value = "/getExpress/{id}")
|
|
public R getExpress(@PathVariable("id") Long id)
|
|
public R getExpress(@PathVariable("id") Long id)
|
|
{
|
|
{
|
|
- FsStoreOrder order=fsStoreOrderService.selectFsStoreOrderByOrderId(id);
|
|
|
|
ExpressInfoDTO expressInfoDTO=null;
|
|
ExpressInfoDTO expressInfoDTO=null;
|
|
- if(StringUtils.isNotEmpty(order.getDeliverySn())){
|
|
|
|
- String lastFourNumber = "";
|
|
|
|
- if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
|
|
|
|
-
|
|
|
|
- lastFourNumber = order.getUserPhone();
|
|
|
|
- if (lastFourNumber.length() == 11) {
|
|
|
|
- lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
- }else if (lastFourNumber.length()>11){
|
|
|
|
- String jm = decryptPhone(lastFourNumber);
|
|
|
|
- lastFourNumber = StrUtil.sub(jm, jm.length(), -4);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
|
|
|
|
-
|
|
|
|
- if((expressInfoDTO.getStateEx()!=null&&expressInfoDTO.getStateEx().equals("0"))&&(expressInfoDTO.getState()!=null&&expressInfoDTO.getState().equals("0"))){
|
|
|
|
- lastFourNumber = "19923690275";
|
|
|
|
|
|
+ FsStoreOrder order=fsStoreOrderService.selectFsStoreOrderByOrderId(id);
|
|
|
|
+ //代服管家 查询自己的物流
|
|
|
|
+ IErpOrderService erpService = getErpService();
|
|
|
|
+ if (erpService == dfOrderService){
|
|
|
|
+ expressInfoDTO = fsStoreOrderService.getDfExpressInfoDTO(order);
|
|
|
|
+ } else {
|
|
|
|
+ if(StringUtils.isNotEmpty(order.getDeliverySn())){
|
|
|
|
+ String lastFourNumber = "";
|
|
if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
|
|
if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
|
|
|
|
+
|
|
|
|
+ lastFourNumber = order.getUserPhone();
|
|
if (lastFourNumber.length() == 11) {
|
|
if (lastFourNumber.length() == 11) {
|
|
lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
+ }else if (lastFourNumber.length()>11){
|
|
|
|
+ String jm = decryptPhone(lastFourNumber);
|
|
|
|
+ lastFourNumber = StrUtil.sub(jm, jm.length(), -4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
|
|
expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
|
|
|
|
|
|
|
|
+ if((expressInfoDTO.getStateEx()!=null&&expressInfoDTO.getStateEx().equals("0"))&&(expressInfoDTO.getState()!=null&&expressInfoDTO.getState().equals("0"))){
|
|
|
|
+ lastFourNumber = "19923690275";
|
|
|
|
+ if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
|
|
|
|
+ if (lastFourNumber.length() == 11) {
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
return R.ok().put("data",expressInfoDTO);
|
|
return R.ok().put("data",expressInfoDTO);
|
|
}
|
|
}
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:msgList')")
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:msgList')")
|
|
@@ -646,15 +713,21 @@ public class FsStoreOrderController extends BaseController
|
|
@PostMapping("/editErpPhone")
|
|
@PostMapping("/editErpPhone")
|
|
public AjaxResult editErpPhone(@RequestBody FsStoreOrderSetErpPhoneParam param)
|
|
public AjaxResult editErpPhone(@RequestBody FsStoreOrderSetErpPhoneParam param)
|
|
{
|
|
{
|
|
- String erpPhone = param.getErpPhone();
|
|
|
|
- if (StringUtils.isBlank(erpPhone)) {
|
|
|
|
|
|
+ List<String> erpPhone = param.getErpPhone();
|
|
|
|
+ if (erpPhone == null || erpPhone.isEmpty()) {
|
|
return AjaxResult.error("请选择手机号");
|
|
return AjaxResult.error("请选择手机号");
|
|
}
|
|
}
|
|
- List<Long> orderIds = param.getOrderIds();
|
|
|
|
- if (orderIds == null || orderIds.isEmpty()){
|
|
|
|
- return AjaxResult.success();
|
|
|
|
- }
|
|
|
|
return toAjax(fsStoreOrderService.batchUpdateErpByOrderIds(param));
|
|
return toAjax(fsStoreOrderService.batchUpdateErpByOrderIds(param));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取erp账户
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getErpAccount")
|
|
|
|
+ public R getErpAccount()
|
|
|
|
+ {
|
|
|
|
+ List<DFConfigVo> erpAccounts = fsStoreOrderService.getErpAccount();
|
|
|
|
+ List<String> list = erpAccounts.stream().map(DFConfigVo::getLoginAccount).collect(Collectors.toList());
|
|
|
|
+ return R.ok().put("data", list);
|
|
|
|
+ }
|
|
}
|
|
}
|