Commit 92a64da4 by huluobin

update

parent 7a9e78d7
......@@ -39,7 +39,7 @@ public class GlobalExceptionHandler {
result.put("msg", e.getMessage());
result.put("message", e.getMessage());
log.error(e.getMessage());
log.error(e.getMessage(), e);
return result;
}
......@@ -56,7 +56,7 @@ public class GlobalExceptionHandler {
result.put("msg", e.getMessage());
result.put("message", e.getMessage());
log.error(e.getMessage());
log.error(e.getMessage(), e);
return result;
}
......
......@@ -36,10 +36,24 @@ public class CostTemplateBaseColController {
}
@ApiOperation("新增费用单基础字段")
@PostMapping("/新增费用单基础字段")
@PostMapping("/add")
public CostResult<Void> add(@RequestBody CostTemplateColReq.AddReq req) {
costTemplateBaseColService.add(req);
return CostResult.success();
}
@ApiOperation("更新费用单基础字段")
@PostMapping("/modify")
public CostResult<Void> modify(@RequestBody CostTemplateBaseCol costTemplateBaseCol) {
costTemplateBaseColService.modify(costTemplateBaseCol);
return CostResult.success();
}
@ApiOperation("删除费用单基础字段")
@PostMapping("/delete")
public CostResult<Void> delete(@RequestParam Integer id) {
costTemplateBaseColService.delete(id);
return CostResult.success();
}
}
package com.blt.other.module.cost.controller.costtemplate;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.service.ICostTemplateColService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>
......@@ -19,5 +23,27 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/costTemplateCol")
public class CostTemplateColController {
@Resource
ICostTemplateColService costTemplateColService;
@ApiOperation("/新增费用单模版字段")
@PostMapping("/add")
public CostResult<Void> add(@RequestBody CostTemplateCol costTemplateCol) {
costTemplateColService.add(costTemplateCol);
return CostResult.success();
}
@ApiOperation("/新增费用单模版字段")
@PostMapping("/modify")
public CostResult<Void> modify(@RequestBody CostTemplateCol costTemplateCol) {
costTemplateColService.modify(costTemplateCol);
return CostResult.success();
}
@ApiOperation("/删除费用单模版字段")
@PostMapping("/delete")
public CostResult<Void> add(@RequestParam Integer id) {
costTemplateColService.delete(id);
return CostResult.success();
}
}
......@@ -42,7 +42,6 @@ public class CostTemplateController {
return CostResult.success();
}
@ApiOperation("/查询费用单模板")
@GetMapping("/queryDetail")
public CostResult<CostTemplate> queryDetail(@RequestParam Integer id) {
......
package com.blt.other.module.cost.dao;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import java.util.List;
/**
* <p>
......@@ -13,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface CostTemplateBaseColMapper extends BaseMapper<CostTemplateBaseCol> {
/**
* <p>
* 查询不同费用单基础模版对应的默认字段
* </p>
*
* @param costType type
* @return list
*/
List<CostTemplateBaseCol> defaultBaseColList(Integer costType);
}
package com.blt.other.module.cost.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blt.other.module.database.model.UserCostFinansysDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -9,9 +10,9 @@ import java.util.List;
@Mapper
@Repository
public interface UserCostFinansysDao {
public interface UserCostFinansysDao extends BaseMapper<UserCostFinansysDomain> {
Integer insert(UserCostFinansysDomain userCostFinansysDomain);
// Integer insert(UserCostFinansysDomain userCostFinansysDomain);
UserCostFinansysDomain selectByNo(String userCostFinansysNo);
......
......@@ -21,7 +21,7 @@ public class CostTemplateApiDto {
private String templateName;
@ApiModelProperty("创建人")
private Integer createUserId;
@ApiModelProperty("更信任")
@ApiModelProperty("更新人")
private Integer updateUserId;
@ApiModelProperty("是否开启自动审核")
private Boolean enableAutoReview;
......
......@@ -9,6 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
......@@ -30,6 +31,9 @@ public class CostTemplate implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("1-付款单2-收款单 3-借支单 4-借还单")
private Integer costType;
@ApiModelProperty(value = "费用单模版名")
private String templateName;
......@@ -46,17 +50,22 @@ public class CostTemplate implements Serializable {
private Boolean enableFinalReview;
@ApiModelProperty("最终审核人最低审核金额")
private Boolean finalMinimumReviewAmount;
private BigDecimal finalMinimumReviewAmount;
@ApiModelProperty("是否默认模版")
private Boolean isDefault;
private Integer createUserId;
private String createUserName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新时间")
private LocalDateTime lastUpdateTime;
private Integer updateUserId;
private String updateUserName;
@TableField(exist = false)
......
......@@ -35,12 +35,15 @@ public class CostTemplateCol implements Serializable {
@ApiModelProperty(value = "费用单基础字段id")
private Integer costTemplateBaseColId;
@ApiModelProperty(value = "1 = 2 != 3 < 4 <= 5 > 6 >= 7 list contain (校验值用逗号分隔) 8 ! list contain (校验值用逗号分隔) ")
@ApiModelProperty(value = "1 = ;2 != ;3 < ;4 <= ;5 > ;6 >= ;7 list contain (校验值用逗号分隔) ;8 ! list contain (校验值用逗号分隔) ")
private Integer autoRuleType;
@ApiModelProperty(value = "自动校验的校验值 cost_col_type在程序做类型转换 写入的时候也要校验类型")
private String autoRuleCheckVal;
@ApiModelProperty("是否默认模版字段")
private Boolean isDefault;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
......
......@@ -3,6 +3,7 @@ package com.blt.other.module.cost.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.cost.dto.CostTemplateColReq;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import org.springframework.lang.NonNull;
import java.util.List;
......@@ -33,4 +34,33 @@ public interface ICostTemplateBaseColService extends IService<CostTemplateBaseCo
* @param req req
*/
void add(CostTemplateColReq.AddReq req);
/**
* <p>
* 更新费用单基础字段
* </p>
*
* @param costTemplateBaseCol req
*/
void modify(CostTemplateBaseCol costTemplateBaseCol);
/**
* <p>
* 删除费用单基础字段
* </p>
*
* @param id id
*/
void delete(@NonNull Integer id);
/**
* <p>
* 获取不同基础费用单模版对应的默认基础字段
* </p>
*
* @param costType type
* @return list
*/
List<CostTemplateBaseCol> defaultBaseColList(@NonNull Integer costType);
}
package com.blt.other.module.cost.service;
import com.blt.other.module.cost.model.CostTemplateCol;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.cost.model.CostTemplateCol;
/**
* <p>
......@@ -13,4 +13,30 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ICostTemplateColService extends IService<CostTemplateCol> {
/**
* <p>
* 删除费用单模版字段
* </p>
*
* @param id req
*/
void delete(Integer id);
/**
* <p>
* 修改费用单模版字段
* </p>
*
* @param costTemplateCol req
*/
void modify(CostTemplateCol costTemplateCol);
/**
* <p>
* 新增费用单模版字段
* </p>
*
* @param costTemplateCol req
*/
void add(CostTemplateCol costTemplateCol);
}
package com.blt.other.module.cost.service.impl;
import com.blt.other.module.cost.dao.CostCheckSearchDao;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.dao.CostCheckSearchDao;
import com.blt.other.module.cost.service.CostCheckSearchService;
import com.blt.other.module.cost.service.CostListSearchService;
import com.blt.other.module.cost.service.CostService;
......@@ -29,12 +29,12 @@ public class CostCheckSearchServiceImpl implements CostCheckSearchService {
@Override
public Map<String, Object> getAll(Integer pageNum, Integer pageSize, String authority) {
PageHelper.startPage(pageNum,pageSize);
PageHelper.startPage(pageNum, pageSize);
List<CostDomain> costDomains = costCheckSearchDao.selectAll(authority);
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
Map<String,Object> map = new HashMap<>();
map.put("pageInfo",pageInfo);
map.put("costs",domainListToDto(costDomains));
Map<String, Object> map = new HashMap<>();
map.put("pageInfo", pageInfo);
map.put("costs", domainListToDto(costDomains));
return map;
}
......@@ -43,13 +43,13 @@ public class CostCheckSearchServiceImpl implements CostCheckSearchService {
}
@Override
public Map<String, Object> seachByKey(String key,int pageNum,int pageSize, String authority) {
Map<String,Object> map = new HashMap<>();
PageHelper.startPage(pageNum,pageSize);
public Map<String, Object> seachByKey(String key, int pageNum, int pageSize, String authority) {
Map<String, Object> map = new HashMap<>();
PageHelper.startPage(pageNum, pageSize);
List<CostDomain> costDomains = costCheckSearchDao.selectByKey(key, authority);
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
map.put("costs",domainListToDto(costDomains));
map.put("pageInfo",pageInfo);
map.put("costs", domainListToDto(costDomains));
map.put("pageInfo", pageInfo);
return map;
}
......@@ -60,23 +60,23 @@ public class CostCheckSearchServiceImpl implements CostCheckSearchService {
@Override
public Map<String, Object> searchByKeys(CostCheckSearchKeysVo searchKeysVo) {
Map<String,Object> map = new HashMap<>();
PageHelper.startPage(searchKeysVo.getParams().getPageNum(),searchKeysVo.getParams().getPageSize());
Map<String, Object> map = new HashMap<>();
PageHelper.startPage(searchKeysVo.getParams().getPageNum(), searchKeysVo.getParams().getPageSize());
List<CostDomain> costDomains = costCheckSearchDao.selectByKeys(searchKeysVo);
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
if (null != searchKeysVo.getParams().getKeys().getLinkCost() && !searchKeysVo.getParams().getKeys().getLinkCost().isEmpty()){
if (null != searchKeysVo.getParams().getKeys().getLinkCost() && !searchKeysVo.getParams().getKeys().getLinkCost().isEmpty()) {
List<CostDomain> list = new ArrayList<>();
CostDomain supCost = costService.getCostDomainByNo(searchKeysVo.getParams().getKeys().getLinkCost());
list.add(supCost);
if (null != costDomains && costDomains.size() >= 1){
for (CostDomain cost: costDomains){
if (null != costDomains && costDomains.size() >= 1) {
for (CostDomain cost : costDomains) {
list.add(cost);
}
costDomains = list;
}
}
map.put("costs",domainListToDto(costDomains));
map.put("pageInfo",pageInfo);
map.put("costs", domainListToDto(costDomains));
map.put("pageInfo", pageInfo);
return map;
}
......
......@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.bailuntec.common.JsonUtilByFsJson;
import com.bailuntec.cost.api.dto.LogisticsFinansysDto;
import com.bailuntec.cost.api.dto.SubLogisticsFinansysDto;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.common.util.MyMapperUtil;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.UserCostFinansysDao;
import com.blt.other.module.cost.service.UserCostFinansysService;
import com.blt.other.module.cost.vo.UserCostFinansysVo;
......@@ -148,29 +148,28 @@ public class UserCostFinansysServiceImpl implements UserCostFinansysService {
*/
private Integer insertUserFinansys(UserCostFinansysVo vo) {
UserCostFinansysDomain userCostFinansysDomain = userCostFinansysDao.selectByBankInfo(vo.getBankname(), vo.getCardno(), vo.getCardusername(), vo.getCardusername());
UserCostFinansysDomain domain = new UserCostFinansysDomain();
domain.setSyncId(vo.getId());
domain.setUserid(vo.getCreateuserid());
domain.setUsername(vo.getCreateusername());
domain.setUseraccount(vo.getUsername());
domain.setBankName(vo.getBankname());
domain.setBankCardUser(vo.getCardusername());
domain.setBankCard(vo.getCardno());
domain.setBankCompany(vo.getCardusername());
domain.setUserCostFinansysNo(createNo());
if (null == userCostFinansysDomain) {
// 没有该记录,添加
Integer insert = userCostFinansysDao.insert(domain);
if (null != insert && 1 == insert)
if (userCostFinansysDomain == null) {
userCostFinansysDomain = new UserCostFinansysDomain();
userCostFinansysDomain.setSyncId(vo.getId());
userCostFinansysDomain.setUserid(vo.getCreateuserid());
userCostFinansysDomain.setUsername(vo.getCreateusername());
userCostFinansysDomain.setUseraccount(vo.getUsername());
userCostFinansysDomain.setBankName(vo.getBankname());
userCostFinansysDomain.setBankCardUser(vo.getCardusername());
userCostFinansysDomain.setBankCard(vo.getCardno());
userCostFinansysDomain.setBankCompany(vo.getCardusername());
userCostFinansysDomain.setUserCostFinansysNo(createNo());
userCostFinansysDao.insert(userCostFinansysDomain);
return 1;
else
return null;
} else {
Integer update = userCostFinansysDao.updateBySyncId(domain);
if (null != update && 1 == update)
userCostFinansysDomain.setSyncId(vo.getId());
userCostFinansysDomain.setUserid(vo.getCreateuserid());
userCostFinansysDomain.setUsername(vo.getCreateusername());
userCostFinansysDomain.setUseraccount(vo.getUsername());
userCostFinansysDao.updateById(userCostFinansysDomain);
return 0;
else
return null;
}
}
......@@ -192,12 +191,12 @@ public class UserCostFinansysServiceImpl implements UserCostFinansysService {
String url = getSupplierPageListApi + "?page=" + pageNum + "&pagesize=" + pageSize + "&key";
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
String strBody = null;
String strBody;
if (response.getStatusCodeValue() == 200) {
strBody = response.getBody();
UserFinansysVo object = (UserFinansysVo) MyMapperUtil.getObject(strBody, UserFinansysVo.class);
return object;
return (UserFinansysVo) MyMapperUtil.getObject(strBody, UserFinansysVo.class);
}
return null;
}
......
......@@ -172,7 +172,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
payPlan.setKindName(null);
payPlan.setKindNo(null);
payPlan.setCostReason("借支差额:" + payPlan.getSupCostNo());
Integer insert2 = costPlanDao.insert(payPlan);
int insert2 = costPlanDao.insert(payPlan);
if (insert2 == 1) {
log.info("生成一张补差额的付款单计划:" + payPlan);
// 生成空子类的子项目
......
package com.blt.other.module.cost.service.impl;
package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.BeanUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -6,6 +6,7 @@ import com.blt.other.module.cost.dao.CostTemplateBaseColMapper;
import com.blt.other.module.cost.dto.CostTemplateColReq;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.service.ICostTemplateBaseColService;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -35,4 +36,19 @@ public class CostTemplateBaseColServiceImpl extends ServiceImpl<CostTemplateBase
BeanUtils.copyProperties(req, costTemplateBaseCol);
this.save(costTemplateBaseCol);
}
@Override
public void modify(CostTemplateBaseCol costTemplateBaseCol) {
this.updateById(costTemplateBaseCol);
}
@Override
public void delete(@NonNull Integer id) {
this.removeById(id);
}
@Override
public List<CostTemplateBaseCol> defaultBaseColList(@NonNull Integer costFrom) {
return baseMapper.defaultBaseColList(costFrom);
}
}
package com.blt.other.module.cost.service.impl;
package com.blt.other.module.cost.service.impl.costtemplate;
import com.blt.other.module.cost.model.CostTemplateCol;
import com.blt.other.module.cost.dao.CostTemplateColMapper;
......@@ -17,4 +17,18 @@ import org.springframework.stereotype.Service;
@Service
public class CostTemplateColServiceImpl extends ServiceImpl<CostTemplateColMapper, CostTemplateCol> implements ICostTemplateColService {
@Override
public void delete(Integer id) {
this.removeById(id);
}
@Override
public void modify(CostTemplateCol costTemplateCol) {
this.updateById(costTemplateCol);
}
@Override
public void add(CostTemplateCol costTemplateCol) {
this.save(costTemplateCol);
}
}
package com.blt.other.module.cost.service.impl;
package com.blt.other.module.cost.service.impl.costtemplate;
import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -6,13 +6,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostTemplateMapper;
import com.blt.other.module.cost.dto.CostTemplateApiDto;
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.service.ICostTemplateBaseColService;
import com.blt.other.module.cost.service.ICostTemplateColService;
import com.blt.other.module.cost.service.ICostTemplateService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -22,15 +27,32 @@ import java.util.List;
* @author robbendev
* @since 2020-10-14
*/
@Primary
@Service
public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, CostTemplate> implements ICostTemplateService {
@Resource
ICostTemplateColService costTemplateColService;
@Resource
ICostTemplateBaseColService costTemplateBaseColService;
@Override
public void add(CostTemplate costTemplate) {
this.save(costTemplate);
List<CostTemplateBaseCol> costTemplateBaseColList = costTemplateBaseColService.defaultBaseColList(costTemplate.getCostType());
List<CostTemplateCol> defaultCostTemplateCol = costTemplateBaseColList.stream().map(costTemplateBaseCol -> {
CostTemplateCol costTemplateCol = new CostTemplateCol();
costTemplateCol.setCostTemplateBaseColId(costTemplateBaseCol.getId());
costTemplateCol.setAutoRuleType(0);
costTemplateCol.setCreateTime(LocalDateTime.now());
costTemplateCol.setIsDefault(true);
return costTemplateCol;
})
.collect(Collectors.toList());
costTemplate.getCostTemplateColList().addAll(defaultCostTemplateCol);
costTemplate.getCostTemplateColList().forEach(costTemplateCol -> costTemplateCol.setCostTemplateId(costTemplate.getId()));
costTemplateColService.saveBatch(costTemplate.getCostTemplateColList());
}
......@@ -41,6 +63,7 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
List<CostTemplateCol> costTemplateColList = costTemplateColService.list(new LambdaQueryWrapper<CostTemplateCol>()
.eq(CostTemplateCol::getCostTemplateId, id));
// List<CostTemplateBaseCol>
costTemplate.setCostTemplateColList(costTemplateColList);
return costTemplate;
}
......@@ -70,7 +93,7 @@ public class CostTemplateServiceImpl extends ServiceImpl<CostTemplateMapper, Cos
if (req.getEnableAutoReview() != null) {
wrapper.eq(CostTemplate::getEnableAutoReview, req.getEnableAutoReview());
}
if (StringUtils.isEmpty(req.getTemplateName())) {
if (StringUtils.isNotEmpty(req.getTemplateName())) {
wrapper.eq(CostTemplate::getTemplateName, req.getTemplateName());
}
if (req.getCreateUserId() != null) {
......
......@@ -22,34 +22,48 @@ public class CostPlanDomain {
@TableId(type = IdType.AUTO)
private Integer id; // 费用单表 id
private String costPlanNo; // 费用计划编号
private String companyNo; // 主体编号
private String companyName; // 主体名称
private String typeNo; // 类型编号
private String typeName; // 类型标题
private String kindNo; // 种类编号
private String kindName; // 种类标题
private Integer createUserid; // 创建人 id
private String createUsercode; // 创建人编号
private String createUsername; // 创建人名称
private String costReason; // 付款理由
private String costRemark; // 费用单备注
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; // 创建时间
private String sonCostNo; // 关联子单
private String supCostNo; // 关联父单
private Integer costPlanStatus; // 费用计划状态 0 待确认 1 已确认
private String filePath; // 文件地址
private String morFilePath; // 补充材料地址
private BigDecimal planAmount; // 费用总金额
private Integer subLogisticsSupplierId; // 二级物流供应商ID
private Integer logisticsSupplierId; // 一级物流供应商ID
private String bankName; // 收款银行(平台)
private String bankCard; // 收款账户
private String bankCardUser; // 收款用户名
private String bankCompany; // 收款/付款单位
private String morRemark; // 补充信息
private Integer costForm; // 1 付款费用 2 收款费用 3 借支/借还
private String costReason; // 付款理由
private Integer isLend; // 1 借支 2 借还
private BigDecimal hadPay; // 借支单已还金额
private Integer lendStatus; // 借支单状态 1 未还 2 部分还款 3 结清
private BigDecimal compensate; // 借支单补偿金额
......
package com.blt.other.module.database.model;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel("用户财务帐号信息")
@Data
@TableName("user_cost_finansys")
public class UserCostFinansysDomain {
private Integer id;
......
......@@ -2,4 +2,10 @@
<!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.CostTemplateBaseColMapper">
<select id="defaultBaseColList" resultType="com.blt.other.module.cost.model.CostTemplateBaseCol">
select *
from cost_template_base_col
where is_extension = false
and find_in_set(#{costType}, cost_type)
</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