|  | @@ -2,6 +2,8 @@ package com.ruoyi.system.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.ruoyi.common.annotation.DataSource;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.domain.entity.SysRole;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.core.domain.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.redis.RedisCache;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.enums.DataSourceType;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.SecurityUtils;
 | 
	
	
		
			
				|  | @@ -57,11 +59,12 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public List<WfTaskList> getOrderBillsPlansList(String dataStart, String dataEnd, String orderNo, Integer head, Integer tail) {
 | 
	
		
			
				|  |  | +    public List<WfTaskList> getOrderBillsPlansList(String dataStart, String dataEnd, String orderNo, Integer head, Integer tail, String type) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 根据登录名去匹配EMPLS 里面的EMPL  找到 EMPLID
 | 
	
		
			
				|  |  | -        String userName = SecurityUtils.getLoginUser().getUsername();
 | 
	
		
			
				|  |  | -        Long emplId = emplsMapper.getByEmpl(userName);
 | 
	
		
			
				|  |  | +        SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // Long emplId = 0L;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -77,33 +80,79 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Object actId = redisCache.getCacheObject("sys_config:risk.actId");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        map.put("emplId", emplId);
 | 
	
		
			
				|  |  |          map.put("dataStart", dataStart);
 | 
	
		
			
				|  |  |          map.put("dataEnd", dataEnd);
 | 
	
		
			
				|  |  |          map.put("orderNo", orderNo);
 | 
	
		
			
				|  |  |          map.put("actId", actId.toString());
 | 
	
		
			
				|  |  |          map.put("head", head);
 | 
	
		
			
				|  |  |          map.put("tail", tail);
 | 
	
		
			
				|  |  | +        map.put("type", type);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 获取角色区分队长与驾驶员
 | 
	
		
			
				|  |  | +        for (SysRole role : user.getRoles()) {
 | 
	
		
			
				|  |  | +            if ("JSY".equals(role.getRoleKey())) {
 | 
	
		
			
				|  |  | +                Long emplId = emplsMapper.getByEmpl(user.getUserName());
 | 
	
		
			
				|  |  | +                map.put("emplId", emplId);
 | 
	
		
			
				|  |  | +                map.put("role", "1");
 | 
	
		
			
				|  |  | +            } else if ("DZ".equals(role.getRoleKey())) {
 | 
	
		
			
				|  |  | +                Long emplId = emplsMapper.getByEmplDZ(user.getUserName());
 | 
	
		
			
				|  |  | +                map.put("emplId", emplId);
 | 
	
		
			
				|  |  | +                map.put("role", "0");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          List<WfTaskList> orderBillsPlansList = new ArrayList<>();
 | 
	
		
			
				|  |  | -        try {
 | 
	
		
			
				|  |  | +//        try {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            orderBillsPlansList = orderBillsPlansMapper.getOrderBillsPlansLsit(map);
 | 
	
		
			
				|  |  | -        } catch (Exception a) {
 | 
	
		
			
				|  |  | -            System.out.println("aa");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        orderBillsPlansList = orderBillsPlansMapper.getOrderBillsPlansLsit(map);
 | 
	
		
			
				|  |  | +//        } catch (Exception a) {
 | 
	
		
			
				|  |  | +//            System.out.println("aa");
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  |          for (WfTaskList wfTaskList : orderBillsPlansList) {
 | 
	
		
			
				|  |  | -            Long status317 = wfTaskList.getStatus317();
 | 
	
		
			
				|  |  | -            Long status376 = wfTaskList.getStatus376();
 | 
	
		
			
				|  |  | -            if (status317 == null || status376 == null) {
 | 
	
		
			
				|  |  | -                break;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if (status317 == 2) {
 | 
	
		
			
				|  |  | -                wfTaskList.setBillStatusName("里程待提交");
 | 
	
		
			
				|  |  | -            } else if (status376 == 2 || status376 == 0) {
 | 
	
		
			
				|  |  | -                wfTaskList.setBillStatusName("费用待提交");
 | 
	
		
			
				|  |  | -            } else if (status376 == 6) {
 | 
	
		
			
				|  |  | -                wfTaskList.setBillStatusName("报单完成");
 | 
	
		
			
				|  |  | +//            Long status317 = wfTaskList.getStatus317();
 | 
	
		
			
				|  |  | +//            Long status376 = wfTaskList.getStatus376();
 | 
	
		
			
				|  |  | +//            if (status317 == null || status376 == null) {
 | 
	
		
			
				|  |  | +//                break;
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//            if (status317 == 2) {
 | 
	
		
			
				|  |  | +//                wfTaskList.setBillStatusName("里程待提交");
 | 
	
		
			
				|  |  | +//            } else if (status376 == 2 || status376 == 0) {
 | 
	
		
			
				|  |  | +//                wfTaskList.setBillStatusName("费用待提交");
 | 
	
		
			
				|  |  | +//            } else if (status376 == 6) {
 | 
	
		
			
				|  |  | +//                wfTaskList.setBillStatusName("报单完成");
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if ("BD".equals(type)) {
 | 
	
		
			
				|  |  | +//                if ("T".equals(wfTaskList.getIfLoaded()) && "T".equals(wfTaskList.getIfUnLoaded())) {
 | 
	
		
			
				|  |  | +//                    if ("S".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +//                        wfTaskList.setBillStatusName("费用已提交");
 | 
	
		
			
				|  |  | +//                    } else if ("A".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +//                        wfTaskList.setBillStatusName("审核通过");
 | 
	
		
			
				|  |  | +//                    } else if ("B".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +//                        wfTaskList.setBillStatusName("审核驳回");
 | 
	
		
			
				|  |  | +//                    } else if ("F".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +//                        wfTaskList.setBillStatusName("里程已提交");
 | 
	
		
			
				|  |  | +//                    }
 | 
	
		
			
				|  |  | +//                } else {
 | 
	
		
			
				|  |  | +//                    wfTaskList.setBillStatusName("里程待提交");
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +                if ("T".equals(wfTaskList.getIfLoaded()) && "T".equals(wfTaskList.getIfUnLoaded())) {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("里程已提交");
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("里程待提交");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else if ("BX".equals(type)) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if ("S".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("费用已提交");
 | 
	
		
			
				|  |  | +                } else if ("A".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("审核通过");
 | 
	
		
			
				|  |  | +                } else if ("B".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("审核驳回");
 | 
	
		
			
				|  |  | +                } else if ("F".equals(wfTaskList.getIfStarted())) {
 | 
	
		
			
				|  |  | +                    wfTaskList.setBillStatusName("费用待提交");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return orderBillsPlansList;
 | 
	
	
		
			
				|  | @@ -151,6 +200,14 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |              fileList1.add(imgVo);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        // 角色信息
 | 
	
		
			
				|  |  | +        SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
		
			
				|  |  | +        List<String> roleList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (SysRole role : user.getRoles()) {
 | 
	
		
			
				|  |  | +            roleList.add(role.getRoleKey());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        vo.setRoleList(roleList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          vo.setFileList1(fileList1);
 | 
	
		
			
				|  |  |          return vo;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -227,7 +284,7 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 更新明细
 | 
	
		
			
				|  |  | -        List<ItemsVo> itemsVoList = orderBillsPlansVo.getItemsVoList();
 | 
	
		
			
				|  |  | +//        List<ItemsVo> itemsVoList = orderBillsPlansVo.getItemsVoList();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // if (itemsVoList == null || itemsVoList.size() == 0) {
 | 
	
		
			
				|  |  |          //     return AjaxResult.success();
 | 
	
	
		
			
				|  | @@ -298,6 +355,15 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<LoadFeeItems> loadFeeItemsList = orderBillsPlansMapper.getLoadFeeItemsByEntityId(data.getLoadBillsEntityId());
 | 
	
		
			
				|  |  |          data.setLoadFeeItemsList(loadFeeItemsList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 角色信息
 | 
	
		
			
				|  |  | +        SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
	
		
			
				|  |  | +        List<String> roleList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (SysRole role : user.getRoles()) {
 | 
	
		
			
				|  |  | +            roleList.add(role.getRoleKey());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        data.setRoleList(roleList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return data;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -348,4 +414,67 @@ public class OrderBillsPlansServiceImpl implements IOrderBillsPlansService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return AjaxResult.error();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public AjaxResult isMileage(Long orderNo) {
 | 
	
		
			
				|  |  | +        // 查询这条数据是否有为提交里程
 | 
	
		
			
				|  |  | +        List<WfTaskList> isMileage = orderBillsPlansMapper.getIsMileageOrderBillsPlansByOrder(orderNo);
 | 
	
		
			
				|  |  | +        if (!isMileage.isEmpty()) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("410", null);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("200", null);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 驾驶员提交审核
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param orderBillsPlansVo
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    @Transient
 | 
	
		
			
				|  |  | +    public AjaxResult submitAudit(OrderBillsPlansVo orderBillsPlansVo) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Integer i = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 保存数据
 | 
	
		
			
				|  |  | +        insertLoadFeeItems(orderBillsPlansVo);
 | 
	
		
			
				|  |  | +        // 提交审核
 | 
	
		
			
				|  |  | +        i = orderBillsPlansMapper.submitAudit(orderBillsPlansVo.getOrderNo());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (i == 1) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("ok");
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("no");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 队长审核
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param type T-通过 F-驳回
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    @Transient
 | 
	
		
			
				|  |  | +    public AjaxResult audit(OrderBillsPlansVo orderBillsPlansVo) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Integer i = 0;
 | 
	
		
			
				|  |  | +        Object actId = redisCache.getCacheObject("sys_config:risk.actId");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if ("T".equals(orderBillsPlansVo.getAuditType())) {
 | 
	
		
			
				|  |  | +            i = orderBillsPlansMapper.approved(orderBillsPlansVo.getOrderNo());
 | 
	
		
			
				|  |  | +            orderBillsPlansMapper.approvedTaskList(actId.toString(), orderBillsPlansVo.getEntityId().toString());
 | 
	
		
			
				|  |  | +        } else if ("F".equals(orderBillsPlansVo.getAuditType())) {
 | 
	
		
			
				|  |  | +            i = orderBillsPlansMapper.theAuditFailed(orderBillsPlansVo.getOrderNo());
 | 
	
		
			
				|  |  | +            orderBillsPlansMapper.theAuditFailedTaskList(actId.toString(), orderBillsPlansVo.getEntityId());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (i == 1) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("ok");
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("no");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |