|
|
@@ -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());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出订单列表
|
|
|
*/
|