|
|
@@ -4,6 +4,7 @@ import api.entity.database.call.CallLog;
|
|
4
|
4
|
import api.entity.database.order.*;
|
|
5
|
5
|
import api.entity.database.patient.Patient;
|
|
6
|
6
|
import api.entity.database.system.*;
|
|
|
7
|
+import api.entity.input.order.SimilarOrdersInput;
|
|
7
|
8
|
import api.entity.input.order.TransOrderInput;
|
|
8
|
9
|
import api.entity.view.order.*;
|
|
9
|
10
|
import api.entity.view.system.DeptView;
|
|
|
@@ -33,6 +34,7 @@ import api.service.order.IOrderBaseService;
|
|
33
|
34
|
import api.util.annotation.Log;
|
|
34
|
35
|
import api.util.enums.BusinessType;
|
|
35
|
36
|
import api.util.helper.StringHelper;
|
|
|
37
|
+import io.milvus.response.SearchResultsWrapper;
|
|
36
|
38
|
import io.swagger.annotations.Api;
|
|
37
|
39
|
import io.swagger.annotations.ApiOperation;
|
|
38
|
40
|
import lombok.var;
|
|
|
@@ -41,6 +43,7 @@ import org.springframework.web.bind.annotation.*;
|
|
41
|
43
|
|
|
42
|
44
|
import java.text.SimpleDateFormat;
|
|
43
|
45
|
import java.util.*;
|
|
|
46
|
+import java.util.concurrent.CompletableFuture;
|
|
44
|
47
|
import java.util.stream.Collectors;
|
|
45
|
48
|
|
|
46
|
49
|
@Api(value = "新加的controller,蓝天燃气工单用这个",tags = "新加的controller,蓝天燃气工单用这个")
|
|
|
@@ -410,6 +413,7 @@ public class OrderBaseController extends BaseController {
|
|
410
|
413
|
}
|
|
411
|
414
|
} catch (Exception e) {
|
|
412
|
415
|
}
|
|
|
416
|
+
|
|
413
|
417
|
boolean customerresult = patientService.insert(pt);
|
|
414
|
418
|
}
|
|
415
|
419
|
//添加操作日志
|
|
|
@@ -428,6 +432,14 @@ public class OrderBaseController extends BaseController {
|
|
428
|
432
|
|
|
429
|
433
|
}
|
|
430
|
434
|
}
|
|
|
435
|
+ CompletableFuture.supplyAsync(() -> {
|
|
|
436
|
+ try {
|
|
|
437
|
+ orderbaseService.historicalOrders(input);
|
|
|
438
|
+ } catch (Exception e) {
|
|
|
439
|
+ throw new RuntimeException(e);
|
|
|
440
|
+ }
|
|
|
441
|
+ return null;
|
|
|
442
|
+ }).thenAccept(results -> System.out.println("Result: " + results));
|
|
431
|
443
|
return Success("成功", input.getWorkOrderCode());
|
|
432
|
444
|
} else {
|
|
433
|
445
|
return Error("新增失败");
|
|
|
@@ -660,6 +672,10 @@ public class OrderBaseController extends BaseController {
|
|
660
|
672
|
public AjaxResult end(@RequestBody HashMap<String,String> map) {
|
|
661
|
673
|
String code= map.get("code");
|
|
662
|
674
|
|
|
|
675
|
+
|
|
|
676
|
+
|
|
|
677
|
+
|
|
|
678
|
+
|
|
663
|
679
|
Date currentDate = new Date(System.currentTimeMillis());
|
|
664
|
680
|
|
|
665
|
681
|
LambdaUpdateWrapper< OrderBase> qw = new LambdaUpdateWrapper<>();
|
|
|
@@ -678,6 +694,23 @@ public class OrderBaseController extends BaseController {
|
|
678
|
694
|
}
|
|
679
|
695
|
|
|
680
|
696
|
if (result) {
|
|
|
697
|
+ CompletableFuture.supplyAsync(() -> {
|
|
|
698
|
+ try {
|
|
|
699
|
+ LambdaQueryWrapper<OrderBase> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
700
|
+ queryWrapper.eq(OrderBase::getWorkOrderCode, code);
|
|
|
701
|
+ queryWrapper.last("limit 1");
|
|
|
702
|
+ queryWrapper.orderByDesc(OrderBase::getWorkOrderId);
|
|
|
703
|
+ OrderBase orderBase = orderbaseService.getEntity(queryWrapper);
|
|
|
704
|
+ if (orderBase!=null&&StringHelper.isNotEmpty(orderBase.getCorrelation()))
|
|
|
705
|
+ {
|
|
|
706
|
+ overOrder(orderBase);
|
|
|
707
|
+ }
|
|
|
708
|
+ } catch (Exception e) {
|
|
|
709
|
+ throw new RuntimeException(e);
|
|
|
710
|
+ }
|
|
|
711
|
+ return null;
|
|
|
712
|
+ }).thenAccept(results -> System.out.println("Result: " + results));
|
|
|
713
|
+
|
|
681
|
714
|
boolean logresult = addlog("完结了工单" + reason, "完结", CurrentUser().getUserName(), code, CurrentUser().getNickName(), "");
|
|
682
|
715
|
return Success("完结成功");
|
|
683
|
716
|
} else {
|
|
|
@@ -713,9 +746,90 @@ public class OrderBaseController extends BaseController {
|
|
713
|
746
|
}
|
|
714
|
747
|
}
|
|
715
|
748
|
|
|
|
749
|
+ @ApiOperation("关联工单")
|
|
|
750
|
+ @Log(title = "关联工单", businessType = BusinessType.UPDATE)
|
|
|
751
|
+ @PutMapping("/correlation/{ids}")
|
|
|
752
|
+ public AjaxResult correlation(@PathVariable List<Long> ids) {
|
|
|
753
|
+ LambdaQueryWrapper<OrderBase> qw=new LambdaQueryWrapper<>();
|
|
|
754
|
+ qw.eq(OrderBase::getIsDelete,0);
|
|
|
755
|
+ qw.in(OrderBase::getWorkOrderId,ids);
|
|
|
756
|
+ var list=orderbaseService.getList(qw);
|
|
|
757
|
+ if (list!=null&&list.size()>0)
|
|
|
758
|
+ {
|
|
|
759
|
+ var overList=list.stream().filter(x->x.getIsEnd()==1).collect(Collectors.toList());
|
|
|
760
|
+ var unfinished=list.stream().filter(x->x.getIsEnd()!=1).collect(Collectors.toList());
|
|
|
761
|
+ var mainWorkOrder=new OrderBase();
|
|
|
762
|
+ if (overList.size()>0)
|
|
|
763
|
+ {
|
|
|
764
|
+ mainWorkOrder=overList.get(0);
|
|
|
765
|
+ }
|
|
|
766
|
+ else
|
|
|
767
|
+ {
|
|
|
768
|
+ mainWorkOrder=list.get(0);
|
|
|
769
|
+ }
|
|
|
770
|
+ List<Long>unfinishedIds=new ArrayList<>();
|
|
|
771
|
+ if (unfinished.size()>0)
|
|
|
772
|
+ {
|
|
|
773
|
+ unfinishedIds=unfinished.stream() .map(OrderBase::getWorkOrderId)
|
|
|
774
|
+ .collect(Collectors.toList());
|
|
|
775
|
+ }
|
|
|
776
|
+ LambdaUpdateWrapper<OrderBase> qu=new LambdaUpdateWrapper<>();
|
|
|
777
|
+ qu.eq(OrderBase::getIsDelete,0);
|
|
|
778
|
+ qu.in(OrderBase::getWorkOrderId,ids);
|
|
|
779
|
+ qu.set(OrderBase::getCorrelation,mainWorkOrder.getWorkOrderId());
|
|
|
780
|
+ boolean n=orderbaseService.updateBatch(qu);
|
|
|
781
|
+ if (n )
|
|
|
782
|
+ {
|
|
|
783
|
+ if (overList.size()>0&&unfinishedIds.size()>0)
|
|
|
784
|
+ {
|
|
|
785
|
+ LambdaUpdateWrapper<OrderBase> qu1=new LambdaUpdateWrapper<>();
|
|
|
786
|
+ qu1.eq(OrderBase::getIsDelete,0);
|
|
|
787
|
+ qu1.eq(OrderBase::getCorrelation,mainWorkOrder.getWorkOrderId());
|
|
|
788
|
+ qu1.eq(OrderBase::getIsEnd,0);
|
|
|
789
|
+ qu1.set(OrderBase::getWorkOrderState, EnumOrderStatus.end.getValue());
|
|
|
790
|
+ qu1.set(OrderBase::getIsEnd, 1);
|
|
|
791
|
+ qu1.set(OrderBase::getEndTime, new Date());
|
|
|
792
|
+ qu1.set(OrderBase::getDealUserCode, mainWorkOrder.getDealUserCode());
|
|
|
793
|
+ qu1.set(OrderBase::getDealDept, mainWorkOrder.getDealDept());
|
|
|
794
|
+ qu1.set(OrderBase::getDealUserName, mainWorkOrder.getDealUserName());
|
|
|
795
|
+ qu1.set(OrderBase::getFile,mainWorkOrder.getFile());
|
|
|
796
|
+ qu1.set(OrderBase::getDealContent,mainWorkOrder.getDealContent());
|
|
|
797
|
+ boolean n1=orderbaseService.updateBatch(qu1);
|
|
|
798
|
+ if (!n1)
|
|
|
799
|
+ {
|
|
|
800
|
+ return Error("结案失败");
|
|
|
801
|
+ }
|
|
|
802
|
+ }
|
|
|
803
|
+ return Success("关联成功");
|
|
|
804
|
+ }
|
|
|
805
|
+ else
|
|
|
806
|
+ {
|
|
|
807
|
+ return Error("关联失败");
|
|
|
808
|
+ }
|
|
|
809
|
+ }
|
|
|
810
|
+ else
|
|
|
811
|
+ {
|
|
|
812
|
+ return Error("工单不存在");
|
|
|
813
|
+ }
|
|
716
|
814
|
|
|
|
815
|
+ }
|
|
717
|
816
|
|
|
718
|
|
-
|
|
|
817
|
+ private void overOrder(OrderBase orderBase)
|
|
|
818
|
+ {
|
|
|
819
|
+ LambdaUpdateWrapper<OrderBase> qu=new LambdaUpdateWrapper<>();
|
|
|
820
|
+ qu.eq(OrderBase::getIsDelete,0);
|
|
|
821
|
+ qu.eq(OrderBase::getCorrelation,orderBase.getCorrelation());
|
|
|
822
|
+ qu.eq(OrderBase::getIsEnd,0);
|
|
|
823
|
+ qu.set(OrderBase::getWorkOrderState, EnumOrderStatus.end.getValue());
|
|
|
824
|
+ qu.set(OrderBase::getIsEnd, 1);
|
|
|
825
|
+ qu.set(OrderBase::getEndTime, new Date());
|
|
|
826
|
+ qu.set(OrderBase::getDealUserCode, orderBase.getDealUserCode());
|
|
|
827
|
+ qu.set(OrderBase::getDealDept, orderBase.getDealDept());
|
|
|
828
|
+ qu.set(OrderBase::getDealUserName, orderBase.getDealUserName());
|
|
|
829
|
+ qu.set(OrderBase::getFile,orderBase.getFile());
|
|
|
830
|
+ qu.set(OrderBase::getDealContent,orderBase.getDealContent());
|
|
|
831
|
+ boolean n1=orderbaseService.updateBatch(qu);
|
|
|
832
|
+ }
|
|
719
|
833
|
@ApiOperation(" 接单 code")
|
|
720
|
834
|
@Log(title = "接单,参数是code,以后都用code", businessType = BusinessType.OTHER)
|
|
721
|
835
|
@PutMapping("/receive")
|
|
|
@@ -807,7 +921,7 @@ public class OrderBaseController extends BaseController {
|
|
807
|
921
|
String dealContent="";
|
|
808
|
922
|
if(map.get("result")!=null && !StringHelper.isEmpty(map.get("result").toString())){
|
|
809
|
923
|
dealContent=",回复内容:"+map.get("result").toString();
|
|
810
|
|
-
|
|
|
924
|
+ qw .set(OrderBase::getDealContent,map.get("result").toString());
|
|
811
|
925
|
}
|
|
812
|
926
|
boolean result = orderbaseService.updateBatch(qw);
|
|
813
|
927
|
if (result) {
|
|
|
@@ -874,6 +988,22 @@ public class OrderBaseController extends BaseController {
|
|
874
|
988
|
visitLogService.insert(visitLog);
|
|
875
|
989
|
|
|
876
|
990
|
if (result) {
|
|
|
991
|
+ CompletableFuture.supplyAsync(() -> {
|
|
|
992
|
+ try {
|
|
|
993
|
+ LambdaQueryWrapper<OrderBase> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
994
|
+ queryWrapper.eq(OrderBase::getWorkOrderCode, code);
|
|
|
995
|
+ queryWrapper.last("limit 1");
|
|
|
996
|
+ queryWrapper.orderByDesc(OrderBase::getWorkOrderId);
|
|
|
997
|
+ OrderBase orderBase = orderbaseService.getEntity(queryWrapper);
|
|
|
998
|
+ if (orderBase!=null&&StringHelper.isNotEmpty(orderBase.getCorrelation()))
|
|
|
999
|
+ {
|
|
|
1000
|
+ overOrder(orderBase);
|
|
|
1001
|
+ }
|
|
|
1002
|
+ } catch (Exception e) {
|
|
|
1003
|
+ throw new RuntimeException(e);
|
|
|
1004
|
+ }
|
|
|
1005
|
+ return null;
|
|
|
1006
|
+ }).thenAccept(results -> System.out.println("Result: " + results));
|
|
877
|
1007
|
boolean logresult = addlog("回访了工单" , "回访", CurrentUser().getUserName(),
|
|
878
|
1008
|
code , CurrentUser().getNickName(), "");
|
|
879
|
1009
|
return Success("回访成功");
|
|
|
@@ -882,6 +1012,25 @@ public class OrderBaseController extends BaseController {
|
|
882
|
1012
|
}
|
|
883
|
1013
|
}
|
|
884
|
1014
|
|
|
885
|
|
-
|
|
|
1015
|
+ @ApiOperation("查找相似工单")
|
|
|
1016
|
+ @Log(title = "查找相似工单",businessType = BusinessType.QUERY)
|
|
|
1017
|
+ @PostMapping("/detection")
|
|
|
1018
|
+ @Anonymous
|
|
|
1019
|
+ public AjaxResult detection(@RequestBody SimilarOrdersInput input ) {
|
|
|
1020
|
+ var result = orderbaseService.findSimilarOrders(input.getContent(),input.getTopK());
|
|
|
1021
|
+ return Success("成功",result);
|
|
|
1022
|
+ }
|
|
|
1023
|
+ @ApiOperation("添加历史工单")
|
|
|
1024
|
+ @Log(title = "添加历史工单",businessType = BusinessType.INSERT)
|
|
|
1025
|
+ @GetMapping("/addHistorical")
|
|
|
1026
|
+ @Anonymous
|
|
|
1027
|
+ public AjaxResult addHistorical() {
|
|
|
1028
|
+ var list=orderbaseService.getList();
|
|
|
1029
|
+ for (OrderBase item :list)
|
|
|
1030
|
+ {
|
|
|
1031
|
+ orderbaseService.historicalOrders(item);
|
|
|
1032
|
+ }
|
|
|
1033
|
+ return Success("添加工单");
|
|
|
1034
|
+ }
|
|
886
|
1035
|
|
|
887
|
1036
|
}
|