瀏覽代碼

订单查询及金牛需求

ct 1 天之前
父節點
當前提交
a72c775238

+ 64 - 10
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -17,6 +17,7 @@ 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;
@@ -42,6 +43,7 @@ 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;
@@ -105,18 +107,36 @@ public class FsStoreOrderController extends BaseController
 
     @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);
+
+        //金牛需求 区别其他项目 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;
     }
 
     /**
@@ -527,13 +547,9 @@ public class FsStoreOrderController extends BaseController
             try {
                 df.setOrderId(orderId);
                 FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
-                if (temp != null){
-                    df.setUpdateTime(new Date());
-                    fsStoreOrderDfService.updateFsStoreOrderDf(df);
-                } else {
+                if (temp == null){
                     fsStoreOrderDfService.insertFsStoreOrderDf(df);
                 }
-
                 fsStoreOrderService.createOmsOrder(orderId);
             } catch (ParseException e) {
                 throw new RuntimeException(e);
@@ -543,6 +559,44 @@ public class FsStoreOrderController extends BaseController
         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);
+            }
+        });
+        return R.ok();
+    }
+
     private FsStoreOrderDf getDFInfo(String loginAccount) {
         //查询订单账户 判断是否存在该订单账户
         List<DFConfigVo> erpAccounts = fsStoreOrderService.getErpAccount();

+ 36 - 7
fs-service/src/main/java/com/fs/erp/service/impl/DfOrderServiceImpl.java

@@ -155,7 +155,7 @@ public class DfOrderServiceImpl implements IErpOrderService
                         if (dfApiResponse != null && "ok".equals(dfApiResponse.getCode())) {
                             dfApiResponse.setCode(mailNumber);
                             Object result = dfApiResponse.getResult();
-                            String jsonStr = JSONUtil.toJsonStr(result);
+                            String jsonStr = JSON.toJSONString(JSON.parseObject(JSONUtil.toJsonStr(result), HashMap.class).get("list"));
                             List<ErpDeliverys> dfDeliveryResponse = null;
                             try {
                                 dfDeliveryResponse = JSON.parseArray(jsonStr, ErpDeliverys.class);
@@ -264,10 +264,11 @@ public class DfOrderServiceImpl implements IErpOrderService
             //3.处理请求结果
             if (dfApiResponse != null && "ok".equals(dfApiResponse.getCode())) {
                 String jsonString = JSON.toJSONString(dfApiResponse.getResult());
-                List<DFOrderStatusResultRequest> requestList = JSON.parseArray(jsonString, DFOrderStatusResultRequest.class);
-                if (requestList != null && !requestList.isEmpty()){
+//                List<DFOrderStatusResultRequest> requestList = JSON.parseArray(jsonString, DFOrderStatusResultRequest.class);
+                DFOrderStatusResultRequest temp = JSON.parseObject(jsonString, DFOrderStatusResultRequest.class);
+//                if (requestList != null && !requestList.isEmpty()){
                     //0待揽收 1已揽收 2运输中 3派送中 4异常件 5退回件 6退回签收 7转寄件 8作废件 9已签收 10 已取消
-                    for (DFOrderStatusResultRequest temp : requestList) {
+//                    for (DFOrderStatusResultRequest temp : requestList) {
                         if (temp.getStatus() == 10){
                             //取消订单
                             String mailNumber = temp.getMailNumber();
@@ -287,10 +288,13 @@ public class DfOrderServiceImpl implements IErpOrderService
                                     log.info("代服管家 订单取消成功: {}", response);
                                 });
                             }
+                        } else if (temp.getStatus() == 9){
+                            //已签收
+                            fsStoreOrderService.getGoods(order.getOrderId());
                         }
                     }
-                }
-            }
+//                }
+//            }
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -533,7 +537,17 @@ public class DfOrderServiceImpl implements IErpOrderService
                         //下单结果
                         BspOrderResponseWrapper bspOrderResponse = JSONUtil.toBean(jsonString, BspOrderResponseWrapper.class);
                         if (bspOrderResponse != null) {
-                            setExpress(bspOrderResponse);
+                            String failMsg = bspOrderResponse.getFailMsg();
+                            if (StringUtils.isNotBlank(failMsg)) {
+                                if (failMsg.equals("暂未结果, 请稍后再查")){
+                                    return;
+                                }
+                                //下单失败 返回未推送状态
+                                String  orderNumber = bspOrderResponse.getOrderNumber();
+                                rollBackOrder(orderNumber,failMsg);
+                            } else {
+                                setExpress(bspOrderResponse);
+                            }
                         }
                     } else if ("2".equals(status)) {
                         //取消订单
@@ -556,6 +570,21 @@ public class DfOrderServiceImpl implements IErpOrderService
         }
     }
 
+    private void rollBackOrder(String orderNumber,String failMsg) {
+        FsStoreOrder fsStoreOrder = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderNumber);
+        FsStoreOrder tempOrder = new FsStoreOrder();
+        tempOrder.setOrderId(fsStoreOrder.getOrderId());
+        tempOrder.setExtendOrderId("");
+        fsStoreOrderMapper.updateFsStoreOrder(tempOrder);
+        FsStoreOrderDf df = new FsStoreOrderDf();
+        df.setOrderId(fsStoreOrder.getOrderId());
+        df.setStatus(0); //回到默认
+        df.setFailMsg(failMsg); //失败消息
+        df.setUpdateTime(new Date());
+        fsStoreOrderDfMapper.updateFsStoreOrderDf(df);
+        //推送失败消息
+    }
+
     /**
      * 顺丰会有自己的轨迹推送 不使用快递鸟(代服务管家设置推送地址)
      *

+ 3 - 0
fs-service/src/main/java/com/fs/his/domain/FsStoreOrderDf.java

@@ -54,5 +54,8 @@ public class FsStoreOrderDf extends BaseEntity{
     @Excel(name = "0:默认 1下单 2取消订单")
     private Integer status;
 
+    /** 失败原因 */
+    private String failMsg;
+
 
 }

+ 1 - 1
fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderMapper.java

@@ -1082,7 +1082,7 @@ public interface FsStoreOrderMapper
             "</script>"})
     Integer selectFsStoreOrderCountByType(@Param("companyId") Long companyId,@Param("userId") long userId, @Param("type")int type);
 
-    @Select("select * from fs_store_order where  `status`=2 and extend_order_id is not null ")
+    @Select("select * from fs_store_order where  `status`=2 and extend_order_id is not null and extend_order_id != '' ")
     List<FsStoreOrder> selectWdtOmsOrderdeliveryOp();
 
     int batchUpdateErpByOrderIds(@Param("maps") List<Map<String, String>> maps);

+ 12 - 3
fs-service/src/main/java/com/fs/his/param/FsStoreOrderParam.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class FsStoreOrderParam extends BaseEntity implements Serializable {
@@ -18,6 +19,8 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
     private Long storeId;
     @Excel(name = "订单号")
     private String orderCode;
+    //多个订单号搜索
+    private List<String> orderCodes;
     /** 订单号 */
     @Excel(name = "订单号")
     private String subOrderCode;
@@ -77,7 +80,7 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
     @Excel(name = "支付方式 1微信")
     private String payType;
 
-    /** 订单状态(-1 : 申请退款 -2 : 退货成功 1:待支付 2:待发货;3:待收货;4:待评价;5:已完成) */
+    /** 订单状态(-1 : 申请退款 -2 : 退货成功 1:待支付 2:待发货;3:待收货;4:待评价;5:已完成) 6(金牛代服待推送,请避开6)*/
     @Excel(name = "订单状态", readConverterExp = "-=1,:=,申=请退款,-=2,:=,退=货成功,1=:待支付,2=:待发货;3:待收货;4:待评价;5:已完成")
     private Integer status;
 
@@ -176,6 +179,7 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
     @Excel(name = "订单类型")
     private Integer orderType;
     private Long companyId;
+    private List<Long> companyIds;
     private Long companyUserId;
 
     private Long userCouponId;
@@ -212,9 +216,9 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
 
     private String qwSubject;
 //    @ApiModelProperty(value = "页码,默认为1")
-//    private Integer pageNum =1;
+    private Integer pageNum;
 //    @ApiModelProperty(value = "页大小,默认为10")
-//    private Integer pageSize = 10;
+    private Integer pageSize;
 
 
     private String packageSecondName;
@@ -228,4 +232,9 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
     private String source;
 
     private Long taskId;//任务ID
+
+    //排序字段
+    private String sortField;
+    //排序规则
+    private String sortOrder;
 }

+ 83 - 37
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -3176,38 +3176,60 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
 
         } else {
             BspOrderResponseWrapper addParam = JSON.parseObject(body, BspOrderResponseWrapper.class);
+            if (addParam == null) {
+                return R.ok("接收成功").put("code", "ok");
+            }
+            String failMsg = addParam.getFailMsg();
+            if (com.hc.openapi.tool.util.StringUtils.isNotBlank(failMsg)) {
+                if (failMsg.equals("暂未结果, 请稍后再查")){
+                    return R.ok("接收成功").put("code", "ok");
+                }
+                //下单失败 返回未推送状态
+                String  orderNumber = addParam.getOrderNumber();
+                FsStoreOrder fsStoreOrder = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderNumber);
+                FsStoreOrder tempOrder = new FsStoreOrder();
+                tempOrder.setOrderId(fsStoreOrder.getOrderId());
+                tempOrder.setExtendOrderId("");
+                fsStoreOrderMapper.updateFsStoreOrder(tempOrder);
+                FsStoreOrderDf df = new FsStoreOrderDf();
+                df.setOrderId(fsStoreOrder.getOrderId());
+                df.setStatus(0); //回到默认
+                df.setFailMsg(failMsg); //失败消息
+                df.setUpdateTime(new Date());
+                fsStoreOrderDfMapper.updateFsStoreOrderDf(df);
+                //推送失败消息
+                return R.ok("接收成功").put("code", "ok");
+            }
             if (addParam.getBspResponse() != null) {
                 //更新物流
-                if (addParam != null) {
-                    log.info("代服管家创建订单回调,{}", JSON.toJSONString(addParam));
-                    List<OrderResponse> list = addParam.getBspResponse().getBody();
-                    if (list != null && !list.isEmpty()) {
-                        for (OrderResponse orderResponse : list) {
-                            List<RlsInfo> rlsInfos = orderResponse.getRlsInfo();
-                            String orderNumber = orderResponse.getOrderNumber();
-                            String mailNumber = orderResponse.getMailNumber();
-                            if (rlsInfos != null && rlsInfos.size() > 0) {
-                                RlsInfo rlsInfo = rlsInfos.get(0);
-                                List<RlsDetail> rlsDetails = rlsInfo.getRlsDetail();
-                                if (rlsDetails != null && !rlsDetails.isEmpty()) {
-                                    RlsDetail rlsDetail = rlsDetails.get(0);
-                                    String proName = rlsDetail.getProName();
-                                    if (com.hc.openapi.tool.util.StringUtils.isNotBlank(proName)) {
-                                        FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderNumber);
-                                        if (order != null && order.getStatus() == 2) {
-                                            order.setDeliverySn(mailNumber);
-                                            order.setDeliveryName(proName);
-                                            order.setDeliveryCode("SF");
-                                            order.setStatus(3);
-                                            order.setDeliverySendTime(DateUtils.getNowDate());
-                                            fsStoreOrderMapper.updateFsStoreOrder(order);
-                                            fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.DELIVERY_GOODS.getValue(), FsStoreOrderLogEnum.DELIVERY_GOODS.getDesc());
-                                            if (order.getCompanyId() != null && order.getCompanyId() > 0) {
-                                                companyService.subtractCompanyMoney(order);
-                                            }
+                log.info("代服管家创建订单回调,{}", JSON.toJSONString(addParam));
+                List<OrderResponse> list = addParam.getBspResponse().getBody();
+                if (list != null && !list.isEmpty()) {
+                    for (OrderResponse orderResponse : list) {
+                        List<RlsInfo> rlsInfos = orderResponse.getRlsInfo();
+                        String orderNumber = orderResponse.getOrderNumber();
+                        String mailNumber = orderResponse.getMailNumber();
+                        if (rlsInfos != null && rlsInfos.size() > 0) {
+                            RlsInfo rlsInfo = rlsInfos.get(0);
+                            List<RlsDetail> rlsDetails = rlsInfo.getRlsDetail();
+                            if (rlsDetails != null && !rlsDetails.isEmpty()) {
+                                RlsDetail rlsDetail = rlsDetails.get(0);
+                                String proName = rlsDetail.getProName();
+                                if (com.hc.openapi.tool.util.StringUtils.isNotBlank(proName)) {
+                                    FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderNumber);
+                                    if (order != null && order.getStatus() == 2) {
+                                        order.setDeliverySn(mailNumber);
+                                        order.setDeliveryName(proName);
+                                        order.setDeliveryCode("SF");
+                                        order.setStatus(3);
+                                        order.setDeliverySendTime(DateUtils.getNowDate());
+                                        fsStoreOrderMapper.updateFsStoreOrder(order);
+                                        fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.DELIVERY_GOODS.getValue(), FsStoreOrderLogEnum.DELIVERY_GOODS.getDesc());
+                                        if (order.getCompanyId() != null && order.getCompanyId() > 0) {
+                                            companyService.subtractCompanyMoney(order);
                                         }
-                                        break;
                                     }
+                                    break;
                                 }
                             }
                         }
@@ -3229,13 +3251,16 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
             return R.error(dto.getReason());
         }
         FsStoreOrder map = new FsStoreOrder();
-        map.setDeliveryStatus(Integer.parseInt(dto.getState()));
-        map.setOrderId(order.getOrderId());
-        map.setDeliveryType(dto.getStateEx());
-        fsStoreOrderMapper.updateFsStoreOrder(map);
-        //如果是正常签收,更新订单状态
-        if (dto.getState().equals("3") && (dto.getStateEx().equals("301") || dto.getStateEx().equals("302") || dto.getStateEx().equals("304") || dto.getStateEx().equals("311"))) {
-            this.getGoods(order.getOrderId());
+        if(dto != null && dto.getState() != null){
+            map.setDeliveryStatus(Integer.parseInt(dto.getState()));
+            map.setOrderId(order.getOrderId());
+            map.setDeliveryType(dto.getStateEx());
+            fsStoreOrderMapper.updateFsStoreOrder(map);
+            //如果是正常签收,更新订单状态
+            if (dto.getState().equals("3")) {
+                this.getGoods(order.getOrderId());
+            }
+
         }
         return R.ok();
     }
@@ -3243,6 +3268,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
     @Override
     public ExpressInfoDTO getDfExpressInfoDTO(FsStoreOrder order) {
         ExpressInfoDTO expressInfoDTO = new ExpressInfoDTO();
+        expressInfoDTO.setOrderCode(order.getOrderCode());
+        expressInfoDTO.setSuccess(true);
         ErpDeliverysRequest erpDeliverysRequest = new ErpDeliverysRequest();
         erpDeliverysRequest.setCode(order.getOrderCode());
         ErpDeliverysResponse deliver = null;
@@ -3258,14 +3285,33 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
                 List<TracesDTO> tracesDTOS = new ArrayList<>();
                 for (ErpDeliverys item : deliverys) {
                     TracesDTO dto = new TracesDTO();
-//                        dto.setAction();
                     dto.setLocation(item.getAcceptAddress());
                     dto.setAcceptStation(item.getRemark());
                     dto.setAcceptTime(item.getAcceptTime());
+                    tracesDTOS.add(dto);
+
                 }
                 expressInfoDTO.setTraces(tracesDTOS);
-                expressInfoDTO.setOrderCode(order.getOrderCode());
+                //匹配原代码物流编码
+                ErpDeliverys item = deliverys.get(deliverys.size()-1);
+                String opCode = item.getOpCode();
+                if ("54".equals(opCode)) {
+                    //54 取件
+                    expressInfoDTO.setState("1");
+                    expressInfoDTO.setStateEx("1");
+                } else if (opCode.startsWith("3")) {
+                    //30 分拣,36 31
+                    expressInfoDTO.setState("2");
+                    expressInfoDTO.setStateEx("2");
+                } else if ("80".equals(opCode)) {
+                    //80:您的快件已派送至本人
+                    expressInfoDTO.setState("3");
+                    expressInfoDTO.setStateEx("301");
+                }
             }
+        } else {
+            expressInfoDTO.setState("0");
+            expressInfoDTO.setStateEx("0");
         }
         return expressInfoDTO;
     }

+ 3 - 0
fs-service/src/main/java/com/fs/his/vo/FsStoreOrderListVO.java

@@ -63,4 +63,7 @@ public class FsStoreOrderListVO {
 
     //erp推送号码
     private String erpPhone;
+
+    //erp推送账号
+    private String erpAccount;
 }

+ 3 - 0
fs-service/src/main/resources/application-druid-jnmy-test.yml

@@ -148,3 +148,6 @@ rocketmq:
         group: test-group
         access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
         secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey
+ipad:
+    ipadUrl:
+    aiApi:

+ 3 - 0
fs-service/src/main/resources/application-druid-jnmy.yml

@@ -148,3 +148,6 @@ rocketmq:
         group: test-group
         access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
         secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey
+ipad:
+    ipadUrl:
+    aiApi:

+ 6 - 1
fs-service/src/main/resources/mapper/his/FsStoreOrderDfMapper.xml

@@ -17,10 +17,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status"    column="status"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="failMsg"    column="fail_msg"    />
     </resultMap>
 
     <sql id="selectFsStoreOrderDfVo">
-        select order_id, order_code, app_key, app_secret, login_account, monthly_card, express_product_code,total_price, platform_price, status, create_time, update_time from fs_store_order_df
+        select order_id, order_code, app_key, app_secret, login_account, monthly_card, express_product_code,total_price, platform_price, status, create_time, update_time,fail_msg from fs_store_order_df
     </sql>
 
     <select id="selectFsStoreOrderDfList" parameterType="FsStoreOrderDf" resultMap="FsStoreOrderDfResult">
@@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="totalPrice != null "> and total_price = #{totalPrice}</if>
             <if test="platformPrice != null "> and platform_price = #{platformPrice}</if>
             <if test="status != null "> and status = #{status}</if>
+            <if test="failMsg != null and failMsg != ''"> and fail_msg like concat(#{failMsg},'%')</if>
         </where>
     </select>
 
@@ -58,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null">status,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="failMsg != null">fail_msg,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderId != null">#{orderId},</if>
@@ -72,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null">#{status},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="failMsg != null">#{failMsg},</if>
          </trim>
     </insert>
 
@@ -89,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null">status = #{status},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="failMsg != null and failMsg != ''">fail_msg = #{failMsg},</if>
         </trim>
         where order_id = #{orderId}
     </update>

+ 51 - 7
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -530,6 +530,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.storeId != null ">
             and so.store_id = #{maps.storeId}
         </if>
+        <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+            and so.order_code in
+            <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                #{orderCode}
+            </foreach>
+        </if>
         <if test="maps.orderCode != null and maps.orderCode != ''">
             and so.order_code = #{maps.orderCode}
         </if>
@@ -548,15 +554,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.isFirst != null ">
             and so.is_first = #{maps.isFirst}
         </if>
-        <if test="maps.status != null  and maps.status != 5">
+        <if test="maps.status != null  and maps.status != 6">
             and so.status = #{maps.status}
         </if>
-        <if test="maps.status == 5">
+        <if test="maps.status == 6">
             and so.`status`= 2
             and (
             so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
             )
-            and  so.extend_order_id is null
+            and  (so.extend_order_id is null or so.extend_order_id like '')
         </if>
         <if test="maps.deliverySn != null and maps.deliverySn != ''">
             and so.delivery_sn = #{maps.deliverySn}
@@ -612,6 +618,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.companyUserNickName != null and maps.companyUserNickName !='' ">
             and cu.nick_name like concat( #{maps.companyUserNickName}, '%')
         </if>
+        <if test="maps.companyIds != null and  maps.companyIds.size >0">
+            and so.company_id in
+            <foreach collection="maps.companyIds" item="companyId" open="(" close=")" separator=",">
+                #{companyId}
+            </foreach>
+        </if>
         <if test='maps.companyId != null and maps.companyId != "-1" '>
             and so.company_id = #{maps.companyId}
         </if>
@@ -709,6 +721,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.storeId != null">
                 and so.store_id = #{maps.storeId}
             </if>
+            <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+                and so.order_code in
+                <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                    #{orderCode}
+                </foreach>
+            </if>
             <if test="maps.orderCode != null  and maps.orderCode != ''">
                 and so.order_code = #{maps.orderCode}
             </if>
@@ -727,15 +745,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.isFirst != null">
                 and so.is_first = #{maps.isFirst}
             </if>
-            <if test="maps.status != null and maps.status != 5">
+            <if test="maps.status != null and maps.status != 6">
                 and so.status = #{maps.status}
             </if>
-            <if test="maps.status == 5">
+            <if test="maps.status == 6">
                 and so.`status`= 2
                 and (
                 so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
                 )
-                and  so.extend_order_id is null
+                and  (so.extend_order_id is null or  so.extend_order_id like '')
             </if>
             <if test="maps.source != null">
                 and so.source = #{maps.source}
@@ -794,6 +812,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=''">
                 and cu.nick_name like concat( #{maps.companyUserNickName}, '%')
             </if>
+            <if test="maps.companyIds != null and  maps.companyIds.size >0">
+                and so.company_id in
+                <foreach collection="maps.companyIds" item="companyId" open="(" close=")" separator=",">
+                    #{companyId}
+                </foreach>
+            </if>
             <if test="maps.companyId != null and  maps.companyId != -1">
                 and so.company_id =#{maps.companyId}
             </if>
@@ -862,7 +886,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
 
         </where>
+
+        ORDER BY
+
+        <if test="maps.sortField == 'companyUserName'">
+            cu.nick_name
+        </if>
+        <if test="maps.sortField == 'packageName'">
+            so.package_name
+        </if>
+        <if test="maps.sortField == 'payPrice'">
+            so.pay_price
+        </if>
+        <if test="maps.sortField == 'payMoney'">
+            so.pay_money
+        </if>
+        <if test="maps.sortOrder != null and maps.sortOrder != ''">
+            ${maps.sortOrder}
+        </if>
+        <if test="maps.sortField == null or maps.sortField == ''">
+            so.order_id desc
+        </if>
         ${maps.params.dataScope}
-        ORDER BY so.order_id desc
     </select>
 </mapper>