From 4e66aeb98bc94a9ad91fb3be2c90a434434e1d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Wed, 30 Jun 2021 00:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=B6=E6=AC=BE=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/数据库更新记录-首次安装请勿使用.txt | 12 +- .../erp/controller/AccountItemController.java | 2 + .../erp/controller/DepotHeadController.java | 36 +++++- .../controller/SystemConfigController.java | 85 +++++++++++++ .../erp/datasource/entities/AccountHead.java | 10 ++ .../entities/AccountHeadExample.java | 70 ++++++++++ .../entities/AccountHeadVo4ListEx.java | 10 ++ .../erp/datasource/entities/AccountItem.java | 20 +++ .../entities/AccountItemExample.java | 120 ++++++++++++++++++ .../erp/datasource/entities/DepotHead.java | 10 ++ .../datasource/entities/DepotHeadExample.java | 70 ++++++++++ .../mappers/AccountItemMapperEx.java | 3 + .../datasource/mappers/DepotHeadMapperEx.java | 12 ++ .../erp/datasource/vo/DepotHeadVo4List.java | 10 ++ .../accountItem/AccountItemService.java | 10 ++ .../service/depotHead/DepotHeadService.java | 45 ++++++- .../java/com/jsh/erp/utils/FileUtils.java | 22 ++++ .../src/main/resources/application.properties | 4 +- .../mapper_xml/AccountHeadMapper.xml | 25 +++- .../mapper_xml/AccountItemMapper.xml | 46 +++++-- .../mapper_xml/AccountItemMapperEx.xml | 12 ++ .../resources/mapper_xml/DepotHeadMapper.xml | 43 +++++-- .../mapper_xml/DepotHeadMapperEx.xml | 53 ++++++++ 23 files changed, 693 insertions(+), 37 deletions(-) diff --git a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt index 18c4d61e4..c64508ae0 100644 --- a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt +++ b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt @@ -1090,7 +1090,7 @@ INSERT INTO `jsh_platform_config` (`id`, `platform_key`, `platform_key_info`, `p -- by jishenghua -- 将库存状态报表改为进销存统计报表 -- -------------------------------------------------------- -update jsh_function set name='进销存统计', sort='0658' where id=59 +update jsh_function set name='进销存统计', sort='0658' where id=59; -- -------------------------------------------------------- -- 时间 2021年6月20日 @@ -1102,6 +1102,12 @@ INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component -- -------------------------------------------------------- -- 时间 2021年6月29日 -- by jishenghua --- 给功能表增加组件字段component +-- 给财务子表增加字段bill_id +-- 给财务主表增加附件字段file_name +-- 给财务主表增加附件字段file_name -- -------------------------------------------------------- -alter table jsh_account_item add bill_id bigint(20) DEFAULT NULL COMMENT '单据id' after in_out_item_id; \ No newline at end of file +alter table jsh_account_item add bill_id bigint(20) DEFAULT NULL COMMENT '进销存单据id' after in_out_item_id; +alter table jsh_account_item add need_debt decimal(24,6) DEFAULT NULL COMMENT '应收欠款' after bill_id; +alter table jsh_account_item add finish_debt decimal(24,6) DEFAULT NULL COMMENT '已收欠款' after need_debt; +alter table jsh_depot_head add file_name varchar(500) DEFAULT NULL COMMENT '附件名称' after remark; +alter table jsh_account_head add file_name varchar(500) DEFAULT NULL COMMENT '附件名称' after remark; \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountItemController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountItemController.java index 9e0cae579..20a721a44 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountItemController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountItemController.java @@ -52,6 +52,8 @@ public class AccountItemController { item.put("inOutItemId", ai.getInOutItemId()); item.put("inOutItemName", ai.getInOutItemName()); item.put("billNumber", ai.getBillNumber()); + item.put("needDebt", ai.getNeedDebt()); + item.put("finishDebt", ai.getFinishDebt()); BigDecimal eachAmount = ai.getEachAmount(); item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount); item.put("remark", ai.getRemark()); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java index aaa0be63a..be0929d27 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java @@ -14,10 +14,7 @@ import com.jsh.erp.exception.BusinessParamCheckingException; import com.jsh.erp.service.depotHead.DepotHeadService; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.redis.RedisService; -import com.jsh.erp.utils.BaseResponseInfo; -import com.jsh.erp.utils.ErpInfo; -import com.jsh.erp.utils.StringUtil; -import com.jsh.erp.utils.Tools; +import com.jsh.erp.utils.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -425,4 +422,35 @@ public class DepotHeadController { } return res; } + + /** + * 查询存在欠款的单据 + * @param search + * @param request + * @return + * @throws Exception + */ + @GetMapping(value = "/debtList") + public String debtList(@RequestParam(value = Constants.SEARCH, required = false) String search, + HttpServletRequest request)throws Exception { + Map objectMap = new HashMap<>(); + String organIdStr = StringUtil.getInfo(search, "organId"); + Long organId = Long.parseLong(organIdStr); + String materialParam = StringUtil.getInfo(search, "materialParam"); + String number = StringUtil.getInfo(search, "number"); + String beginTime = StringUtil.getInfo(search, "beginTime"); + String endTime = StringUtil.getInfo(search, "endTime"); + String type = StringUtil.getInfo(search, "type"); + String subType = StringUtil.getInfo(search, "subType"); + String roleType = StringUtil.getInfo(search, "roleType"); + String status = StringUtil.getInfo(search, "status"); + List list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, type, subType, roleType, status); + if (list != null) { + objectMap.put("rows", list); + return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); + } else { + objectMap.put("rows", new ArrayList<>()); + return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code); + } + } } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java index 728b0a90f..0ae376d19 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java @@ -11,14 +11,22 @@ import com.jsh.erp.service.systemConfig.SystemConfigService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.userBusiness.UserBusinessService; import com.jsh.erp.utils.BaseResponseInfo; +import com.jsh.erp.utils.FileUtils; import com.jsh.erp.utils.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.dao.DataAccessException; +import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; import java.util.List; /** @@ -43,6 +51,9 @@ public class SystemConfigController { @Resource private SystemConfigService systemConfigService; + @Value(value="${file.path}") + private String filePath; + @GetMapping(value = "/getDictItems/{dictCode}") public BaseResponseInfo getDictItems(@PathVariable String dictCode, HttpServletRequest request) { @@ -107,4 +118,78 @@ public class SystemConfigController { } return res; } + + + /** + * 文件上传统一方法 + * @param request + * @param response + * @return + */ + @PostMapping(value = "/upload") + public BaseResponseInfo upload(HttpServletRequest request, HttpServletResponse response) { + BaseResponseInfo res = new BaseResponseInfo(); + try { + String savePath = ""; + String bizPath = request.getParameter("biz"); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象 + if(StringUtil.isEmpty(bizPath)){ + bizPath = ""; + } + savePath = this.uploadLocal(file,bizPath); + if(StringUtil.isNotEmpty(savePath)){ + res.code = 200; + res.data = savePath; + }else { + res.code = 500; + res.data = "上传失败!"; + } + } catch (Exception e) { + e.printStackTrace(); + res.code = 500; + res.data = "上传失败!"; + } + return res; + } + + /** + * 本地文件上传 + * @param mf 文件 + * @param bizPath 自定义路径 + * @return + */ + private String uploadLocal(MultipartFile mf,String bizPath){ + try { + String ctxPath = filePath; + String fileName = null; + File file = new File(ctxPath + File.separator + bizPath + File.separator ); + if (!file.exists()) { + file.mkdirs();// 创建文件根目录 + } + String orgName = mf.getOriginalFilename();// 获取文件名 + orgName = FileUtils.getFileName(orgName); + if(orgName.indexOf(".")!=-1){ + fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); + }else{ + fileName = orgName+ "_" + System.currentTimeMillis(); + } + String savePath = file.getPath() + File.separator + fileName; + File savefile = new File(savePath); + FileCopyUtils.copy(mf.getBytes(), savefile); + String dbpath = null; + if(StringUtil.isNotEmpty(bizPath)){ + dbpath = bizPath + File.separator + fileName; + }else{ + dbpath = fileName; + } + if (dbpath.contains("\\")) { + dbpath = dbpath.replace("\\", "/"); + } + return dbpath; + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return ""; + } } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHead.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHead.java index f47c3234b..8ed666ba2 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHead.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHead.java @@ -26,6 +26,8 @@ public class AccountHead { private String remark; + private String fileName; + private Long tenantId; private String deleteFlag; @@ -118,6 +120,14 @@ public class AccountHead { this.remark = remark == null ? null : remark.trim(); } + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName == null ? null : fileName.trim(); + } + public Long getTenantId() { return tenantId; } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadExample.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadExample.java index 933509ea4..7b8367860 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadExample.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadExample.java @@ -796,6 +796,76 @@ public class AccountHeadExample { return (Criteria) this; } + public Criteria andFileNameIsNull() { + addCriterion("file_name is null"); + return (Criteria) this; + } + + public Criteria andFileNameIsNotNull() { + addCriterion("file_name is not null"); + return (Criteria) this; + } + + public Criteria andFileNameEqualTo(String value) { + addCriterion("file_name =", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotEqualTo(String value) { + addCriterion("file_name <>", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThan(String value) { + addCriterion("file_name >", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThanOrEqualTo(String value) { + addCriterion("file_name >=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThan(String value) { + addCriterion("file_name <", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThanOrEqualTo(String value) { + addCriterion("file_name <=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLike(String value) { + addCriterion("file_name like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotLike(String value) { + addCriterion("file_name not like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameIn(List values) { + addCriterion("file_name in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotIn(List values) { + addCriterion("file_name not in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameBetween(String value1, String value2) { + addCriterion("file_name between", value1, value2, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotBetween(String value1, String value2) { + addCriterion("file_name not between", value1, value2, "fileName"); + return (Criteria) this; + } + public Criteria andTenantIdIsNull() { addCriterion("tenant_id is null"); return (Criteria) this; diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadVo4ListEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadVo4ListEx.java index df5f8dc09..341d1183a 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadVo4ListEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountHeadVo4ListEx.java @@ -25,6 +25,8 @@ public class AccountHeadVo4ListEx { private String remark; + private String fileName; + private Long tenantId; private String deleteFlag; @@ -121,6 +123,14 @@ public class AccountHeadVo4ListEx { this.remark = remark; } + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + public Long getTenantId() { return tenantId; } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItem.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItem.java index 403457f3a..8a3bdc14d 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItem.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItem.java @@ -13,6 +13,10 @@ public class AccountItem { private Long billId; + private BigDecimal needDebt; + + private BigDecimal finishDebt; + private BigDecimal eachAmount; private String remark; @@ -61,6 +65,22 @@ public class AccountItem { this.billId = billId; } + public BigDecimal getNeedDebt() { + return needDebt; + } + + public void setNeedDebt(BigDecimal needDebt) { + this.needDebt = needDebt; + } + + public BigDecimal getFinishDebt() { + return finishDebt; + } + + public void setFinishDebt(BigDecimal finishDebt) { + this.finishDebt = finishDebt; + } + public BigDecimal getEachAmount() { return eachAmount; } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItemExample.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItemExample.java index afb201d87..af09b93bc 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItemExample.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/AccountItemExample.java @@ -405,6 +405,126 @@ public class AccountItemExample { return (Criteria) this; } + public Criteria andNeedDebtIsNull() { + addCriterion("need_debt is null"); + return (Criteria) this; + } + + public Criteria andNeedDebtIsNotNull() { + addCriterion("need_debt is not null"); + return (Criteria) this; + } + + public Criteria andNeedDebtEqualTo(BigDecimal value) { + addCriterion("need_debt =", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtNotEqualTo(BigDecimal value) { + addCriterion("need_debt <>", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtGreaterThan(BigDecimal value) { + addCriterion("need_debt >", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("need_debt >=", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtLessThan(BigDecimal value) { + addCriterion("need_debt <", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtLessThanOrEqualTo(BigDecimal value) { + addCriterion("need_debt <=", value, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtIn(List values) { + addCriterion("need_debt in", values, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtNotIn(List values) { + addCriterion("need_debt not in", values, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("need_debt between", value1, value2, "needDebt"); + return (Criteria) this; + } + + public Criteria andNeedDebtNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("need_debt not between", value1, value2, "needDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtIsNull() { + addCriterion("finish_debt is null"); + return (Criteria) this; + } + + public Criteria andFinishDebtIsNotNull() { + addCriterion("finish_debt is not null"); + return (Criteria) this; + } + + public Criteria andFinishDebtEqualTo(BigDecimal value) { + addCriterion("finish_debt =", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtNotEqualTo(BigDecimal value) { + addCriterion("finish_debt <>", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtGreaterThan(BigDecimal value) { + addCriterion("finish_debt >", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("finish_debt >=", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtLessThan(BigDecimal value) { + addCriterion("finish_debt <", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtLessThanOrEqualTo(BigDecimal value) { + addCriterion("finish_debt <=", value, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtIn(List values) { + addCriterion("finish_debt in", values, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtNotIn(List values) { + addCriterion("finish_debt not in", values, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("finish_debt between", value1, value2, "finishDebt"); + return (Criteria) this; + } + + public Criteria andFinishDebtNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("finish_debt not between", value1, value2, "finishDebt"); + return (Criteria) this; + } + public Criteria andEachAmountIsNull() { addCriterion("each_amount is null"); return (Criteria) this; diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHead.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHead.java index 1d06bbdf1..c48e703e3 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHead.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHead.java @@ -36,6 +36,8 @@ public class DepotHead { private String remark; + private String fileName; + private String salesMan; private String accountIdList; @@ -192,6 +194,14 @@ public class DepotHead { this.remark = remark == null ? null : remark.trim(); } + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName == null ? null : fileName.trim(); + } + public String getSalesMan() { return salesMan; } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHeadExample.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHeadExample.java index e3ae76fae..0309a3f6f 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHeadExample.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/DepotHeadExample.java @@ -1136,6 +1136,76 @@ public class DepotHeadExample { return (Criteria) this; } + public Criteria andFileNameIsNull() { + addCriterion("file_name is null"); + return (Criteria) this; + } + + public Criteria andFileNameIsNotNull() { + addCriterion("file_name is not null"); + return (Criteria) this; + } + + public Criteria andFileNameEqualTo(String value) { + addCriterion("file_name =", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotEqualTo(String value) { + addCriterion("file_name <>", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThan(String value) { + addCriterion("file_name >", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThanOrEqualTo(String value) { + addCriterion("file_name >=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThan(String value) { + addCriterion("file_name <", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThanOrEqualTo(String value) { + addCriterion("file_name <=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLike(String value) { + addCriterion("file_name like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotLike(String value) { + addCriterion("file_name not like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameIn(List values) { + addCriterion("file_name in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotIn(List values) { + addCriterion("file_name not in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameBetween(String value1, String value2) { + addCriterion("file_name between", value1, value2, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotBetween(String value1, String value2) { + addCriterion("file_name not between", value1, value2, "fileName"); + return (Criteria) this; + } + public Criteria andSalesManIsNull() { addCriterion("sales_man is null"); return (Criteria) this; diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/AccountItemMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/AccountItemMapperEx.java index a023f31f1..148a60252 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/AccountItemMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/AccountItemMapperEx.java @@ -5,6 +5,7 @@ import com.jsh.erp.datasource.entities.AccountItemExample; import com.jsh.erp.datasource.vo.AccountItemVo4List; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -34,4 +35,6 @@ public interface AccountItemMapperEx { List getAccountItemListByInOutItemIds(@Param("inOutItemIds") String[] inOutItemIds); int batchDeleteAccountItemByHeadIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids); + + BigDecimal getEachAmountByBillId(@Param("billId") Long billId); } \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java index 9bb8ae480..866273bb8 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java @@ -132,4 +132,16 @@ public interface DepotHeadMapperEx { @Param("hasSupplier") Integer hasSupplier, @Param("beginTime") String beginTime, @Param("endTime") String endTime); + + List debtList( + @Param("organId") Long organId, + @Param("type") String type, + @Param("subType") String subType, + @Param("creatorArray") String[] creatorArray, + @Param("status") String status, + @Param("number") String number, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("materialParam") String materialParam, + @Param("depotArray") String[] depotArray); } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java index ac7708f7b..ed5b0d234 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java @@ -23,6 +23,8 @@ public class DepotHeadVo4List extends DepotHead{ private String operTimeStr; + private BigDecimal finishDebt; + public String getProjectName() { return projectName; } @@ -86,4 +88,12 @@ public class DepotHeadVo4List extends DepotHead{ public void setOperTimeStr(String operTimeStr) { this.operTimeStr = operTimeStr; } + + public BigDecimal getFinishDebt() { + return finishDebt; + } + + public void setFinishDebt(BigDecimal finishDebt) { + this.finishDebt = finishDebt; + } } \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java index f1d3fea98..42218f066 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java @@ -205,6 +205,12 @@ public class AccountItemService { String billNo = tempInsertedJson.getString("billNumber"); accountItem.setBillId(depotHeadService.getDepotHead(billNo).getId()); } + if (tempInsertedJson.get("needDebt") != null && !tempInsertedJson.get("needDebt").equals("")) { + accountItem.setNeedDebt(tempInsertedJson.getBigDecimal("needDebt")); + } + if (tempInsertedJson.get("finishDebt") != null && !tempInsertedJson.get("finishDebt").equals("")) { + accountItem.setFinishDebt(tempInsertedJson.getBigDecimal("finishDebt")); + } if (tempInsertedJson.get("eachAmount") != null && !tempInsertedJson.get("eachAmount").equals("")) { BigDecimal eachAmount = tempInsertedJson.getBigDecimal("eachAmount"); if (type.equals("付款")) { @@ -249,4 +255,8 @@ public class AccountItemService { } return result; } + + public BigDecimal getEachAmountByBillId(Long billId) { + return accountItemMapperEx.getEachAmountByBillId(billId); + } } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java index 94db7e534..dceb9e4bc 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java @@ -3,7 +3,10 @@ package com.jsh.erp.service.depotHead; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.ExceptionConstants; -import com.jsh.erp.datasource.entities.*; +import com.jsh.erp.datasource.entities.DepotHead; +import com.jsh.erp.datasource.entities.DepotHeadExample; +import com.jsh.erp.datasource.entities.DepotItem; +import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.DepotHeadMapper; import com.jsh.erp.datasource.mappers.DepotHeadMapperEx; import com.jsh.erp.datasource.mappers.DepotItemMapperEx; @@ -14,6 +17,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount; import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; import com.jsh.erp.service.account.AccountService; +import com.jsh.erp.service.accountItem.AccountItemService; import com.jsh.erp.service.depot.DepotService; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.log.LogService; @@ -36,7 +40,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.sql.Timestamp; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; import static com.jsh.erp.utils.Tools.getCenternTime; @@ -65,6 +72,8 @@ public class DepotHeadService { @Resource private AccountService accountService; @Resource + private AccountItemService accountItemService; + @Resource DepotItemMapperEx depotItemMapperEx; @Resource private LogService logService; @@ -685,4 +694,36 @@ public class DepotHeadService { } return depotHead; } + + public List debtList(Long organId, String materialParam, String number, String beginTime, String endTime, + String type, String subType, String roleType, String status) { + List resList = new ArrayList<>(); + try{ + String depotIds = depotService.findDepotStrByCurrentUser(); + String [] depotArray=depotIds.split(","); + String [] creatorArray = getCreatorArray(roleType); + beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); + endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME); + List list=depotHeadMapperEx.debtList(organId, type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotArray); + if (null != list) { + for (DepotHeadVo4List dh : list) { + if(dh.getChangeAmount() != null) { + dh.setChangeAmount(dh.getChangeAmount().abs()); + } + if(dh.getTotalPrice() != null) { + dh.setTotalPrice(dh.getTotalPrice().abs()); + } + if(dh.getOperTime() != null) { + dh.setOperTimeStr(getCenternTime(dh.getOperTime())); + } + dh.setFinishDebt(accountItemService.getEachAmountByBillId(dh.getId())); + dh.setMaterialsList(findMaterialsListByHeaderId(dh.getId())); + resList.add(dh); + } + } + }catch(Exception e){ + JshException.readFail(logger, e); + } + return resList; + } } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/utils/FileUtils.java b/jshERP-boot/src/main/java/com/jsh/erp/utils/FileUtils.java index 6fed21fe0..df0ca3026 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/utils/FileUtils.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/utils/FileUtils.java @@ -330,4 +330,26 @@ public class FileUtils { } } + /** + * 判断文件名是否带盘符,重新处理 + * @param fileName + * @return + */ + public static String getFileName(String fileName){ + //判断是否带有盘符信息 + // Check for Unix-style path + int unixSep = fileName.lastIndexOf('/'); + // Check for Windows-style path + int winSep = fileName.lastIndexOf('\\'); + // Cut off at latest possible point + int pos = (winSep > unixSep ? winSep : unixSep); + if (pos != -1) { + // Any sort of path separator found... + fileName = fileName.substring(pos + 1); + } + //替换上传文件名字的特殊字符 + fileName = fileName.replace("=","").replace(",","").replace("&",""); + return fileName; + } + } diff --git a/jshERP-boot/src/main/resources/application.properties b/jshERP-boot/src/main/resources/application.properties index 99edb4354..0ae3ba9f2 100644 --- a/jshERP-boot/src/main/resources/application.properties +++ b/jshERP-boot/src/main/resources/application.properties @@ -25,4 +25,6 @@ demonstrate.open=false #插件配置 plugin.runMode=prod plugin.pluginPath=plugins -plugin.pluginConfigFilePath=pluginConfig \ No newline at end of file +plugin.pluginConfigFilePath=pluginConfig +#文件上传根目录 +file.path=/opt/jshERP/upload \ No newline at end of file diff --git a/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml b/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml index 6b0f68721..34efcb398 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml @@ -13,6 +13,7 @@ + @@ -76,7 +77,7 @@ id, type, organ_id, hands_person_id, creator, change_amount, total_price, account_id, - bill_no, bill_time, remark, tenant_id, delete_flag + bill_no, bill_time, remark, file_name, tenant_id, delete_flag select @@ -106,13 +108,13 @@ insert into jsh_account_item (id, header_id, account_id, - in_out_item_id, bill_id, each_amount, - remark, tenant_id, delete_flag - ) + in_out_item_id, bill_id, need_debt, + finish_debt, each_amount, remark, + tenant_id, delete_flag) values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, - #{inOutItemId,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, #{eachAmount,jdbcType=DECIMAL}, - #{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR} - ) + #{inOutItemId,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, #{needDebt,jdbcType=DECIMAL}, + #{finishDebt,jdbcType=DECIMAL}, #{eachAmount,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}, + #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}) insert into jsh_account_item @@ -132,6 +134,12 @@ bill_id, + + need_debt, + + + finish_debt, + each_amount, @@ -161,6 +169,12 @@ #{billId,jdbcType=BIGINT}, + + #{needDebt,jdbcType=DECIMAL}, + + + #{finishDebt,jdbcType=DECIMAL}, + #{eachAmount,jdbcType=DECIMAL}, @@ -199,6 +213,12 @@ bill_id = #{record.billId,jdbcType=BIGINT}, + + need_debt = #{record.needDebt,jdbcType=DECIMAL}, + + + finish_debt = #{record.finishDebt,jdbcType=DECIMAL}, + each_amount = #{record.eachAmount,jdbcType=DECIMAL}, @@ -223,6 +243,8 @@ account_id = #{record.accountId,jdbcType=BIGINT}, in_out_item_id = #{record.inOutItemId,jdbcType=BIGINT}, bill_id = #{record.billId,jdbcType=BIGINT}, + need_debt = #{record.needDebt,jdbcType=DECIMAL}, + finish_debt = #{record.finishDebt,jdbcType=DECIMAL}, each_amount = #{record.eachAmount,jdbcType=DECIMAL}, remark = #{record.remark,jdbcType=VARCHAR}, tenant_id = #{record.tenantId,jdbcType=BIGINT}, @@ -246,6 +268,12 @@ bill_id = #{billId,jdbcType=BIGINT}, + + need_debt = #{needDebt,jdbcType=DECIMAL}, + + + finish_debt = #{finishDebt,jdbcType=DECIMAL}, + each_amount = #{eachAmount,jdbcType=DECIMAL}, @@ -267,6 +295,8 @@ account_id = #{accountId,jdbcType=BIGINT}, in_out_item_id = #{inOutItemId,jdbcType=BIGINT}, bill_id = #{billId,jdbcType=BIGINT}, + need_debt = #{needDebt,jdbcType=DECIMAL}, + finish_debt = #{finishDebt,jdbcType=DECIMAL}, each_amount = #{eachAmount,jdbcType=DECIMAL}, remark = #{remark,jdbcType=VARCHAR}, tenant_id = #{tenantId,jdbcType=BIGINT}, diff --git a/jshERP-boot/src/main/resources/mapper_xml/AccountItemMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/AccountItemMapperEx.xml index ab69b21b5..a5e652607 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/AccountItemMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/AccountItemMapperEx.xml @@ -102,6 +102,7 @@ ) and ifnull(delete_flag,'0') !='1' + update jsh_account_item set delete_flag='1' @@ -112,4 +113,15 @@ ) + + \ No newline at end of file diff --git a/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapper.xml b/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapper.xml index 4f00a422d..32bc8d34c 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapper.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapper.xml @@ -18,6 +18,7 @@ + @@ -93,8 +94,8 @@ id, type, sub_type, default_number, number, create_time, oper_time, organ_id, hands_person_id, - creator, account_id, change_amount, total_price, pay_type, bill_type, remark, sales_man, - account_id_list, account_money_list, discount, discount_money, discount_last_money, + creator, account_id, change_amount, total_price, pay_type, bill_type, remark, file_name, + sales_man, account_id_list, account_money_list, discount, discount_money, discount_last_money, other_money, other_money_list, other_money_item, account_day, status, link_number, tenant_id, delete_flag @@ -134,23 +135,23 @@ oper_time, organ_id, hands_person_id, creator, account_id, change_amount, total_price, pay_type, bill_type, - remark, sales_man, account_id_list, - account_money_list, discount, discount_money, - discount_last_money, other_money, other_money_list, - other_money_item, account_day, status, - link_number, tenant_id, delete_flag - ) + remark, file_name, sales_man, + account_id_list, account_money_list, discount, + discount_money, discount_last_money, other_money, + other_money_list, other_money_item, account_day, + status, link_number, tenant_id, + delete_flag) values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR}, #{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{handsPersonId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{changeAmount,jdbcType=DECIMAL}, #{totalPrice,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR}, #{billType,jdbcType=VARCHAR}, - #{remark,jdbcType=VARCHAR}, #{salesMan,jdbcType=VARCHAR}, #{accountIdList,jdbcType=VARCHAR}, - #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL}, #{discountMoney,jdbcType=DECIMAL}, - #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL}, #{otherMoneyList,jdbcType=VARCHAR}, - #{otherMoneyItem,jdbcType=VARCHAR}, #{accountDay,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, - #{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR} - ) + #{remark,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{salesMan,jdbcType=VARCHAR}, + #{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL}, + #{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL}, + #{otherMoneyList,jdbcType=VARCHAR}, #{otherMoneyItem,jdbcType=VARCHAR}, #{accountDay,jdbcType=INTEGER}, + #{status,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, + #{deleteFlag,jdbcType=VARCHAR}) insert into jsh_depot_head @@ -203,6 +204,9 @@ remark, + + file_name, + sales_man, @@ -295,6 +299,9 @@ #{remark,jdbcType=VARCHAR}, + + #{fileName,jdbcType=VARCHAR}, + #{salesMan,jdbcType=VARCHAR}, @@ -396,6 +403,9 @@ remark = #{record.remark,jdbcType=VARCHAR}, + + file_name = #{record.fileName,jdbcType=VARCHAR}, + sales_man = #{record.salesMan,jdbcType=VARCHAR}, @@ -461,6 +471,7 @@ pay_type = #{record.payType,jdbcType=VARCHAR}, bill_type = #{record.billType,jdbcType=VARCHAR}, remark = #{record.remark,jdbcType=VARCHAR}, + file_name = #{record.fileName,jdbcType=VARCHAR}, sales_man = #{record.salesMan,jdbcType=VARCHAR}, account_id_list = #{record.accountIdList,jdbcType=VARCHAR}, account_money_list = #{record.accountMoneyList,jdbcType=VARCHAR}, @@ -527,6 +538,9 @@ remark = #{remark,jdbcType=VARCHAR}, + + file_name = #{fileName,jdbcType=VARCHAR}, + sales_man = #{salesMan,jdbcType=VARCHAR}, @@ -589,6 +603,7 @@ pay_type = #{payType,jdbcType=VARCHAR}, bill_type = #{billType,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, + file_name = #{fileName,jdbcType=VARCHAR}, sales_man = #{salesMan,jdbcType=VARCHAR}, account_id_list = #{accountIdList,jdbcType=VARCHAR}, account_money_list = #{accountMoneyList,jdbcType=VARCHAR}, diff --git a/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml index 93eeb1d7b..bb34f4ce0 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/DepotHeadMapperEx.xml @@ -448,4 +448,57 @@ and ifnull(delete_flag,'0') !='1' + + \ No newline at end of file