优化收款单

This commit is contained in:
季圣华
2021-06-29 01:07:03 +08:00
parent 72ac4ce1a8
commit 225eb16bba
11 changed files with 144 additions and 14 deletions

View File

@@ -81,6 +81,7 @@ CREATE TABLE `jsh_account_item` (
`header_id` bigint(20) NOT NULL COMMENT '表头Id',
`account_id` bigint(20) DEFAULT NULL COMMENT '账户Id',
`in_out_item_id` bigint(20) DEFAULT NULL COMMENT '收支项目Id',
`bill_id` bigint(20) NULL DEFAULT NULL COMMENT '单据id' ,
`each_amount` decimal(24,6) DEFAULT NULL COMMENT '单项金额',
`remark` varchar(100) DEFAULT NULL COMMENT '单据备注',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
@@ -94,12 +95,12 @@ CREATE TABLE `jsh_account_item` (
-- ----------------------------
-- Records of jsh_account_item
-- ----------------------------
INSERT INTO `jsh_account_item` VALUES ('143', '118', null, '23', '55.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('144', '119', null, '21', '66.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('145', '120', '17', null, '33.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('146', '121', '18', null, '-22.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('147', '122', '17', null, '11.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('148', '123', '17', null, '66.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('143', '118', null, '23', null, '55.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('144', '119', null, '21', null, '66.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('145', '120', '17', null, null, '33.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('146', '121', '18', null, null, '-22.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('147', '122', '17', null, null, '11.000000', '', '63', '0');
INSERT INTO `jsh_account_item` VALUES ('148', '123', '17', null, null, '66.000000', '', '63', '0');
-- ----------------------------
-- Table structure for jsh_depot

View File

@@ -1098,3 +1098,10 @@ update jsh_function set name='进销存统计', sort='0658' where id=59
-- 增加商品库存报表
-- --------------------------------------------------------
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('030113', '商品库存', '0301', '/report/material_stock', '/report/MaterialStock', b'0', '0605', b'1', '电脑版', '', 'profile', '0');
-- --------------------------------------------------------
-- 时间 2021年6月29日
-- by jishenghua
-- 给功能表增加组件字段component
-- --------------------------------------------------------
alter table jsh_account_item add bill_id bigint(20) DEFAULT NULL COMMENT '单据id' after in_out_item_id;

View File

@@ -51,6 +51,7 @@ public class AccountItemController {
item.put("accountName", ai.getAccountName());
item.put("inOutItemId", ai.getInOutItemId());
item.put("inOutItemName", ai.getInOutItemName());
item.put("billNumber", ai.getBillNumber());
BigDecimal eachAmount = ai.getEachAmount();
item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount);
item.put("remark", ai.getRemark());

View File

@@ -11,6 +11,8 @@ public class AccountItem {
private Long inOutItemId;
private Long billId;
private BigDecimal eachAmount;
private String remark;
@@ -51,6 +53,14 @@ public class AccountItem {
this.inOutItemId = inOutItemId;
}
public Long getBillId() {
return billId;
}
public void setBillId(Long billId) {
this.billId = billId;
}
public BigDecimal getEachAmount() {
return eachAmount;
}

View File

@@ -345,6 +345,66 @@ public class AccountItemExample {
return (Criteria) this;
}
public Criteria andBillIdIsNull() {
addCriterion("bill_id is null");
return (Criteria) this;
}
public Criteria andBillIdIsNotNull() {
addCriterion("bill_id is not null");
return (Criteria) this;
}
public Criteria andBillIdEqualTo(Long value) {
addCriterion("bill_id =", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotEqualTo(Long value) {
addCriterion("bill_id <>", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdGreaterThan(Long value) {
addCriterion("bill_id >", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdGreaterThanOrEqualTo(Long value) {
addCriterion("bill_id >=", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdLessThan(Long value) {
addCriterion("bill_id <", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdLessThanOrEqualTo(Long value) {
addCriterion("bill_id <=", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdIn(List<Long> values) {
addCriterion("bill_id in", values, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotIn(List<Long> values) {
addCriterion("bill_id not in", values, "billId");
return (Criteria) this;
}
public Criteria andBillIdBetween(Long value1, Long value2) {
addCriterion("bill_id between", value1, value2, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotBetween(Long value1, Long value2) {
addCriterion("bill_id not between", value1, value2, "billId");
return (Criteria) this;
}
public Criteria andEachAmountIsNull() {
addCriterion("each_amount is null");
return (Criteria) this;

View File

@@ -8,6 +8,8 @@ public class AccountItemVo4List extends AccountItem {
private String inOutItemName;
private String billNumber;
public String getAccountName() {
return accountName;
}
@@ -23,4 +25,12 @@ public class AccountItemVo4List extends AccountItem {
public void setInOutItemName(String inOutItemName) {
this.inOutItemName = inOutItemName;
}
public String getBillNumber() {
return billNumber;
}
public void setBillNumber(String billNumber) {
this.billNumber = billNumber;
}
}

View File

@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.datasource.vo.AccountItemVo4List;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -34,13 +35,14 @@ public class AccountItemService {
@Resource
private AccountItemMapper accountItemMapper;
@Resource
private AccountItemMapperEx accountItemMapperEx;
@Resource
private LogService logService;
@Resource
private UserService userService;
@Resource
private DepotHeadService depotHeadService;
public AccountItem getAccountItem(long id)throws Exception {
AccountItem result=null;
@@ -199,6 +201,10 @@ public class AccountItemService {
if (tempInsertedJson.get("inOutItemId") != null && !tempInsertedJson.get("inOutItemId").equals("")) {
accountItem.setInOutItemId(tempInsertedJson.getLong("inOutItemId"));
}
if (tempInsertedJson.get("billNumber") != null && !tempInsertedJson.get("billNumber").equals("")) {
String billNo = tempInsertedJson.getString("billNumber");
accountItem.setBillId(depotHeadService.getDepotHead(billNo).getId());
}
if (tempInsertedJson.get("eachAmount") != null && !tempInsertedJson.get("eachAmount").equals("")) {
BigDecimal eachAmount = tempInsertedJson.getBigDecimal("eachAmount");
if (type.equals("付款")) {

View File

@@ -670,4 +670,19 @@ public class DepotHeadService {
public BigDecimal getBuyAndSaleRetailStatistics(String type, String subType, Integer hasSupplier, String beginTime, String endTime) {
return depotHeadMapperEx.getBuyAndSaleRetailStatistics(type, subType, hasSupplier, beginTime, endTime);
}
public DepotHead getDepotHead(String number)throws Exception {
DepotHead depotHead = new DepotHead();
try{
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andNumberEqualTo(number).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotHead> list = depotHeadMapper.selectByExample(example);
if(null!=list && list.size()>0) {
depotHead = list.get(0);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return depotHead;
}
}

View File

@@ -6,6 +6,7 @@
<result column="header_id" jdbcType="BIGINT" property="headerId" />
<result column="account_id" jdbcType="BIGINT" property="accountId" />
<result column="in_out_item_id" jdbcType="BIGINT" property="inOutItemId" />
<result column="bill_id" jdbcType="BIGINT" property="billId" />
<result column="each_amount" jdbcType="DECIMAL" property="eachAmount" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
@@ -70,7 +71,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, header_id, account_id, in_out_item_id, each_amount, remark, tenant_id, delete_flag
id, header_id, account_id, in_out_item_id, bill_id, each_amount, remark, tenant_id,
delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountItemExample" resultMap="BaseResultMap">
select
@@ -104,11 +106,13 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.AccountItem">
insert into jsh_account_item (id, header_id, account_id,
in_out_item_id, each_amount, remark,
tenant_id, delete_flag)
in_out_item_id, bill_id, each_amount,
remark, tenant_id, delete_flag
)
values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT},
#{inOutItemId,jdbcType=BIGINT}, #{eachAmount,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
#{inOutItemId,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, #{eachAmount,jdbcType=DECIMAL},
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.AccountItem">
insert into jsh_account_item
@@ -125,6 +129,9 @@
<if test="inOutItemId != null">
in_out_item_id,
</if>
<if test="billId != null">
bill_id,
</if>
<if test="eachAmount != null">
each_amount,
</if>
@@ -151,6 +158,9 @@
<if test="inOutItemId != null">
#{inOutItemId,jdbcType=BIGINT},
</if>
<if test="billId != null">
#{billId,jdbcType=BIGINT},
</if>
<if test="eachAmount != null">
#{eachAmount,jdbcType=DECIMAL},
</if>
@@ -186,6 +196,9 @@
<if test="record.inOutItemId != null">
in_out_item_id = #{record.inOutItemId,jdbcType=BIGINT},
</if>
<if test="record.billId != null">
bill_id = #{record.billId,jdbcType=BIGINT},
</if>
<if test="record.eachAmount != null">
each_amount = #{record.eachAmount,jdbcType=DECIMAL},
</if>
@@ -209,6 +222,7 @@
header_id = #{record.headerId,jdbcType=BIGINT},
account_id = #{record.accountId,jdbcType=BIGINT},
in_out_item_id = #{record.inOutItemId,jdbcType=BIGINT},
bill_id = #{record.billId,jdbcType=BIGINT},
each_amount = #{record.eachAmount,jdbcType=DECIMAL},
remark = #{record.remark,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
@@ -229,6 +243,9 @@
<if test="inOutItemId != null">
in_out_item_id = #{inOutItemId,jdbcType=BIGINT},
</if>
<if test="billId != null">
bill_id = #{billId,jdbcType=BIGINT},
</if>
<if test="eachAmount != null">
each_amount = #{eachAmount,jdbcType=DECIMAL},
</if>
@@ -249,6 +266,7 @@
set header_id = #{headerId,jdbcType=BIGINT},
account_id = #{accountId,jdbcType=BIGINT},
in_out_item_id = #{inOutItemId,jdbcType=BIGINT},
bill_id = #{billId,jdbcType=BIGINT},
each_amount = #{eachAmount,jdbcType=DECIMAL},
remark = #{remark,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},

View File

@@ -5,6 +5,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap" id="ResultWithInfoExMap" type="com.jsh.erp.datasource.vo.AccountItemVo4List">
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
<result column="InOutItemName" jdbcType="VARCHAR" property="inOutItemName" />
<result column="billNumber" jdbcType="VARCHAR" property="billNumber" />
</resultMap>
<select id="selectByConditionAccountItem" parameterType="com.jsh.erp.datasource.entities.AccountItemExample" resultMap="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap">
@@ -47,9 +48,10 @@
</select>
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.AccountItemExample" resultMap="ResultWithInfoExMap">
select ai.*,a.Name AccountName,ioi.Name InOutItemName
select ai.*,a.Name AccountName,ioi.Name InOutItemName, dh.number billNumber
from jsh_account_item ai left join jsh_account a on ai.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
left join jsh_in_out_item ioi on ai.in_out_item_id = ioi.id and ifnull(ioi.delete_Flag,'0') !='1'
left join jsh_depot_head dh on ai.bill_id = dh.id and ifnull(dh.delete_Flag,'0') !='1'
where ai.header_id = #{headerId}
and ifnull(ai.delete_flag,'0') !='1'
order by ai.id asc

View File

@@ -14,7 +14,7 @@
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/jsh_erp_boot?generateSimpleParameterMetadata=true"
connectionURL="jdbc:mysql://localhost:3306/jsh_erp?generateSimpleParameterMetadata=true"
userId="root" password="123456">
</jdbcConnection>