From e14e4217b3f53a5cad511b4331cd7c0a40a40db2 Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期四, 19 十二月 2024 13:52:03 +0800
Subject: [PATCH] zjh202412019

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java   |   26 ++++++------
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java    |   56 +++++++++++----------------
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java |   19 +++++----
 3 files changed, 47 insertions(+), 54 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
index dc4ea1c..268b0fc 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -2634,16 +2634,18 @@
 //        }
     }
 
-    @PostMapping("/heXiaoByIds/{orderIds}")
+    @PostMapping("/heXiaoByIds")
     @ApiOperation(value = "鏍告敹鎶ュ憡鈥斺�斺�斺�斺�斺�旀�绘瀹℃牳閫氳繃鍚庡彲浠ユ牳閿�锛屾牳鏀跺悗鎵嶈兘鎵撳嵃")
     @Transactional
     @RepeatSubmit
-    public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) {
+    public AjaxResult heXiaoByIds(@RequestBody List<String> orderIds) {
         Date date = new Date();
+        if(null !=orderIds && !orderIds.isEmpty()){
         for (String orderId : orderIds) {
             TjOrder byId = tjOrderService.getById(orderId);
             if (null != byId) {
-                if (byId.getReportTime() == null) {
+
+                /*if (byId.getReportTime() == null) {
                     LambdaQueryWrapper<TjReportTemplate> tjReportTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>();
                     tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getFlag, 1);
                     tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getOpen, 0);
@@ -2658,25 +2660,10 @@
                         //淇敼order琛ㄤ腑鐨勬墦鍗版姤鍛婃椂闂翠负褰撳墠鏃堕棿
                         LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>();
                         updateWrapper.eq(TjOrder::getTjNumber, byId.getTjNumber());
-//                        updateWrapper.set(TjOrder::getReportTime, new Date());
-//                        updateWrapper.set(TjOrder::getPrintLastTime, new Date());
-//                        updateWrapper.set(TjOrder::getDownloadLastTime, new Date());
                         updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END);
                         tjOrderService.update(updateWrapper);
                     }
-                    String hisRegistrationId = byId.getCardId();
-                    Date createTime = byId.getCreateTime();
-                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    String ksrq = dateFormat.format(createTime);
-                    String jsrq = dateFormat.format(date);
-                    HashMap<String, Object> params = new HashMap<>();
-                    params.put("his_registration_id", hisRegistrationId);
-                    params.put("ksbm", "");
-                    params.put("pationid", "");
-                    params.put("ksrq", ksrq);
-                    params.put("jsrq", jsrq);
-                    params.put("pagecount", 100);
-                    params.put("page", 1);
+
                     LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
                     wq1.eq(TjCustomer::getCusId, byId.getUserId());
                     TjCustomer tjCustomer = tjCustomerService.getOne(wq1);
@@ -2687,9 +2674,6 @@
                     try {
                         shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate, zongJianYiShiQianMing);
                         byId.setStatus(TjConstants.TJ_END);
-//                        byId.setReportTime(date);
-//                        byId.setPrintLastTime(date);
-//                        byId.setDownloadLastTime(date);
                     } catch (Exception e) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         e.printStackTrace();
@@ -2697,8 +2681,7 @@
                         logger.error("鐢熸垚鎶ュ憡寮傚父");
                         return AjaxResult.error("鐢熸垚鎶ュ憡寮傚父,鏍告敹澶辫触");
                     }
-                }
-
+                }*/
                 byId.setHeshouStatus(1);
                 byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId());
                 byId.setHeshouTime(date);
@@ -2708,13 +2691,13 @@
                 }
             }
         }
+        }
         return AjaxResult.success("鏍告敹鎴愬姛");
     }
 
 
     public AjaxResult shengchengbgmoban(String tjNumber, TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate, TjReportTemplate zongJianYiShiQianMing) throws Exception {
-//        AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate);
-//        AjaxResult ajaxResult = hisPDFUtil.hisPDFNew(tjOrder, tjCustomer, reportTemplate);
+
         AjaxResult ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate, zongJianYiShiQianMing);
         if (!ajaxResult.get("code").toString().equals("200")) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -2730,12 +2713,6 @@
             tjReport.setType("浣撴鎶ュ憡");
             tjReport.setPrint("pdf");
             tjReportService.save(tjReport);
-//            Date date = new Date();
-//            tjOrder.setStatus(TjConstants.TJ_END);
-//            tjOrder.setReportTime(date);
-//            tjOrder.setPrintLastTime(date);
-//            tjOrder.setDownloadLastTime(date);
-//            tjOrderService.updateById(tjOrder);
         }
         return ajaxResult;
     }
@@ -3295,11 +3272,19 @@
 
 
     @PostMapping("/heshouchexiao")
-    @ApiOperation(value = "鏍告敹鎾ら攢鎺ュ彛")
+    @ApiOperation(value = "鎾ら攢鎶ュ憡鎺ュ彛")
     @Transactional
     public AjaxResult heshouchexiao(@RequestBody List<String> tjNUms) {
 
         if(null !=tjNUms && !tjNUms.isEmpty()){
+
+            // 涓嶅湪浣跨敤閫昏緫鍒犻櫎 閫昏緫鍒犻櫎瀵艰嚧鎵撳嵃鎶ュ憡鐢熸垚 鏌ヨsql缂撴參
+            //閫昏緫鍒犻櫎鏁版嵁搴撻噷鐨勬姤鍛�
+            LambdaQueryWrapper<TjReport> wq1 = new LambdaQueryWrapper<>();
+            wq1.select(TjReport::getReId);
+            wq1.in(TjReport::getTjNumber, tjNUms);
+            wq1.eq(TjReport::getPrint, "pdf");
+            List<Long> list = tjReportService.list(wq1).stream().map(TjReport::getReId).collect(Collectors.toList());
             for (String tjNUm : tjNUms) {
                 TjOrder order = tjOrderService.getOrderByTjNum(tjNUm);
                 if(null !=order){
@@ -3307,6 +3292,7 @@
                     order.setHeshouTime(null);
                     order.setHeshouDoctor(null);
                     order.setPrintLastTime(null);
+                    order.setReportTime(null);
                     order.setStatus(TjConstants.TJ_WAIT);
                     if (!tjOrderService.updateById(order)) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -3314,6 +3300,10 @@
                     }
                 }
             }
+            int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{}));
+            if (i == 0) {
+                return AjaxResult.error("鎾ゅ洖澶辫触锛�");
+            }
             return AjaxResult.success("鎿嶄綔鎴愬姛");
         }
         return AjaxResult.error();
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java
index 1295071..b3a5d2b 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java
@@ -383,19 +383,19 @@
                     tjOrderService.update(updateWrapper);
                     return AjaxResult.success("宸茬敓鎴愭姤鍛婏紒鍙洿鎺ョ偣鍑婚瑙堬紒");
                 }
-                String hisRegistrationId = tjOrder.getCardId();
-                Date createTime = tjOrder.getCreateTime();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                String ksrq = dateFormat.format(createTime);
-                String jsrq = dateFormat.format(new Date());
-                HashMap<String, Object> params = new HashMap<>();
-                params.put("his_registration_id", hisRegistrationId);
-                params.put("ksbm", "");
-                params.put("pationid", "");
-                params.put("ksrq", ksrq);
-                params.put("jsrq", jsrq);
-                params.put("pagecount", 100);
-                params.put("page", 1);
+//                String hisRegistrationId = tjOrder.getCardId();
+//                Date createTime = tjOrder.getCreateTime();
+//                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                String ksrq = dateFormat.format(createTime);
+//                String jsrq = dateFormat.format(new Date());
+//                HashMap<String, Object> params = new HashMap<>();
+//                params.put("his_registration_id", hisRegistrationId);
+//                params.put("ksbm", "");
+//                params.put("pationid", "");
+//                params.put("ksrq", ksrq);
+//                params.put("jsrq", jsrq);
+//                params.put("pagecount", 100);
+//                params.put("page", 1);
                 LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
                 wq1.eq(TjCustomer::getCusId, tjOrder.getUserId());
                 TjCustomer tjCustomer = tjCustomerService.getOne(wq1);
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
index adc092e..802c01d 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
@@ -216,24 +216,27 @@
         LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TjSampling::getIsSignFor, isSignFor);
         if (null != tjNum && StrUtil.isNotBlank(tjNum))
-            wrapper.eq(TjSampling::getTjNum, tjNum);
+            wrapper.like(TjSampling::getTjNum, tjNum);
         if (null != name && StrUtil.isNotBlank(name))
-            wrapper.eq(TjSampling::getCusName, name);
+            wrapper.like(TjSampling::getCusName, name);
         if (null != beginTime && null != endTime && StrUtil.isNotBlank(beginTime) && StrUtil.isNotBlank(endTime))
             wrapper.between(TjSampling::getApplicationTime, beginTime, endTime);
         wrapper.groupBy(TjSampling::getCusId);
+        wrapper.orderByDesc(TjSampling::getCreateTime);
 //        wrapper.last("LIMIT " + (pageNum - 1) * pageSize + "," + pageSize);
         Page<TjSampling> page = tjSamplingService.page(samplingPage, wrapper);
         List<TjSampling> list = page.getRecords();
         ArrayList<TjCustomer> tjCustomers = new ArrayList<>();
         for (TjSampling tjSampling : list) {
             TjCustomer customer = customerService.getById(tjSampling.getCusId());
-            customer.setCusName(customer.getCusName());
-            customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
-            customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
-            customer.setTjNumber(tjSampling.getTjNum());
-            customer.setApplicationTime(tjSampling.getApplicationTime());
-            tjCustomers.add(customer);
+            if(null !=customer){
+                customer.setCusName(customer.getCusName());
+                customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
+                customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
+                customer.setTjNumber(tjSampling.getTjNum());
+                customer.setApplicationTime(tjSampling.getApplicationTime());
+                tjCustomers.add(customer);
+            }
         }
         HashMap<String, Object> hashMap = new HashMap<>();
         hashMap.put("list", tjCustomers);

--
Gitblit v1.8.0