|
|
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
9
|
9
|
import com.google.common.collect.Maps;
|
|
10
|
10
|
import com.unissoft.MyConstant;
|
|
11
|
11
|
import com.unissoft.dto.ProcessToBeDone;
|
|
|
12
|
+import com.unissoft.dto.ToBeDoneCallbackVO;
|
|
|
13
|
+import com.unissoft.feign.MessageFeign;
|
|
12
|
14
|
import com.unissoft.feign.SystemFeign;
|
|
13
|
15
|
import com.unissoft.mapper.*;
|
|
14
|
16
|
import com.unissoft.model.*;
|
|
|
@@ -59,6 +61,9 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
59
|
61
|
private SystemFeign systemFeign;
|
|
60
|
62
|
|
|
61
|
63
|
@Autowired
|
|
|
64
|
+ private MessageFeign messageFeign;
|
|
|
65
|
+
|
|
|
66
|
+ @Autowired
|
|
62
|
67
|
private RestTemplate restTemplate;
|
|
63
|
68
|
|
|
64
|
69
|
|
|
|
@@ -154,15 +159,15 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
154
|
159
|
}
|
|
155
|
160
|
|
|
156
|
161
|
if (StringUtils.isNotBlank(object.optString("startTime")) || StringUtils.isNotBlank(object.optString("endTime"))) {
|
|
157
|
|
- if(StringUtils.isNotBlank(object.optString("startTime")) && StringUtils.isNotBlank(object.optString("endTime")) &&
|
|
158
|
|
- object.optString("startTime").equals(object.optString("endTime"))){
|
|
159
|
|
- ew.apply("date_format(apply_time,'%Y-%m-%d')='"+object.optString("startTime")+"'" );
|
|
160
|
|
- }else{
|
|
161
|
|
- ew.between("apply_time", object.optString("startTime"), object.optString("endTime"));
|
|
|
162
|
+ if (StringUtils.isNotBlank(object.optString("startTime")) && StringUtils.isNotBlank(object.optString("endTime")) &&
|
|
|
163
|
+ object.optString("startTime").equals(object.optString("endTime"))) {
|
|
|
164
|
+ ew.apply("date_format(apply_time,'%Y-%m-%d')='" + object.optString("startTime") + "'");
|
|
|
165
|
+ } else {
|
|
|
166
|
+ ew.between("apply_time", object.optString("startTime"), object.optString("endTime"));
|
|
162
|
167
|
}
|
|
163
|
168
|
|
|
164
|
169
|
}
|
|
165
|
|
-
|
|
|
170
|
+
|
|
166
|
171
|
|
|
167
|
172
|
}
|
|
168
|
173
|
|
|
|
@@ -329,7 +334,7 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
329
|
334
|
processAudit1.setApplyPeople(processAudit.getApplyPeople());
|
|
330
|
335
|
processAudit1.setProcessId(processAudit.getProcessId());
|
|
331
|
336
|
processAudit1.setApplyTime(processAudit.getApplyTime());
|
|
332
|
|
- if(processAudit.getType().equals("tf")){
|
|
|
337
|
+ if (processAudit.getType().equals("tf")) {
|
|
333
|
338
|
processAudit1.setWorkName("机械通风申请");
|
|
334
|
339
|
}
|
|
335
|
340
|
processAuditMapper.insert(processAudit1);
|
|
|
@@ -518,7 +523,7 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
518
|
523
|
|
|
519
|
524
|
if (pageInfo.getTotal() > 0) {
|
|
520
|
525
|
for (ProcessAudit processAudit : pageInfo.getRecords()) {
|
|
521
|
|
- //根据仓房id获取仓房名称
|
|
|
526
|
+ //根据仓房id获取仓房名称
|
|
522
|
527
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(MyConstant.SYSTEM_WAREHOUSE + processAudit.getHouseId(), String.class);
|
|
523
|
528
|
JSONObject jsonObject = JSON.parseObject(forEntity.getBody());
|
|
524
|
529
|
BasicsWarehouse ware = JSONObject.toJavaObject(jsonObject, BasicsWarehouse.class);
|
|
|
@@ -575,7 +580,7 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
575
|
580
|
Page<ProcessAudit> pageInfo = processAuditMapper.selectPage(page, ew);
|
|
576
|
581
|
if (pageInfo.getTotal() > 0) {
|
|
577
|
582
|
for (ProcessAudit processAudit : pageInfo.getRecords()) {
|
|
578
|
|
- //根据仓房id获取仓房名称
|
|
|
583
|
+ //根据仓房id获取仓房名称
|
|
579
|
584
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(MyConstant.SYSTEM_WAREHOUSE + processAudit.getHouseId(), String.class);
|
|
580
|
585
|
JSONObject jsonObject = JSON.parseObject(forEntity.getBody());
|
|
581
|
586
|
BasicsWarehouse ware = JSONObject.toJavaObject(jsonObject, BasicsWarehouse.class);
|
|
|
@@ -600,18 +605,24 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
600
|
605
|
}
|
|
601
|
606
|
|
|
602
|
607
|
@Override
|
|
603
|
|
- public void toBeDone(ProcessToBeDone processToBeDone) {//systemFeign
|
|
|
608
|
+ public List<ToBeDoneCallbackVO> toBeDone(ProcessToBeDone processToBeDone) {
|
|
|
609
|
+ List<ToBeDoneCallbackVO> result = new ArrayList<>();
|
|
|
610
|
+
|
|
604
|
611
|
String usersInfo = processToBeDone.getUsersInfo();
|
|
605
|
|
- if(StringUtils.isNotEmpty(usersInfo)) {
|
|
|
612
|
+ if (StringUtils.isNotEmpty(usersInfo)) {
|
|
606
|
613
|
String[] userInfoArr = usersInfo.split(",");
|
|
607
|
|
- for(String userInfo : userInfoArr) {
|
|
|
614
|
+ for (String userInfo : userInfoArr) {
|
|
608
|
615
|
String[] temp = userInfo.split("\\|");
|
|
609
|
616
|
Integer userId = Integer.parseInt(temp[0]);
|
|
610
|
617
|
SysUserDTO user = systemFeign.getUserById(userId);
|
|
611
|
618
|
String storehouseIds = user.getStorehouseIds();
|
|
612
|
|
- if(StringUtils.isNotEmpty(storehouseIds)) {
|
|
|
619
|
+ String storehouseNames = user.getStorehouseNames();
|
|
|
620
|
+ if (StringUtils.isNotEmpty(storehouseIds)) {
|
|
613
|
621
|
String[] houseIdArr = storehouseIds.split(",");
|
|
614
|
|
- for(String houseId : houseIdArr) {
|
|
|
622
|
+ String[] houseNameArr = storehouseNames.split(",");
|
|
|
623
|
+ for (int i = 0; i < houseIdArr.length; i++) {
|
|
|
624
|
+ String houseId = houseIdArr[i];
|
|
|
625
|
+ String houseName = houseNameArr[i];
|
|
615
|
626
|
ProcessToBeDoneVO toBeDoneVO = new ProcessToBeDoneVO();
|
|
616
|
627
|
toBeDoneVO.setTitle(processToBeDone.getTitle());
|
|
617
|
628
|
toBeDoneVO.setHouseId(Integer.parseInt(houseId));
|
|
|
@@ -622,15 +633,45 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
622
|
633
|
toBeDoneVO.setUserId(userId);
|
|
623
|
634
|
toBeDoneVO.setType(processToBeDone.getType());
|
|
624
|
635
|
//
|
|
625
|
|
- toBeDone(toBeDoneVO);
|
|
|
636
|
+ ProcessAudit processAudit = toBeDone(toBeDoneVO);//生成待办数据
|
|
|
637
|
+ //
|
|
|
638
|
+ ToBeDoneCallbackVO toBeDoneCallbackVO = new ToBeDoneCallbackVO();
|
|
|
639
|
+ toBeDoneCallbackVO.setToBeDoneId(processAudit.getId());
|
|
|
640
|
+ toBeDoneCallbackVO.setUserId(userId);
|
|
|
641
|
+ toBeDoneCallbackVO.setPersonnelName(user.getPersonnelName());
|
|
|
642
|
+ toBeDoneCallbackVO.setDepotId(user.getDepotId());
|
|
|
643
|
+ toBeDoneCallbackVO.setDepotName(user.getDepotName());
|
|
|
644
|
+ toBeDoneCallbackVO.setHouseId(Integer.parseInt(houseId));
|
|
|
645
|
+ toBeDoneCallbackVO.setHouseName(houseName);
|
|
|
646
|
+// toBeDoneCallbackVO.setTitle(processToBeDone.getTitle());
|
|
|
647
|
+
|
|
|
648
|
+ result.add(toBeDoneCallbackVO);
|
|
626
|
649
|
}
|
|
627
|
650
|
}
|
|
628
|
651
|
}
|
|
629
|
652
|
}
|
|
630
|
|
- }
|
|
631
|
653
|
|
|
|
654
|
+ return result;
|
|
|
655
|
+ }
|
|
632
|
656
|
|
|
633
|
|
- private void toBeDone(ProcessToBeDoneVO processToBeDone) {
|
|
|
657
|
+// private SendNoticeVO getSendNoticeVO(ProcessToBeDoneVO toBeDoneVO, SysUserDTO userDTO, String houseName) {
|
|
|
658
|
+// SendNoticeVO vo = new SendNoticeVO();
|
|
|
659
|
+// Map<Integer, String> users = new HashMap<>();
|
|
|
660
|
+// users.put(userDTO.getUId(), userDTO.getUName());
|
|
|
661
|
+// SysNoticeVO sysNoticeVO = new SysNoticeVO();
|
|
|
662
|
+//
|
|
|
663
|
+// String content = toBeDoneVO.getTitle() + "-" + houseName + "-" + "待处理";
|
|
|
664
|
+// sysNoticeVO.setContent(content);
|
|
|
665
|
+// sysNoticeVO.setNoticeTime(new Date());
|
|
|
666
|
+// sysNoticeVO.setNoticeType(10);
|
|
|
667
|
+// sysNoticeVO.setOrgName(userDTO.getCompanyName());
|
|
|
668
|
+//
|
|
|
669
|
+// vo.setUsers(users);
|
|
|
670
|
+// vo.setSysNoticeVO(sysNoticeVO);
|
|
|
671
|
+// return vo;
|
|
|
672
|
+// }
|
|
|
673
|
+
|
|
|
674
|
+ private ProcessAudit toBeDone(ProcessToBeDoneVO processToBeDone) {
|
|
634
|
675
|
// TODO Auto-generated method stub
|
|
635
|
676
|
ProcessAudit processAudit = new ProcessAudit();
|
|
636
|
677
|
if (null != processToBeDone) {
|
|
|
@@ -667,30 +708,31 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
667
|
708
|
}
|
|
668
|
709
|
processAuditMapper.insert(processAudit);
|
|
669
|
710
|
}
|
|
|
711
|
+ return processAudit;
|
|
670
|
712
|
}
|
|
671
|
713
|
|
|
672
|
714
|
|
|
673
|
715
|
@Override
|
|
674
|
|
- public void haveDone(Integer id,Integer auditState) {
|
|
|
716
|
+ public void haveDone(Integer id, Integer auditState) {
|
|
675
|
717
|
// TODO Auto-generated method stub
|
|
676
|
718
|
ProcessAudit processAudit = processAuditMapper.selectById(id);
|
|
677
|
|
- if(null!=processAudit){
|
|
678
|
|
- if(processAudit.getAuditState().equals(4)){//已经处理完成 则不处理
|
|
679
|
|
- haveDone(processAudit.getApplyPeople(),processAudit.getType(),processAudit.getDepotId(),processAudit.getHouseId(),auditState);
|
|
680
|
|
- }else{
|
|
681
|
|
- processAudit.setAuditState(auditState);//设置状态
|
|
|
719
|
+ if (null != processAudit) {
|
|
|
720
|
+ if (processAudit.getAuditState().equals(4)) {//已经处理完成 则不处理
|
|
|
721
|
+ haveDone(processAudit.getApplyPeople(), processAudit.getType(), processAudit.getDepotId(), processAudit.getHouseId(), auditState);
|
|
|
722
|
+ } else {
|
|
|
723
|
+ processAudit.setAuditState(auditState);//设置状态
|
|
682
|
724
|
// 获得SimpleDateFormat类
|
|
683
|
725
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
684
|
726
|
processAudit.setOperationTime(sf.format(new Date()));//具体办理时的时间
|
|
685
|
727
|
processAuditMapper.updateById(processAudit);
|
|
686
|
|
- }
|
|
|
728
|
+ }
|
|
687
|
729
|
}
|
|
688
|
|
-
|
|
|
730
|
+
|
|
689
|
731
|
}
|
|
690
|
732
|
|
|
691
|
733
|
|
|
692
|
734
|
@Override
|
|
693
|
|
- public void haveDone(Integer userId, String type, Integer depotId, Integer houseId,Integer auditState) {
|
|
|
735
|
+ public void haveDone(Integer userId, String type, Integer depotId, Integer houseId, Integer auditState) {
|
|
694
|
736
|
// TODO Auto-generated method stub
|
|
695
|
737
|
//根据用户id、流程类型(如科长每2周粮情检查的类型:xxxx1),按时间倒序查出待办流程,将最近日期的流程设成已办
|
|
696
|
738
|
//同时要存储具体办理时的时间,因为要计算该流程办理的周期(或计算逾期时间)
|
|
|
@@ -701,14 +743,57 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
|
|
701
|
743
|
ew.eq("house_id", houseId);
|
|
702
|
744
|
ew.orderByDesc("start_date");//根据时间倒叙
|
|
703
|
745
|
List<ProcessAudit> auditList = processAuditMapper.selectList(ew);
|
|
704
|
|
- if(auditList.size()>0){
|
|
705
|
|
- auditList.get(0).setAuditState(auditState);//设置状态
|
|
706
|
|
- // 获得SimpleDateFormat类
|
|
707
|
|
- SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
708
|
|
- auditList.get(0).setOperationTime(sf.format(new Date()));//具体办理时的时间
|
|
709
|
|
- processAuditMapper.updateById(auditList.get(0));
|
|
|
746
|
+ if (auditList.size() > 0) {
|
|
|
747
|
+ auditList.get(0).setAuditState(auditState);//设置状态
|
|
|
748
|
+ // 获得SimpleDateFormat类
|
|
|
749
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
750
|
+ auditList.get(0).setOperationTime(sf.format(new Date()));//具体办理时的时间
|
|
|
751
|
+ processAuditMapper.updateById(auditList.get(0));
|
|
|
752
|
+ }
|
|
|
753
|
+
|
|
|
754
|
+ }
|
|
|
755
|
+
|
|
|
756
|
+ @Override
|
|
|
757
|
+ public List<Integer> getNotBeDoneNotice(String toBeDoneIds) {
|
|
|
758
|
+ List<Integer> result = null;
|
|
|
759
|
+ if (StringUtils.isNotEmpty(toBeDoneIds)) {
|
|
|
760
|
+ String[] toBeDoneIdArr = toBeDoneIds.split(",");
|
|
|
761
|
+ List<ProcessAudit> toBeDone = processAuditMapper.getToBeDone(convertType(toBeDoneIdArr));
|
|
|
762
|
+ if (null != toBeDone && toBeDone.size() > 0) {
|
|
|
763
|
+ result = new ArrayList<>();
|
|
|
764
|
+ for(ProcessAudit processAudit : toBeDone) {
|
|
|
765
|
+ result.add(processAudit.getId());
|
|
|
766
|
+ }
|
|
|
767
|
+ }
|
|
710
|
768
|
}
|
|
|
769
|
+ return result;
|
|
|
770
|
+ }
|
|
711
|
771
|
|
|
|
772
|
+ private List<Integer> convertType(String[] stringArr) {
|
|
|
773
|
+ List<Integer> result = null;
|
|
|
774
|
+ if (null != stringArr && stringArr.length > 0) {
|
|
|
775
|
+ result = new ArrayList<>();
|
|
|
776
|
+ for (String str : stringArr) {
|
|
|
777
|
+ result.add(Integer.parseInt(str));
|
|
|
778
|
+ }
|
|
|
779
|
+ }
|
|
|
780
|
+ return result;
|
|
712
|
781
|
}
|
|
713
|
782
|
|
|
|
783
|
+ private String getWarehouse(SysUserDTO user, Integer houseId) {
|
|
|
784
|
+ String storehouseIds = user.getStorehouseIds();
|
|
|
785
|
+ String storehouseNames = user.getStorehouseNames();
|
|
|
786
|
+ if (StringUtils.isNotEmpty(storehouseIds)) {
|
|
|
787
|
+ String[] storehouseIdArr = storehouseIds.split(",");
|
|
|
788
|
+ String[] storehouseNameArr = storehouseNames.split(",");
|
|
|
789
|
+ for (int i = 0; i < storehouseIdArr.length; i++) {
|
|
|
790
|
+ if (storehouseIdArr[i].equals(houseId + "")) {
|
|
|
791
|
+ return storehouseNameArr[i];
|
|
|
792
|
+ }
|
|
|
793
|
+ }
|
|
|
794
|
+ }
|
|
|
795
|
+ return null;
|
|
|
796
|
+ }
|
|
|
797
|
+
|
|
|
798
|
+
|
|
714
|
799
|
}
|