fNumb 1 year ago
commit 18f04bfc3a

@ -56,7 +56,12 @@ public class CommonResult<T> implements Serializable {
result.msg = message; result.msg = message;
return result; return result;
} }
public static <T> CommonResult<T> error(String message) {
CommonResult<T> result = new CommonResult<>();
result.code = 500;
result.msg = message;
return result;
}
public static <T> CommonResult<T> error(ErrorCode errorCode) { public static <T> CommonResult<T> error(ErrorCode errorCode) {
return error(errorCode.getCode(), errorCode.getMsg()); return error(errorCode.getCode(), errorCode.getMsg());
} }
@ -68,7 +73,13 @@ public class CommonResult<T> implements Serializable {
result.msg = ""; result.msg = "";
return result; 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) { public static boolean isSuccess(Integer code) {
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode()); return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
} }

@ -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;
}

@ -15,8 +15,8 @@ public enum BpmProcessInstanceResultEnum {
PROCESS(1, "处理中"), PROCESS(1, "处理中"),
APPROVE(2, "通过"), APPROVE(2, "通过"),
REJECT(3, "不通过"), REJECT(3, "驳回"),
CANCEL(4, "取消"), CANCEL(4, "取消"),
// ========== 流程任务独有的状态 ========== // ========== 流程任务独有的状态 ==========

@ -26,7 +26,11 @@
<artifactId>yudao-module-system-api</artifactId> <artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bs-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 --> <!-- 业务组件 -->
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>

@ -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<Boolean> 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<ExpenseApplyDO> getExpenseApply(@RequestParam("id") Long id) {
ExpenseApplyDO expenseApply = expenseApplyService.getExpenseApply(id);
if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) {
LambdaQueryWrapperX<ExpenseApplyTripDO> queryWrapper = new LambdaQueryWrapperX<>();
queryWrapper.eq(ExpenseApplyTripDO::getApplyId, expenseApply.getId());
List<ExpenseApplyTripDO> 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<List<ExpenseApplyRespVO>> getExpenseApplyList(@RequestParam("ids") Collection<Long> ids) {
List<ExpenseApplyDO> list = expenseApplyService.getExpenseApplyList(ids);
return success(ExpenseApplyConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得申请单分页")
@PreAuthorize("@ss.hasPermission('bs:expense-apply:query')")
public CommonResult<PageResult<ExpenseApplyRespVO>> getExpenseApplyPage(@Valid ExpenseApplyPageReqVO pageVO) {
PageResult<ExpenseApplyDO> 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<ExpenseApplyDO> list = expenseApplyService.getExpenseApplyList(exportReqVO);
// 导出 Excel
List<ExpenseApplyExcelVO> datas = ExpenseApplyConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "申请单.xls", "数据", ExpenseApplyExcelVO.class, datas);
}
}

@ -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<ExpenseApplyDO> {
/**
*
*
* @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<ExpenseApplyDO> getExpenseApplyList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ExpenseApplyDO> getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<ExpenseApplyDO> getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO);
void processInstanceCallBack(long id, Integer result);
}

@ -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<ExpenseApplyMapper, ExpenseApplyDO> 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<Object> result = dataValidAndSetFileName(createReqVO, expenseApply);
if (result.isError()) {
return result;
}
saveOrUpdate(expenseApply);
if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) {
//插入或者更新差旅明细
List<ExpenseApplyTripDO> trips = ExpenseApplyConvert.INSTANCE.convert(createReqVO.getExpenseApplyTrips());
for (ExpenseApplyTripDO trip : trips) {
trip.setApplyId(expenseApply.getId());
}
//采用先删后增的方式来
//删除行程明细
expenseApplyTripService.remove(new LambdaQueryWrapperX<ExpenseApplyTripDO>().eq(ExpenseApplyTripDO::getApplyId, expenseApply.getId()));
expenseApplyTripService.saveBatch(trips);
}
if (expenseApply.getStatus().equals(ExpenseApplyStatusEnum.PROCESS.getValue())) {
Map<String, Object> 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<Object> dataValidAndSetFileName(ExpenseApplyCreateReqVO createReqVO, ExpenseApplyDO expenseApply) {
boolean isAdd = createReqVO.getId() == null;
if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) {
List<ExpenseApplyTripCreateReqVO> 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<ExpenseApplyTripDO>().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<ExpenseApplyDO> getExpenseApplyList(Collection<Long> ids) {
return expenseApplyMapper.selectBatchIds(ids);
}
@Override
public PageResult<ExpenseApplyDO> getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO) {
return expenseApplyMapper.selectPage(pageReqVO);
}
@Override
public List<ExpenseApplyDO> 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);
}
}
}

@ -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<ExpenseApplyTripDO> {
}

@ -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<ExpenseApplyTripMapper, ExpenseApplyTripDO> implements ExpenseApplyTripService {
}

@ -33,32 +33,32 @@ public class BpmMessageServiceImpl implements BpmMessageService {
@Override @Override
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) { public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); // Map<String, Object> templateParams = new HashMap<>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); // templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); // templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), // smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); // BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
} }
@Override @Override
public void sendMessageWhenProcessInstanceReject(BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO) { public void sendMessageWhenProcessInstanceReject(BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); // Map<String, Object> templateParams = new HashMap<>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); // templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("reason", reqDTO.getReason()); // templateParams.put("reason", reqDTO.getReason());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); // templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), // smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); // BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams));
} }
@Override @Override
public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) { public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); // Map<String, Object> templateParams = new HashMap<>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); // templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("taskName", reqDTO.getTaskName()); // templateParams.put("taskName", reqDTO.getTaskName());
templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); // templateParams.put("startUserNickname", reqDTO.getStartUserNickname());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); // templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), // smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(),
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)); // BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
} }
private String getProcessInstanceDetailUrl(String taskId) { private String getProcessInstanceDetailUrl(String taskId) {

@ -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());
}
}

@ -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;
}

@ -10,5 +10,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants { public interface ErrorCodeConstants {
ErrorCode INVOICE_NOT_EXISTS = new ErrorCode(200100, "我的发票不存在"); ErrorCode INVOICE_NOT_EXISTS = new ErrorCode(200100, "我的发票不存在");
ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在");
} }

@ -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;
}

@ -18,6 +18,10 @@
</description> </description>
<dependencies> <dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bs-api</artifactId> <artifactId>yudao-module-bs-api</artifactId>

@ -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<ImageVo> files;
@Schema(description = "行程明细,仅为差旅申请单的时候需要传", example = "")
private List<ExpenseApplyTripCreateReqVO> expenseApplyTrips;
}

@ -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());
}
}

@ -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;
}

@ -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<ImageVo> 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;
}

@ -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<ImageVo> 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;
}

@ -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;
}

@ -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;
}

@ -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<Long> tripPartners;
@Schema(description = "预计费用")
private BigDecimal amount;
}

@ -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 {
}

@ -1,10 +1,12 @@
package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* Excel VO * Excel VO
@ -18,7 +20,7 @@ public class InvoiceExcelVO {
private Long id; private Long id;
@ExcelProperty("附件") @ExcelProperty("附件")
private String files; private List<ImageVo> files;
@ExcelProperty("创建者") @ExcelProperty("创建者")
private String createBy; private String createBy;

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; 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; 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 { public class InvoiceExportReqVO {
@Schema(description = "附件") @Schema(description = "附件")
private String files; private List<ImageVo> files;
@Schema(description = "创建者") @Schema(description = "创建者")
private String createBy; private String createBy;

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; 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 cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -9,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; 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; 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 { public class InvoicePageReqVO extends PageParam {
@Schema(description = "附件") @Schema(description = "附件")
private String files; private List<ImageVo> files;
@Schema(description = "创建者") @Schema(description = "创建者")
private String createBy; private String createBy;

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 我的发票 Response VO") @Schema(description = "管理后台 - 我的发票 Response VO")
@Data @Data
@ -17,7 +19,7 @@ public class InvoiceRespVO extends InvoiceBaseVO {
private Long id; private Long id;
@Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED)
private String files; private List<ImageVo> files;
@Schema(description = "创建者") @Schema(description = "创建者")
private String createBy; private String createBy;

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 我的发票更新 Request VO") @Schema(description = "管理后台 - 我的发票更新 Request VO")
@Data @Data
@ -19,6 +21,6 @@ public class InvoiceUpdateReqVO extends InvoiceBaseVO {
@Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "附件不能为空") @NotNull(message = "附件不能为空")
private String files; private List<ImageVo> files;
} }

@ -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<ExpenseApplyTripDO> convert(List<ExpenseApplyTripCreateReqVO> bean);
ExpenseApplyDO convert(ExpenseApplyUpdateReqVO bean);
ExpenseApplyRespVO convert(ExpenseApplyDO bean);
List<ExpenseApplyRespVO> convertList(List<ExpenseApplyDO> list);
PageResult<ExpenseApplyRespVO> convertPage(PageResult<ExpenseApplyDO> page);
List<ExpenseApplyExcelVO> convertList02(List<ExpenseApplyDO> list);
}

@ -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<ImageVo> files;
/**
*
*
* ProcessInstance id
*/
private String processInstanceId;
@TableField(exist = false)
private List<ExpenseApplyTripDO> expenseApplyTrips;
@TableField(exist = false)
private Boolean deleted;
@TableField(exist = false)
private String nickname;
@TableField(exist = false)
private String detpName;
}

@ -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<ImageVo> 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<Long> tripPartners;
/**
*
*/
private BigDecimal amount;
@TableField(exist = false)
private Boolean deleted;
}

@ -1,18 +1,22 @@
package cn.iocoder.yudao.module.bs.dal.dataobject.invoice; 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.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* DO * DO
* *
* @author chenqp * @author chenqp
*/ */
@TableName("bs_invoice") @TableName(value = "bs_invoice", autoResultMap = true)
@KeySequence("bs_invoice_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("bs_invoice_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -20,7 +24,7 @@ import java.time.LocalDateTime;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class InvoiceDO extends BaseDO { public class InvoiceDO extends TenantBaseDO {
/** /**
* id * id
@ -30,15 +34,9 @@ public class InvoiceDO extends BaseDO {
/** /**
* *
*/ */
private String files; @TableField(typeHandler = JacksonTypeHandler.class)
/** private List<ImageVo> files;
*
*/
private String createBy;
/**
*
*/
private String updateBy;
/** /**
* *
*/ */
@ -86,5 +84,8 @@ public class InvoiceDO extends BaseDO {
@TableField(exist = false) @TableField(exist = false)
private Boolean deleted; private Boolean deleted;
/**
*
*/
private String status;
} }

@ -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<ExpenseApplyDO> {
default PageResult<ExpenseApplyDO> selectPage(ExpenseApplyPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ExpenseApplyDO>()
.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<ExpenseApplyDO> selectList(ExpenseApplyExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ExpenseApplyDO>()
.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));
}
}

@ -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<ExpenseApplyTripDO> {
}

@ -21,9 +21,7 @@ public interface InvoiceMapper extends BaseMapperX<InvoiceDO> {
default PageResult<InvoiceDO> selectPage(InvoicePageReqVO reqVO) { default PageResult<InvoiceDO> selectPage(InvoicePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InvoiceDO>() return selectPage(reqVO, new LambdaQueryWrapperX<InvoiceDO>()
.eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles())
.eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy())
.eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType())
.eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode())
.eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum())
@ -41,9 +39,7 @@ public interface InvoiceMapper extends BaseMapperX<InvoiceDO> {
default List<InvoiceDO> selectList(InvoiceExportReqVO reqVO) { default List<InvoiceDO> selectList(InvoiceExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<InvoiceDO>() return selectList(new LambdaQueryWrapperX<InvoiceDO>()
.eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles())
.eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy())
.eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType())
.eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode())
.eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum())

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.bs.dal.mysql.expenseapplytrip.ExpenseApplyTripMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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<InvoiceDO> 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<InvoiceDO> list = invoiceService.getInvoiceList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbInvoice, list.get(0));
}
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.tenant; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@ -20,6 +21,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -36,9 +38,13 @@ public class TenantController {
@PermitAll @PermitAll
@Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号") @Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号")
@Parameter(name = "name", description = "租户名", required = true, example = "1024") @Parameter(name = "name", description = "租户名", required = true, example = "1024")
public CommonResult<Long> getTenantIdByName(@RequestParam("name") String name) { public CommonResult<Object> getTenantIdByName(@RequestParam("name") String name) {
TenantDO tenantDO = tenantService.getTenantByName(name); TenantDO tenantDO = tenantService.getTenantByName(name);
return success(tenantDO != null ? tenantDO.getId() : null); if (tenantDO == null) {
return success(null);
}
Map<Object, Object> data = MapUtil.builder().put("id", tenantDO.getId()).put("name", tenantDO.getName()).build();
return success(data);
} }
@PostMapping("/create") @PostMapping("/create")

@ -150,6 +150,7 @@ logging:
level: level:
# 配置自己写的 MyBatis Mapper 打印日志 # 配置自己写的 MyBatis Mapper 打印日志
cn.iocoder.yudao.module.bpm.dal.mysql: debug 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: debug
cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info
cn.iocoder.yudao.module.pay.dal.mysql: debug cn.iocoder.yudao.module.pay.dal.mysql: debug

Loading…
Cancel
Save