|
@@ -17,28 +17,33 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.param.CompanyStoreOrderMoneyLogsListParam;
|
|
|
import com.fs.company.service.ICompanyMoneyLogsService;
|
|
|
import com.fs.company.vo.CompanyStoreOrderMoneyLogsVO;
|
|
|
+import com.fs.config.cloud.CloudHostProper;
|
|
|
import com.fs.erp.domain.ErpDeliverys;
|
|
|
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.ErpOrderQueryResponse;
|
|
|
+import com.fs.erp.dto.df.BspOrderResponse;
|
|
|
+import com.fs.erp.dto.df.DFConfigVo;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.framework.web.service.TokenService;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
|
import com.fs.his.dto.StoreOrderExpressExportDTO;
|
|
|
+import com.fs.his.dto.TracesDTO;
|
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
|
import com.fs.his.param.FsFollowMsgParam;
|
|
|
import com.fs.his.param.FsStoreOrderParam;
|
|
|
import com.fs.his.param.FsStoreOrderSalesParam;
|
|
|
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.vo.*;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.mapper.SysConfigMapper;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -49,7 +54,6 @@ import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
-import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -95,20 +99,58 @@ public class FsStoreOrderController extends BaseController
|
|
|
@Qualifier("hzOMSErpOrderServiceImpl")
|
|
|
private IErpOrderService hdtOrderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("hzOMSErpOrderServiceImpl")
|
|
|
+ private IErpOrderService hzOMSErpOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("dfOrderServiceImpl")
|
|
|
+ private IErpOrderService dfOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("JSTErpOrderServiceImpl")
|
|
|
+ private IErpOrderService jSTOrderService;
|
|
|
+
|
|
|
@Autowired
|
|
|
SysConfigMapper sysConfigMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreOrderDfService fsStoreOrderDfService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CloudHostProper cloudHostProper;
|
|
|
/**
|
|
|
* 查询订单列表
|
|
|
*/
|
|
|
- @GetMapping("/list")
|
|
|
- public TableDataInfo list(FsStoreOrderParam fsStoreOrder)
|
|
|
+ @PostMapping("/list")
|
|
|
+ public TableDataInfo list(@RequestBody FsStoreOrderParam fsStoreOrder)
|
|
|
{
|
|
|
- startPage();
|
|
|
- if (fsStoreOrder.getUserPhoneMk()!=null&&fsStoreOrder.getUserPhoneMk()!=""){
|
|
|
+ PageHelper.startPage(fsStoreOrder);
|
|
|
+ if (fsStoreOrder.getUserPhoneMk()!=null&& !fsStoreOrder.getUserPhoneMk().isEmpty()){
|
|
|
fsStoreOrder.setUserPhone(encryptPhone(fsStoreOrder.getUserPhoneMk()));
|
|
|
}
|
|
|
- List<FsStoreOrderListVO> list = fsStoreOrderService.selectFsStoreOrderListVO(fsStoreOrder);
|
|
|
- return getDataTable(list);
|
|
|
+ List<FsStoreOrderListVO> list;
|
|
|
+ if (StringUtils.isNotBlank(fsStoreOrder.getErpAccount())){
|
|
|
+ //金牛erp查询
|
|
|
+ list = fsStoreOrderService.selectFsStoreOrderListVOByErpAccount(fsStoreOrder);
|
|
|
+ } else {
|
|
|
+ list = fsStoreOrderService.selectFsStoreOrderListVO(fsStoreOrder);
|
|
|
+ }
|
|
|
+ //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
|
|
|
+ TableDataInfo dataTable = getDataTable(list);
|
|
|
+ if ("金牛明医".equals(cloudHostProper.getCompanyName())){
|
|
|
+ if (fsStoreOrder.getStatus() !=null && fsStoreOrder.getStatus() != 1){
|
|
|
+ list.forEach(vo->{
|
|
|
+ //查询顺丰代服账号
|
|
|
+ FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getOrderId());
|
|
|
+ if (df != null){
|
|
|
+ vo.setErpAccount(df.getLoginAccount());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ dataTable.setMsg("jnmy");
|
|
|
+ }
|
|
|
+ return dataTable;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -375,8 +417,13 @@ public class FsStoreOrderController extends BaseController
|
|
|
//旺店通
|
|
|
erpOrderService = wdtOrderService;
|
|
|
} else if (erpType == 3){
|
|
|
- //旺店通
|
|
|
- erpOrderService = hdtOrderService;
|
|
|
+ //
|
|
|
+ erpOrderService = hzOMSErpOrderService;
|
|
|
+ } else if (erpType == 4){
|
|
|
+ //代服
|
|
|
+ erpOrderService = dfOrderService;
|
|
|
+ }else if(erpType == 5){
|
|
|
+ erpOrderService=jSTOrderService;
|
|
|
}
|
|
|
return erpOrderService;
|
|
|
|
|
@@ -491,20 +538,95 @@ public class FsStoreOrderController extends BaseController
|
|
|
@ApiOperation("批量创建ERP订单")
|
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:createErpOrder')")
|
|
|
@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);
|
|
|
+ FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
|
|
|
+ if (temp == null){
|
|
|
+ fsStoreOrderDfService.insertFsStoreOrderDf(df);
|
|
|
+ }
|
|
|
+ fsStoreOrderService.createOmsOrder(orderId);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
return R.ok();
|
|
|
+}
|
|
|
+ @ApiOperation("批量设置订单账户")
|
|
|
+ @PreAuthorize("@ss.hasPermi('his:storeOrder:createErpOrder')")
|
|
|
+ @PostMapping(value = "/batchSetErpOrder")
|
|
|
+ public R batchSetErpOrder(@RequestBody FsStoreOrderSetErpPhoneParam param)
|
|
|
+ {
|
|
|
+ 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->{
|
|
|
+ df.setOrderId(orderId);
|
|
|
+ FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
|
|
|
+ if (temp != null){
|
|
|
+ df.setUpdateTime(new Date());
|
|
|
+ fsStoreOrderDfService.updateFsStoreOrderDf(df);
|
|
|
+ } else {
|
|
|
+ fsStoreOrderDfService.insertFsStoreOrderDf(df);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ 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.setExpressProductCode(erpAccount.getExpressProductCode());
|
|
|
+ df.setStatus(0);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return df;
|
|
|
}
|
|
|
|
|
|
@Log(title = "冻结/解冻", businessType = BusinessType.UPDATE)
|
|
@@ -543,7 +665,12 @@ public class FsStoreOrderController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:syncExpress')")
|
|
|
@GetMapping(value = "/syncExpress/{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')")
|
|
@@ -564,34 +691,41 @@ public class FsStoreOrderController extends BaseController
|
|
|
@GetMapping(value = "/getExpress/{id}")
|
|
|
public R getExpress(@PathVariable("id") Long id)
|
|
|
{
|
|
|
- FsStoreOrder order=fsStoreOrderService.selectFsStoreOrderByOrderId(id);
|
|
|
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())) {
|
|
|
+
|
|
|
+ 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";
|
|
|
+ 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);
|
|
|
}
|
|
|
@PreAuthorize("@ss.hasPermi('his:storeOrder:msgList')")
|
|
@@ -654,15 +788,21 @@ public class FsStoreOrderController extends BaseController
|
|
|
@PostMapping("/editErpPhone")
|
|
|
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("请选择手机号");
|
|
|
}
|
|
|
- List<Long> orderIds = param.getOrderIds();
|
|
|
- if (orderIds == null || orderIds.isEmpty()){
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
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);
|
|
|
+ }
|
|
|
}
|