Commit 6fb07a96 by huluobin

财务审核状态过滤

parent 24cdb1fb
package com.blt.other.module.auth.service; package com.blt.other.module.auth.service;
import com.blt.other.module.auth.vo.UserGetByBLUserAcct; import com.blt.other.module.auth.vo.UserGetByBLUserAcct;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.UserDomain; import com.blt.other.module.database.model.UserDomain;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;
...@@ -51,4 +52,5 @@ public interface UserService { ...@@ -51,4 +52,5 @@ public interface UserService {
* @return 费用系统用户列表 * @return 费用系统用户列表
*/ */
List<UserDomain> getByCompanyId(@NonNull Integer companyId); List<UserDomain> getByCompanyId(@NonNull Integer companyId);
} }
...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.service.impl; ...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.service.impl;
import com.blt.other.module.auth.dao.UserDao; import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.auth.service.UserService; import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.auth.vo.UserGetByBLUserAcct; import com.blt.other.module.auth.vo.UserGetByBLUserAcct;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.UserDomain; import com.blt.other.module.database.model.UserDomain;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -113,4 +114,6 @@ public class UserServiceImpl implements UserService { ...@@ -113,4 +114,6 @@ public class UserServiceImpl implements UserService {
public List<UserDomain> getByCompanyId(@NonNull Integer companyId) { public List<UserDomain> getByCompanyId(@NonNull Integer companyId) {
return userDao.getByCompanyId(companyId); return userDao.getByCompanyId(companyId);
} }
} }
...@@ -3,12 +3,14 @@ package com.blt.other.module.cost.model; ...@@ -3,12 +3,14 @@ package com.blt.other.module.cost.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.blt.other.module.database.model.CostDomain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
...@@ -54,4 +56,15 @@ public class CostTemplateCol implements Serializable { ...@@ -54,4 +56,15 @@ public class CostTemplateCol implements Serializable {
private CostTemplateBaseCol costTemplateBaseCol; private CostTemplateBaseCol costTemplateBaseCol;
public Boolean RuleCheck(CostDomain costDomain) throws NoSuchFieldException, IllegalAccessException {
Class<CostDomain> clazz = CostDomain.class;
Field field = clazz.getDeclaredField(this.costTemplateBaseCol.getColName());
field.setAccessible(true);
Object fieldVar = field.get(costDomain);
return false;
}
} }
package com.blt.other.module.cost.service.impl.costtemplate; package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.BeanUtils; import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.ListUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostTemplateBaseColMapper; import com.blt.other.module.cost.dao.CostTemplateBaseColMapper;
import com.blt.other.module.cost.dto.CostTemplateColReq; import com.blt.other.module.cost.dto.CostTemplateColReq;
...@@ -57,10 +58,13 @@ public class CostTemplateBaseColServiceImpl extends ServiceImpl<CostTemplateBase ...@@ -57,10 +58,13 @@ public class CostTemplateBaseColServiceImpl extends ServiceImpl<CostTemplateBase
@Override @Override
public void setCostTemplateBaseCol(List<CostTemplateCol> costTemplateColList) { public void setCostTemplateBaseCol(List<CostTemplateCol> costTemplateColList) {
List<Integer> costTemplateBaseColIds = costTemplateColList.stream().map(CostTemplateCol::getCostTemplateBaseColId).collect(Collectors.toList()); List<Integer> costTemplateBaseColIds = costTemplateColList.stream().map(CostTemplateCol::getCostTemplateBaseColId).collect(Collectors.toList());
List<CostTemplateBaseCol> costTemplateBaseColList = this.listByIds(costTemplateBaseColIds); if (ListUtil.isNotEmpty(costTemplateBaseColIds)) {
List<CostTemplateBaseCol> costTemplateBaseColList = this.listByIds(costTemplateBaseColIds);
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1));
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1)); costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId())));
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId()))); }
} }
} }
...@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostTemplateColMapper; import com.blt.other.module.cost.dao.CostTemplateColMapper;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.model.CostTemplateCol; import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.service.ICostTemplateBaseColService; import com.blt.other.module.cost.service.ICostTemplateBaseColService;
import com.blt.other.module.cost.service.ICostTemplateColService; import com.blt.other.module.cost.service.ICostTemplateColService;
...@@ -54,11 +53,19 @@ public class CostTemplateColServiceImpl extends ServiceImpl<CostTemplateColMappe ...@@ -54,11 +53,19 @@ public class CostTemplateColServiceImpl extends ServiceImpl<CostTemplateColMappe
.in(CostTemplateCol::getCostTemplateId, costTemplateIds)); .in(CostTemplateCol::getCostTemplateId, costTemplateIds));
costTemplateBaseColService.setCostTemplateBaseCol(costTemplateColList); costTemplateBaseColService.setCostTemplateBaseCol(costTemplateColList);
Map<Integer, List<CostTemplateCol>> map = costTemplateColList.stream().collect(Collectors.groupingBy(CostTemplateCol::getCostTemplateId));
costTemplateList.forEach(costTemplate -> {
costTemplate.setCostTemplateColList(map.get(costTemplate.getId()));
});
} }
} }
@Override @Override
public void setCostTemplateCol(CostTemplate costTemplate) { public void setCostTemplateCol(CostTemplate costTemplate) {
List<CostTemplateCol> costTemplateColList = this.list(new LambdaQueryWrapper<CostTemplateCol>()
.eq(CostTemplateCol::getCostTemplateId, costTemplate.getId()));
costTemplateBaseColService.setCostTemplateBaseCol(costTemplateColList);
costTemplate.setCostTemplateColList(costTemplateColList);
} }
} }
package com.blt.other.module.cost.service.impl.costtemplate; package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.ListUtil;
import com.bailuntec.common.StringUtils; import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.cost.dao.CostTemplateMapper; import com.blt.other.module.cost.dao.CostTemplateMapper;
import com.blt.other.module.cost.dto.CostTemplateApiDto; import com.blt.other.module.cost.dto.CostTemplateApiDto;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
...@@ -12,13 +12,13 @@ import com.blt.other.module.cost.model.CostTemplateCol; ...@@ -12,13 +12,13 @@ import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.service.ICostTemplateBaseColService; import com.blt.other.module.cost.service.ICostTemplateBaseColService;
import com.blt.other.module.cost.service.ICostTemplateColService; import com.blt.other.module.cost.service.ICostTemplateColService;
import com.blt.other.module.cost.service.ICostTemplateService; import com.blt.other.module.cost.service.ICostTemplateService;
import com.blt.other.module.database.model.UserDomain;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -38,9 +38,16 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos ...@@ -38,9 +38,16 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
ICostTemplateColService costTemplateColService; ICostTemplateColService costTemplateColService;
@Resource @Resource
ICostTemplateBaseColService costTemplateBaseColService; ICostTemplateBaseColService costTemplateBaseColService;
@Resource
UserService userService;
@Override @Override
public void add(CostTemplate costTemplate) { public void add(CostTemplate costTemplate) {
UserDomain userDomain = userService.findByUserid(costTemplate.getCreateUserId());
costTemplate.setCreateUserName(userDomain.getUsername());
costTemplate.setUpdateUserId(userDomain.getUseridsso());
costTemplate.setUpdateUserName(userDomain.getUsername());
this.save(costTemplate); this.save(costTemplate);
List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.defaultBaseColList(costTemplate.getCostType()); List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.defaultBaseColList(costTemplate.getCostType());
...@@ -62,27 +69,17 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos ...@@ -62,27 +69,17 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
@Override @Override
public CostTemplate queryDetail(Integer id) { public CostTemplate queryDetail(Integer id) {
CostTemplate costTemplate = this.getById(id); CostTemplate costTemplate = this.getById(id);
List<CostTemplateCol> costTemplateColList = costTemplateColService.list(new LambdaQueryWrapper<CostTemplateCol>() costTemplateColService.setCostTemplateCol(costTemplate);
.eq(CostTemplateCol::getCostTemplateId, id));
List<Integer> costTemplateBaseColIds = costTemplateColList.stream().map(CostTemplateCol::getCostTemplateBaseColId).collect(Collectors.toList());
if (ListUtil.isNotEmpty(costTemplateBaseColIds)) {
List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.listByIds(costTemplateBaseColIds);
Map<Integer, CostTemplateBaseCol> costTemplateBaseColMap = costTemplateBaseColList.stream().collect(Collectors.toMap(CostTemplateBaseCol::getId, costTemplateBaseCol -> costTemplateBaseCol, (k1, k2) -> k1));
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateBaseCol(costTemplateBaseColMap.get(costTemplateCol.getCostTemplateBaseColId())));
}
costTemplate.setCostTemplateColList(costTemplateColList);
return costTemplate; return costTemplate;
} }
@Override @Override
public void edit(CostTemplate costTemplate) { public void edit(CostTemplate costTemplate) {
this.save(costTemplate); UserDomain userDomain = userService.findByUserid(costTemplate.getUpdateUserId());
List<CostTemplateCol> costTemplateColList = costTemplate.getCostTemplateColList(); costTemplate.setUpdateUserId(userDomain.getUseridsso());
costTemplateColList.forEach(costTemplateCol -> costTemplateCol.setCostTemplateId(costTemplate.getId())); costTemplate.setUpdateUserName(userDomain.getUsername());
costTemplateColService.saveBatch(costTemplateColList);
this.updateById(costTemplate);
} }
@Override @Override
...@@ -103,7 +100,7 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos ...@@ -103,7 +100,7 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview()); wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview());
} }
if (StringUtils.isNotEmpty(req.getTemplateName())) { if (StringUtils.isNotEmpty(req.getTemplateName())) {
wrapper.eq(CostTemplate::getTemplateName, req.getTemplateName()); wrapper.like(CostTemplate::getTemplateName, req.getTemplateName());
} }
if (req.getCreateUserId() != null) { if (req.getCreateUserId() != null) {
wrapper.eq(CostTemplate::getCreateUserId, req.getCreateUserId()); wrapper.eq(CostTemplate::getCreateUserId, req.getCreateUserId());
...@@ -128,7 +125,6 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos ...@@ -128,7 +125,6 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
} }
List<CostTemplate> costTemplateList = this.list(wrapper); List<CostTemplate> costTemplateList = this.list(wrapper);
costTemplateColService.setCostTemplateCol(costTemplateList); costTemplateColService.setCostTemplateCol(costTemplateList);
return list(); return costTemplateList;
} }
} }
...@@ -3,6 +3,9 @@ package com.blt.other.module.database.model; ...@@ -3,6 +3,9 @@ package com.blt.other.module.database.model;
import com.bailuntec.common.BeanUtils; import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.SpringContextUtil; import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.cost.api.dto.CostDto; import com.bailuntec.cost.api.dto.CostDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.module.database.mapper.StatusMapper; import com.blt.other.module.database.mapper.StatusMapper;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
...@@ -12,6 +15,7 @@ import java.math.BigDecimal; ...@@ -12,6 +15,7 @@ import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Date; import java.util.Date;
@TableName("cost")
@Data @Data
public class CostDomain { public class CostDomain {
...@@ -22,6 +26,7 @@ public class CostDomain { ...@@ -22,6 +26,7 @@ public class CostDomain {
//借支/借还 //借支/借还
public final static Integer COST_FROM_3 = 2; public final static Integer COST_FROM_3 = 2;
// 费用单编号 // 费用单编号
@TableId(type = IdType.AUTO)
private Integer id; private Integer id;
// 费用单编号 // 费用单编号
private String costNo; private String costNo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment