Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into dev-假期设置
# Conflicts: # yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/rpc/config/RpcConfiguration.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
This commit is contained in:
commit
1a98304813
@ -5,7 +5,10 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAAssetClaimItemService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAAssetClaimService;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -14,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -27,6 +31,9 @@ public class BpmOAAssetClaimController {
|
||||
@Resource
|
||||
private BpmOAAssetClaimService assetClaimService;
|
||||
|
||||
@Resource
|
||||
private BpmOAAssetClaimItemService itemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createAssetClaim(@Valid @RequestBody BpmOAAssetClaimCreateReqVO createReqVO) {
|
||||
@ -41,7 +48,11 @@ public class BpmOAAssetClaimController {
|
||||
|
||||
BpmOAAssetClaimDO assetClaimDO = assetClaimService.getAssetClaim(id);
|
||||
|
||||
return success(BeanUtils.toBean(assetClaimDO, BpmOAAssetClaimRespVO.class));
|
||||
// 获取明细数据
|
||||
List<BpmOAAssetClaimItemDO> itemDOS = itemService.getAssetClaimItem(id);
|
||||
|
||||
return success(BeanUtils.toBean(assetClaimDO, BpmOAAssetClaimRespVO.class)
|
||||
.setReceive(itemDOS));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@ -51,6 +62,10 @@ public class BpmOAAssetClaimController {
|
||||
|
||||
BpmOAAssetClaimDO assetClaimDO = assetClaimService.getByProcessInstanceId(processInstanceId);
|
||||
|
||||
return success(BeanUtils.toBean(assetClaimDO, BpmOAAssetClaimRespVO.class));
|
||||
// 获取明细数据
|
||||
List<BpmOAAssetClaimItemDO> itemDOS = itemService.getAssetClaimItem(assetClaimDO.getId());
|
||||
|
||||
return success(BeanUtils.toBean(assetClaimDO, BpmOAAssetClaimRespVO.class)
|
||||
.setReceive(itemDOS));
|
||||
}
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ import java.util.List;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAAssetClaimCreateReqVO {
|
||||
|
||||
@Schema(description = "收款人信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销总金额不能为空")
|
||||
@Schema(description = "资产类型编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "资产类型不能为空")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "现金支出明细")
|
||||
private Integer num;
|
||||
@Schema(description = "资产申领明细")
|
||||
private List<BpmOAAssetClaimItemSaveVO> receive;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String util;
|
||||
@Schema(description = "申请原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 资产申领明细VO")
|
||||
@Data
|
||||
public class BpmOAAssetClaimItemSaveVO {
|
||||
|
||||
@Schema(description = "资产申领编号")
|
||||
private Long assetClaimId;
|
||||
|
||||
@Schema(description = "资产类型编号")
|
||||
@NotNull(message = "资产类型不能为空")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "资产类型名称")
|
||||
private String assetsTypeName;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
private String assetsNo;
|
||||
|
||||
@Schema(description = "资产名称")
|
||||
private String assetsName;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "使用单位")
|
||||
private String util;
|
||||
}
|
@ -2,14 +2,12 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.cash.Cash;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -21,15 +19,11 @@ import java.util.List;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAAssetClaimRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "收款人信息")
|
||||
private Long assetsTypeId;
|
||||
@Schema(description = "申领明细")
|
||||
private List<BpmOAAssetClaimItemDO> receive;
|
||||
|
||||
@Schema(description = "现金支出明细")
|
||||
private List<Cash> num;
|
||||
|
||||
@Schema(description = "报销总金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销总金额不能为空")
|
||||
private BigDecimal util;
|
||||
@Schema(description = "申请原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
@ -37,6 +37,9 @@ public class BpmOAImprestCreateReqVO {
|
||||
@NotNull(message = "费用金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "已报销金额")
|
||||
private BigDecimal reimbursedAmount;
|
||||
|
||||
@Schema(description = "使用日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "使用日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
|
@ -36,6 +36,9 @@ public class BpmOAImprestRespVO extends BpmOABaseRespVO {
|
||||
@NotNull(message = "费用金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "已报销金额")
|
||||
private BigDecimal reimbursedAmount;
|
||||
|
||||
@Schema(description = "使用日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "使用日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
|
@ -37,26 +37,16 @@ public class BpmOAAssetClaimDO extends BaseDO {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 资产类型编号
|
||||
*/
|
||||
private Long assetsTypeId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String util;
|
||||
|
||||
/**
|
||||
* 申请事由
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 申领类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 用章的结果
|
||||
* 枚举 {@link BpmProcessInstanceResultEnum}、
|
||||
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* OA 资产申领明细 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName(value ="bpm_oa_asset_claim_item", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BpmOAAssetClaimItemDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 出差表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 资产申领业务表编号
|
||||
*/
|
||||
private Long assetClaimId;
|
||||
|
||||
/**
|
||||
* 资产类型编号
|
||||
*/
|
||||
private Long assetsTypeId;
|
||||
|
||||
/**
|
||||
* 资产类型名称
|
||||
*/
|
||||
private String assetsTypeName;
|
||||
|
||||
/**
|
||||
* 业务类型 1行政类型 2生产类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
private String assetsNo;
|
||||
|
||||
/**
|
||||
* 资产名称
|
||||
*/
|
||||
private String assetsName;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String util;
|
||||
}
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
public class BpmOAImprestDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 是否已报销 0否 1是 2进行中
|
||||
* 是否已报销 0否 1是 2报销中
|
||||
*/
|
||||
public static final Integer FLAG_FALSE = 0;
|
||||
public static final Integer FLAG_TRUE = 1;
|
||||
@ -64,6 +64,11 @@ public class BpmOAImprestDO extends BaseDO {
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 已报销的金额
|
||||
*/
|
||||
private BigDecimal reimbursedAmount;
|
||||
|
||||
/**
|
||||
* 使用日期
|
||||
*/
|
||||
|
@ -84,6 +84,11 @@ public class BpmOAReimbursementDO extends BaseDO {
|
||||
*/
|
||||
private Integer reimbursementType;
|
||||
|
||||
/**
|
||||
* 备用金表单编号
|
||||
*/
|
||||
private Long imprestId;
|
||||
|
||||
/**
|
||||
* 备用差额
|
||||
*/
|
||||
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.mysql.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BpmOAAssetClaimItemMapper extends BaseMapperX<BpmOAAssetClaimItemDO> {
|
||||
}
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.bpm.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.AssetReceiveApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
import cn.iocoder.yudao.module.system.api.attendance.AttendanceApi;
|
||||
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
@ -24,6 +26,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class, SupplierApi.class, AssetsApi.class, HolidayApi.class
|
||||
AssetsTypeApi.class, AssetReceiveApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimItemSaveVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BpmOAAssetClaimItemService {
|
||||
|
||||
/**
|
||||
* 创建资产申领明细
|
||||
* @param createReqVO 创建信息
|
||||
*/
|
||||
void createAssetClaimItem(List<BpmOAAssetClaimItemSaveVO> createReqVO);
|
||||
|
||||
/**
|
||||
* 根据资产申领编号,获得资产申领明细
|
||||
* @param assetClaimId 资产申领编号
|
||||
* @return 明细数据
|
||||
*/
|
||||
List<BpmOAAssetClaimItemDO> getAssetClaimItem(Long assetClaimId);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimItemSaveVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAAssetClaimItemMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OA 资产申领明细 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BpmOAAssetClaimItemServiceImpl implements BpmOAAssetClaimItemService{
|
||||
|
||||
@Resource
|
||||
private BpmOAAssetClaimItemMapper assetClaimItemMapper;
|
||||
|
||||
@Override
|
||||
public void createAssetClaimItem(List<BpmOAAssetClaimItemSaveVO> createReqVO) {
|
||||
|
||||
List<BpmOAAssetClaimItemDO> items = BeanUtils.toBean(createReqVO, BpmOAAssetClaimItemDO.class);
|
||||
assetClaimItemMapper.insertBatch(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAAssetClaimItemDO> getAssetClaimItem(Long assetClaimId) {
|
||||
|
||||
return assetClaimItemMapper.selectList(BpmOAAssetClaimItemDO::getAssetClaimId, assetClaimId);
|
||||
}
|
||||
}
|
@ -4,15 +4,24 @@ import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.BpmOAAssetClaimItemSaveVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimItemDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAAssetClaimMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.AssetReceiveApi;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.dto.AssetReceiveSaveDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -37,12 +46,21 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
@Resource
|
||||
private BpmOAAssetClaimMapper assetClaimMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOAAssetClaimItemService itemService;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private AssetReceiveApi receiveApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Override
|
||||
public Long createAssetClaim(Long userId, BpmOAAssetClaimCreateReqVO createReqVO) {
|
||||
|
||||
@ -51,6 +69,10 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
assetClaimMapper.insert(assetClaim);
|
||||
|
||||
// 同步插入明细数据
|
||||
createReqVO.getReceive().forEach(item -> item.setAssetClaimId(assetClaim.getId()));
|
||||
itemService.createAssetClaimItem(createReqVO.getReceive());
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||
@ -71,6 +93,7 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId, fileItems);
|
||||
}
|
||||
|
||||
return assetClaim.getId();
|
||||
}
|
||||
|
||||
@ -87,15 +110,50 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAssetClaimResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
validateLeaveExists(id);
|
||||
BpmOAAssetClaimDO assetClaim = validateLeaveExists(id);
|
||||
// 获取明细数据
|
||||
List<BpmOAAssetClaimItemDO> itemDOs = itemService.getAssetClaimItem(id);
|
||||
|
||||
// 获取用户信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(assetClaim.getUserId()).getCheckedData();
|
||||
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = processInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
List<AssetReceiveSaveDTO> receiveDTOs = new ArrayList<>();
|
||||
for (BpmOAAssetClaimItemDO itemDO : itemDOs) {
|
||||
|
||||
receiveDTOs.add(new AssetReceiveSaveDTO()
|
||||
.setUserId(assetClaim.getUserId())
|
||||
.setDeptId(userRespDTO.getDeptId())
|
||||
.setAssetsTypeId(itemDO.getAssetsTypeId())
|
||||
.setAssetsTypeName(itemDO.getAssetsTypeName())
|
||||
.setAssetsNo(itemDO.getAssetsNo())
|
||||
.setAssetsName(itemDO.getAssetsName())
|
||||
.setNum(itemDO.getNum())
|
||||
.setApplyDate(assetClaim.getCreateTime().toLocalDate())
|
||||
.setStatus(0));
|
||||
}
|
||||
|
||||
// 批量插入资产领用信息
|
||||
receiveApi.createReceive(receiveDTOs);
|
||||
}
|
||||
}
|
||||
assetClaimMapper.updateById(new BpmOAAssetClaimDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (assetClaimMapper.selectById(id) == null) {
|
||||
private BpmOAAssetClaimDO validateLeaveExists(Long id) {
|
||||
BpmOAAssetClaimDO assetClaim = assetClaimMapper.selectById(id);
|
||||
if (assetClaim == null) {
|
||||
throw exception(OA_ASSET_NOT_EXISTS);
|
||||
}
|
||||
return assetClaim;
|
||||
}
|
||||
}
|
||||
|
@ -153,24 +153,23 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateReimbursementResult(String processInstanceId, Long id, Integer result) {
|
||||
validateLeaveExists(id);
|
||||
|
||||
BpmOAReimbursementDO bpmOAReimbursementDO = validateLeaveExists(id);
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
//获得备用金信息
|
||||
BpmOAImprestDO bpmOAImprestDO = bpmOAImprestMapper.selectOne(BpmOAImprestDO::getReimbursementId, id);
|
||||
if (bpmOAImprestDO != null) {
|
||||
|
||||
//判断是否为备用金报销
|
||||
if (bpmOAReimbursementDO.getImprestId() != null) {
|
||||
//将相应备用金申请状态改为 已报销
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAReimbursementDO.getImprestId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
|
||||
}
|
||||
|
||||
//判断是否有采购报销
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
|
||||
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
|
||||
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
@ -234,7 +233,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
|
||||
//判断是否有采购报销
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
|
||||
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
|
||||
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
@ -269,10 +267,12 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (reimbursementMapper.selectById(id) == null) {
|
||||
private BpmOAReimbursementDO validateLeaveExists(Long id) {
|
||||
BpmOAReimbursementDO reimbursementDO = reimbursementMapper.selectById(id);
|
||||
if (reimbursementDO == null) {
|
||||
throw exception(OA_REIMBURSEMENT_NOT_EXISTS);
|
||||
}
|
||||
return reimbursementDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,14 +2,12 @@ package cn.iocoder.yudao.module.infra.api.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@ -26,9 +24,7 @@ public class ConfigApiImpl implements ConfigApi{
|
||||
if (config == null) {
|
||||
return success(null);
|
||||
}
|
||||
if (!config.getVisible()) {
|
||||
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||
}
|
||||
|
||||
return success(config.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.api.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.dto.AssetReceiveSaveDTO;
|
||||
import cn.iocoder.yudao.module.system.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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 资产领用")
|
||||
public interface AssetReceiveApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/assetReceive";
|
||||
|
||||
@PostMapping(PREFIX + "/createReceive")
|
||||
@Operation(summary = "创建资产领用信息")
|
||||
CommonResult<Boolean> createReceive(@RequestBody List<AssetReceiveSaveDTO> saveDTOs);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.system.api.assetreceive.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "管理后台 - 资产领用新增/修改 Request VO")
|
||||
@Data
|
||||
public class AssetReceiveSaveDTO {
|
||||
|
||||
@Schema(description = "资产领用表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "领用人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146")
|
||||
@NotNull(message = "领用人的用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "领用人的部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
||||
@NotNull(message = "领用人的部门编号不能为空")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "分配人的用户编号")
|
||||
private Long receiveUserId;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
private String assetsNo;
|
||||
|
||||
@Schema(description = "资产名称")
|
||||
private String assetsName;
|
||||
|
||||
@Schema(description = "资产类型编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "资产类型编号不能为空")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "资产类型名称")
|
||||
private String assetsTypeName;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
private LocalDate applyDate;
|
||||
|
||||
@Schema(description = "分配日期")
|
||||
private LocalDate allocationDate;
|
||||
|
||||
@Schema(description = "领用状态 | 0待领用 1采购中 2已领用 ", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private String fileItems;
|
||||
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
package cn.iocoder.yudao.module.system.api.assets;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.assets.dto.AssetsTypeDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -10,6 +11,7 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@ -23,4 +25,14 @@ public interface AssetsTypeApi {
|
||||
@Parameter(name = "code", description = "资产类型code", example = "1", required = true)
|
||||
CommonResult<List<Long>> getAssetsTypeIdsByCode(@RequestParam("code") String code);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得资产类型信息")
|
||||
@Parameter(name = "id", description = "资产类型编号", example = "1", required = true)
|
||||
CommonResult<AssetsTypeDTO> get(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/get-list")
|
||||
@Operation(summary = "获得资产类型信息")
|
||||
@Parameter(name = "ids", description = "资产类型编号", example = "1", required = true)
|
||||
CommonResult<List<AssetsTypeDTO>> getList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.system.api.assets.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - 资产类型 Response DTO")
|
||||
@Data
|
||||
public class AssetsTypeDTO {
|
||||
|
||||
@Schema(description = "资产类型编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "资产类型名称", example = "办公用品")
|
||||
private String name;
|
||||
}
|
@ -242,6 +242,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode INSUFFICIENT_IDLE_MATERIALS = new ErrorCode(1_010_001_005, "空闲物料不足!");
|
||||
|
||||
ErrorCode THE_CORRESPONDING_ASSET_TYPE_WAS_NOT_FOUND = new ErrorCode(1_010_001_006, "未找到对应的资产类型!");
|
||||
ErrorCode ASSET_RECEIVE_NOT_EXISTS = new ErrorCode(1_010_001_007, "资产领用不存在");
|
||||
|
||||
// ========== 考勤设备相关 1-011-001-001 ==========
|
||||
ErrorCode USERS_EXT_NOT_EXISTS = new ErrorCode(1_011_001_001, "用户信息不存在!");
|
||||
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.api.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.dto.AssetReceiveSaveDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.assetreceive.AssetReceiveService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class AssetReceiveApiImpl implements AssetReceiveApi{
|
||||
|
||||
@Resource
|
||||
private AssetReceiveService assetReceiveService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> createReceive(List<AssetReceiveSaveDTO> saveDTO) {
|
||||
|
||||
List<AssetReceiveSaveReqVO> assetReceives = BeanUtils.toBean(saveDTO, AssetReceiveSaveReqVO.class);
|
||||
return success(assetReceiveService.createAssetReceives(assetReceives));
|
||||
}
|
||||
}
|
@ -3,23 +3,17 @@ package cn.iocoder.yudao.module.system.api.assets;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserSaveRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.api.assets.dto.AssetsTypeDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsTypeDO;
|
||||
import cn.iocoder.yudao.module.system.service.assets.AssetsTypeService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
@ -34,4 +28,17 @@ public class AssetsTypeApiImpl implements AssetsTypeApi {
|
||||
List<Long> ids = assetsTypeService.getAssetsTypeIdsByCode(code);
|
||||
return success(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AssetsTypeDTO> get(Long id) {
|
||||
|
||||
AssetsTypeDO assetsTypeDO = assetsTypeService.getAssetsType(id);
|
||||
return success(BeanUtils.toBean(assetsTypeDO, AssetsTypeDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AssetsTypeDTO>> getList(Collection<Long> ids) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceivePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceiveRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assetreceive.AssetReceiveDO;
|
||||
import cn.iocoder.yudao.module.system.service.assetreceive.AssetReceiveService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 资产领用")
|
||||
@RestController
|
||||
@RequestMapping("/system/asset-receive")
|
||||
@Validated
|
||||
public class AssetReceiveController {
|
||||
|
||||
@Resource
|
||||
private AssetReceiveService assetReceiveService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建资产领用")
|
||||
@PreAuthorize("@ss.hasPermission('system:asset-receive:create')")
|
||||
public CommonResult<Long> createAssetReceive(@Valid @RequestBody AssetReceiveSaveReqVO createReqVO) {
|
||||
return success(assetReceiveService.createAssetReceive(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新资产领用")
|
||||
@PreAuthorize("@ss.hasPermission('system:asset-receive:update')")
|
||||
public CommonResult<Boolean> updateAssetReceive(@Valid @RequestBody AssetReceiveSaveReqVO updateReqVO) {
|
||||
assetReceiveService.updateAssetReceive(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除资产领用")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:asset-receive:delete')")
|
||||
public CommonResult<Boolean> deleteAssetReceive(@RequestParam("id") Long id) {
|
||||
assetReceiveService.deleteAssetReceive(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得资产领用")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:asset-receive:query')")
|
||||
public CommonResult<AssetReceiveRespVO> getAssetReceive(@RequestParam("id") Long id) {
|
||||
AssetReceiveDO assetReceive = assetReceiveService.getAssetReceive(id);
|
||||
return success(BeanUtils.toBean(assetReceive, AssetReceiveRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得资产领用分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:asset-receive:query')")
|
||||
public CommonResult<PageResult<AssetReceiveRespVO>> getAssetReceivePage(@Valid AssetReceivePageReqVO pageReqVO) {
|
||||
PageResult<AssetReceiveDO> pageResult = assetReceiveService.getAssetReceivePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AssetReceiveRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 资产领用分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AssetReceivePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "领用人的部门编号", example = "128")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "领用人的用户编号", example = "146")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "分配人的用户编号")
|
||||
private Long receiveUserId;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
private String assetsNo;
|
||||
|
||||
@Schema(description = "资产名称")
|
||||
private String assetsName;
|
||||
|
||||
@Schema(description = "资产类型编号")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] applyDate;
|
||||
|
||||
@Schema(description = "分配日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] allocationDate;
|
||||
|
||||
@Schema(description = "领用状态 | 0待领用 1采购中 2已领用 ", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private String fileItems;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 资产领用 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AssetReceiveRespVO {
|
||||
|
||||
@Schema(description = "资产领用表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("资产领用表单主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "领用人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146")
|
||||
@ExcelProperty("领用人的用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "领用人的部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
||||
@ExcelProperty("领用人的部门编号")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "分配人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("分配人的用户编号")
|
||||
private Long receiveUserId;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
@ExcelProperty("资产编号")
|
||||
private String assetsNo;
|
||||
|
||||
@Schema(description = "资产类型编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("资产类型编号")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
@ExcelProperty("申请日期")
|
||||
private LocalDate applyDate;
|
||||
|
||||
@Schema(description = "分配日期")
|
||||
@ExcelProperty("分配日期")
|
||||
private LocalDate allocationDate;
|
||||
|
||||
@Schema(description = "领用状态 | 0待领用 1采购中 2已领用 ", example = "0")
|
||||
@ExcelProperty("领用状态 | 0待领用 1采购中 2已领用 ")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
@ExcelProperty("附件信息")
|
||||
private String fileItems;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "管理后台 - 资产领用新增/修改 Request VO")
|
||||
@Data
|
||||
public class AssetReceiveSaveReqVO {
|
||||
|
||||
@Schema(description = "资产领用表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "领用人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146")
|
||||
@NotNull(message = "领用人的用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "领用人的部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
||||
@NotNull(message = "领用人的部门编号不能为空")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "分配人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "分配人的用户编号不能为空")
|
||||
private Long receiveUserId;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
private String assetsNo;
|
||||
|
||||
@Schema(description = "资产名称")
|
||||
private String assetsName;
|
||||
|
||||
@Schema(description = "资产类型编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "资产类型编号不能为空")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "资产类型名称")
|
||||
private String assetsTypeName;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "数量不能为空")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
private LocalDate applyDate;
|
||||
|
||||
@Schema(description = "分配日期")
|
||||
private LocalDate allocationDate;
|
||||
|
||||
@Schema(description = "领用状态 | 0待领用 1采购中 2已领用 ", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private String fileItems;
|
||||
|
||||
}
|
@ -35,6 +35,8 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -295,6 +297,25 @@ public class UserController {
|
||||
return success(BeanUtils.toBean(user, UserRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/getUserListByBirthday")
|
||||
@Operation(summary = "获得当天以及当月即将过生日的用户信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||
public CommonResult<PageResult<UserBirthdayRespVO>> getUserListByBirthday(@RequestBody UserBirthdayPageReqVO pageReqVO) {
|
||||
|
||||
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd"));
|
||||
|
||||
PageResult<UserBirthdayRespVO> pageResult = userService.getUserListByBirthday(pageReqVO);
|
||||
pageResult.getList().forEach(data -> {
|
||||
if (data.getBirthday().format(DateTimeFormatter.ofPattern("MM-dd")).equals(time)) {
|
||||
data.setStatus(1);
|
||||
}else if (data.getBirthday().getMonthValue() == LocalDateTime.now().getMonthValue()){
|
||||
data.setStatus(2);
|
||||
}
|
||||
});
|
||||
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:export')")
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Schema(description = "管理后台 - 用户生日信息分页 Request VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserBirthdayPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户账号,模糊匹配", example = "yudao")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "部门编号,同时筛选子部门", example = "1024")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "月份", example = "1024")
|
||||
private Integer month;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "管理后台 - 用户生日信息 Response VO")
|
||||
@Data
|
||||
public class UserBirthdayRespVO {
|
||||
|
||||
@Schema(description = "用户编号", example = "1")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "部门名称", example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位")
|
||||
private String positionName;
|
||||
|
||||
@Schema(description = "职称")
|
||||
private String postName;
|
||||
|
||||
@Schema(description = "用户昵称", example = "芋道")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "入职日期", example = "2")
|
||||
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate entryDate;
|
||||
|
||||
@Schema(description = "生日", example = "2022-02-02")
|
||||
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate birthday;
|
||||
|
||||
@Schema(description = "状态 | 1:今日生日 2:本月生日", example = "1")
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 资产领用 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("system_asset_receive")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AssetReceiveDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 资产领用表单主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 领用人的用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 领用人的部门编号
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 分配人的用户编号
|
||||
*/
|
||||
private Long receiveUserId;
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
private String assetsNo;
|
||||
/**
|
||||
* 资产名称
|
||||
*/
|
||||
private String assetsName;
|
||||
/**
|
||||
* 资产类型编号
|
||||
*/
|
||||
private Long assetsTypeId;
|
||||
/**
|
||||
* 资产类型名称
|
||||
*/
|
||||
private String assetsTypeName;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
/**
|
||||
* 申请日期
|
||||
*/
|
||||
private LocalDate applyDate;
|
||||
/**
|
||||
* 分配日期
|
||||
*/
|
||||
private LocalDate allocationDate;
|
||||
/**
|
||||
* 领用状态 | 0待领用 1采购中 2已领用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 附件信息
|
||||
*/
|
||||
private String fileItems;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceivePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assetreceive.AssetReceiveDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 资产领用 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssetReceiveMapper extends BaseMapperX<AssetReceiveDO> {
|
||||
|
||||
default PageResult<AssetReceiveDO> selectPage(AssetReceivePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AssetReceiveDO>()
|
||||
.eqIfPresent(AssetReceiveDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(AssetReceiveDO::getDeptId, reqVO.getDeptId())
|
||||
.eqIfPresent(AssetReceiveDO::getReceiveUserId, reqVO.getReceiveUserId())
|
||||
.eqIfPresent(AssetReceiveDO::getAssetsNo, reqVO.getAssetsNo())
|
||||
.likeIfPresent(AssetReceiveDO::getAssetsName, reqVO.getAssetsName())
|
||||
.eqIfPresent(AssetReceiveDO::getAssetsTypeId, reqVO.getAssetsTypeId())
|
||||
.betweenIfPresent(AssetReceiveDO::getApplyDate, reqVO.getApplyDate())
|
||||
.betweenIfPresent(AssetReceiveDO::getAllocationDate, reqVO.getAllocationDate())
|
||||
.eqIfPresent(AssetReceiveDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(AssetReceiveDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AssetReceiveDO::getStatus)
|
||||
.orderByDesc(AssetReceiveDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
@ -10,9 +10,7 @@ import cn.iocoder.yudao.module.system.controller.admin.laborcontract.vo.LaborCon
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.dto.UserPageDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.factoryUser.FactoryUserPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -20,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -184,4 +183,34 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
* @return
|
||||
*/
|
||||
IPage<AdminUserDO> getUserBringDeptPage(@Param("page") Page page, @Param("vo") UserPageReqVO vo);
|
||||
|
||||
default PageResult<UserBirthdayRespVO> selectUserPageByBirthday(UserBirthdayPageReqVO pageReqVO,
|
||||
List<Long> deptIds,
|
||||
LocalDate date) {
|
||||
|
||||
MPJLambdaWrapperX<AdminUserDO> queryWrapper = new MPJLambdaWrapperX<AdminUserDO>();
|
||||
queryWrapper.selectAs(AdminUserDO::getId, UserBirthdayRespVO::getUserId)
|
||||
.selectAs(AdminUserDO::getNickname, UserBirthdayRespVO::getNickname)
|
||||
.selectAs(AdminUserDO::getBirthdayDay, UserBirthdayRespVO::getBirthday)
|
||||
.leftJoin(AdminUserDO.class, AdminUserDO::getId, AdminUserDO::getId)
|
||||
.selectAs("d.name", UserBirthdayRespVO::getDeptName)
|
||||
.selectAs("p.name", UserBirthdayRespVO::getPostName)
|
||||
.selectAs("ps.name", UserBirthdayRespVO::getPositionName)
|
||||
.leftJoin("system_dept d on t.dept_id = d.id and d.deleted = 0")
|
||||
.leftJoin("system_post p on LOCATE(p.id, t.post_ids) and p.deleted = 0")
|
||||
.leftJoin("system_position ps on ps.id = t.position_id and ps.deleted = 0");
|
||||
|
||||
queryWrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
||||
queryWrapper.eq(AdminUserDO::getUserType, 1);
|
||||
queryWrapper.likeIfPresent(AdminUserDO::getNickname, pageReqVO.getName());
|
||||
queryWrapper.inIfPresent(AdminUserDO::getDeptId, deptIds);
|
||||
if ( (pageReqVO.getName() == null && pageReqVO.getDeptId() == null) || pageReqVO.getMonth() != null) {
|
||||
queryWrapper.eq("MONTH(t.birthday_day)",date.getMonthValue());
|
||||
queryWrapper.ge("DAY(t.birthday_day)", date.getDayOfMonth());
|
||||
}
|
||||
queryWrapper.groupBy("t.id");
|
||||
queryWrapper.orderByAsc("t.birthday_day");
|
||||
|
||||
return selectJoinPage(pageReqVO, UserBirthdayRespVO.class, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -97,7 +98,7 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
||||
@Param("userId") Long userId);
|
||||
|
||||
@DataPermission(enable = false)
|
||||
List<LogReadUserRespDTO> selectRaedUser(@Param("userId")Long userId, @Param("deptId")Long deptId);
|
||||
List<LogReadUserRespDTO> selectRaedUser(@Param("userId")Long userId, @Param("deptId")Long deptId, @Param("roleIds")Collection<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 获取上一篇下一篇
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.framework.rpc.config;
|
||||
import cn.iocoder.yudao.module.bpm.api.model.BpmModelApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEntryApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
@ -10,6 +11,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class, BpmOAEntryApi.class})
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class, BpmOAEntryApi.class, ConfigApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.system.service.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceivePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assetreceive.AssetReceiveDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产领用 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface AssetReceiveService {
|
||||
|
||||
/**
|
||||
* 创建资产领用
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAssetReceive(@Valid AssetReceiveSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 批量创建资产领用
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Boolean createAssetReceives(@Valid List<AssetReceiveSaveReqVO> createReqVO);
|
||||
|
||||
/**
|
||||
* 更新资产领用
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAssetReceive(@Valid AssetReceiveSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除资产领用
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAssetReceive(Long id);
|
||||
|
||||
/**
|
||||
* 获得资产领用
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 资产领用
|
||||
*/
|
||||
AssetReceiveDO getAssetReceive(Long id);
|
||||
|
||||
/**
|
||||
* 获得资产领用分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 资产领用分页
|
||||
*/
|
||||
PageResult<AssetReceiveDO> getAssetReceivePage(AssetReceivePageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.system.service.assetreceive;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceivePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assetreceive.vo.AssetReceiveSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assetreceive.AssetReceiveDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.assetreceive.AssetReceiveMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ASSET_RECEIVE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 资产领用 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AssetReceiveServiceImpl implements AssetReceiveService {
|
||||
|
||||
@Resource
|
||||
private AssetReceiveMapper assetReceiveMapper;
|
||||
|
||||
@Override
|
||||
public Long createAssetReceive(AssetReceiveSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AssetReceiveDO assetReceive = BeanUtils.toBean(createReqVO, AssetReceiveDO.class);
|
||||
assetReceiveMapper.insert(assetReceive);
|
||||
// 返回
|
||||
return assetReceive.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean createAssetReceives(List<AssetReceiveSaveReqVO> createReqVO) {
|
||||
|
||||
List<AssetReceiveDO> assetReceives = BeanUtils.toBean(createReqVO, AssetReceiveDO.class);
|
||||
assetReceiveMapper.insertBatch(assetReceives);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAssetReceive(AssetReceiveSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAssetReceiveExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AssetReceiveDO updateObj = BeanUtils.toBean(updateReqVO, AssetReceiveDO.class);
|
||||
assetReceiveMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAssetReceive(Long id) {
|
||||
// 校验存在
|
||||
validateAssetReceiveExists(id);
|
||||
// 删除
|
||||
assetReceiveMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAssetReceiveExists(Long id) {
|
||||
if (assetReceiveMapper.selectById(id) == null) {
|
||||
throw exception(ASSET_RECEIVE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetReceiveDO getAssetReceive(Long id) {
|
||||
return assetReceiveMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AssetReceiveDO> getAssetReceivePage(AssetReceivePageReqVO pageReqVO) {
|
||||
return assetReceiveMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.assets.vo.AssetsTypeSaveR
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsTypeDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -45,6 +46,14 @@ public interface AssetsTypeService {
|
||||
*/
|
||||
AssetsTypeDO getAssetsType(Long id);
|
||||
|
||||
/**
|
||||
* 获得资产类型
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 资产类型
|
||||
*/
|
||||
List<AssetsTypeDO> getAssetsTypes(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得资产类型分页
|
||||
*
|
||||
|
@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -54,6 +55,12 @@ public class AssetsTypeServiceImpl implements AssetsTypeService {
|
||||
return assetsTypeMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AssetsTypeDO> getAssetsTypes(Collection<Long> ids) {
|
||||
|
||||
return assetsTypeMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AssetsTypeDO> getAssetsTypePage(AssetsTypePageReqVO pageReqVO) {
|
||||
return assetsTypeMapper.selectPage(pageReqVO);
|
||||
|
@ -65,7 +65,12 @@ public interface AttendanceService {
|
||||
*/
|
||||
Integer verifyCheckInAddress(double latitude, double longitude, List<AttendanceAddressGroupItemDO> addressList, String addressGroupIds);
|
||||
|
||||
List<AttendanceOnTheDayDTO> buildAttendanceOnTheDay(List<AttendanceGroupShiftItemDO> attendanceGroupShiftItemDOList);
|
||||
/**
|
||||
* @param attendanceGroupShiftItemDOList
|
||||
* @param dayTime 日期yyyy-MM-dd格式 (归属于哪一天)
|
||||
* @return
|
||||
*/
|
||||
List<AttendanceOnTheDayDTO> buildAttendanceOnTheDay(List<AttendanceGroupShiftItemDO> attendanceGroupShiftItemDOList, String dayTime);
|
||||
|
||||
/**
|
||||
* 按天查询
|
||||
|
@ -433,7 +433,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
|
||||
// 如果Redis中没有,则从数据库加载并存入Redis
|
||||
if (attendanceOnTheDayDTOS.isEmpty()) {
|
||||
attendanceOnTheDayDTOS = this.buildAttendanceOnTheDay(attendanceGroupShiftItemDOList);
|
||||
attendanceOnTheDayDTOS = this.buildAttendanceOnTheDay(attendanceGroupShiftItemDOList, targetDayStr);
|
||||
this.saveToRedis(key, targetDayStr, mapKey, attendanceOnTheDayDTOS);
|
||||
}
|
||||
return attendanceOnTheDayDTOS;
|
||||
@ -459,7 +459,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttendanceOnTheDayDTO> buildAttendanceOnTheDay(List<AttendanceGroupShiftItemDO> attendanceGroupShiftItemDOList) {
|
||||
public List<AttendanceOnTheDayDTO> buildAttendanceOnTheDay(List<AttendanceGroupShiftItemDO> attendanceGroupShiftItemDOList, String dayTime) {
|
||||
List<AttendanceOnTheDayDTO> attendanceOnTheDayDTOS = new ArrayList<>();
|
||||
//上下班时间
|
||||
for (AttendanceGroupShiftItemDO attendanceGroupShiftItemDO : attendanceGroupShiftItemDOList) {
|
||||
@ -470,6 +470,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
dto.setTime(attendanceGroupShiftItemDO.getBeginTime());
|
||||
dto.setPunchTime(StringUtils.EMPTY);
|
||||
dto.setType(UP_WORK);
|
||||
dto.setDayTime(dayTime);
|
||||
dto.setLevel(attendanceGroupShiftItemDO.getLevel());
|
||||
dto.setBeforePunchTime(attendanceGroupShiftItemDO.getBeforePunchTimeUpWork());
|
||||
dto.setAfterPunchTime(attendanceGroupShiftItemDO.getAfterPunchTimeUpWork());
|
||||
@ -485,6 +486,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
dto.setTime(attendanceGroupShiftItemDO.getEndTime());
|
||||
dto.setPunchTime(StringUtils.EMPTY);
|
||||
dto.setType(DOWN_WORK);
|
||||
dto.setDayTime(dayTime);
|
||||
dto.setLevel(attendanceGroupShiftItemDO.getLevel());
|
||||
dto.setBeforePunchTime(attendanceGroupShiftItemDO.getBeforePunchTimeDownWork());
|
||||
dto.setAfterPunchTime(attendanceGroupShiftItemDO.getAfterPunchTimeDownWork());
|
||||
|
@ -77,4 +77,6 @@ public class AttendanceOnTheDayDTO {
|
||||
@Schema(description = "早退时长时间戳")
|
||||
private Long leaveEarlyTime;
|
||||
|
||||
@Schema(description = "日期yyyy-MM-dd格式 (归属于哪一天)")
|
||||
private String dayTime;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class AttendancePunchRecordServiceImpl implements AttendancePunchRecordSe
|
||||
if (CollectionUtil.isEmpty(attendanceGroupShiftItemDOS)) {
|
||||
continue;
|
||||
}
|
||||
List<AttendanceOnTheDayDTO> attendanceOnTheDayDTOS = attendanceService.buildAttendanceOnTheDay(attendanceGroupShiftItemDOS);
|
||||
List<AttendanceOnTheDayDTO> attendanceOnTheDayDTOS = attendanceService.buildAttendanceOnTheDay(attendanceGroupShiftItemDOS, time);
|
||||
for (Long userId : userIds) {
|
||||
AdminUserDO adminUserDO = userMap.get(userId);
|
||||
Map<Object, Object> leaveRedisMap = this.getAttendanceLeaveRedisMap(userId);
|
||||
|
@ -386,4 +386,12 @@ public interface AdminUserService {
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUserListByUserStaffing(Integer userStaffing);
|
||||
|
||||
/**
|
||||
* 获得指定日期过生日的用户信息分页
|
||||
*
|
||||
* @param pageReqVO 分页信息
|
||||
* @return 用户信息分页
|
||||
*/
|
||||
PageResult<UserBirthdayRespVO> getUserListByBirthday(UserBirthdayPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -765,4 +766,21 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
return userMapper.selectList(AdminUserDO::getUserStaffing, userStaffing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<UserBirthdayRespVO> getUserListByBirthday(UserBirthdayPageReqVO pageReqVO) {
|
||||
|
||||
List<Long> deptIds = new ArrayList<>();
|
||||
if (pageReqVO.getDeptId() != null) {
|
||||
deptIds = convertList(deptService.getChildDept(pageReqVO.getDeptId()), DeptDO::getId);
|
||||
}
|
||||
|
||||
LocalDate date = LocalDate.now();
|
||||
if (pageReqVO.getMonth() != null) {
|
||||
// 获取该月份的第一天
|
||||
date = LocalDate.of(LocalDate.now().getYear(), pageReqVO.getMonth(), 1);
|
||||
}
|
||||
|
||||
return userMapper.selectUserPageByBirthday(pageReqVO, deptIds, date);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import cn.hutool.json.JSONObject;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceNextOrUpVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstancePageReqVO;
|
||||
@ -23,6 +24,7 @@ import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.mapstruct.ap.internal.util.Strings;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -73,6 +75,9 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
@Lazy
|
||||
private LogStatisticsService logStatisticsService;
|
||||
|
||||
@Resource
|
||||
private ConfigApi configApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createLogInstance(LogInstanceSaveReqVO createReqVO) {
|
||||
@ -132,7 +137,12 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
//创建日志时,查询可以查看发起人日志的用户组 用线程控制
|
||||
new Thread(() -> {
|
||||
|
||||
List<LogReadUserRespDTO> respDTOS = logInstanceMapper.selectRaedUser(userId, adminUserDO.getDeptId());
|
||||
List<Long> roleIds = Arrays.asList(1L,101L);
|
||||
String roleId = configApi.getConfigKey("system_work_log_role_id").getCheckedData();
|
||||
if (Strings.isNotEmpty(roleId)) {
|
||||
roleIds = Arrays.stream(roleId.split(",")).map(Long::valueOf).collect(Collectors.toList());
|
||||
}
|
||||
List<LogReadUserRespDTO> respDTOS = logInstanceMapper.selectRaedUser(userId, adminUserDO.getDeptId(), roleIds);
|
||||
|
||||
//特殊情况, 日志发起人为研发部时 手动添加查看者
|
||||
if (adminUserDO.getDeptId() == 128L && adminUserDO.getId() != 126L) {
|
||||
|
@ -70,9 +70,13 @@
|
||||
LEFT JOIN system_menu role ON a.menu_id = role.id
|
||||
WHERE
|
||||
role.permission = 'system:view-log:query'
|
||||
AND a.role_id != 1
|
||||
AND a.role_id != 101
|
||||
AND a.deleted = 0
|
||||
<if test="roleIds != null and roleIds.size() > 0">
|
||||
AND a.role_id NOT IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</if>
|
||||
) menu
|
||||
LEFT JOIN system_role role on role.id = menu.role_id
|
||||
) role_id ON u_role.role_id = role_id.id
|
||||
|
@ -29,6 +29,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
@ -118,12 +119,27 @@ public class FactoryDataController {
|
||||
setDate(pageReqVO);
|
||||
}
|
||||
|
||||
// 获取指定工厂指定日期的出入库数据
|
||||
FactoryDataTotalVO dataTotalVO = dataService.getDataTotal(pageReqVO.getFactoryId(), pageReqVO.getDate());
|
||||
if (dataTotalVO == null) {
|
||||
dataTotalVO = new FactoryDataTotalVO();
|
||||
dataTotalVO.setInTotal(0);
|
||||
dataTotalVO.setOutTotal(0);
|
||||
dataTotalVO.setDamageNum(0);
|
||||
|
||||
if (pageReqVO.getFactoryId() != null) {
|
||||
|
||||
// 获取全工厂指定日期的总数据
|
||||
FactoryDataTotalVO dataTotal = dataService.getDataTotal(null, pageReqVO.getDate());
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#.##"); // 保留两位小数
|
||||
if (dataTotal.getInTotal() != 0) {
|
||||
// 设置出入库比列
|
||||
dataTotalVO.setInPercentage(df.format((double)dataTotalVO.getInTotal() / dataTotal.getInTotal() * 100L) + "%");
|
||||
}
|
||||
if (dataTotal.getOutTotal() != 0) {
|
||||
// 设置出库比例
|
||||
dataTotalVO.setOutPercentage(df.format((double)dataTotalVO.getOutTotal() / dataTotal.getOutTotal() * 100L) + "%");
|
||||
}
|
||||
if (dataTotalVO.getInTotal() != 0 && dataTotalVO.getOutTotal() != 0) {
|
||||
// 设置出入库比列
|
||||
dataTotalVO.setInOutPercentage(df.format((double)dataTotalVO.getOutTotal() / dataTotalVO.getInTotal() * 100L) + "%");
|
||||
}
|
||||
}
|
||||
|
||||
return success(dataTotalVO);
|
||||
|
@ -21,4 +21,13 @@ public class FactoryDataTotalVO {
|
||||
|
||||
@Schema(description = "破损总数")
|
||||
private Integer damageNum;
|
||||
|
||||
@Schema(description = "入库百分比")
|
||||
private String inPercentage;
|
||||
|
||||
@Schema(description = "出库百分比")
|
||||
private String outPercentage;
|
||||
|
||||
@Schema(description = "入库出库百分比")
|
||||
private String inOutPercentage;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
public String convertSquare(Object num, Integer type, String sizeName) {
|
||||
|
||||
int size = Integer.parseInt(sizeName.split("\\*")[0]);
|
||||
int size1 = Integer.parseInt(sizeName.split("\\*")[1]);
|
||||
int size1 = Integer.parseInt(sizeName.split("\\*")[1].replaceAll("[^0-9]", ""));
|
||||
|
||||
// 转换规格片数
|
||||
int unit = StringUtil.sizeNameAnalysis(sizeName);
|
||||
|
@ -60,9 +60,9 @@
|
||||
|
||||
<select id="selectDataSum" resultType="cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataTotalVO">
|
||||
SELECT
|
||||
SUM( CASE WHEN data_type = 2 THEN IFNULL(total_num, 0) END ) AS inTotal,
|
||||
SUM( CASE WHEN data_type = 1 THEN IFNULL(total_num, 0) END ) AS outTotal,
|
||||
SUM( CASE WHEN data_type = 1 OR data_type = 2 THEN IFNULL(damage_num, 0) END ) AS damageNum
|
||||
IFNULL( SUM( CASE WHEN data_type = 2 THEN IFNULL(total_num, 0) END ), 0 ) AS inTotal,
|
||||
IFNULL( SUM( CASE WHEN data_type = 1 THEN IFNULL(total_num, 0) END ), 0 ) AS outTotal,
|
||||
IFNULL( SUM( CASE WHEN data_type = 1 OR data_type = 2 THEN IFNULL(damage_num, 0) END ), 0 ) AS damageNum
|
||||
FROM
|
||||
sf_factory_data
|
||||
WHERE
|
||||
|
Loading…
Reference in New Issue
Block a user