|
@@ -21,9 +21,11 @@ import com.jeeplus.test.reimbursement.reimbursementInfo.mapper.ReimbursementInfo
|
|
|
import com.jeeplus.test.reimbursement.reimbursementInfo.service.dto.QueryListDto;
|
|
|
import com.jeeplus.test.reimbursement.reimbursementInfo.service.dto.RetureListDto;
|
|
|
import com.jeeplus.test.reimbursement.reimbursementInfo.service.dto.SaveInfoDto;
|
|
|
+import com.jeeplus.test.reimbursement.reimbursementInfo.service.dto.TreeUserDto;
|
|
|
import com.jeeplus.test.workContract.service.WorkContractService;
|
|
|
import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
|
|
|
-import org.apache.commons.beanutils.BeanUtils;
|
|
|
+import com.jeeplus.test.workContract.service.dto.WorkContractInfoDto;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -63,21 +65,22 @@ public class ReimbursementInfoService {
|
|
|
* b表是reimbursementDetailInfo
|
|
|
* c表是sysUser
|
|
|
*/
|
|
|
+ queryWrapper.eq("a.del_flag", 0);
|
|
|
// 报销项目
|
|
|
if (StringUtils.isNotEmpty(dto.getProject())) {
|
|
|
- queryWrapper.eq("b.project_id", dto.getProject()).or().like("b.project_name", dto.getProject());
|
|
|
+ queryWrapper.apply("(b.project_id = {0} OR b.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
|
|
|
}
|
|
|
// 报销时间
|
|
|
if (dto.getDates() != null) {
|
|
|
- queryWrapper.between("a.create_date", dto.getDates()[0], dto.getDates()[1]);
|
|
|
+ queryWrapper.between("a.reim_date", dto.getDates()[0], dto.getDates()[1]);
|
|
|
}
|
|
|
// 经办人
|
|
|
if (StringUtils.isNotEmpty(dto.getHandled())) {
|
|
|
- queryWrapper.eq("a.create_by", dto.getHandled()).or().like("c.user_name", dto.getHandled());
|
|
|
+ queryWrapper.apply("(a.create_by = {0} OR c.name LIKE {1})", dto.getHandled(), "%" + dto.getHandled() + "%");
|
|
|
}
|
|
|
// 报销人
|
|
|
- if (StringUtils.isNotEmpty(dto.getRemiBy())) {
|
|
|
- queryWrapper.eq("b.user_id", dto.getRemiBy()).or().like("b.user_name", dto.getRemiBy());
|
|
|
+ if (StringUtils.isNotEmpty(dto.getReimBy())) {
|
|
|
+ queryWrapper.apply("( b.user_id = {0} OR b.user_name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
|
|
|
}
|
|
|
// 报销状态
|
|
|
if (StringUtils.isNotEmpty(dto.getType())) {
|
|
@@ -85,11 +88,11 @@ public class ReimbursementInfoService {
|
|
|
}
|
|
|
// 报销部门
|
|
|
if (StringUtils.isNotEmpty(dto.getDepartment())) {
|
|
|
- queryWrapper.eq("b.dept_id", dto.getDepartment()).or().like("b.dept_name", dto.getDepartment());
|
|
|
+ queryWrapper.apply("( b.dept_id = {0} OR b.dept_name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
|
|
|
}
|
|
|
// 报销类别
|
|
|
if (StringUtils.isNotEmpty(dto.getRemiType())) {
|
|
|
- queryWrapper.eq("b.type_id", dto.getRemiType()).or().like("b.type_name", dto.getRemiType());
|
|
|
+ queryWrapper.apply(" (b.type_id = {0} OR b.type_name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
|
|
|
}
|
|
|
// 报销金额
|
|
|
if (dto.getAmounts() != null) {
|
|
@@ -126,6 +129,7 @@ public class ReimbursementInfoService {
|
|
|
ReimbursementInfo info = new ReimbursementInfo();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
|
info.setId(id);
|
|
|
+ info.setNo(no);
|
|
|
info.setCreateBy(userDTO.getId());
|
|
|
info.setCreateDate(new Date());
|
|
|
info.setUpdateBy(userDTO.getId());
|
|
@@ -165,13 +169,13 @@ public class ReimbursementInfoService {
|
|
|
}
|
|
|
}
|
|
|
// 保存附件列表信息
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getWorkAttachments())) {
|
|
|
- workContractService.saveFiles(dto.getWorkAttachments(), userDTO, id);
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
+ workContractService.saveFiles(dto.getFiles(), userDTO, id);
|
|
|
}
|
|
|
- return "操作成功";
|
|
|
+ return id;
|
|
|
}
|
|
|
|
|
|
- public String update(SaveInfoDto dto, UserDTO userDTO) throws Exception{
|
|
|
+ public String update(SaveInfoDto dto, UserDTO userDTO) {
|
|
|
// 修改基础信息
|
|
|
ReimbursementInfo info = new ReimbursementInfo();
|
|
|
BeanUtils.copyProperties(dto, info);
|
|
@@ -219,10 +223,10 @@ public class ReimbursementInfoService {
|
|
|
}
|
|
|
}
|
|
|
// 修改附件信息列表
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getWorkAttachments())) {
|
|
|
- workContractService.updateFiles(dto.getWorkAttachments(), userDTO, dto.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getFiles())) {
|
|
|
+ workContractService.updateFiles(dto.getFiles(), userDTO, dto.getId());
|
|
|
}
|
|
|
- return "操作成功";
|
|
|
+ return dto.getId();
|
|
|
}
|
|
|
|
|
|
public String remove(String id) {
|
|
@@ -243,7 +247,7 @@ public class ReimbursementInfoService {
|
|
|
return "操作成功";
|
|
|
}
|
|
|
|
|
|
- public SaveInfoDto findById(String id) throws Exception{
|
|
|
+ public SaveInfoDto findById(String id) {
|
|
|
SaveInfoDto dto = new SaveInfoDto();
|
|
|
// 查询基础信息表
|
|
|
ReimbursementInfo info = infoMapper.selectById(id);
|
|
@@ -259,17 +263,13 @@ public class ReimbursementInfoService {
|
|
|
List<ReimbursementAmountInfo> amountInfos = amountInfoMapper.selectList(amountInfoLambdaQueryWrapper);
|
|
|
dto.setAmountInfos(amountInfos);
|
|
|
// 查询附件信息
|
|
|
- LambdaQueryWrapper<WorkAttachment> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(WorkAttachment::getAttachmentId, id);
|
|
|
- List<WorkAttachment> workAttachments = ossServiceMapper.selectList(wrapper);
|
|
|
- List<WorkAttachmentDto> dtos = new ArrayList<>();
|
|
|
- for (WorkAttachment i : workAttachments) {
|
|
|
- WorkAttachmentDto workAttachmentDto = new WorkAttachmentDto();
|
|
|
- BeanUtils.copyProperties(i, workAttachmentDto);
|
|
|
- workAttachmentDto.setCreateBy(UserUtils.get(i.getId()));
|
|
|
- dtos.add(workAttachmentDto);
|
|
|
+ List<WorkAttachmentDto> files = infoMapper.findFiles(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(files)) {
|
|
|
+ for (WorkAttachmentDto i : files) {
|
|
|
+ i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
+ }
|
|
|
}
|
|
|
- dto.setWorkAttachments(dtos);
|
|
|
+ dto.setFiles(files);
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
@@ -282,4 +282,99 @@ public class ReimbursementInfoService {
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ public void updateStatusById(RetureListDto dto) {
|
|
|
+ infoMapper.updateStatusById(dto.getId(), dto.getType());
|
|
|
+ }
|
|
|
+
|
|
|
+ //用户树形
|
|
|
+ public List<TreeUserDto> userTree(String name) {
|
|
|
+ List<TreeUserDto> list = new ArrayList<>();
|
|
|
+ // 查询部门
|
|
|
+ List<TreeUserDto> officeList = infoMapper.findOfficeList();
|
|
|
+ if (CollectionUtils.isNotEmpty(officeList)) {
|
|
|
+ list.addAll(officeList);
|
|
|
+ }
|
|
|
+ // 查询用户
|
|
|
+ List<TreeUserDto> userList = infoMapper.findUserList(name);
|
|
|
+ if (CollectionUtils.isNotEmpty(userList)) {
|
|
|
+ list.addAll(userList);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载列表查询
|
|
|
+ */
|
|
|
+ public List<RetureListDto> exportList(QueryListDto dto) throws Exception{
|
|
|
+ QueryWrapper<QueryListDto> queryWrapper = QueryWrapperGenerator.buildQueryCondition(dto, QueryListDto.class);
|
|
|
+ /**
|
|
|
+ * a表是reimbursementInfo
|
|
|
+ * b表是reimbursementDetailInfo
|
|
|
+ * c表是sysUser
|
|
|
+ */
|
|
|
+ queryWrapper.eq("a.del_flag", 0);
|
|
|
+ // 报销项目
|
|
|
+ if (StringUtils.isNotEmpty(dto.getProject())) {
|
|
|
+ queryWrapper.apply("(b.project_id = {0} OR b.project_name LIKE {1})", dto.getProject(), "%" + dto.getProject() + "%");
|
|
|
+ }
|
|
|
+ // 报销时间
|
|
|
+ if (dto.getDates() != null) {
|
|
|
+ queryWrapper.between("a.reim_date", dto.getDates()[0], dto.getDates()[1]);
|
|
|
+ }
|
|
|
+ // 经办人
|
|
|
+ if (StringUtils.isNotEmpty(dto.getHandled())) {
|
|
|
+ queryWrapper.apply("(a.create_by = {0} OR c.name LIKE {1})", dto.getHandled(), "%" + dto.getHandled() + "%");
|
|
|
+ }
|
|
|
+ // 报销人
|
|
|
+ if (StringUtils.isNotEmpty(dto.getReimBy())) {
|
|
|
+ queryWrapper.apply("( b.user_id = {0} OR b.user_name LIKE {1} )", dto.getReimBy(), "%" + dto.getReimBy() + "%");
|
|
|
+ }
|
|
|
+ // 报销状态
|
|
|
+ if (StringUtils.isNotEmpty(dto.getType())) {
|
|
|
+ queryWrapper.eq("a.type", dto.getType());
|
|
|
+ }
|
|
|
+ // 报销部门
|
|
|
+ if (StringUtils.isNotEmpty(dto.getDepartment())) {
|
|
|
+ queryWrapper.apply("( b.dept_id = {0} OR b.dept_name LIKE {1} )", dto.getDepartment(), "%" + dto.getDepartment() + "%");
|
|
|
+ }
|
|
|
+ // 报销类别
|
|
|
+ if (StringUtils.isNotEmpty(dto.getRemiType())) {
|
|
|
+ queryWrapper.apply(" (b.type_id = {0} OR b.type_name LIKE {1}) ", dto.getRemiType(), "%" + dto.getRemiType() + "%");
|
|
|
+ }
|
|
|
+ // 报销金额
|
|
|
+ if (dto.getAmounts() != null) {
|
|
|
+ if (StringUtils.isNotEmpty(dto.getAmounts()[0])) {
|
|
|
+ queryWrapper.ge("b.number", dto.getAmounts()[0]);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(dto.getAmounts()[1])) {
|
|
|
+ queryWrapper.le("b.number", dto.getAmounts()[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 报告号
|
|
|
+ if (StringUtils.isNotEmpty(dto.getReportNumber())) {
|
|
|
+ queryWrapper.like("b.report_number", dto.getReportNumber());
|
|
|
+ }
|
|
|
+ List<RetureListDto> exportList = infoMapper.findExportList(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(exportList)) {
|
|
|
+ for (RetureListDto retureListDto : exportList) {
|
|
|
+ if ("1".equals(retureListDto.getType())) {
|
|
|
+ retureListDto.setType("暂存");
|
|
|
+ }
|
|
|
+ if ("2".equals(retureListDto.getType())) {
|
|
|
+ retureListDto.setType("审批中");
|
|
|
+ }
|
|
|
+ if ("3".equals(retureListDto.getType())) {
|
|
|
+ retureListDto.setType("撤回");
|
|
|
+ }
|
|
|
+ if ("4".equals(retureListDto.getType())) {
|
|
|
+ retureListDto.setType("驳回");
|
|
|
+ }
|
|
|
+ if ("5".equals(retureListDto.getType())) {
|
|
|
+ retureListDto.setType("已完成");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return exportList;
|
|
|
+ }
|
|
|
}
|