优化财务单据
This commit is contained in:
@@ -231,10 +231,10 @@ public class DepotHeadController {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("采购退货出库")) {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("付款")) {
|
||||
allPrice = p1.add(p2);
|
||||
} else if (type.equals("收款")) {
|
||||
allPrice = BigDecimal.ZERO.subtract(p1.add(p2));
|
||||
allPrice = BigDecimal.ZERO.subtract(p1);
|
||||
} else if (type.equals("付款")) {
|
||||
allPrice = p1;
|
||||
} else if (type.equals("收入")) {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("支出")) {
|
||||
|
||||
@@ -17,16 +17,17 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -192,4 +193,76 @@ public class SystemConfigController {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览图片&下载文件
|
||||
* 请求地址:http://localhost:8080/common/static/{financial/afsdfasdfasdf_1547866868179.txt}
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/static/**")
|
||||
public void view(HttpServletRequest request, HttpServletResponse response) {
|
||||
// ISO-8859-1 ==> UTF-8 进行编码转换
|
||||
String imgPath = extractPathFromPattern(request);
|
||||
if(StringUtil.isEmpty(imgPath) || imgPath=="null"){
|
||||
return;
|
||||
}
|
||||
// 其余处理略
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
imgPath = imgPath.replace("..", "");
|
||||
if (imgPath.endsWith(",")) {
|
||||
imgPath = imgPath.substring(0, imgPath.length() - 1);
|
||||
}
|
||||
String fileUrl = filePath + File.separator + imgPath;
|
||||
File file = new File(fileUrl);
|
||||
if(!file.exists()){
|
||||
response.setStatus(404);
|
||||
throw new RuntimeException("文件不存在..");
|
||||
}
|
||||
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
|
||||
inputStream = new BufferedInputStream(new FileInputStream(fileUrl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
logger.error("预览文件失败" + e.getMessage());
|
||||
response.setStatus(404);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把指定URL后的字符串全部截断当成参数
|
||||
* 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private static String extractPathFromPattern(final HttpServletRequest request) {
|
||||
String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
|
||||
String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
|
||||
return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public class AccountHead {
|
||||
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
private BigDecimal discountMoney;
|
||||
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
private Long accountId;
|
||||
@@ -80,6 +82,14 @@ public class AccountHead {
|
||||
this.changeAmount = changeAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getDiscountMoney() {
|
||||
return discountMoney;
|
||||
}
|
||||
|
||||
public void setDiscountMoney(BigDecimal discountMoney) {
|
||||
this.discountMoney = discountMoney;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
@@ -476,6 +476,66 @@ public class AccountHeadExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyIsNull() {
|
||||
addCriterion("discount_money is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyIsNotNull() {
|
||||
addCriterion("discount_money is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyEqualTo(BigDecimal value) {
|
||||
addCriterion("discount_money =", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyNotEqualTo(BigDecimal value) {
|
||||
addCriterion("discount_money <>", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyGreaterThan(BigDecimal value) {
|
||||
addCriterion("discount_money >", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyGreaterThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("discount_money >=", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyLessThan(BigDecimal value) {
|
||||
addCriterion("discount_money <", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyLessThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("discount_money <=", value, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyIn(List<BigDecimal> values) {
|
||||
addCriterion("discount_money in", values, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyNotIn(List<BigDecimal> values) {
|
||||
addCriterion("discount_money not in", values, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("discount_money between", value1, value2, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDiscountMoneyNotBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("discount_money not between", value1, value2, "discountMoney");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTotalPriceIsNull() {
|
||||
addCriterion("total_price is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@@ -3,150 +3,18 @@ package com.jsh.erp.datasource.entities;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class AccountHeadVo4ListEx {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String type;
|
||||
|
||||
private Long organId;
|
||||
|
||||
private Long handsPersonId;
|
||||
|
||||
private BigDecimal changeAmount;
|
||||
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private String billNo;
|
||||
|
||||
private Date billTime;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private String deleteFlag;
|
||||
public class AccountHeadVo4ListEx extends AccountHead{
|
||||
|
||||
private String organName;
|
||||
|
||||
private String handsPersonName;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String billTimeStr;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getOrganId() {
|
||||
return organId;
|
||||
}
|
||||
|
||||
public void setOrganId(Long organId) {
|
||||
this.organId = organId;
|
||||
}
|
||||
|
||||
public Long getHandsPersonId() {
|
||||
return handsPersonId;
|
||||
}
|
||||
|
||||
public void setHandsPersonId(Long handsPersonId) {
|
||||
this.handsPersonId = handsPersonId;
|
||||
}
|
||||
|
||||
public BigDecimal getChangeAmount() {
|
||||
return changeAmount;
|
||||
}
|
||||
|
||||
public void setChangeAmount(BigDecimal changeAmount) {
|
||||
this.changeAmount = changeAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getBillNo() {
|
||||
return billNo;
|
||||
}
|
||||
|
||||
public void setBillNo(String billNo) {
|
||||
this.billNo = billNo;
|
||||
}
|
||||
|
||||
public Date getBillTime() {
|
||||
return billTime;
|
||||
}
|
||||
|
||||
public void setBillTime(Date billTime) {
|
||||
this.billTime = billTime;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getDeleteFlag() {
|
||||
return deleteFlag;
|
||||
}
|
||||
|
||||
public void setDeleteFlag(String deleteFlag) {
|
||||
this.deleteFlag = deleteFlag;
|
||||
}
|
||||
|
||||
public String getOrganName() {
|
||||
return organName;
|
||||
}
|
||||
@@ -163,14 +31,6 @@ public class AccountHeadVo4ListEx {
|
||||
this.handsPersonName = handsPersonName;
|
||||
}
|
||||
|
||||
public Long getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(Long creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,9 @@ import java.util.regex.Pattern;
|
||||
@WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"},
|
||||
initParams = {@WebInitParam(name = "ignoredUrl", value = ".ico"),
|
||||
@WebInitParam(name = "filterPath",
|
||||
value = "/jshERP-boot/user/login#/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage" +
|
||||
"#/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars")})
|
||||
value = "/jshERP-boot/user/login#/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#" +
|
||||
"/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#" +
|
||||
"/jshERP-boot/systemConfig/static")})
|
||||
public class LogCostFilter implements Filter {
|
||||
|
||||
private static final String FILTER_PATH = "filterPath";
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@@ -49,6 +50,8 @@ public class AccountHeadService {
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private AccountItemMapperEx accountItemMapperEx;
|
||||
@Value(value="${file.path}")
|
||||
private String filePath;
|
||||
|
||||
public AccountHead getAccountHead(long id) throws Exception {
|
||||
AccountHead result=null;
|
||||
@@ -85,16 +88,12 @@ public class AccountHeadService {
|
||||
}
|
||||
|
||||
public List<AccountHeadVo4ListEx> select(String type, String roleType, String billNo, String beginTime, String endTime, int offset, int rows) throws Exception{
|
||||
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
||||
List<AccountHeadVo4ListEx> list=null;
|
||||
List<AccountHeadVo4ListEx> resList = new ArrayList<>();
|
||||
try{
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo, beginTime, endTime, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo, beginTime, endTime, offset, rows);
|
||||
if (null != list) {
|
||||
for (AccountHeadVo4ListEx ah : list) {
|
||||
if(ah.getChangeAmount() != null) {
|
||||
@@ -107,6 +106,9 @@ public class AccountHeadService {
|
||||
resList.add(ah);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
@@ -315,8 +317,8 @@ public class AccountHeadService {
|
||||
i = -1;
|
||||
}
|
||||
//收付款部分
|
||||
sum = sum.add((allMoney(getS, "付款", "合计",endTime).add(allMoney(getS, "付款", "实际",endTime))).multiply(new BigDecimal(i)));
|
||||
sum = sum.subtract((allMoney(getS, "收款", "合计",endTime).add(allMoney(getS, "收款", "实际",endTime))).multiply(new BigDecimal(i)));
|
||||
sum = sum.subtract((allMoney(getS, "收款", "合计",endTime)).multiply(new BigDecimal(i)));
|
||||
sum = sum.add((allMoney(getS, "付款", "合计",endTime)).multiply(new BigDecimal(i)));
|
||||
sum = sum.add((allMoney(getS, "收入", "合计",endTime).subtract(allMoney(getS, "收入", "实际",endTime))).multiply(new BigDecimal(i)));
|
||||
sum = sum.subtract((allMoney(getS, "支出", "合计",endTime).subtract(allMoney(getS, "支出", "实际",endTime))).multiply(new BigDecimal(i)));
|
||||
return sum;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="hands_person_id" jdbcType="BIGINT" property="handsPersonId" />
|
||||
<result column="creator" jdbcType="BIGINT" property="creator" />
|
||||
<result column="change_amount" jdbcType="DECIMAL" property="changeAmount" />
|
||||
<result column="discount_money" jdbcType="DECIMAL" property="discountMoney" />
|
||||
<result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
|
||||
<result column="account_id" jdbcType="BIGINT" property="accountId" />
|
||||
<result column="bill_no" jdbcType="VARCHAR" property="billNo" />
|
||||
@@ -76,8 +77,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, type, organ_id, hands_person_id, creator, change_amount, total_price, account_id,
|
||||
bill_no, bill_time, remark, file_name, tenant_id, delete_flag
|
||||
id, type, organ_id, hands_person_id, creator, change_amount, discount_money, total_price,
|
||||
account_id, bill_no, bill_time, remark, file_name, tenant_id, delete_flag
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -112,14 +113,16 @@
|
||||
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.AccountHead">
|
||||
insert into jsh_account_head (id, type, organ_id,
|
||||
hands_person_id, creator, change_amount,
|
||||
total_price, account_id, bill_no,
|
||||
bill_time, remark, file_name,
|
||||
tenant_id, delete_flag)
|
||||
discount_money, total_price, account_id,
|
||||
bill_no, bill_time, remark,
|
||||
file_name, tenant_id, delete_flag
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{organId,jdbcType=BIGINT},
|
||||
#{handsPersonId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL},
|
||||
#{totalPrice,jdbcType=DECIMAL}, #{accountId,jdbcType=BIGINT}, #{billNo,jdbcType=VARCHAR},
|
||||
#{billTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
#{discountMoney,jdbcType=DECIMAL}, #{totalPrice,jdbcType=DECIMAL}, #{accountId,jdbcType=BIGINT},
|
||||
#{billNo,jdbcType=VARCHAR}, #{billTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR},
|
||||
#{fileName,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.AccountHead">
|
||||
insert into jsh_account_head
|
||||
@@ -142,6 +145,9 @@
|
||||
<if test="changeAmount != null">
|
||||
change_amount,
|
||||
</if>
|
||||
<if test="discountMoney != null">
|
||||
discount_money,
|
||||
</if>
|
||||
<if test="totalPrice != null">
|
||||
total_price,
|
||||
</if>
|
||||
@@ -186,6 +192,9 @@
|
||||
<if test="changeAmount != null">
|
||||
#{changeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="discountMoney != null">
|
||||
#{discountMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="totalPrice != null">
|
||||
#{totalPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -239,6 +248,9 @@
|
||||
<if test="record.changeAmount != null">
|
||||
change_amount = #{record.changeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.discountMoney != null">
|
||||
discount_money = #{record.discountMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="record.totalPrice != null">
|
||||
total_price = #{record.totalPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -276,6 +288,7 @@
|
||||
hands_person_id = #{record.handsPersonId,jdbcType=BIGINT},
|
||||
creator = #{record.creator,jdbcType=BIGINT},
|
||||
change_amount = #{record.changeAmount,jdbcType=DECIMAL},
|
||||
discount_money = #{record.discountMoney,jdbcType=DECIMAL},
|
||||
total_price = #{record.totalPrice,jdbcType=DECIMAL},
|
||||
account_id = #{record.accountId,jdbcType=BIGINT},
|
||||
bill_no = #{record.billNo,jdbcType=VARCHAR},
|
||||
@@ -306,6 +319,9 @@
|
||||
<if test="changeAmount != null">
|
||||
change_amount = #{changeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="discountMoney != null">
|
||||
discount_money = #{discountMoney,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="totalPrice != null">
|
||||
total_price = #{totalPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -340,6 +356,7 @@
|
||||
hands_person_id = #{handsPersonId,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
change_amount = #{changeAmount,jdbcType=DECIMAL},
|
||||
discount_money = #{discountMoney,jdbcType=DECIMAL},
|
||||
total_price = #{totalPrice,jdbcType=DECIMAL},
|
||||
account_id = #{accountId,jdbcType=BIGINT},
|
||||
bill_no = #{billNo,jdbcType=VARCHAR},
|
||||
|
||||
Reference in New Issue
Block a user