|
@@ -1,18 +1,23 @@
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.winsea.svc.base.workflow.entity.Workflow;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
-import com.yh.saas.common.support.util.StringUtils;
|
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.ClockInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.ClockInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.exception.YException;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.ClockInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.ClockInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IClockInfoService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IClockInfoService;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
-import com.yh.saas.plugin.yiliangyiyun.service.ILeaveInfoService;
|
|
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.INewWorkflowService;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -32,7 +37,7 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
|
|
@Autowired
|
|
@Autowired
|
|
private IClockInfoService clockInfoService;
|
|
private IClockInfoService clockInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
- private ILeaveInfoService leaveInfoService;
|
|
|
|
|
|
+ private INewWorkflowService workflowService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加打卡信息
|
|
* 添加打卡信息
|
|
@@ -127,11 +132,21 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
|
|
pageView.put("compId", clockInfo.getCompId());
|
|
pageView.put("compId", clockInfo.getCompId());
|
|
pageView.put("commonId", clockInfo.getCommonId());
|
|
pageView.put("commonId", clockInfo.getCommonId());
|
|
pageView.put("pageSize", clockInfo.getPageSize());
|
|
pageView.put("pageSize", clockInfo.getPageSize());
|
|
- pageView.put("yearMonth",clockInfo.getYearMonth());
|
|
|
|
|
|
+ pageView.put("yearMonth", clockInfo.getYearMonth());
|
|
pageView.put("currentPage", clockInfo.getCurrentPage());
|
|
pageView.put("currentPage", clockInfo.getCurrentPage());
|
|
// 查询总数
|
|
// 查询总数
|
|
Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
List<ClockInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
List<ClockInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
|
+ dataList.forEach(clockInfo1 -> {
|
|
|
|
+ String taskId = "";
|
|
|
|
+ // 只有待审核状态才有taskId
|
|
|
|
+ if (StringUtils.isNotBlank(clockInfo1.getWorkflowId())) {
|
|
|
|
+ JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(clockInfo1.getWorkflowId()), clockInfo1.getId());
|
|
|
|
+ taskId = jsonObject.getString("taskId");
|
|
|
|
+ clockInfo1.setTaskId(taskId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
Page<ClockInfo> page = new Page<>();
|
|
Page<ClockInfo> page = new Page<>();
|
|
page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
page.setTotal(dataCount == null ? 0 : dataCount);
|
|
page.setTotal(dataCount == null ? 0 : dataCount);
|
|
@@ -183,50 +198,59 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
|
|
/**
|
|
/**
|
|
* 添加补卡信息
|
|
* 添加补卡信息
|
|
*
|
|
*
|
|
- * @param clockInfo
|
|
|
|
|
|
+ * @param clockInfo1
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public String suppClock(ClockInfo clockInfo) {
|
|
|
|
|
|
+ public String suppClock(ClockInfo clockInfo1) {
|
|
//查询打卡信息
|
|
//查询打卡信息
|
|
- ClockInfo clockInfo1 = this.selectById(clockInfo.getId());
|
|
|
|
- if (clockInfo1 != null) {
|
|
|
|
- clockInfo1.setSupplementClockType(clockInfo.getSupplementClockType());
|
|
|
|
- clockInfo1.setReasonForApplication(clockInfo.getReasonForApplication());
|
|
|
|
- //补卡状态改为审核中
|
|
|
|
- clockInfo1.setStatus(StatusEnum.SUPP_REVIEWED.getName());
|
|
|
|
- clockInfo1.setStatusFlag(StatusEnum.SUPP_REVIEWED.getFlag());
|
|
|
|
- this.updateById(clockInfo1);
|
|
|
|
|
|
+ ClockInfo clockInfo = this.selectById(clockInfo1.getId());
|
|
|
|
+ if (clockInfo != null) {
|
|
|
|
+ clockInfo.setSupplementClockType(clockInfo1.getSupplementClockType());
|
|
|
|
+ clockInfo.setReasonForApplication(clockInfo1.getReasonForApplication());
|
|
|
|
+ this.updateById(clockInfo);
|
|
|
|
+
|
|
|
|
+ boolean isStartWorkflow = StringUtils.isBlank(clockInfo.getWorkflowId());
|
|
|
|
+ // 不是退回的单子
|
|
|
|
+ if (isStartWorkflow) {
|
|
|
|
+ Workflow workflow = workflowService
|
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(clockInfo.getCompId(), "BUKA-APPROVE");
|
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
|
+ if (workflow == null) {
|
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ // 开启审核流
|
|
|
|
+ else {
|
|
|
|
+ // 设置状态 已提交审核
|
|
|
|
+ clockInfo.setWorkflowId(workflow.getId());
|
|
|
|
+ clockInfoService.updateById(clockInfo);
|
|
|
|
+ workflowService.startInstance(workflow.getId(), clockInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退回的单子 再启用
|
|
|
|
+ else {
|
|
|
|
+ clockInfoService.updateById(clockInfo);
|
|
|
|
+ workflowService.activateInstance(clockInfo.getWorkflowId(), clockInfo.getId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return "OK";
|
|
return "OK";
|
|
}
|
|
}
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 补卡信息审核
|
|
|
|
-// *
|
|
|
|
-// * @param clockInfo
|
|
|
|
-// * @return
|
|
|
|
-// */
|
|
|
|
-// @Override
|
|
|
|
-// public String examineClock(ClockInfo clockInfo) {
|
|
|
|
-// //查询打卡信息
|
|
|
|
-// ClockInfo clockInfo1 = this.selectById(clockInfo.getId());
|
|
|
|
-// if (clockInfo1 != null && "1".equals(clockInfo1.getStatusFlag())) {
|
|
|
|
-// //通过
|
|
|
|
-// if (clockInfo.getExamineFlag() == 1) {
|
|
|
|
-// //补卡状态改为补卡成功
|
|
|
|
-// clockInfo1.setStatus(StatusEnum.SUPP_SUCCESS.getName());
|
|
|
|
-// clockInfo1.setStatusFlag(StatusEnum.SUPP_SUCCESS.getFlag());
|
|
|
|
-// }
|
|
|
|
-// //驳回
|
|
|
|
-// else {
|
|
|
|
-// //补卡状态改为补卡失败
|
|
|
|
-// clockInfo1.setStatus(StatusEnum.SUPP_FAIL.getName());
|
|
|
|
-// clockInfo1.setStatusFlag(StatusEnum.SUPP_FAIL.getFlag());
|
|
|
|
-// }
|
|
|
|
-// //更新数据
|
|
|
|
-// this.updateById(clockInfo1);
|
|
|
|
-// }
|
|
|
|
-// return null;
|
|
|
|
-// }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查看补卡信息
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ClockInfo getSuppClock(String id) {
|
|
|
|
+ //根据id查询补卡信息
|
|
|
|
+ ClockInfo clockInfo = this.selectById(id);
|
|
|
|
+ String taskId = "";
|
|
|
|
+ // 只有待审核状态才有taskId
|
|
|
|
+ if (StringUtils.isNotBlank(clockInfo.getWorkflowId())) {
|
|
|
|
+ JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(clockInfo.getWorkflowId()), clockInfo.getId());
|
|
|
|
+ taskId = jsonObject.getString("taskId");
|
|
|
|
+ clockInfo.setTaskId(taskId);
|
|
|
|
+ }
|
|
|
|
+ return clockInfo;
|
|
|
|
+ }
|
|
}
|
|
}
|