Kaynağa Gözat

update:取消 “中药订单不允许发起售后”的条件限制,手动推送订单

ct 2 hafta önce
ebeveyn
işleme
a10ced7c88

+ 11 - 8
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -488,32 +488,35 @@ public class FsStoreOrderController extends BaseController
     @PreAuthorize("@ss.hasPermi('his:storeOrder:edit')")
     @Log(title = "订单", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody FsStoreOrder fsStoreOrder)
+    public R edit(@RequestBody FsStoreOrder fsStoreOrder)
     {
-        AjaxResult error = moneyCheck(fsStoreOrder);
+        R error = moneyCheck(fsStoreOrder);
         if (error != null) return error;
         try {
             FsUserInfoCollectionAndStoreOrderVo infoVo = fsPackageOrderService.selectInformationCollectionByStoreOrderId(fsStoreOrder.getOrderId());
             if (infoVo != null) {
                 Integer doctorType2Confirm = infoVo.getDoctorType2Confirm();
                 if (doctorType2Confirm == null || doctorType2Confirm != 1) {
-                    return AjaxResult.error("信息采集订单药师未确认,不能修改状态!");
+                    return R.error("信息采集订单药师未确认,不能修改状态!");
                 }
             }
         } catch (Exception e) {
             log.error("信息采集查询错误,orderId: " + fsStoreOrder.getOrderId() + ",信息:{}"+ e);
         }
-        return toAjax(fsStoreOrderService.updateFsStoreOrder(fsStoreOrder));
+        if (CloudHostUtils.hasCloudHostName("金牛明医")){
+            return fsStoreOrderService.updateStoreOrder(fsStoreOrder);
+        }
+        return fsStoreOrderService.updateFsStoreOrder(fsStoreOrder)>0?R.ok():R.error();
     }
 
-    private AjaxResult moneyCheck(FsStoreOrder fsStoreOrder) {
+    private R moneyCheck(FsStoreOrder fsStoreOrder) {
         BigDecimal payRemain = fsStoreOrder.getPayRemain();
         BigDecimal payPrice = fsStoreOrder.getPayPrice();
         if (payRemain != null && payPrice == null){
-            return AjaxResult.error("订单应收金额不正确!");
+            return R.error("订单应收金额不正确!");
         }
         if (payRemain == null && payPrice != null){
-            return AjaxResult.error("订单物流代收金额不正确!");
+            return R.error("订单物流代收金额不正确!");
         }
         if (payRemain != null && payPrice != null){
             FsStoreOrder temp = fsStoreOrderService.selectFsStoreOrderByOrderId(fsStoreOrder.getOrderId());
@@ -528,7 +531,7 @@ public class FsStoreOrderController extends BaseController
                 }
                 BigDecimal tempPayPrice = payMoney.add(payRemain);
                 if(0 != tempPayPrice.compareTo(fsStoreOrder.getPayPrice())){
-                    return AjaxResult.error("订单金额不正确!");
+                    return R.error("订单金额不正确!");
                 }
             }
         }

+ 72 - 0
fs-admin/src/main/java/com/fs/his/controller/FsStoreSubOrderController.java

@@ -3,10 +3,14 @@ package com.fs.his.controller;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.StringUtils;
 import com.fs.his.domain.FsStoreOrder;
 import com.fs.his.param.FsStoreOrderParam;
+import com.fs.his.param.FsStoreOrderPushParam;
 import com.fs.his.vo.FsStoreSubOrderListVO;
 import com.fs.his.vo.FsStoreSubOrderVO;
+import com.fs.his.vo.FsSubOrderResultVO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -65,6 +69,74 @@ public class FsStoreSubOrderController extends BaseController
         return getDataTable(list);
     }
 
+
+    /**
+     * 推送到卫健委
+     */
+    @PreAuthorize("@ss.hasPermi('his:storeSubOrder:push')")
+    @PostMapping("/pushStoreSubOrder")
+    public R pushStoreSubOrder(@RequestBody FsStoreOrderPushParam param)
+    {
+        List<Long> orderIds = param.getOrderIds();
+        StringBuilder msg=new StringBuilder();
+        if (orderIds == null || orderIds.isEmpty()){
+            List<FsStoreSubOrderListVO> list = null;
+            Long companyId = getLoginUser().getUser().getCompanyId();
+            if (companyId!=null){
+                if (param.getCompanyId()!=null && !companyId.equals(param.getCompanyId())){
+                        list = new ArrayList<>();
+                } else {
+                    param.setCompanyId(companyId);
+                    list = fsStoreSubOrderService.selectFsStoreSubOrderList(param);
+                }
+            }
+
+            if (list != null && !list.isEmpty()){
+                Integer errorCount = 0;
+                for (FsStoreSubOrderListVO vo : list) {
+                    Long orderId = vo.getSubOrderId();
+                    try {
+                        FsSubOrderResultVO fsSubOrderResultVO = fsStoreSubOrderService.TuiFsStoreSubOrderByStoreOrder(orderId);
+                        if (fsSubOrderResultVO == null || (fsSubOrderResultVO.getCode() == null || fsSubOrderResultVO.getCode() != 1)) {
+                            if (fsSubOrderResultVO!=null && StringUtils.isNotBlank(fsSubOrderResultVO.getMsg())) {
+                                errorCount++;
+                                msg.append(errorCount).append(".订单 ").append(vo.getOrderCode()).append(" 推送失败,失败原因:").append(fsSubOrderResultVO.getMsg()).append("\\n");
+                            } else {
+                                errorCount++;
+                                msg.append(errorCount).append(".订单 ").append(vo.getOrderCode()).append(" 推送失败\\n");
+                            }
+
+                        }
+                    } catch (Exception e) {
+                        errorCount++;
+                        msg.append(errorCount).append(".订单 ").append(vo.getOrderCode()).append(" 推送失败,失败原因:").append(e.getMessage()).append("\\n");
+                    }
+                }
+            }
+        } else {
+            Integer errorCount = 0;
+            for (Long orderId : orderIds) {
+                try {
+                    FsSubOrderResultVO fsSubOrderResultVO = fsStoreSubOrderService.TuiFsStoreSubOrderByStoreOrder(orderId);
+                    if (fsSubOrderResultVO == null || (fsSubOrderResultVO.getCode() == null || fsSubOrderResultVO.getCode() != 1)) {
+                        if (fsSubOrderResultVO!=null && StringUtils.isNotBlank(fsSubOrderResultVO.getMsg())) {
+                            errorCount++;
+                            msg.append(errorCount).append(".订单id ").append(orderId).append(" 推送失败,失败原因").append(fsSubOrderResultVO.getMsg()).append("\\n");
+                        } else {
+                            errorCount++;
+                            msg.append(errorCount).append(".订单id ").append(orderId).append(" 推送失败\\n");
+                        }
+
+                    }
+                } catch (Exception e) {
+                    errorCount++;
+                    msg.append(errorCount).append(".订单id ").append(orderId).append(" 推送失败,失败原因:").append(e.getMessage()).append("\\n");
+                }
+            }
+        }
+        return R.ok(msg.toString());
+    }
+
     /**
      * 导出订单列表
      */

+ 3 - 0
fs-service/src/main/java/com/fs/his/mapper/FsStoreSubOrderMapper.java

@@ -108,6 +108,9 @@ public interface FsStoreSubOrderMapper
             "<if test = 'maps.deptId != null    '> " +
             "  AND (so.dept_id = #{maps.deptId} OR so.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +
+            "<if test = 'maps.isPush != null    '> " +
+            " and so.is_push =#{maps.isPush} " +
+            "</if>" +
             "<if test=\"maps.packageName != null and maps.packageName != '' \"> and so.package_name like concat('%', #{maps.packageName}, '%')</if> " +
             " ORDER BY so.sub_order_id desc "+
             "</script>"})

+ 1 - 0
fs-service/src/main/java/com/fs/his/param/FsStoreOrderParam.java

@@ -248,4 +248,5 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable {
     private Long coursePlaySourceConfigId;
     //erp账户
     private String erpAccount;
+    private Integer isPush;
 }

+ 11 - 0
fs-service/src/main/java/com/fs/his/param/FsStoreOrderPushParam.java

@@ -0,0 +1,11 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class FsStoreOrderPushParam extends FsStoreOrderParam implements Serializable {
+    private List<Long> orderIds;
+}

+ 1 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java

@@ -650,7 +650,7 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
         if (!order.getUserId().equals(uesrId)) {
             throw new CustomException("非法操作");
         }
-        if (order.getOrderType().equals(2)) {
+        if (!CloudHostUtils.hasCloudHostName("金牛明医") && order.getOrderType().equals(2)) {
             return R.error("中药订单不允许发起售后");
         }
         if (order.getStatus() == 0) {

+ 15 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreSubOrderServiceImpl.java

@@ -636,6 +636,20 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
         FsStoreSubOrder fsStoreSubOrder = fsStoreSubOrderMapper.selectFsStoreSubOrderBySubOrderId(orderId);
         FsSubOrderResultVO fsSubOrderResultVO = new FsSubOrderResultVO();
 
+        Integer isPush = fsStoreSubOrder.getIsPush();
+        if (isPush==1){
+            fsSubOrderResultVO.setCode(0);
+            fsSubOrderResultVO.setMsg("订单已推送过,无须再推送");
+            return fsSubOrderResultVO;
+        }
+        Date createTime = fsStoreSubOrder.getCreateTime();
+        Date payTime = fsStoreSubOrder.getPayTime();
+        if (createTime.after(DateUtils.getNowDate()) || payTime.after(DateUtils.getNowDate())) {
+            fsSubOrderResultVO.setCode(0);
+            fsSubOrderResultVO.setMsg("订单未达到推送时间");
+            return fsSubOrderResultVO;
+        }
+
         try {
             //1.网络咨询服务数据上传-外部
             FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(fsStoreSubOrder.getDoctorId());
@@ -653,7 +667,7 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
             } else {
                 sex = "女";
             }
-            String createDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(fsStoreSubOrder.getCreateTime());
+            String createDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
             UploadConsultNewDto uploadConsultNewDto = UploadConsultNewDto.builder()
                     .thirdUniqueid(thirdUniqueid)
                     .uploadTime(DateUtils.getTime())