diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java index cb82d301..aa9fd118 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java @@ -56,7 +56,12 @@ public class CommonResult implements Serializable { result.msg = message; return result; } - + public static CommonResult error(String message) { + CommonResult result = new CommonResult<>(); + result.code = 500; + result.msg = message; + return result; + } public static CommonResult error(ErrorCode errorCode) { return error(errorCode.getCode(), errorCode.getMsg()); } @@ -68,7 +73,13 @@ public class CommonResult implements Serializable { result.msg = ""; return result; } - + public static CommonResult success() { + CommonResult result = new CommonResult<>(); + result.code = GlobalErrorCodeConstants.SUCCESS.getCode(); + result.data = null; + result.msg = ""; + return result; + } public static boolean isSuccess(Integer code) { return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode()); } diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/ImageVo.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/ImageVo.java new file mode 100644 index 00000000..5dff535a --- /dev/null +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/ImageVo.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.framework.common.pojo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 路由显示信息 + * + * @author ruoyi + */ +@Data +public class ImageVo implements Serializable { + private static final long serialVersionUID=1L; + String name; + String url; +} diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java index 3b57554c..01c82999 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java @@ -15,8 +15,8 @@ public enum BpmProcessInstanceResultEnum { PROCESS(1, "处理中"), APPROVE(2, "通过"), - REJECT(3, "不通过"), - CANCEL(4, "已取消"), + REJECT(3, "驳回"), + CANCEL(4, "取消"), // ========== 流程任务独有的状态 ========== diff --git a/yudao-module-bpm/yudao-module-bpm-biz/pom.xml b/yudao-module-bpm/yudao-module-bpm-biz/pom.xml index 12d5c5be..d4934c56 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/pom.xml +++ b/yudao-module-bpm/yudao-module-bpm-biz/pom.xml @@ -26,7 +26,11 @@ yudao-module-system-api ${revision} - + + cn.iocoder.boot + yudao-module-bs-biz + ${revision} + cn.iocoder.boot diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java new file mode 100644 index 00000000..0801a9a3 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java @@ -0,0 +1,105 @@ +package cn.iocoder.yudao.module.bpm.controller.admin.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.*; +import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bpm.service.expenseapply.ExpenseApplyService; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; +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.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 申请单") +@RestController +@RequestMapping("/bs/expense-apply") +@Validated +public class ExpenseApplyController { + + @Resource + private ExpenseApplyService expenseApplyService; + @Resource + private ExpenseApplyTripService expenseApplyTripService; + @PostMapping("/create") + @Operation(summary = "创建申请单") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:create')") + public CommonResult createExpenseApply(@Valid @RequestBody ExpenseApplyCreateReqVO createReqVO) { + return expenseApplyService.createExpenseApply(createReqVO); + } + + + @DeleteMapping("/delete") + @Operation(summary = "删除申请单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('bs:expense-apply:delete')") + public CommonResult deleteExpenseApply(@RequestParam("id") Long id) { + expenseApplyService.deleteExpenseApply(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得申请单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult getExpenseApply(@RequestParam("id") Long id) { + ExpenseApplyDO expenseApply = expenseApplyService.getExpenseApply(id); + if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) { + LambdaQueryWrapperX queryWrapper = new LambdaQueryWrapperX<>(); + queryWrapper.eq(ExpenseApplyTripDO::getApplyId, expenseApply.getId()); + List list = expenseApplyTripService.list(queryWrapper); + expenseApply.setExpenseApplyTrips(list); + //cqptodo 需要设置用户名,部门返回前端 +// expenseApplyService.setRepField(expenseApply); + } + return success(expenseApply); + } + + @GetMapping("/list") + @Operation(summary = "获得申请单列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult> getExpenseApplyList(@RequestParam("ids") Collection ids) { + List list = expenseApplyService.getExpenseApplyList(ids); + return success(ExpenseApplyConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得申请单分页") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult> getExpenseApplyPage(@Valid ExpenseApplyPageReqVO pageVO) { + PageResult pageResult = expenseApplyService.getExpenseApplyPage(pageVO); + return success(ExpenseApplyConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出申请单 Excel") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:export')") + @OperateLog(type = EXPORT) + public void exportExpenseApplyExcel(@Valid ExpenseApplyExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = expenseApplyService.getExpenseApplyList(exportReqVO); + // 导出 Excel + List datas = ExpenseApplyConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "申请单.xls", "数据", ExpenseApplyExcelVO.class, datas); + } + +} diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java new file mode 100644 index 00000000..f252e6e5 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.bpm.service.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 申请单 Service 接口 + * + * @author 芋道源码 + */ +public interface ExpenseApplyService extends IService { + + /** + * 创建申请单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + CommonResult createExpenseApply(@Valid ExpenseApplyCreateReqVO createReqVO); + + + + + /** + * 删除申请单 + * + * @param id 编号 + */ + void deleteExpenseApply(Long id); + + /** + * 获得申请单 + * + * @param id 编号 + * @return 申请单 + */ + ExpenseApplyDO getExpenseApply(Long id); + + /** + * 获得申请单列表 + * + * @param ids 编号 + * @return 申请单列表 + */ + List getExpenseApplyList(Collection ids); + + /** + * 获得申请单分页 + * + * @param pageReqVO 分页查询 + * @return 申请单分页 + */ + PageResult getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO); + + /** + * 获得申请单列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 申请单列表 + */ + List getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO); + + void processInstanceCallBack(long id, Integer result); + +} diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java new file mode 100644 index 00000000..15f47cb2 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java @@ -0,0 +1,208 @@ +package cn.iocoder.yudao.module.bpm.service.expenseapply; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.RandomUtil; +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.ExpenseApplyTripCreateReqVO; +import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper; +import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; +import cn.iocoder.yudao.module.bs.enums.ExpenseApplyStatusEnum; +import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import javax.validation.Validator; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; +import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.EXPENSE_APPLY_NOT_EXISTS; + +/** + * 申请单 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +@Transactional(rollbackFor = Exception.class) +public class ExpenseApplyServiceImpl extends ServiceImpl implements ExpenseApplyService { + + public static final String PROCESS_KEY = "expense_apply"; + @Resource + private Validator validator; + @Resource + private ExpenseApplyMapper expenseApplyMapper; + @Resource + private AdminUserApi adminUserApi; + @Resource + private ExpenseApplyTripService expenseApplyTripService; + @Resource + private BpmProcessInstanceApi processInstanceApi; + @Override + public CommonResult createExpenseApply(ExpenseApplyCreateReqVO createReqVO) { + ExpenseApplyDO expenseApply = ExpenseApplyConvert.INSTANCE.convert(createReqVO); + CommonResult result = dataValidAndSetFileName(createReqVO, expenseApply); + if (result.isError()) { + return result; + } + + saveOrUpdate(expenseApply); + if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) { + //插入或者更新差旅明细 + List trips = ExpenseApplyConvert.INSTANCE.convert(createReqVO.getExpenseApplyTrips()); + for (ExpenseApplyTripDO trip : trips) { + trip.setApplyId(expenseApply.getId()); + } + //采用先删后增的方式来 + //删除行程明细 + expenseApplyTripService.remove(new LambdaQueryWrapperX().eq(ExpenseApplyTripDO::getApplyId, expenseApply.getId())); + expenseApplyTripService.saveBatch(trips); + } + if (expenseApply.getStatus().equals(ExpenseApplyStatusEnum.PROCESS.getValue())) { + Map variables = new HashMap<>(); + variables.put("billType", expenseApply.getBillType()); + variables.put("amount", expenseApply.getAmount()); + variables.put("deptId", expenseApply.getDeptId()); + String processInstanceId = processInstanceApi.createProcessInstance(expenseApply.getUserId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + .setVariables(variables).setBusinessKey(String.valueOf(expenseApply.getId()))); + updateById(new ExpenseApplyDO().setId(expenseApply.getId()).setProcessInstanceId(processInstanceId)); + } + // 返回 + return CommonResult.success(); + } + + /** + * 新增和更新数据校验 + * @param createReqVO + * @param expenseApply + * @return + */ + private CommonResult dataValidAndSetFileName(ExpenseApplyCreateReqVO createReqVO, ExpenseApplyDO expenseApply) { + boolean isAdd = createReqVO.getId() == null; + + if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) { + List expenseApplyTrips = createReqVO.getExpenseApplyTrips(); + if (CollUtil.isEmpty(expenseApplyTrips)) { + return CommonResult.error("差旅明细不能为空"); + } + // 参数校验 + ValidationUtils.validate(validator, expenseApplyTrips); + BigDecimal amount = BigDecimal.ZERO; + for (ExpenseApplyTripCreateReqVO trip : expenseApplyTrips) { + if (trip.getAmount()!=null) { + amount = amount.add(trip.getAmount()); + } + } + expenseApply.setAmount(amount); + } + if (isAdd) { + //新增 + //cqptodo 单号的规则需要重写 + expenseApply.setApplyNo(RandomUtil.randomString(6)); + }else { + ExpenseApplyDO dbApply = validateExpenseApplyExists(expenseApply.getId()); + if (!dbApply.getStatus().equals(ExpenseApplyStatusEnum.NOSUBMIT.getValue())) { + //只有未提交才能更新 + return CommonResult.error("只有未提交单据才能更新"); + } + } + LoginUser loginUser = getLoginUser(); + expenseApply.setUserId(loginUser.getId()); + AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId()); + expenseApply.setDeptId(user.getDeptId()); + + return CommonResult.success(); + } + + @Override + public void deleteExpenseApply(Long id) { + // 校验存在 + ExpenseApplyDO apply = validateExpenseApplyExists(id); + if (!apply.getStatus().equals(ExpenseApplyStatusEnum.NOSUBMIT.getValue())) { + //只有未提交才能更新 + throw exception(new ErrorCode(500, "单据状态不可操作,请刷新后重试")); + } + // 删除 + expenseApplyMapper.deleteById(id); + //删除行程明细 + expenseApplyTripService.remove(new LambdaQueryWrapperX().eq(ExpenseApplyTripDO::getApplyId, apply.getId())); + } + + private ExpenseApplyDO validateExpenseApplyExists(Long id) { + ExpenseApplyDO expenseApplyDO = expenseApplyMapper.selectById(id); + if (expenseApplyDO == null) { + throw exception(EXPENSE_APPLY_NOT_EXISTS); + } + return expenseApplyDO; + } + + @Override + public ExpenseApplyDO getExpenseApply(Long id) { + return expenseApplyMapper.selectById(id); + } + + @Override + public List getExpenseApplyList(Collection ids) { + return expenseApplyMapper.selectBatchIds(ids); + } + + @Override + public PageResult getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO) { + return expenseApplyMapper.selectPage(pageReqVO); + } + + @Override + public List getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO) { + return expenseApplyMapper.selectList(exportReqVO); + } + + /** + * 流程回调 + * @param id + * @param result + */ + @Override + public void processInstanceCallBack(long id, Integer result) { + ExpenseApplyDO apply = getById(id); + if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) { + //审核通过 + apply.setStatus(ExpenseApplyStatusEnum.APPROVE.getValue()); + updateById(apply); + } else if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)) { + //驳回 + apply.setStatus(ExpenseApplyStatusEnum.REJECT.getValue()); + updateById(apply); + }else if (BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)) { + //驳回 + apply.setStatus(ExpenseApplyStatusEnum.CANCEL.getValue()); + updateById(apply); + } + } +} diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripService.java new file mode 100644 index 00000000..cbd59ec6 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripService.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.bpm.service.expenseapplytrip; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.*; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 申请单行程明细 Service 接口 + * + * @author 芋道源码 + */ +public interface ExpenseApplyTripService extends IService { + + +} diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripServiceImpl.java new file mode 100644 index 00000000..d8117b59 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapplytrip/ExpenseApplyTripServiceImpl.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.bpm.service.expenseapplytrip; + +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.module.bs.dal.mysql.expenseapplytrip.ExpenseApplyTripMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +/** + * 申请单行程明细 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ExpenseApplyTripServiceImpl extends ServiceImpl implements ExpenseApplyTripService { + + +} diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java index 03237015..90c47763 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java @@ -33,32 +33,32 @@ public class BpmMessageServiceImpl implements BpmMessageService { @Override public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) { - Map templateParams = new HashMap<>(); - templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); - templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); - smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), - BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); +// Map templateParams = new HashMap<>(); +// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); +// templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); +// smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), +// BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); } @Override public void sendMessageWhenProcessInstanceReject(BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO) { - Map templateParams = new HashMap<>(); - templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); - templateParams.put("reason", reqDTO.getReason()); - templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); - smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), - BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); +// Map templateParams = new HashMap<>(); +// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); +// templateParams.put("reason", reqDTO.getReason()); +// templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); +// smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), +// BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); } @Override public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) { - Map templateParams = new HashMap<>(); - templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); - templateParams.put("taskName", reqDTO.getTaskName()); - templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); - templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); - smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), - BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)); +// Map templateParams = new HashMap<>(); +// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); +// templateParams.put("taskName", reqDTO.getTaskName()); +// templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); +// templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); +// smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), +// BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)); } private String getProcessInstanceDetailUrl(String taskId) { diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/ExpenseApplyResultListener.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/ExpenseApplyResultListener.java new file mode 100644 index 00000000..f4e9c267 --- /dev/null +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/ExpenseApplyResultListener.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.bpm.service.oa.listener; + +import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent; +import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventListener; +import cn.iocoder.yudao.module.bpm.service.expenseapply.ExpenseApplyServiceImpl; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * OA 请假单的结果的监听器实现类 + * + * @author 芋道源码 + */ +@Component +public class ExpenseApplyResultListener extends BpmProcessInstanceResultEventListener { + + @Resource + private ExpenseApplyServiceImpl expenseApplyService; + + @Override + protected String getProcessDefinitionKey() { + return ExpenseApplyServiceImpl.PROCESS_KEY; + } + + @Override + protected void onEvent(BpmProcessInstanceResultEvent event) { + expenseApplyService.processInstanceCallBack(Long.parseLong(event.getBusinessKey()), event.getResult()); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java new file mode 100644 index 00000000..f65fc578 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/BillTypeEnum.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.bs.enums; + +import cn.hutool.core.util.ArrayUtil; +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.stream.Collectors; + +/** + * 单据类型枚举 + */ +@AllArgsConstructor +@Getter +public enum BillTypeEnum { + + CLSQ("CLSQ", "差旅申请单"), + RCSQ("RCSQ", "日常申请单"); + + + /** + * 类型 + */ + private final String value; + /** + * 类型名 + */ + private final String name; + + +} diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java index 65726454..69657919 100644 --- a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java @@ -10,5 +10,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { ErrorCode INVOICE_NOT_EXISTS = new ErrorCode(200100, "我的发票不存在"); - + ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在"); } diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ExpenseApplyStatusEnum.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ExpenseApplyStatusEnum.java new file mode 100644 index 00000000..d218ca08 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ExpenseApplyStatusEnum.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.bs.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 申请状态枚举 + */ +@AllArgsConstructor +@Getter +public enum ExpenseApplyStatusEnum { + + NOSUBMIT("0", "未提交"), + PROCESS("1", "待审核"), + APPROVE("2", "通过"), + REJECT("3", "驳回"), + CANCEL("4", "取消"); + + + /** + * 类型 + */ + private final String value; + /** + * 类型名 + */ + private final String name; + + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/pom.xml b/yudao-module-bs/yudao-module-bs-biz/pom.xml index 808be241..2f3f197d 100644 --- a/yudao-module-bs/yudao-module-bs-biz/pom.xml +++ b/yudao-module-bs/yudao-module-bs-biz/pom.xml @@ -18,6 +18,10 @@ + + cn.iocoder.boot + yudao-spring-boot-starter-biz-tenant + cn.iocoder.boot yudao-module-bs-api diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java new file mode 100644 index 00000000..484b7fd3 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.ExpenseApplyTripCreateReqVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 申请单 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ExpenseApplyBaseVO { + + @Schema(description = "申请类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "申请类型不能为空") + private String billType; + +// @Schema(description = "申请者ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9227") +// @NotNull(message = "申请者ID不能为空") +// private Long userId; +// +// @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") +// @NotNull(message = "用户昵称不能为空") +// private String nickname; +// +// @Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32343") +// @NotNull(message = "部门ID不能为空") +// private Long deptId; +// +// @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") +// @NotNull(message = "部门名称不能为空") +// private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + @NotNull(message = "申请事由") + private String reason; + + private String status; + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) + private List files; + + @Schema(description = "行程明细,仅为差旅申请单的时候需要传", example = "") + private List expenseApplyTrips; +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java new file mode 100644 index 00000000..e655d295 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.module.bs.enums.ExpenseApplyStatusEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.AssertTrue; + +@Schema(description = "管理后台 - 申请单创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyCreateReqVO extends ExpenseApplyBaseVO { + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14225") + private Long id; + @AssertTrue(message = "状态只能是0或者1提交") + public boolean isStatusValid() { + //只能传未提交和待审核 + return getStatus().equals(ExpenseApplyStatusEnum.NOSUBMIT.getValue()) || getStatus().equals(ExpenseApplyStatusEnum.PROCESS.getValue()); + } +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java new file mode 100644 index 00000000..adc287a3 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + + +/** + * 申请单 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ExpenseApplyExcelVO { + + @ExcelProperty("id") + private Long id; + + @ExcelProperty(value = "申请类型", converter = DictConvert.class) + @DictFormat("bs_bill_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String billType; + + @ExcelProperty("申请单号") + private String applyNo; + + @ExcelProperty("申请者ID") + private Long userId; + + @ExcelProperty("用户昵称") + private String nickname; + + @ExcelProperty("部门ID") + private Long deptId; + + @ExcelProperty("部门名称") + private String deptName; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申请事由") + private String reason; + + @ExcelProperty("申请金额") + private BigDecimal amount; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat("bs_expense_apply_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String status; + + @ExcelProperty("备注") + private String remark; + + + + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java new file mode 100644 index 00000000..73952b8a --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java @@ -0,0 +1,64 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 申请单 Excel 导出 Request VO,参数和 ExpenseApplyPageReqVO 是一致的") +@Data +public class ExpenseApplyExportReqVO { + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "申请单号") + private String applyNo; + + @Schema(description = "申请者ID", example = "9227") + private Long userId; + + @Schema(description = "用户昵称", example = "张三") + private String nickname; + + @Schema(description = "部门ID", example = "32343") + private Long deptId; + + @Schema(description = "部门名称", example = "王五") + private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + private String reason; + + @Schema(description = "申请金额") + private BigDecimal amount; + + @Schema(description = "状态", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private List files; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updateBy; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java new file mode 100644 index 00000000..3e00921a --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java @@ -0,0 +1,69 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +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.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +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 ExpenseApplyPageReqVO extends PageParam { + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "申请单号") + private String applyNo; + + @Schema(description = "申请者ID", example = "9227") + private Long userId; + + @Schema(description = "用户昵称", example = "张三") + private String nickname; + + @Schema(description = "部门ID", example = "32343") + private Long deptId; + + @Schema(description = "部门名称", example = "王五") + private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + private String reason; + + @Schema(description = "申请金额") + private BigDecimal amount; + + @Schema(description = "状态", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private List files; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updateBy; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java new file mode 100644 index 00000000..03f65991 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 申请单 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyRespVO extends ExpenseApplyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14225") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java new file mode 100644 index 00000000..6619f3dc --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 申请单更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyUpdateReqVO extends ExpenseApplyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14225") + @NotNull(message = "id不能为空") + private Long id; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java new file mode 100644 index 00000000..2eb69273 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Set; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 申请单行程明细 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ExpenseApplyTripBaseVO { + + + + @Schema(description = "出发地编码,二级市", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "出发地编码,二级市不能为空") + private String departureLocation; + + @Schema(description = "目的地编码,二级市", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "目的地编码,二级市不能为空") + private String destinationLocation; + + @Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "开始日期不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime startTime; + + @Schema(description = "结束日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "结束日期不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime endTime; + + @Schema(description = "出差天数") + @NotNull(message = "出差天数不能为空") + private BigDecimal tripDay; + + @Schema(description = "出差类型") + private String tripType; + + @Schema(description = "出差同行人") + private Set tripPartners; + + @Schema(description = "预计费用") + private BigDecimal amount; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripCreateReqVO.java new file mode 100644 index 00000000..34ddc4c2 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripCreateReqVO.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 申请单行程明细创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyTripCreateReqVO extends ExpenseApplyTripBaseVO { + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java index 29a42281..ae2236ed 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * 我的发票 Excel VO @@ -18,7 +20,7 @@ public class InvoiceExcelVO { private Long id; @ExcelProperty("附件") - private String files; + private List files; @ExcelProperty("创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java index 3dca983f..ee833ceb 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -14,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ public class InvoiceExportReqVO { @Schema(description = "附件") - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java index 0ed3dfdf..d3084c2b 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -9,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -19,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ public class InvoicePageReqVO extends PageParam { @Schema(description = "附件") - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java index 1d975252..09c20542 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import java.time.LocalDateTime; +import java.util.List; @Schema(description = "管理后台 - 我的发票 Response VO") @Data @@ -17,7 +19,7 @@ public class InvoiceRespVO extends InvoiceBaseVO { private Long id; @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java index 999922ee..0ab5ce1c 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; +import java.util.List; @Schema(description = "管理后台 - 我的发票更新 Request VO") @Data @@ -19,6 +21,6 @@ public class InvoiceUpdateReqVO extends InvoiceBaseVO { @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "附件不能为空") - private String files; + private List files; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java new file mode 100644 index 00000000..989710ea --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.bs.convert.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExcelVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyRespVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.ExpenseApplyTripCreateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 申请单 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ExpenseApplyConvert { + + ExpenseApplyConvert INSTANCE = Mappers.getMapper(ExpenseApplyConvert.class); + + ExpenseApplyDO convert(ExpenseApplyCreateReqVO bean); + ExpenseApplyTripDO convert(ExpenseApplyTripCreateReqVO bean); + List convert(List bean); + + ExpenseApplyDO convert(ExpenseApplyUpdateReqVO bean); + + ExpenseApplyRespVO convert(ExpenseApplyDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java new file mode 100644 index 00000000..a43bcfa3 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 申请单 DO + * + * @author 芋道源码 + */ +@TableName(value = "bs_expense_apply", autoResultMap = true) +@KeySequence("bs_expense_apply_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ExpenseApplyDO extends TenantBaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 申请类型 + * + * 枚举 {@link TODO bs_bill_type 对应的类} + */ + private String billType; + /** + * 申请单号 + */ + private String applyNo; + /** + * 申请者ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 项目名称 + */ + private String projectName; + /** + * 申请事由 + */ + private String reason; + /** + * 申请金额 + */ + private BigDecimal amount; + /** + * 状态 + * + * 枚举 {@link TODO bs_expense_apply_status 对应的类} + */ + private String status; + /** + * 备注 + */ + private String remark; + /** + * 附件 + */ + + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; + /** + * 对应的流程编号 + * + * 关联 ProcessInstance 的 id 属性 + */ + private String processInstanceId; + + @TableField(exist = false) + private List expenseApplyTrips; + @TableField(exist = false) + private Boolean deleted; + @TableField(exist = false) + private String nickname; + @TableField(exist = false) + private String detpName; +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java new file mode 100644 index 00000000..bed5db48 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip; + +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler; +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Set; + +/** + * 申请单行程明细 DO + * + * @author 芋道源码 + */ +@TableName(value = "bs_expense_apply_trip", autoResultMap = true) +@KeySequence("bs_expense_apply_trip_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ExpenseApplyTripDO extends TenantBaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 备注 + */ + private String remark; + /** + * 附件 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; + /** + * 创建者 + */ + private String createBy; + /** + * 更新者 + */ + private String updateBy; + /** + * 申请单ID + */ + private Long applyId; + /** + * 出发地编码,二级市 + */ + private String departureLocation; + /** + * 目的地编码,二级市 + */ + private String destinationLocation; + /** + * 开始日期 + */ + private LocalDateTime startTime; + /** + * 结束日期 + */ + private LocalDateTime endTime; + /** + * 出差天数 + */ + private BigDecimal tripDay; + /** + * 出差类型 + * + * 枚举 {@link TODO bs_trip_type 对应的类} + */ + private String tripType; + /** + * 出差同行人 + */ + @TableField(typeHandler = JsonLongSetTypeHandler.class) + private Set tripPartners; + /** + * 预计费用 + */ + private BigDecimal amount; + @TableField(exist = false) + private Boolean deleted; +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java index ffd2e5c6..6ee973c0 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java @@ -1,18 +1,22 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.invoice; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * 我的发票 DO * * @author chenqp */ -@TableName("bs_invoice") +@TableName(value = "bs_invoice", autoResultMap = true) @KeySequence("bs_invoice_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @Data @EqualsAndHashCode(callSuper = true) @@ -20,7 +24,7 @@ import java.time.LocalDateTime; @Builder @NoArgsConstructor @AllArgsConstructor -public class InvoiceDO extends BaseDO { +public class InvoiceDO extends TenantBaseDO { /** * id @@ -30,15 +34,9 @@ public class InvoiceDO extends BaseDO { /** * 附件 */ - private String files; - /** - * 创建者 - */ - private String createBy; - /** - * 更新者 - */ - private String updateBy; + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; + /** * 发票类型 */ @@ -86,5 +84,8 @@ public class InvoiceDO extends BaseDO { @TableField(exist = false) private Boolean deleted; - + /** + * 验真状态 + */ + private String status; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java new file mode 100644 index 00000000..b16bb68d --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.bs.dal.mysql.expenseapply; + +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.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 申请单 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ExpenseApplyMapper extends BaseMapperX { + + default PageResult selectPage(ExpenseApplyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ExpenseApplyDO::getBillType, reqVO.getBillType()) + .eqIfPresent(ExpenseApplyDO::getApplyNo, reqVO.getApplyNo()) + .eqIfPresent(ExpenseApplyDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ExpenseApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ExpenseApplyDO::getProjectName, reqVO.getProjectName()) + .eqIfPresent(ExpenseApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(ExpenseApplyDO::getAmount, reqVO.getAmount()) + .eqIfPresent(ExpenseApplyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ExpenseApplyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ExpenseApplyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(ExpenseApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ExpenseApplyDO::getId)); + } + + default List selectList(ExpenseApplyExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ExpenseApplyDO::getBillType, reqVO.getBillType()) + .eqIfPresent(ExpenseApplyDO::getApplyNo, reqVO.getApplyNo()) + .eqIfPresent(ExpenseApplyDO::getUserId, reqVO.getUserId()) + .eqIfPresent(ExpenseApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ExpenseApplyDO::getProjectName, reqVO.getProjectName()) + .eqIfPresent(ExpenseApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(ExpenseApplyDO::getAmount, reqVO.getAmount()) + .eqIfPresent(ExpenseApplyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ExpenseApplyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ExpenseApplyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(ExpenseApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ExpenseApplyDO::getId)); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapplytrip/ExpenseApplyTripMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapplytrip/ExpenseApplyTripMapper.java new file mode 100644 index 00000000..8d3dada5 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapplytrip/ExpenseApplyTripMapper.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.bs.dal.mysql.expenseapplytrip; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.*; + +/** + * 申请单行程明细 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ExpenseApplyTripMapper extends BaseMapperX { + + + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java index c4633ac7..26506c25 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java @@ -21,9 +21,7 @@ public interface InvoiceMapper extends BaseMapperX { default PageResult selectPage(InvoicePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) - .eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) @@ -41,9 +39,7 @@ public interface InvoiceMapper extends BaseMapperX { default List selectList(InvoiceExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) - .eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml new file mode 100644 index 00000000..6e4dcdc0 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapplytrip/ExpenseApplyTripMapper.xml b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapplytrip/ExpenseApplyTripMapper.xml new file mode 100644 index 00000000..cfc5952d --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapplytrip/ExpenseApplyTripMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java b/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java deleted file mode 100644 index 71d5c516..00000000 --- a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java +++ /dev/null @@ -1,263 +0,0 @@ -package cn.iocoder.yudao.module.bs.service.invoice; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; - -import javax.annotation.Resource; - -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; - -import cn.iocoder.yudao.module.bs.controller.admin.invoice.vo.*; -import cn.iocoder.yudao.module.bs.dal.dataobject.invoice.InvoiceDO; -import cn.iocoder.yudao.module.bs.dal.mysql.invoice.InvoiceMapper; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import javax.annotation.Resource; -import org.springframework.context.annotation.Import; -import java.util.*; -import java.time.LocalDateTime; - -import static cn.hutool.core.util.RandomUtil.*; -import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -/** - * {@link InvoiceServiceImpl} 的单元测试类 - * - * @author chenqp - */ -@Import(InvoiceServiceImpl.class) -public class InvoiceServiceImplTest extends BaseDbUnitTest { - - @Resource - private InvoiceServiceImpl invoiceService; - - @Resource - private InvoiceMapper invoiceMapper; - - @Test - public void testCreateInvoice_success() { - // 准备参数 - InvoiceCreateReqVO reqVO = randomPojo(InvoiceCreateReqVO.class); - - // 调用 - Long invoiceId = invoiceService.createInvoice(reqVO); - // 断言 - assertNotNull(invoiceId); - // 校验记录的属性是否正确 - InvoiceDO invoice = invoiceMapper.selectById(invoiceId); - assertPojoEquals(reqVO, invoice); - } - - @Test - public void testUpdateInvoice_success() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class); - invoiceMapper.insert(dbInvoice);// @Sql: 先插入出一条存在的数据 - // 准备参数 - InvoiceUpdateReqVO reqVO = randomPojo(InvoiceUpdateReqVO.class, o -> { - o.setId(dbInvoice.getId()); // 设置更新的 ID - }); - - // 调用 - invoiceService.updateInvoice(reqVO); - // 校验是否更新正确 - InvoiceDO invoice = invoiceMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, invoice); - } - - @Test - public void testUpdateInvoice_notExists() { - // 准备参数 - InvoiceUpdateReqVO reqVO = randomPojo(InvoiceUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> invoiceService.updateInvoice(reqVO), INVOICE_NOT_EXISTS); - } - - @Test - public void testDeleteInvoice_success() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class); - invoiceMapper.insert(dbInvoice);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbInvoice.getId(); - - // 调用 - invoiceService.deleteInvoice(id); - // 校验数据不存在了 - assertNull(invoiceMapper.selectById(id)); - } - - @Test - public void testDeleteInvoice_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> invoiceService.deleteInvoice(id), INVOICE_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetInvoicePage() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class, o -> { // 等会查询到 - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - o.setInvoiceType(null); - o.setInvoiceCode(null); - o.setInvoiceNum(null); - o.setInvoiceDate(null); - o.setSeller(null); - o.setTaxAmount(null); - o.setExcludingTaxAmount(null); - o.setTotalAmount(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRemark(null); - }); - invoiceMapper.insert(dbInvoice); - // 测试 files 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setUpdateBy(null))); - // 测试 invoiceType 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceType(null))); - // 测试 invoiceCode 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceCode(null))); - // 测试 invoiceNum 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceNum(null))); - // 测试 invoiceDate 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceDate(null))); - // 测试 seller 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setSeller(null))); - // 测试 taxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTaxAmount(null))); - // 测试 excludingTaxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setExcludingTaxAmount(null))); - // 测试 totalAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTotalAmount(null))); - // 测试 deptId 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptName(null))); - // 测试 remark 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setRemark(null))); - // 准备参数 - InvoicePageReqVO reqVO = new InvoicePageReqVO(); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - reqVO.setInvoiceType(null); - reqVO.setInvoiceCode(null); - reqVO.setInvoiceNum(null); - reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setSeller(null); - reqVO.setTaxAmount(null); - reqVO.setExcludingTaxAmount(null); - reqVO.setTotalAmount(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRemark(null); - - // 调用 - PageResult pageResult = invoiceService.getInvoicePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbInvoice, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetInvoiceList() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class, o -> { // 等会查询到 - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - o.setInvoiceType(null); - o.setInvoiceCode(null); - o.setInvoiceNum(null); - o.setInvoiceDate(null); - o.setSeller(null); - o.setTaxAmount(null); - o.setExcludingTaxAmount(null); - o.setTotalAmount(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRemark(null); - }); - invoiceMapper.insert(dbInvoice); - // 测试 files 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setUpdateBy(null))); - // 测试 invoiceType 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceType(null))); - // 测试 invoiceCode 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceCode(null))); - // 测试 invoiceNum 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceNum(null))); - // 测试 invoiceDate 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceDate(null))); - // 测试 seller 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setSeller(null))); - // 测试 taxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTaxAmount(null))); - // 测试 excludingTaxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setExcludingTaxAmount(null))); - // 测试 totalAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTotalAmount(null))); - // 测试 deptId 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptName(null))); - // 测试 remark 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setRemark(null))); - // 准备参数 - InvoiceExportReqVO reqVO = new InvoiceExportReqVO(); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - reqVO.setInvoiceType(null); - reqVO.setInvoiceCode(null); - reqVO.setInvoiceNum(null); - reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setSeller(null); - reqVO.setTaxAmount(null); - reqVO.setExcludingTaxAmount(null); - reqVO.setTotalAmount(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRemark(null); - - // 调用 - List list = invoiceService.getInvoiceList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbInvoice, list.get(0)); - } - -} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java index 0020c928..0d1f86f0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant; +import cn.hutool.core.map.MapUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -20,6 +21,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -36,9 +38,13 @@ public class TenantController { @PermitAll @Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号") @Parameter(name = "name", description = "租户名", required = true, example = "1024") - public CommonResult getTenantIdByName(@RequestParam("name") String name) { + public CommonResult getTenantIdByName(@RequestParam("name") String name) { TenantDO tenantDO = tenantService.getTenantByName(name); - return success(tenantDO != null ? tenantDO.getId() : null); + if (tenantDO == null) { + return success(null); + } + Map data = MapUtil.builder().put("id", tenantDO.getId()).put("name", tenantDO.getName()).build(); + return success(data); } @PostMapping("/create") diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 04fd67c7..9c506d42 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -150,6 +150,7 @@ logging: level: # 配置自己写的 MyBatis Mapper 打印日志 cn.iocoder.yudao.module.bpm.dal.mysql: debug + cn.iocoder.yudao.module.bs.dal.mysql: debug cn.iocoder.yudao.module.infra.dal.mysql: debug cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info cn.iocoder.yudao.module.pay.dal.mysql: debug