Commit 62fcd276 by huluobin

# update

parent 5edec21a
...@@ -223,4 +223,6 @@ public class CostDto { ...@@ -223,4 +223,6 @@ public class CostDto {
@TableField(exist = false) @TableField(exist = false)
private CostTemplateDto costTemplate; private CostTemplateDto costTemplate;
private Boolean isPic;
} }
...@@ -2,6 +2,7 @@ package com.blt.other.module.cost.model; ...@@ -2,6 +2,7 @@ package com.blt.other.module.cost.model;
import com.bailuntec.common.BeanUtils; import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.SpringContextUtil; import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.common.StringUtils;
import com.bailuntec.cost.api.dto.CostAttach; import com.bailuntec.cost.api.dto.CostAttach;
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.IdType;
...@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; ...@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.database.mapper.StatusMapper; import com.blt.other.database.mapper.StatusMapper;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -22,8 +24,6 @@ import java.text.DecimalFormat; ...@@ -22,8 +24,6 @@ import java.text.DecimalFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Accessors(chain = true) @Accessors(chain = true)
@TableName(value = "cost", autoResultMap = true) @TableName(value = "cost", autoResultMap = true)
...@@ -240,13 +240,16 @@ public class CostDomain implements Serializable { ...@@ -240,13 +240,16 @@ public class CostDomain implements Serializable {
private static final String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正则 private static final String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正则
private final static List<String> picFilter = Lists.newArrayList("png", "jpg", "bmp,", "gif");
public CostDto castToDto() { public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
CostDto costDto = new CostDto(); CostDto costDto = new CostDto();
BeanUtils.copyProperties(this, costDto); BeanUtils.copyProperties(this, costDto);
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
/*字典翻译*/ /*字典翻译*/
costDto.setCostStatusDto(statusMapper.getStatusValue("cost_status", this.getCostStatus())); costDto.setCostStatusDto(statusMapper.getStatusValue("cost_status", this.getCostStatus()));
if (null != this.getIsLend()) { if (null != this.getIsLend()) {
...@@ -258,21 +261,21 @@ public class CostDomain implements Serializable { ...@@ -258,21 +261,21 @@ public class CostDomain implements Serializable {
if (null != this.getLendStatus()) { if (null != this.getLendStatus()) {
costDto.setLendStatusDto(statusMapper.getStatusValue("lend_status", this.getLendStatus())); costDto.setLendStatusDto(statusMapper.getStatusValue("lend_status", this.getLendStatus()));
} }
// 抵个税
if (1 == costDto.getCostForm()) {
costDto.setIsTaxStr(statusMapper.getStatusValue("is_tax", costDto.getIsTax()));
}
// 获取文件名 // 获取文件名
String filePath = this.getFilePath(); String filePath = this.getFilePath();
if (null != filePath && filePath.contains("&")) { if (null != filePath && filePath.contains("&")) {
String fileName = filePath.substring(filePath.lastIndexOf("&") + 1); String fileName = filePath.substring(filePath.lastIndexOf("&") + 1);
costDto.setFileName(fileName); costDto.setFileName(fileName);
} }
// 抵个税
if (1 == costDto.getCostForm()) {
costDto.setIsTaxStr(statusMapper.getStatusValue("is_tax", costDto.getIsTax()));
}
// 币种 // 币种
costDto.setDicDto(CurUtils.getCurDto(costDto.getDic())); costDto.setDicDto(CurUtils.getCurDto(costDto.getDic()));
costDto.setPayDicDto(CurUtils.getCurDto(costDto.getPayDic())); costDto.setPayDicDto(CurUtils.getCurDto(costDto.getPayDic()));
//
DecimalFormat df = new DecimalFormat("#0.00"); DecimalFormat df = new DecimalFormat("#0.00");
if (null != costDto.getAmount()) { if (null != costDto.getAmount()) {
String format = df.format(costDto.getAmount()); String format = df.format(costDto.getAmount());
...@@ -282,6 +285,15 @@ public class CostDomain implements Serializable { ...@@ -282,6 +285,15 @@ public class CostDomain implements Serializable {
String format = df.format(costDto.getPayPlanAmount()); String format = df.format(costDto.getPayPlanAmount());
costDto.setPayPlanAmountDto(format); costDto.setPayPlanAmountDto(format);
} }
if (StringUtils.isNotEmpty(filePath)) {
int i = filePath.lastIndexOf('.');
String extension = "";
if (i > 0) {
extension = filePath.substring(i + 1);
}
costDto.setIsPic(picFilter.contains(extension));
}
return costDto; return costDto;
} }
......
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