Merge branch 'dev' of http://47.97.8.94:19527/yj/zn-cloud into dev
This commit is contained in:
commit
8c6bfd1ef5
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.bpm.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
@Tag(name = "RPC 服务 - 流程实例")
|
||||||
|
public interface BpmOAGoOutApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/oa/goOut";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getGoOutByTime")
|
||||||
|
@Operation(summary = "获取当日以及昨日外出的用户编号")
|
||||||
|
CommonResult<Map<String, List<Long>>> getLeaveListByTime();
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.api.oa;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAGoOutService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flowable 流程实例 Api 实现类
|
||||||
|
*
|
||||||
|
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
public class BpmOAGoOutApiImpl implements BpmOAGoOutApi{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAGoOutService goOutService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Map<String, List<Long>>> getLeaveListByTime() {
|
||||||
|
|
||||||
|
// 定义格式化模式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
List<BpmOAGoOutDO> goOutNow = goOutService.getGoOutByStartTime(LocalDate.now().format(formatter));
|
||||||
|
List<BpmOAGoOutDO> goOutYesterday = goOutService.getGoOutByStartTime(LocalDate.now().minusDays(1).format(formatter));
|
||||||
|
|
||||||
|
Map<String, List<Long>> result = new HashMap<>();
|
||||||
|
result.put("now", convertList(goOutNow, BpmOAGoOutDO::getUserId));
|
||||||
|
result.put("yesterday", convertList(goOutYesterday, BpmOAGoOutDO::getUserId));
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.bpm.service.oa;
|
|||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAGoOutDO;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface BpmOAGoOutService {
|
public interface BpmOAGoOutService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,4 +37,11 @@ public interface BpmOAGoOutService {
|
|||||||
* @return 外出申请
|
* @return 外出申请
|
||||||
*/
|
*/
|
||||||
BpmOAGoOutDO getGoOut(Long id);
|
BpmOAGoOutDO getGoOut(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定开始时间的外出申请
|
||||||
|
* @param time 时间
|
||||||
|
* @return 外出申请
|
||||||
|
*/
|
||||||
|
List<BpmOAGoOutDO> getGoOutByStartTime(String time);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.goOut.BpmOAGoOutCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||||
@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -79,8 +81,11 @@ public class BpmOAGoOutServiceImpl extends BpmOABaseService implements BpmOAGoOu
|
|||||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发起外出申请后,设置外勤打卡权限
|
// 发起外出申请后,判断是否是当天的外出
|
||||||
userApi.updateFieldwork(getLoginUserId(), 1);
|
if (goOut.getStartTime().toLocalDate().isEqual(LocalDate.now())) {
|
||||||
|
// 设置外勤打卡权限
|
||||||
|
userApi.updateFieldwork(getLoginUserId(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
return goOut.getId();
|
return goOut.getId();
|
||||||
}
|
}
|
||||||
@ -115,6 +120,13 @@ public class BpmOAGoOutServiceImpl extends BpmOABaseService implements BpmOAGoOu
|
|||||||
return goOutMapper.selectById(id);
|
return goOutMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BpmOAGoOutDO> getGoOutByStartTime(String time) {
|
||||||
|
|
||||||
|
return goOutMapper.selectList(new LambdaQueryWrapperX<BpmOAGoOutDO>()
|
||||||
|
.likeIfPresent(BpmOAGoOutDO::getStartTime, time));
|
||||||
|
}
|
||||||
|
|
||||||
private void validateLeaveExists(Long id) {
|
private void validateLeaveExists(Long id) {
|
||||||
if (goOutMapper.selectById(id) == null) {
|
if (goOutMapper.selectById(id) == null) {
|
||||||
throw exception(OA_GOOut_NOT_EXISTS);
|
throw exception(OA_GOOut_NOT_EXISTS);
|
||||||
|
Loading…
Reference in New Issue
Block a user