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; 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 com.blt.other.module.database.model.CostTypeDomain;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface CostTypeDao { public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
/**
* 通过 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);
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 { ...@@ -66,12 +66,7 @@ public class CostDomain implements Serializable {
private String typeNo; private String typeNo;
@ApiModelProperty("类型标题") @ApiModelProperty("类型标题")
private String typeName; private String typeName;
@ApiModelProperty("科目编号")
private String subjectCode;
@ApiModelProperty("小类编号")
private String kindNo;
@ApiModelProperty("小类标题")
private String kindName;
@ApiModelProperty("创建人id") @ApiModelProperty("创建人id")
private Integer createUserid; private Integer createUserid;
...@@ -208,9 +203,7 @@ public class CostDomain implements Serializable { ...@@ -208,9 +203,7 @@ public class CostDomain implements Serializable {
@ApiModelProperty("费用模版id") @ApiModelProperty("费用模版id")
private Integer costTemplateId; private Integer costTemplateId;
@TableField(exist = false) @ApiModelProperty("最后更新时间")
private CostTemplate costTemplate;
private LocalDateTime lastModifyDate; private LocalDateTime lastModifyDate;
@ApiModelProperty("能否审核") @ApiModelProperty("能否审核")
...@@ -220,6 +213,17 @@ public class CostDomain implements Serializable { ...@@ -220,6 +213,17 @@ public class CostDomain implements Serializable {
@ApiModelProperty("借支单,还款申请金额,包括已还的和申请中 ,借支单币种。") @ApiModelProperty("借支单,还款申请金额,包括已还的和申请中 ,借支单币种。")
private BigDecimal repaymentAppliedAmount; private BigDecimal repaymentAppliedAmount;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
//-------------
@TableField(exist = false)
private CostTemplate costTemplate;
@TableField(exist = false) @TableField(exist = false)
private Integer primaryDepartmentId; private Integer primaryDepartmentId;
...@@ -229,6 +233,7 @@ public class CostDomain implements Serializable { ...@@ -229,6 +233,7 @@ public class CostDomain implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String costCurrentReviewer; private String costCurrentReviewer;
public CostDto castToDto() { public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class); StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
package com.blt.other.module.cost.service; 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.CostTypeKindDomain;
import com.blt.other.module.database.model.LogisticsSupplierBankDomain; 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 { 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 获取费用种类详情 * 根据 kindNo 获取费用种类详情
*
* @param kindNo * @param kindNo
* @return * @return
*/ */
CostTypeKindDomain getKindByKindNo(String kindNo); 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); LogisticsSupplierBankDomain getLogisticsBank(String subSupplierName);
} }
package com.blt.other.module.cost.service; package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostTypeDto; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blt.other.module.database.model.TypeRelationDomain; 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 com.blt.other.module.database.model.CostTypeDomain;
import java.util.List; public interface CostTypeService extends IService<CostTypeDomain> {
public interface CostTypeService {
/** /**
* 通过 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(); void modifyCostType(CostTypeModifyReq req);
CostTypeDto domainToDto(CostTypeDomain costTypeDomain);
CostTypeDomain getByTypeNo(String typeNo);
TypeRelationDomain getTyeRelation(String typeName);
Integer insertTypeRalation(String typeName);
} }
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; 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.blt.other.module.cost.dao.CostTypeDao;
import com.bailuntec.cost.api.dto.CostTypeDto; import com.blt.other.module.cost.dto.request.CostTypeAddReq;
import com.blt.other.module.database.model.TypeRelationDomain; 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.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 com.blt.other.module.database.model.CostTypeDomain;
import org.springframework.beans.BeanUtils; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import javax.annotation.Resource;
import java.util.ArrayList; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Random;
@Service @Service
public class CostTypeServiceImpl implements CostTypeService { @Slf4j
public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain> implements CostTypeService {
@Autowired @Resource
private CostTypeDao costTypeDao; AccountingSubjectMapper accountingSubjectMapper;
@Autowired @Resource
private CostCompanyDao costCompanyDao; OaUserMapper oaUserMapper;
@Autowired
private StatusMapper statusMapper;
@Override @Override
public List<CostTypeDto> getListByCompanyNo(String companyNo) { public void addCostType(CostTypeAddReq req) {
List<CostTypeDomain> costTypeDomains = costTypeDao.selectByCompanyNo(companyNo); CostTypeDomain costTypeDomain = new CostTypeDomain();
List<CostTypeDto> dtos = null; costTypeDomain.setAccountingSubjectNo(req.getAccountingSubjectNo());
if (null != costTypeDomains && costTypeDomains.size() >=1){ costTypeDomain.setTypeNo(req.getTypeNo());
dtos = new ArrayList<>(); costTypeDomain.setTypeName(req.getTypeName());
for (CostTypeDomain costTypeDomain: costTypeDomains){ costTypeDomain.setDescription(req.getDescription());
CostTypeDto costTypeDto = domainToDto(costTypeDomain);
if (null != costTypeDto) {
dtos.add(costTypeDto);
}
}
}
return dtos; costTypeDomain.setCostTemplateType(req.getType());
}
/** this.save(costTypeDomain);
* 保存费用类型
* @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;
} }
/**
* 获取所有类型
* @return
*/
@Override @Override
public List<CostTypeDomain> getAllType() { public Page<CostTypeResult> queryPage(CostTypeQueryPageReq req) {
List<CostTypeDomain> list = costTypeDao.selectAll(); 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 @Override
public CostTypeDto domainToDto(CostTypeDomain costTypeDomain) { public void modifyCostType(CostTypeModifyReq req) {
CostTypeDto costTypeDto = null; OaUser oaUser = oaUserMapper.selectByOaUserId(req.getCurrentUserId());
if (null != costTypeDomain && null != costTypeDomain.getTypeNo()){
costTypeDto = new CostTypeDto();
BeanUtils.copyProperties(costTypeDomain,costTypeDto);
return costTypeDto;
}
return costTypeDto;
}
@Override
public CostTypeDomain getByTypeNo(String typeNo) {
return costTypeDao.selectByTypeNo(typeNo);
}
@Override log.info("{} 更新费用类型", oaUser.getUserName());
public TypeRelationDomain getTyeRelation(String typeName) { if (req.getTypeNo() != null) {
return costTypeDao.getTyeRelation(typeName); 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 log.info("{} 更新会计一级科目", oaUser.getUserName());
public Integer insertTypeRalation(String typeName) { if (req.getAccountingSubjectNo() != null) {
return costTypeDao.insertTypeRalation(typeName); 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;
}
/** /**
* 生成唯一的费用类型编号 * 根据ui类型获取费用类型 对应的费用模版类型
* @return *
* @param type 1-费用类型 2-收入类型
* @return res
*/ */
private String createTypeNo(){ private Integer getCostTemplateType(Integer type) {
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); if (type.equals(1)) {
Random random = new Random(); return CostTypeDomain.feeType;
String costTypeNo = "CTN"+sdf.format(new Date())+random.nextInt(9); } else if (type.equals(2)) {
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costTypeNo); return CostTypeDomain.incomeType;
while (null != costTypeDomain && null != costTypeDomain.getTypeName()){ } else {
costTypeNo = "CTN"+sdf.format(new Date())+random.nextInt(9); throw new BizRuntimeException("invalid type");
costTypeDomain = costTypeDao.selectByTypeNo(costTypeNo);
} }
return costTypeNo;
} }
} }
...@@ -189,10 +189,10 @@ public abstract class AbstractCostPlanService implements CostPlanService { ...@@ -189,10 +189,10 @@ public abstract class AbstractCostPlanService implements CostPlanService {
costDomain.setCompanyValue(costCompanyDao.selectByNo(costPlanDomain.getCompanyNo()).getValue()); costDomain.setCompanyValue(costCompanyDao.selectByNo(costPlanDomain.getCompanyNo()).getValue());
if (costDomain.getTypeNo() != null) { if (costDomain.getTypeNo() != null) {
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costDomain.getTypeNo()); // CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(costDomain.getTypeNo());
if (costTypeDomain != null) { // if (costTypeDomain != null) {
costDomain.setSubjectCode(costTypeDomain.getSubjectCode()); // costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
} // }
} }
costDomain.setAttach(costPlanDomain.getAttach()); costDomain.setAttach(costPlanDomain.getAttach());
return costDomain; return costDomain;
......
...@@ -107,8 +107,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement ...@@ -107,8 +107,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
costDomain.setCostNo(costNo); costDomain.setCostNo(costNo);
costDomain.setTypeNo(typeNo); costDomain.setTypeNo(typeNo);
costDomain.setTypeName(costDetailDomains.get(0).getTypeName()); costDomain.setTypeName(costDetailDomains.get(0).getTypeName());
CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo); // CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
costDomain.setSubjectCode(costTypeDomain.getSubjectCode()); // costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
costDomain.setKindNo(costDetailDomains.get(0).getKindNo()); costDomain.setKindNo(costDetailDomains.get(0).getKindNo());
costDomain.setKindName(costDetailDomains.get(0).getKindName()); costDomain.setKindName(costDetailDomains.get(0).getKindName());
......
...@@ -27,9 +27,9 @@ import java.util.List; ...@@ -27,9 +27,9 @@ import java.util.List;
public class CostPlanDomain implements Serializable { public class CostPlanDomain implements Serializable {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; // 费用单表 id private Integer id;
@ApiModelProperty("费用计划编号") @ApiModelProperty("费用计划编号")
private String costPlanNo; // 费用计划编号 private String costPlanNo;
@ApiModelProperty("0 不抵扣个税 1 抵扣个税") @ApiModelProperty("0 不抵扣个税 1 抵扣个税")
private Integer isTax; private Integer isTax;
...@@ -37,18 +37,18 @@ public class CostPlanDomain implements Serializable { ...@@ -37,18 +37,18 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("公司主体value") @ApiModelProperty("公司主体value")
private Integer companyValue; private Integer companyValue;
@ApiModelProperty("主体编号") @ApiModelProperty("主体编号")
private String companyNo; // 主体编号 private String companyNo;
@ApiModelProperty("主体名称") @ApiModelProperty("主体名称")
private String companyName; // 主体名称 private String companyName;
@ApiModelProperty("类型编号") @ApiModelProperty("类型编号")
private String typeNo; // 类型编号 private String typeNo;
@ApiModelProperty("类型标题") @ApiModelProperty("类型标题")
private String typeName; // 类型标题 private String typeName;
@ApiModelProperty("种类编号") @ApiModelProperty("种类编号")
private String kindNo; // 种类编号 private String kindNo;
@ApiModelProperty("费用计划编号") @ApiModelProperty("费用计划编号")
private String kindName; // 种类标题 private String kindName;
@ApiModelProperty("创建人id") @ApiModelProperty("创建人id")
private Integer createUserid; private Integer createUserid;
...@@ -66,10 +66,6 @@ public class CostPlanDomain implements Serializable { ...@@ -66,10 +66,6 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createTime; private Date createTime;
// @ApiModelProperty("关联子单")
// @Deprecated
// private String sonCostNo;
@ApiModelProperty("关联父单") @ApiModelProperty("关联父单")
private String supCostNo; private String supCostNo;
...@@ -133,9 +129,6 @@ public class CostPlanDomain implements Serializable { ...@@ -133,9 +129,6 @@ public class CostPlanDomain implements Serializable {
private String payDic; private String payDic;
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率") @ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal payCur; private BigDecimal payCur;
@TableField(exist = false)
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal cur;
/*借还单参数 end*/ /*借还单参数 end*/
...@@ -144,9 +137,20 @@ public class CostPlanDomain implements Serializable { ...@@ -144,9 +137,20 @@ public class CostPlanDomain implements Serializable {
private List<CostAttach> attach; private List<CostAttach> attach;
@ApiModelProperty("费用模版id") @ApiModelProperty("费用模版id")
private Integer costTemplateId; private Integer costTemplateId;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
///-------
@TableField(exist = false) @TableField(exist = false)
private CostTemplate costTemplate; private CostTemplate costTemplate;
@TableField(exist = false)
@ApiModelProperty("借还单 借还支付币种 -> 借支币种汇率")
private BigDecimal cur;
public CostPlanDto castToDto() { public CostPlanDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class); StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
package com.blt.other.module.database.model; 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 { public class CostTypeDomain {
private Integer id;// 费用类型
private String typeNo;// 费用类型编号 //费用类型 包括付款 借还
private String typeName;// 费用类型标题 public static final Integer feeType = 0b1001;
private String companyNo;// 主体编号 //收入类别 包括收款
private String companyName;// 主体名称 public static final Integer incomeType = 0b0100;
private Integer costForm; // 费用类型 //借支类别 包括借支
private String subjectCode; // 科目编号 public static final Integer borrow = 0b0010;
private Integer isLend; // 借支/借还
@TableId(type = IdType.AUTO)
public Integer getId() { private Integer id;
return id;
} @ApiModelProperty("费用类型编号")
private String typeNo;
public void setId(Integer id) {
this.id = id; @ApiModelProperty("描述")
} private String description;
public String getTypeNo() { @ApiModelProperty("费用类型标题")
return typeNo; private String typeName;
}
private String accountingSubjectNo;
public void setTypeNo(String typeNo) {
this.typeNo = typeNo; /**
} * 形如0b1001 四位二进制
* 高位到低位分别是 付款 收款 借支 借还
public String getTypeName() { */
return typeName; @ApiModelProperty("费用模版类型作用")
} private Integer costTemplateType;
public void setTypeName(String typeName) { @ApiModelProperty(value = "创建时间")
this.typeName = typeName; private LocalDateTime createTime;
}
@ApiModelProperty(value = "更新人id")
public String getCompanyNo() { private Integer updateUserId;
return companyNo;
} @ApiModelProperty(value = "更新人")
private String updateUser;
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo; @ApiModelProperty(value = "最后更新时间")
} private LocalDateTime lastUpdateTime;
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 +
'}';
}
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<select id="selectAll" resultMap="cost"> <select id="selectAll" resultMap="cost">
SELECT SELECT
t1.*, t1.*,
group_concat(distinct t2.username) as cost_current_reviewer, group_concat(distinct t2.username) as cost_current_reviewer
FROM FROM
cost t1 cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<select id="selectByCostNo" resultMap="cost"> <select id="selectByCostNo" resultMap="cost">
SELECT t1.*, SELECT t1.*,
group_concat(distinct t2.username) as cost_current_reviewer, group_concat(distinct t2.username) as cost_current_reviewer
FROM cost t1 FROM cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE t1.cost_no = #{costNo} WHERE t1.cost_no = #{costNo}
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT SELECT
t1.*, t1.*,
group_concat(distinct t2.username) as cost_current_reviewer, group_concat(distinct t2.username) as cost_current_reviewer
from cost t1 from cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE WHERE
......
...@@ -2,86 +2,25 @@ ...@@ -2,86 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" > "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostTypeDao"> <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 id="queryPage" resultType="com.blt.other.module.cost.dto.response.CostTypeResult">
SELECT select t1.type_no,
* t1.type_name,
FROM t1.description,
cost_type t1.accounting_subject_code,
WHERE t2.name as accounting_subject_name
company_name = #{companyName} from cost_type t1
AND left join accounting_subject t2 on t1.accounting_subject_code = t2.subject_no
type_name = #{typeName} where t1.cost_template_type =#{req.costTemplateType}
<if test="req.accountingSubjectNo !=null">
and t1.accounting_subject_code = #{req.accountingSubjectNo}
</if>
</select> </select>
<select id="getTyeRelation" resultType="com.blt.other.module.database.model.TypeRelationDomain"> <select id="selectByNo" resultType="com.blt.other.module.database.model.CostTypeDomain">
select select *
* from cost_type
from where type_no = #{typeNo}
type_relation
where fee_type = #{typeName} limit 1
</select> </select>
<insert id="insertTypeRalation">
insert into type_relation(manage_cost_type, fee_type)
value(#{typeName}, #{typeName})
</insert>
</mapper> </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