Browse Source

发票优化

hurugang 5 years ago
parent
commit
65d8c3eb00

+ 38 - 0
src/main/java/cn/hnthyy/thmz/common/ScheduledService.java

@@ -1,11 +1,18 @@
 package cn.hnthyy.thmz.common;
 
+import cn.hnthyy.thmz.entity.his.MzyRequest;
+import cn.hnthyy.thmz.service.his.MzyRequestService;
 import cn.hnthyy.thmz.service.thmz.TokenService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
+
+import java.util.Date;
+import java.util.List;
+
 /**
  * 定时任务类
  */
@@ -17,6 +24,8 @@ import org.springframework.scheduling.annotation.Scheduled;
 public class ScheduledService {
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private MzyRequestService mzyRequestService;
     /**
      * 每20分钟执行一次
      */
@@ -27,5 +36,34 @@ public class ScheduledService {
 
 
 
+    /**
+     * 每天凌晨零点五分运行一次
+     */
+    @Scheduled(cron = "5 0 0 * * *")
+    public void scheduled() {
+        process();
+    }
+
+
+    @Scheduled(cron = "50 11 * * * *")
+    public void scheduledFull() {
+        process();
+    }
+
+
+
+    /**
+     * 处理入库数据
+     *
+     */
+    private void process() {
+        List<MzyRequest> requests = mzyRequestService.queryMzyRequestByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
+        //此时排班表数据没有同步过来,需要手动同步,以后排版系统重做后需要移除此功能
+        if(requests==null || requests.size()==0){
+            mzyRequestService.synchronizationRequest();
+        }
+    }
+
+
 
 }

+ 6 - 6
src/main/java/cn/hnthyy/thmz/controller/MzyRequestController.java

@@ -45,12 +45,12 @@ public class MzyRequestController {
                 return resultMap;
             }
             List<String> unitCodes = mzyRequestService.queryUnitCodeByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"), ampm);
-            //此时排班表数据没有同步过来,需要手动同步,以后排版系统重做后需要移除此功能
-            if(unitCodes==null || unitCodes.size()==0){
-                mzyRequestService.synchronizationRequest();
-                //数据导入后重新查询
-                unitCodes = mzyRequestService.queryUnitCodeByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"), ampm);
-            }
+//            //此时排班表数据没有同步过来,需要手动同步,以后排版系统重做后需要移除此功能
+//            if(unitCodes==null || unitCodes.size()==0){
+//                mzyRequestService.synchronizationRequest();
+//                //数据导入后重新查询
+//                unitCodes = mzyRequestService.queryUnitCodeByRequestDay(DateFormatUtils.format(new Date(), "yyyy-MM-dd"), ampm);
+//            }
             List<ZdUnitCode> data = new ArrayList<>();
             if (unitCodes != null && unitCodes.size() > 0) {
                 unitCodes.forEach(u -> {

+ 1 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -356,6 +356,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //本院记账金额
         BigDecimal byjzAmount=totalPayable.subtract(mzReceiptSerial.getTotalCharge());
         if(byjzAmount.compareTo(BigDecimal.ZERO)==1){
+            byjzAmount=byjzAmount.setScale(1, BigDecimal.ROUND_HALF_UP);
             MzReceiptSerial jzMzReceiptSerial=CloneUtil.clone(mzReceiptSerial);
             jzMzReceiptSerial.setCharge1(BigDecimal.ZERO);
             jzMzReceiptSerial.setCharge2(BigDecimal.ZERO);