Commit ade55cbc by huluobin

更新费用类型

parent a707d903
package com.blt.other.module.cost.controller;
import com.bailuntec.common.JsonUtilByFsJson;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.dto.request.AccountingSubjectAddReq;
import com.blt.other.module.cost.service.IAccountingSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>
* 前端控制器
* </p>
*
* @author robbendev
* @since 2020-12-17
*/
@Api(tags = "会计一级科目接口")
@RestController
@RequestMapping("/accountingSubject")
@Slf4j
public class AccountingSubjectController {
@Resource
IAccountingSubjectService accountingSubjectService;
@ApiOperation("新增会计一级科目")
@PostMapping("/add")
public CostResult<Void> add(@RequestBody AccountingSubjectAddReq req) {
log.info("新增会计一级科目:{}", JsonUtilByFsJson.beanToJson(req));
accountingSubjectService.add(req);
return CostResult.success();
}
}
package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.service.CostCompanyService;
import com.blt.other.module.database.model.CostCompanyDomain;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 1:22 下午
*/
@Api(tags = "财务主体接口")
@RestController
public class CostCompanyController {
@Resource
CostCompanyService costCompanyService;
@ApiOperation("查询所有财务付款主体")
@GetMapping("/cost/type/getAllCompany")
public List<CostCompanyDomain> getAllCompany() {
return costCompanyService.getAllCompany();
}
@ApiOperation("获取所有财务付款主体权限?")
@GetMapping("/cost/type/getAllCompanyAuthority")
public List<CostCompanyDomain> getAllCompanyAuthority() {
return costCompanyService.getAllCompanyAuthority();
}
@ApiOperation("同步财务付款主体")
@GetMapping("/cost/type/syncAllCompany")
public CostResult<Void> syncAllCompany() {
costCompanyService.syncCompany();
return CostResult.success();
}
}
package com.blt.other.module.cost.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blt.other.module.cost.model.AccountingSubject;
/**
* <p>
* Mapper 接口
* </p>
*
* @author robbendev
* @since 2020-12-17
*/
public interface AccountingSubjectMapper extends BaseMapper<AccountingSubject> {
//根据编号查
AccountingSubject selectByNo(String accountingSubjectNo);
}
package com.blt.other.module.cost.dao;
import com.blt.other.module.database.model.TypeRelationDomain;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.cost.dto.request.CostTypeQueryPageReq;
import com.blt.other.module.cost.dto.response.CostTypeResult;
import com.blt.other.module.database.model.CostTypeDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface CostTypeDao {
/**
* 通过 companyNo 获取费用类型
* @param CompanyNo
* @return
*/
List<CostTypeDomain> selectByCompanyNo(String CompanyNo);
/**
* 通过 companyNo 和 typeName 获取费用类型,用于新增类型时判断是否已存在
* @return
*/
CostTypeDomain selectByCompanyNoAndTypeName(CostTypeDomain ctd);
/**
* 通过 typeNo 获取费用类型
* @param costTypeNo
* @return
*/
CostTypeDomain selectByTypeNo(String costTypeNo);
/**
* 保存费用类型
* @param ctd
* @return
*/
Integer insert(CostTypeDomain ctd);
/**
* 查询所有类型
* @return
*/
List<CostTypeDomain> selectAll();
CostTypeDomain selectByCompanyNameAndTypeName(@Param("companyName")String companyName, @Param("typeName") String typeName);
CostTypeDomain selectByCompanyNoAndTypeNameAndCostForm(CostTypeDomain costTypeDomain);
public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
TypeRelationDomain getTyeRelation(@Param("typeName") String typeName);
//分页获取费用类型
IPage<CostTypeResult> queryPage(@Param("page") IPage<CostTypeResult> page,
@Param("req") CostTypeQueryPageReq req);
Integer insertTypeRalation(@Param("typeName") String typeName);
//根据编号查
CostTypeDomain selectByNo(String typeNo);
}
package com.blt.other.module.cost.dto.request;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 4:37 下午
*/
@Data
public class AccountingSubjectAddReq {
@ApiModelProperty(value = "会计一级类目编号")
private String subjectNo;
@ApiModelProperty(value = "会计一级类目名称")
private String name;
@ApiModelProperty(value = "更新人id")
private Integer updateUserId;
}
package com.blt.other.module.cost.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 1:28 下午
*/
@Data
public class CostTypeAddReq {
@ApiModelProperty("费用类型编号")
private String typeNo;
@ApiModelProperty("费用类型标题")
private String typeName;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("1-费用类型 2-收入类型")
private Integer type;
}
package com.blt.other.module.cost.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 4:28 下午
*/
@Data
public class CostTypeBaseReq {
@ApiModelProperty("会计一级科目编号")
private String accountingSubjectNo;
@ApiModelProperty()
private Integer type;
@ApiModelProperty(value = "费用模版类型作用", hidden = true)
private Integer costTemplateType;
}
package com.blt.other.module.cost.dto.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 1:28 下午
*/
@Data
public class CostTypeModifyReq {
@ApiModelProperty("费用类型编号")
private String typeNo;
@ApiModelProperty("费用类型标题")
private String typeName;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
private Integer currentUserId;
}
package com.blt.other.module.cost.dto.request;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 3:33 下午
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class CostTypeQueryPageReq extends CostTypeBaseReq {
private Integer pageNum;
private Integer pageSize;
}
package com.blt.other.module.cost.dto.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/17 3:31 下午
*/
@Data
public class CostTypeResult {
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty("费用类型编号")
private String typeNo;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("费用类型标题")
private String typeName;
@ApiModelProperty(value = "会计一级类目编号")
private String accountingSubjectCode;
@ApiModelProperty(value = "会计一级类目名称")
private String accountingSubjectName;
}
package com.blt.other.module.cost.model;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020-12-17
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="AccountingSubject对象", description="")
public class AccountingSubject implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "会计一级类目编号")
private String subjectNo;
@ApiModelProperty(value = "会计一级类目名称")
private String name;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人id")
private Integer updateUserId;
@ApiModelProperty(value = "更新人")
private String updateUser;
@ApiModelProperty(value = "最后更新时间")
private LocalDateTime lastUpdateTime;
}
......@@ -66,12 +66,7 @@ public class CostDomain implements Serializable {
private String typeNo;
@ApiModelProperty("类型标题")
private String typeName;
@ApiModelProperty("科目编号")
private String subjectCode;
@ApiModelProperty("小类编号")
private String kindNo;
@ApiModelProperty("小类标题")
private String kindName;
@ApiModelProperty("创建人id")
private Integer createUserid;
......@@ -208,9 +203,7 @@ public class CostDomain implements Serializable {
@ApiModelProperty("费用模版id")
private Integer costTemplateId;
@TableField(exist = false)
private CostTemplate costTemplate;
@ApiModelProperty("最后更新时间")
private LocalDateTime lastModifyDate;
@ApiModelProperty("能否审核")
......@@ -220,6 +213,17 @@ public class CostDomain implements Serializable {
@ApiModelProperty("借支单,还款申请金额,包括已还的和申请中 ,借支单币种。")
private BigDecimal repaymentAppliedAmount;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
//-------------
@TableField(exist = false)
private CostTemplate costTemplate;
@TableField(exist = false)
private Integer primaryDepartmentId;
......@@ -229,6 +233,7 @@ public class CostDomain implements Serializable {
@TableField(exist = false)
private String costCurrentReviewer;
public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostTypeKindDto;
import com.blt.other.module.database.model.CostTypeKindDomain;
import com.blt.other.module.database.model.LogisticsSupplierBankDomain;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
public interface CostTypeKindService {
/**
* 获取所有费用类型
* @return
*/
List<CostTypeKindDto> getAllKind();
/**
* 分页获取所有费用类型
* @return
*/
Map<String,Object> getAllKindWithPage(Integer pageNum,Integer pageSize);
/**
* 根据 typeNo 获取费用种类
* @param typeNo
* @return
*/
List<CostTypeKindDto> getListByTypeNo(String typeNo);
/**
* 根据 companyNo 获取费用种类
* @param companyNo
* @return
*/
List<CostTypeKindDto> getListByCompanyNo(String companyNo);
/**
* 保存费用种类
* @return
*/
Integer saveNewKind(CostTypeKindDomain costTypeKindDomain);
/**
* 根据 kindNo 获取费用种类详情
*
* @param kindNo
* @return
*/
CostTypeKindDomain getKindByKindNo(String kindNo);
/**
* Excel 导入费用小类
* @param file
*/
Boolean importByExcel(MultipartFile file,String createUsercode) throws Exception;
Integer update(CostTypeKindDomain costTypeKindDomain);
Integer deleteKind(String kindNo);
LogisticsSupplierBankDomain getLogisticsBank(String subSupplierName);
}
package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostTypeDto;
import com.blt.other.module.database.model.TypeRelationDomain;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.cost.dto.request.CostTypeAddReq;
import com.blt.other.module.cost.dto.request.CostTypeModifyReq;
import com.blt.other.module.cost.dto.request.CostTypeQueryPageReq;
import com.blt.other.module.cost.dto.response.CostTypeResult;
import com.blt.other.module.database.model.CostTypeDomain;
import java.util.List;
public interface CostTypeService {
public interface CostTypeService extends IService<CostTypeDomain> {
/**
* 通过 companyNo 获取类型列表
* @param companyNo
* @return
* 添加费用类型
*
* @param req req
*/
List<CostTypeDto> getListByCompanyNo(String companyNo);
void addCostType(CostTypeAddReq req);
/**
* 保存费用类型
* @return
* 分页获取费用类型
*
* @param req req
* @return resp
*/
Integer saveNewType(CostTypeDomain costTypeDomain);
Page<CostTypeResult> queryPage(CostTypeQueryPageReq req);
/**
* 获取所有类型
* @return
* 更新费用类型 (费用类型 或者 会计科目类型)
*
* @param req req
*/
List<CostTypeDomain> getAllType();
CostTypeDto domainToDto(CostTypeDomain costTypeDomain);
CostTypeDomain getByTypeNo(String typeNo);
TypeRelationDomain getTyeRelation(String typeName);
Integer insertTypeRalation(String typeName);
void modifyCostType(CostTypeModifyReq req);
}
package com.blt.other.module.cost.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.cost.dto.request.AccountingSubjectAddReq;
import com.blt.other.module.cost.model.AccountingSubject;
/**
* <p>
* 服务类
* </p>
*
* @author robbendev
* @since 2020-12-17
*/
public interface IAccountingSubjectService extends IService<AccountingSubject> {
/**
* 新增一级科目
*
* @param req req
*/
void add(AccountingSubjectAddReq req);
}
package com.blt.other.module.cost.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dto.request.AccountingSubjectAddReq;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.IAccountingSubjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* <p>
* 服务实现类
* </p>
*
* @author robbendev
* @since 2020-12-17
*/
@Service
@Slf4j
public class AccountingSubjectServiceImpl extends ServiceImpl<AccountingSubjectMapper, AccountingSubject> implements IAccountingSubjectService {
@Resource
OaUserMapper oaUserMapper;
@Override
public void add(AccountingSubjectAddReq req) {
AccountingSubject accountingSubject = new AccountingSubject();
accountingSubject.setSubjectNo(req.getSubjectNo());
accountingSubject.setName(req.getName());
accountingSubject.setUpdateUserId(req.getUpdateUserId());
OaUser oaUser = oaUserMapper.selectByOaUserId(req.getUpdateUserId());
accountingSubject.setUpdateUser(oaUser.getUserName());
accountingSubject.setUpdateUserId(req.getUpdateUserId());
accountingSubject.setCreateTime(LocalDateTime.now());
accountingSubject.setLastUpdateTime(LocalDateTime.now());
this.save(accountingSubject);
}
}
package com.blt.other.module.cost.service.impl;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostTypeDao;
import com.bailuntec.cost.api.dto.CostTypeDto;
import com.blt.other.module.database.model.TypeRelationDomain;
import com.blt.other.module.cost.dto.request.CostTypeAddReq;
import com.blt.other.module.cost.dto.request.CostTypeModifyReq;
import com.blt.other.module.cost.dto.request.CostTypeQueryPageReq;
import com.blt.other.module.cost.dto.response.CostTypeResult;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.CostTypeService;
import com.blt.other.module.database.mapper.StatusMapper;
import com.blt.other.module.database.model.CostCompanyDomain;
import com.blt.other.module.database.model.CostTypeDomain;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import java.time.LocalDateTime;
@Service
public class CostTypeServiceImpl implements CostTypeService {
@Autowired
private CostTypeDao costTypeDao;
@Autowired
private CostCompanyDao costCompanyDao;
@Autowired
private StatusMapper statusMapper;
@Slf4j
public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain> implements CostTypeService {
@Resource
AccountingSubjectMapper accountingSubjectMapper;
@Resource
OaUserMapper oaUserMapper;
@Override
public List<CostTypeDto> getListByCompanyNo(String companyNo) {
List<CostTypeDomain> costTypeDomains = costTypeDao.selectByCompanyNo(companyNo);
List<CostTypeDto> dtos = null;
if (null != costTypeDomains && costTypeDomains.size() >=1){
dtos = new ArrayList<>();
for (CostTypeDomain costTypeDomain: costTypeDomains){
CostTypeDto costTypeDto = domainToDto(costTypeDomain);
if (null != costTypeDto) {
dtos.add(costTypeDto);
}
}
}
public void addCostType(CostTypeAddReq req) {
CostTypeDomain costTypeDomain = new CostTypeDomain();
costTypeDomain.setAccountingSubjectNo(req.getAccountingSubjectNo());
costTypeDomain.setTypeNo(req.getTypeNo());
costTypeDomain.setTypeName(req.getTypeName());
costTypeDomain.setDescription(req.getDescription());
return dtos;
}
costTypeDomain.setCostTemplateType(req.getType());
/**
* 保存费用类型
* @return
*/
@Override
public Integer saveNewType(CostTypeDomain costTypeDomain) {
// 判断是否已经存在相同 companyNo ,相同 typeName
CostTypeDomain byCompanyNoAndTypeName = costTypeDao.selectByCompanyNoAndTypeName(costTypeDomain);
if (null != byCompanyNoAndTypeName && null != byCompanyNoAndTypeName.getTypeNo()){
return null;
}
// 执行 doInsert()
Integer integer = doInsert(costTypeDomain);
return integer;
this.save(costTypeDomain);
}
/**
* 获取所有类型
* @return
*/
@Override
public List<CostTypeDomain> getAllType() {
List<CostTypeDomain> list = costTypeDao.selectAll();
public Page<CostTypeResult> queryPage(CostTypeQueryPageReq req) {
IPage<CostTypeResult> page = new Page<>(req.getPageNum(), req.getPageSize());
return list;
req.setCostTemplateType(this.getCostTemplateType((req.getType())));
page = baseMapper.queryPage(page, req);
return (Page<CostTypeResult>) page;
}
@Override
public CostTypeDto domainToDto(CostTypeDomain costTypeDomain) {
CostTypeDto costTypeDto = null;
if (null != costTypeDomain && null != costTypeDomain.getTypeNo()){
costTypeDto = new CostTypeDto();
BeanUtils.copyProperties(costTypeDomain,costTypeDto);
return costTypeDto;
}
return costTypeDto;
}
public void modifyCostType(CostTypeModifyReq req) {
OaUser oaUser = oaUserMapper.selectByOaUserId(req.getCurrentUserId());
@Override
public CostTypeDomain getByTypeNo(String typeNo) {
return costTypeDao.selectByTypeNo(typeNo);
}
@Override
public TypeRelationDomain getTyeRelation(String typeName) {
return costTypeDao.getTyeRelation(typeName);
}
log.info("{} 更新费用类型", oaUser.getUserName());
if (req.getTypeNo() != null) {
CostTypeDomain costTypeDomain = baseMapper.selectByNo(req.getTypeNo());
costTypeDomain.setTypeName(req.getTypeName().trim());
costTypeDomain.setDescription(req.getDescription());
costTypeDomain.setUpdateUserId(oaUser.getOaUserId());
costTypeDomain.setUpdateUser(oaUser.getUserName());
costTypeDomain.setLastUpdateTime(LocalDateTime.now());
this.updateById(costTypeDomain);
}
@Override
public Integer insertTypeRalation(String typeName) {
return costTypeDao.insertTypeRalation(typeName);
log.info("{} 更新会计一级科目", oaUser.getUserName());
if (req.getAccountingSubjectNo() != null) {
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(req.getAccountingSubjectNo());
accountingSubject.setName(req.getAccountingSubjectName().trim());
accountingSubject.setLastUpdateTime(LocalDateTime.now());
accountingSubject.setUpdateUserId(oaUser.getOaUserId());
accountingSubject.setUpdateUser(oaUser.getUserName());
accountingSubject.setLastUpdateTime(LocalDateTime.now());
accountingSubjectMapper.updateById(accountingSubject);
}
}
public Integer doInsert(CostTypeDomain ctd){
// 获取 companyName
CostCompanyDomain companyDomain = costCompanyDao.selectByNo(ctd.getCompanyNo());
ctd.setCompanyName(companyDomain.getCompanyName());
ctd.setTypeNo(createTypeNo());
// 执行 insert
Integer integer = costTypeDao.insert(ctd);
return integer;
}
/**
* 生成唯一的费用类型编号
* @return
* 根据ui类型获取费用类型 对应的费用模版类型
*
* @param type 1-费用类型 2-收入类型
* @return res
*/
private String createTypeNo(){
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
Random random = new Random();
String costTypeNo = "CTN"+sdf.format(new Date())+random.nextInt(9);
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costTypeNo);
while (null != costTypeDomain && null != costTypeDomain.getTypeName()){
costTypeNo = "CTN"+sdf.format(new Date())+random.nextInt(9);
costTypeDomain = costTypeDao.selectByTypeNo(costTypeNo);
private Integer getCostTemplateType(Integer type) {
if (type.equals(1)) {
return CostTypeDomain.feeType;
} else if (type.equals(2)) {
return CostTypeDomain.incomeType;
} else {
throw new BizRuntimeException("invalid type");
}
return costTypeNo;
}
}
......@@ -189,10 +189,10 @@ public abstract class AbstractCostPlanService implements CostPlanService {
costDomain.setCompanyValue(costCompanyDao.selectByNo(costPlanDomain.getCompanyNo()).getValue());
if (costDomain.getTypeNo() != null) {
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costDomain.getTypeNo());
if (costTypeDomain != null) {
costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
}
// CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costDomain.getTypeNo());
// if (costTypeDomain != null) {
// costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
// }
}
costDomain.setAttach(costPlanDomain.getAttach());
return costDomain;
......
......@@ -107,8 +107,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
costDomain.setCostNo(costNo);
costDomain.setTypeNo(typeNo);
costDomain.setTypeName(costDetailDomains.get(0).getTypeName());
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
// CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
// costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
costDomain.setKindNo(costDetailDomains.get(0).getKindNo());
costDomain.setKindName(costDetailDomains.get(0).getKindName());
......
......@@ -27,9 +27,9 @@ import java.util.List;
public class CostPlanDomain implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id; // 费用单表 id
private Integer id;
@ApiModelProperty("费用计划编号")
private String costPlanNo; // 费用计划编号
private String costPlanNo;
@ApiModelProperty("0 不抵扣个税 1 抵扣个税")
private Integer isTax;
......@@ -37,18 +37,18 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("公司主体value")
private Integer companyValue;
@ApiModelProperty("主体编号")
private String companyNo; // 主体编号
private String companyNo;
@ApiModelProperty("主体名称")
private String companyName; // 主体名称
private String companyName;
@ApiModelProperty("类型编号")
private String typeNo; // 类型编号
private String typeNo;
@ApiModelProperty("类型标题")
private String typeName; // 类型标题
private String typeName;
@ApiModelProperty("种类编号")
private String kindNo; // 种类编号
private String kindNo;
@ApiModelProperty("费用计划编号")
private String kindName; // 种类标题
private String kindName;
@ApiModelProperty("创建人id")
private Integer createUserid;
......@@ -66,10 +66,6 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("创建时间")
private Date createTime;
// @ApiModelProperty("关联子单")
// @Deprecated
// private String sonCostNo;
@ApiModelProperty("关联父单")
private String supCostNo;
......@@ -133,9 +129,6 @@ public class CostPlanDomain implements Serializable {
private String payDic;
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal payCur;
@TableField(exist = false)
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal cur;
/*借还单参数 end*/
......@@ -144,9 +137,20 @@ public class CostPlanDomain implements Serializable {
private List<CostAttach> attach;
@ApiModelProperty("费用模版id")
private Integer costTemplateId;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
///-------
@TableField(exist = false)
private CostTemplate costTemplate;
@TableField(exist = false)
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal cur;
public CostPlanDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
package com.blt.other.module.database.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@TableName(value = "cost_type")
public class CostTypeDomain {
private Integer id;// 费用类型
private String typeNo;// 费用类型编号
private String typeName;// 费用类型标题
private String companyNo;// 主体编号
private String companyName;// 主体名称
private Integer costForm; // 费用类型
private String subjectCode; // 科目编号
private Integer isLend; // 借支/借还
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTypeNo() {
return typeNo;
}
public void setTypeNo(String typeNo) {
this.typeNo = typeNo;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getCompanyNo() {
return companyNo;
}
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public Integer getCostForm() {
return costForm;
}
public void setCostForm(Integer costForm) {
this.costForm = costForm;
}
public String getSubjectCode() {
return subjectCode;
}
public void setSubjectCode(String subjectCode) {
this.subjectCode = subjectCode;
}
public Integer getIsLend() {
return isLend;
}
public void setIsLend(Integer isLend) {
this.isLend = isLend;
}
@Override
public String toString() {
return "CostTypeDomain{" +
"id=" + id +
", typeNo='" + typeNo + '\'' +
", typeName='" + typeName + '\'' +
", companyNo='" + companyNo + '\'' +
", companyName='" + companyName + '\'' +
", costForm=" + costForm +
", subjectCode='" + subjectCode + '\'' +
", isLend=" + isLend +
'}';
}
//费用类型 包括付款 借还
public static final Integer feeType = 0b1001;
//收入类别 包括收款
public static final Integer incomeType = 0b0100;
//借支类别 包括借支
public static final Integer borrow = 0b0010;
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty("费用类型编号")
private String typeNo;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("费用类型标题")
private String typeName;
private String accountingSubjectNo;
/**
* 形如0b1001 四位二进制
* 高位到低位分别是 付款 收款 借支 借还
*/
@ApiModelProperty("费用模版类型作用")
private Integer costTemplateType;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人id")
private Integer updateUserId;
@ApiModelProperty(value = "更新人")
private String updateUser;
@ApiModelProperty(value = "最后更新时间")
private LocalDateTime lastUpdateTime;
}
......@@ -12,7 +12,7 @@
<select id="selectAll" resultMap="cost">
SELECT
t1.*,
group_concat(distinct t2.username) as cost_current_reviewer,
group_concat(distinct t2.username) as cost_current_reviewer
FROM
cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
......@@ -31,7 +31,7 @@
<select id="selectByCostNo" resultMap="cost">
SELECT t1.*,
group_concat(distinct t2.username) as cost_current_reviewer,
group_concat(distinct t2.username) as cost_current_reviewer
FROM cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE t1.cost_no = #{costNo}
......@@ -42,7 +42,7 @@
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT
t1.*,
group_concat(distinct t2.username) as cost_current_reviewer,
group_concat(distinct t2.username) as cost_current_reviewer
from cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE
......
......@@ -2,86 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostTypeDao">
<select id="selectByCompanyNo" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
WHERE
company_no = #{companyNo}
</select>
<select id="selectByCompanyNoAndTypeName" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
WHERE
company_no = #{companyNo}
AND
type_name = #{typeName}
</select>
<select id="selectByCompanyNoAndTypeNameAndCostForm" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
WHERE
company_no = #{companyNo}
AND
type_name = #{typeName}
AND
cost_form = #{costForm}
</select>
<select id="selectByTypeNo" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
WHERE
type_no = #{typeNo}
</select>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO
cost_type(
type_no,type_name,company_no,company_name,cost_form,subject_code,is_lend
)
VALUE
(
#{typeNo},#{typeName},#{companyNo},#{companyName},#{costForm},#{subjectCode},#{isLend}
)
</insert>
<select id="selectAll" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
</select>
<select id="selectByCompanyNameAndTypeName" resultType="com.blt.other.module.database.model.CostTypeDomain">
SELECT
*
FROM
cost_type
WHERE
company_name = #{companyName}
AND
type_name = #{typeName}
<select id="queryPage" resultType="com.blt.other.module.cost.dto.response.CostTypeResult">
select t1.type_no,
t1.type_name,
t1.description,
t1.accounting_subject_code,
t2.name as accounting_subject_name
from cost_type t1
left join accounting_subject t2 on t1.accounting_subject_code = t2.subject_no
where t1.cost_template_type =#{req.costTemplateType}
<if test="req.accountingSubjectNo !=null">
and t1.accounting_subject_code = #{req.accountingSubjectNo}
</if>
</select>
<select id="getTyeRelation" resultType="com.blt.other.module.database.model.TypeRelationDomain">
select
*
from
type_relation
where fee_type = #{typeName} limit 1
<select id="selectByNo" resultType="com.blt.other.module.database.model.CostTypeDomain">
select *
from cost_type
where type_no = #{typeNo}
</select>
<insert id="insertTypeRalation">
insert into type_relation(manage_cost_type, fee_type)
value(#{typeName}, #{typeName})
</insert>
</mapper>
<?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="com.blt.other.module.cost.dao.AccountingSubjectMapper">
<select id="selectByNo" resultType="com.blt.other.module.cost.model.AccountingSubject">
select *
from accounting_subject
where subject_no = #{accountingSubjectNo}
</select>
</mapper>
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