提交 6a6662b0 编写于 作者: doc_wei's avatar doc_wei

记账支出整改

上级 df0751f2
......@@ -4,36 +4,16 @@
package com.skyeye.dao;
import java.util.List;
import java.util.Map;
/**
* @Author: 卫志强
* @Description: TODO
* @Date: 2019/10/20 10:23
*
* @ClassName: ExpenditureDao
* @Description: 记账支出数据接口层
* @author: skyeye云系列--卫志强
* @date: 2021/11/30 21:40
*
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface ExpenditureDao {
public int insertExpenditure(Map<String, Object> params) throws Exception;
public int insertExpenditureItem(List<Map<String, Object>> entitys) throws Exception;
public Map<String, Object> queryExpenditureToEditById(Map<String, Object> params) throws Exception;
public int editExpenditureById(Map<String, Object> params) throws Exception;
public int editExpenditureByDeleteFlag(Map<String, Object> params) throws Exception;
public Map<String, Object> queryExpenditureDetailById(Map<String, Object> params) throws Exception;
public List<Map<String, Object>> queryExpenditureItemsDetailById(Map<String, Object> bean) throws Exception;
public List<Map<String, Object>> queryExpenditureItemsToEditById(Map<String, Object> params) throws Exception;
public int editExpenditureItemsByDeleteFlag(Map<String, Object> params) throws Exception;
public int deleteExpenditureItemById(Map<String, Object> params) throws Exception;
public List<Map<String, Object>> queryMationToExcel(Map<String, Object> params) throws Exception;
}
......@@ -4,6 +4,8 @@
package com.skyeye.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -26,4 +28,80 @@ public interface IfsCommonDao {
*/
List<Map<String, Object>> queryIfsOrderList(Map<String, Object> params) throws Exception;
/**
* 插入财务单据信息
*
* @param orderMation
* @throws Exception
*/
void insertIfsOrderMation(Map<String, Object> orderMation) throws Exception;
/**
* 插入财务单据关联信息
*
* @param entitys
* @throws Exception
*/
void insertIfsOrderItemMation(List<Map<String, Object>> entitys) throws Exception;
/**
* 根据订单id获取订单信息用来编辑
*
* @param orderId 订单id
* @return 订单信息
* @throws Exception
*/
Map<String, Object> queryIfsOrderMationToEditById(@Param("orderId") String orderId) throws Exception;
/**
* 根据订单id获取订单关联信息用来编辑
*
* @param orderId 订单id
* @return 订单关联信息
* @throws Exception
*/
List<Map<String, Object>> queryIfsOrderItemMationToEditById(@Param("orderId") String orderId) throws Exception;
/**
* 修改财务单据信息
*
* @param orderMation
* @throws Exception
*/
void editIfsOrderMation(Map<String, Object> orderMation) throws Exception;
/**
* 插入财务订单相关单据信息
*
* @param orderId 订单id
* @throws Exception
*/
void deleteIfsOrderItemMationByOrderId(@Param("orderId") String orderId) throws Exception;
/**
* 删除单据信息
*
* @param orderId 订单id
* @throws Exception
*/
void deleteIfsOrderMationById(@Param("orderId") String orderId) throws Exception;
/**
* 根据订单id获取订单信息
*
* @param orderId 订单id
* @return 订单信息
* @throws Exception
*/
Map<String, Object> queryIfsOrderMationDetailsById(@Param("orderId") String orderId) throws Exception;
/**
* 根据订单id获取订单关联信息
*
* @param orderId 订单id
* @return 订单关联信息
* @throws Exception
*/
List<Map<String, Object>> queryIfsOrderItemMationDetailsById(@Param("orderId") String orderId) throws Exception;
}
......@@ -4,15 +4,22 @@
package com.skyeye.factory;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.skyeye.common.constans.ErpConstants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.SpringUtils;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.dao.IfsCommonDao;
import com.skyeye.eve.dao.SysEveUserStaffDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -30,6 +37,8 @@ public abstract class IfsOrderFactory {
protected IfsCommonDao ifsCommonDao;
protected SysEveUserStaffDao sysEveUserStaffDao;
protected InputObject inputObject;
protected OutputObject outputObject;
......@@ -55,6 +64,7 @@ public abstract class IfsOrderFactory {
*/
protected void initObject(){
ifsCommonDao = SpringUtils.getBean(IfsCommonDao.class);
sysEveUserStaffDao = SpringUtils.getBean(SysEveUserStaffDao.class);
}
/**
......@@ -89,7 +99,32 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
public void insertOrderMation() throws Exception {
Map<String, Object> params = inputObject.getParams();
// 财务主表ID
String orderId = ToolUtil.getSurFaceId();
// 财务子表实体集合信息
List<Map<String, Object>> entitys = new ArrayList<>();
BigDecimal allPrice = getAllPriceAndChildList(orderId, params.get("initemStr").toString(), entitys);
if(entitys.size() == 0){
outputObject.setreturnMessage("请选择支出项目");
return;
}
Map<String, Object> accountHead = new HashMap<>();
String orderNum = ErpConstants.DepoTheadSubType.getOrderNumBySubType(orderType);
accountHead.put("id", orderId);
accountHead.put("type", orderType);
accountHead.put("billNo", orderNum);
accountHead.put("totalPrice", allPrice);
accountHead.put("organId", params.get("organId"));
accountHead.put("operTime", params.get("operTime"));
accountHead.put("accountId", params.get("accountId"));
accountHead.put("handsPersonId", params.get("handsPersonId"));
accountHead.put("remark", params.get("remark"));
accountHead.put("changeAmount", params.get("changeAmount"));
accountHead.put("deleteFlag", 0);
ifsCommonDao.insertIfsOrderMation(accountHead);
ifsCommonDao.insertIfsOrderItemMation(entitys);
this.insertOrderOtherMation(params, orderId);
}
/**
......@@ -102,6 +137,28 @@ public abstract class IfsOrderFactory {
protected void insertOrderOtherMation(Map<String, Object> inputParams, String orderId) throws Exception{
}
private BigDecimal getAllPriceAndChildList(String orderId, String itemStr, List<Map<String, Object>> entitys) {
List<Map<String, Object>> jArray = JSONUtil.toList(itemStr, null);
// 主单总价
BigDecimal allPrice = new BigDecimal("0");
for(int i = 0; i < jArray.size(); i++){
Map<String, Object> bean = jArray.get(i);
Map<String, Object> entity = new HashMap<>();
// 获取子项金额
BigDecimal itemAllPrice = new BigDecimal(bean.get("initemMoney").toString());
entity.put("id", ToolUtil.getSurFaceId());
entity.put("headerId", orderId);
entity.put("inOutItemId", bean.get("initemId"));
entity.put("eachAmount", bean.get("initemMoney"));
entity.put("remark", bean.get("remark"));
entity.put("deleteFlag", 0);
entitys.add(entity);
// 计算总金额
allPrice = allPrice.add(itemAllPrice);
}
return allPrice;
}
/**
* 编辑时获取订单数据进行回显
*
......@@ -109,8 +166,21 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
public Map<String, Object> queryOrderMationToEditById() throws Exception{
return null;
Map<String, Object> params = inputObject.getParams();
String orderId = params.get("id").toString();
Map<String, Object> bean = ifsCommonDao.queryIfsOrderMationToEditById(orderId);
if(bean != null && !bean.isEmpty()){
List<Map<String, Object>> beans = ifsCommonDao.queryIfsOrderItemMationToEditById(orderId);
bean.put("items", beans);
// 获取经手人员
bean.put("userInfo", sysEveUserStaffDao.queryUserNameList(bean.get("handsPersonId").toString()));
this.quertOrderOtherMationToEditById(bean, orderId);
outputObject.setBean(bean);
outputObject.settotal(1);
}else{
outputObject.setreturnMessage("未查询到信息!");
}
return bean;
}
/**
......@@ -121,7 +191,6 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
protected void quertOrderOtherMationToEditById(Map<String, Object> bean, String orderId) throws Exception{
}
/**
......@@ -130,7 +199,29 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
public void editOrderMationById() throws Exception{
Map<String, Object> params = inputObject.getParams();
String orderId = params.get("id").toString();
// 财务子表实体集合信息
List<Map<String, Object>> entitys = new ArrayList<>();
BigDecimal allPrice = getAllPriceAndChildList(orderId, params.get("initemStr").toString(), entitys);
if(entitys.size() == 0){
outputObject.setreturnMessage("请选择支出项目");
return;
}
Map<String, Object> accountHead = new HashMap<>();
accountHead.put("id", orderId);
accountHead.put("totalPrice", allPrice);
accountHead.put("organId", params.get("organId"));
accountHead.put("operTime", params.get("operTime"));
accountHead.put("accountId", params.get("accountId"));
accountHead.put("handsPersonId", params.get("handsPersonId"));
accountHead.put("remark", params.get("remark"));
accountHead.put("changeAmount", params.get("changeAmount"));
ifsCommonDao.editIfsOrderMation(accountHead);
// 删除之前的绑定信息
ifsCommonDao.deleteIfsOrderItemMationByOrderId(orderId);
ifsCommonDao.insertIfsOrderItemMation(entitys);
this.editOrderOtherMationById(params, orderId);
}
/**
......@@ -141,7 +232,6 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
protected void editOrderOtherMationById(Map<String, Object> inputParams, String orderId) throws Exception{
}
/**
......@@ -150,7 +240,13 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
public void deleteOrderMationById() throws Exception{
Map<String, Object> params = inputObject.getParams();
String orderId = params.get("id").toString();
// 删除订单信息
ifsCommonDao.deleteIfsOrderMationById(orderId);
// 删除绑定信息
ifsCommonDao.deleteIfsOrderItemMationByOrderId(orderId);
this.deleteOrderOtherMationById(params);
}
/**
......@@ -160,7 +256,38 @@ public abstract class IfsOrderFactory {
* @throws Exception
*/
protected void deleteOrderOtherMationById(Map<String, Object> orderMation) throws Exception{
}
/**
* 获取订单详情
*
* @throws Exception
*/
public Map<String, Object> queryOrderMationDetailsById() throws Exception{
Map<String, Object> params = inputObject.getParams();
String orderId = params.get("id").toString();
// 获取财务主表信息
Map<String, Object> bean = ifsCommonDao.queryIfsOrderMationDetailsById(orderId);
if(bean != null && !bean.isEmpty()){
// 获取子表信息
List<Map<String, Object>> beans = ifsCommonDao.queryIfsOrderItemMationDetailsById(orderId);
bean.put("items", beans);
this.queryOrderOtherDetailsMationById(bean);
outputObject.setBean(bean);
outputObject.settotal(1);
}else{
outputObject.setreturnMessage("该数据已不存在.");
}
return bean;
}
/**
* 获取订单详情时,操作其他数据
*
* @param orderMation 订单信息
* @throws Exception
*/
protected void queryOrderOtherDetailsMationById(Map<String, Object> orderMation) throws Exception{
}
/**
......
......@@ -53,6 +53,13 @@ public interface IfsOrderFactoryResult {
*/
void deleteOrderMationById() throws Exception;
/**
* 获取订单详情
*
* @throws Exception
*/
Map<String, Object> queryOrderMationDetailsById() throws Exception;
/**
* 单据提交审核
*
......
......@@ -4,23 +4,17 @@
package com.skyeye.service.impl;
import cn.hutool.json.JSONUtil;
import com.skyeye.common.constans.ErpConstants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ExcelUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.dao.ExpenditureDao;
import com.skyeye.eve.dao.SysEveUserStaffDao;
import com.skyeye.factory.IfsOrderRunFactory;
import com.skyeye.service.ExpenditureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -39,9 +33,6 @@ public class ExpenditureServiceImpl implements ExpenditureService {
@Autowired
private ExpenditureDao expenditureDao;
@Autowired
private SysEveUserStaffDao sysEveUserStaffDao;
/**
* 记账支出类型
......@@ -68,53 +59,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
@Override
@Transactional(value="transactionManager")
public void insertExpenditure(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
// 财务主表ID
String useId = ToolUtil.getSurFaceId();
// 财务子表实体集合信息
List<Map<String, Object>> entitys = new ArrayList<>();
BigDecimal allPrice = getAllPriceAndChildList(useId, params.get("initemStr").toString(), entitys);
if(entitys.size() == 0){
outputObject.setreturnMessage("请选择支出项目");
return;
}
Map<String, Object> accountHead = new HashMap<>();
String orderNum = ErpConstants.DepoTheadSubType.getOrderNumBySubType(ORDER_TYPE);
accountHead.put("id", useId);
accountHead.put("type", ORDER_TYPE);//记账支出
accountHead.put("billNo", orderNum);
accountHead.put("totalPrice", allPrice);
accountHead.put("organId", params.get("organId"));
accountHead.put("operTime", params.get("operTime"));
accountHead.put("accountId", params.get("accountId"));
accountHead.put("handsPersonId", params.get("handsPersonId"));
accountHead.put("remark", params.get("remark"));
accountHead.put("changeAmount", params.get("changeAmount"));
accountHead.put("deleteFlag", 0);
expenditureDao.insertExpenditure(accountHead);
expenditureDao.insertExpenditureItem(entitys);
}
private BigDecimal getAllPriceAndChildList(String useId, String initemStr, List<Map<String, Object>> entitys) {
List<Map<String, Object>> jArray = JSONUtil.toList(initemStr, null);
// 主单总价
BigDecimal allPrice = new BigDecimal("0");
for(int i = 0; i < jArray.size(); i++){
Map<String, Object> bean = jArray.get(i);
Map<String, Object> entity = new HashMap<>();
// 获取子项金额
BigDecimal itemAllPrice = new BigDecimal(bean.get("initemMoney").toString());
entity.put("id", ToolUtil.getSurFaceId());
entity.put("headerId", useId);
entity.put("inOutItemId", bean.get("initemId"));
entity.put("eachAmount", bean.get("initemMoney"));
entity.put("remark", bean.get("remark"));
entity.put("deleteFlag", 0);
entitys.add(entity);
// 计算总金额
allPrice = allPrice.add(itemAllPrice);
}
return allPrice;
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).insertOrderMation();
}
/**
......@@ -125,18 +70,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
*/
@Override
public void queryExpenditureToEditById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
Map<String, Object> bean = expenditureDao.queryExpenditureToEditById(params);
if(bean != null && !bean.isEmpty()){
List<Map<String, Object>> beans = expenditureDao.queryExpenditureItemsToEditById(params);
bean.put("items", beans);
// 获取经手人员
bean.put("userInfo", sysEveUserStaffDao.queryUserNameList(bean.get("handsPersonId").toString()));
outputObject.setBean(bean);
outputObject.settotal(1);
}else{
outputObject.setreturnMessage("未查询到信息!");
}
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).queryOrderMationToEditById();
}
/**
......@@ -148,28 +82,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
@Override
@Transactional(value="transactionManager")
public void editExpenditureById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
String useId = params.get("id").toString();
// 财务子表实体集合信息
List<Map<String, Object>> entitys = new ArrayList<>();
BigDecimal allPrice = getAllPriceAndChildList(useId, params.get("initemStr").toString(), entitys);
if(entitys.size() == 0){
outputObject.setreturnMessage("请选择支出项目");
return;
}
Map<String, Object> accountHead = new HashMap<>();
accountHead.put("id", useId);
accountHead.put("totalPrice", allPrice);
accountHead.put("organId", params.get("organId"));
accountHead.put("operTime", params.get("operTime"));
accountHead.put("accountId", params.get("accountId"));
accountHead.put("handsPersonId", params.get("handsPersonId"));
accountHead.put("remark", params.get("remark"));
accountHead.put("changeAmount", params.get("changeAmount"));
expenditureDao.editExpenditureById(accountHead);
// 删除之前的绑定信息
expenditureDao.deleteExpenditureItemById(params);
expenditureDao.insertExpenditureItem(entitys);
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).editOrderMationById();
}
/**
......@@ -181,10 +94,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
@Override
@Transactional(value="transactionManager")
public void deleteExpenditureById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("deleteFlag", 1);
expenditureDao.editExpenditureByDeleteFlag(params);
expenditureDao.editExpenditureItemsByDeleteFlag(params);
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).deleteOrderMationById();
}
/**
......@@ -195,18 +105,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
*/
@Override
public void queryExpenditureByDetail(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
// 获取财务主表信息
Map<String, Object> bean = expenditureDao.queryExpenditureDetailById(params);
if(bean != null && !bean.isEmpty()){
// 获取子表信息
List<Map<String, Object>> beans = expenditureDao.queryExpenditureItemsDetailById(bean);
bean.put("items", beans);
outputObject.setBean(bean);
outputObject.settotal(1);
}else{
outputObject.setreturnMessage("该数据已不存在.");
}
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).queryOrderMationDetailsById();
}
/**
......@@ -217,9 +116,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
*/
@Override
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("type", ORDER_TYPE);
List<Map<String, Object>> beans = expenditureDao.queryMationToExcel(params);
List<Map<String, Object>> beans = IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).queryOrderList();
String[] key = new String[]{"billNo", "supplierName", "totalPrice", "hansPersonName", "billTime"};
String[] column = new String[]{"单据编号", "往来单位", "合计金额", "经手人", "单据日期"};
String[] dataType = new String[]{"", "data", "data", "data", "data"};
......
......@@ -71,7 +71,6 @@ public class IncomeServiceImpl implements IncomeService {
* @param outputObject
* @throws Exception
*/
@SuppressWarnings("unchecked")
@Override
@Transactional(value="transactionManager")
public void insertIncome(InputObject inputObject, OutputObject outputObject) throws Exception {
......
......@@ -2,156 +2,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.dao.ExpenditureDao">
<insert id="insertExpenditure" parameterType="java.util.Map">
INSERT INTO erp_accounthead(
id, type, organ_id, hands_person_id, change_amount, total_price, account_id, bill_no, bill_time, remark, delete_flag
) VALUES
(#{id}, #{type}, #{organId}, #{handsPersonId}, #{changeAmount}, #{totalPrice}, #{accountId}, #{billNo}, #{operTime}, #{remark}, #{deleteFlag})
</insert>
<insert id="insertExpenditureItem" parameterType="java.util.Map">
INSERT INTO erp_accountitem(
id, header_id, in_out_item_id, each_amount, remark, delete_flag
) VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.headerId}, #{item.inOutItemId}, #{item.eachAmount}, #{item.remark}, #{item.deleteFlag})
</foreach>
</insert>
<select id="queryExpenditureToEditById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.type payType,
a.organ_id organId,
a.hands_person_id handsPersonId,
CONVERT(a.change_amount, decimal(24, 2)) changeAmount,
CONVERT(a.total_price, decimal(24, 2)) totalPrice,
a.account_id accountId,
a.bill_no billNo,
CONVERT (a.bill_time, char) billTime,
a.remark,
s.supplier supplierName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
WHERE
a.id = #{id}
AND a.delete_flag = '0'
ORDER BY a.bill_time DESC
</select>
<select id="queryExpenditureItemsToEditById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.in_out_item_id initemId,
CONVERT(a.each_amount , decimal(24, 2)) initemMoney,
a.remark
FROM
erp_accountitem a
WHERE
a.header_id = #{id}
</select>
<update id="editExpenditureById" parameterType="java.util.Map">
UPDATE erp_accounthead
<set>
organ_id = #{organId},
hands_person_id = #{handsPersonId},
change_amount = #{changeAmount},
total_price = #{totalPrice},
account_id = #{accountId},
bill_time = #{operTime},
remark = #{remark}
</set>
WHERE
id = #{id}
</update>
<delete id="deleteExpenditureItemById" parameterType="java.util.Map">
DELETE
FROM
erp_accountitem
WHERE
header_id = #{id}
</delete>
<update id="editExpenditureByDeleteFlag" parameterType="java.util.Map">
UPDATE erp_accounthead
<set>
delete_flag = #{deleteFlag}
</set>
WHERE
id = #{id}
</update>
<update id="editExpenditureItemsByDeleteFlag" parameterType="java.util.Map">
UPDATE erp_accountitem
<set>
delete_flag = #{deleteFlag}
</set>
WHERE
header_id = #{id}
</update>
<select id="queryExpenditureDetailById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
FORMAT(a.change_amount, 2) changeAmount,
FORMAT(a.total_price, 2) totalPrice,
a.bill_no billNo,
CONVERT (a.bill_time, CHAR) operTime,
a.remark,
s.supplier supplierName,
group_concat(distinct b.user_name) hansPersonName,
t.`name` accountName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
LEFT JOIN erp_account t ON a.account_id = t.id
LEFT JOIN sys_eve_user_staff b ON INSTR(CONCAT(',', a.hands_person_id, ','), CONCAT(',', b.user_id, ','))
WHERE
a.delete_flag = '0'
AND a.id = #{id}
ORDER BY a.bill_time DESC
</select>
<select id="queryExpenditureItemsDetailById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
FORMAT(a.each_amount, 2) eachAmount,
a.remark,
c.`name` inoutitemName
FROM
erp_accountitem a
LEFT JOIN erp_inoutitem c ON a.in_out_item_id = c.id
WHERE
a.header_id = #{id}
AND a.delete_flag = '0'
</select>
<select id="queryMationToExcel" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.change_amount changeAmount,
FORMAT(a.total_price, 2) totalPrice,
a.bill_no billNo,
CONVERT (a.bill_time, CHAR) billTime,
(SELECT group_concat(distinct m.user_name) FROM sys_eve_user_staff m WHERE INSTR(CONCAT(',', a.hands_person_id, ','), CONCAT(',', m.user_id, ','))) hansPersonName,
a.remark,
s.supplier supplierName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
WHERE
a.delete_flag = '0'
AND a.type = #{type}
<if test="billNo != '' and billNo != null">
AND a.bill_no LIKE '%${billNo}%'
</if>
<if test="startTime != '' and startTime != null and endTime != '' and endTime != null">
AND a.bill_time >= #{startTime} AND #{endTime} >= a.bill_time
</if>
ORDER BY a.bill_time DESC, a.id ASC
</select>
</mapper>
\ No newline at end of file
......@@ -23,7 +23,124 @@
<if test="startTime != '' and startTime != null and endTime != '' and endTime != null">
AND a.bill_time >= #{startTime} AND #{endTime} >= a.bill_time
</if>
ORDER BY a.bill_time DESC, a.id ASC
ORDER BY a.bill_time DESC
</select>
<insert id="insertIfsOrderMation" parameterType="java.util.Map">
INSERT INTO erp_accounthead
(id, type, organ_id, hands_person_id, change_amount, total_price, account_id, bill_no, bill_time, remark, delete_flag)
VALUES
(#{id}, #{type}, #{organId}, #{handsPersonId}, #{changeAmount}, #{totalPrice}, #{accountId}, #{billNo}, #{operTime}, #{remark}, #{deleteFlag})
</insert>
<insert id="insertIfsOrderItemMation" parameterType="java.util.Map">
INSERT INTO erp_accountitem
(id, header_id, in_out_item_id, each_amount, remark, delete_flag)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.headerId}, #{item.inOutItemId}, #{item.eachAmount}, #{item.remark}, #{item.deleteFlag})
</foreach>
</insert>
<select id="queryIfsOrderMationToEditById" resultType="java.util.Map">
SELECT
a.id,
a.type payType,
a.organ_id organId,
a.hands_person_id handsPersonId,
CONVERT(a.change_amount, decimal(24, 2)) changeAmount,
CONVERT(a.total_price, decimal(24, 2)) totalPrice,
a.account_id accountId,
a.bill_no billNo,
CONVERT (a.bill_time, char) billTime,
a.remark,
s.supplier supplierName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
WHERE
a.id = #{orderId}
AND a.delete_flag = '0'
ORDER BY a.bill_time DESC
</select>
<select id="queryIfsOrderItemMationToEditById" resultType="java.util.Map">
SELECT
a.id,
a.in_out_item_id initemId,
CONVERT(a.each_amount , decimal(24, 2)) initemMoney,
a.remark
FROM
erp_accountitem a
WHERE
a.header_id = #{orderId}
</select>
<update id="editIfsOrderMation" parameterType="java.util.Map">
UPDATE erp_accounthead
<set>
organ_id = #{organId},
hands_person_id = #{handsPersonId},
change_amount = #{changeAmount},
total_price = #{totalPrice},
account_id = #{accountId},
bill_time = #{operTime},
remark = #{remark}
</set>
WHERE
id = #{id}
</update>
<delete id="deleteIfsOrderMationById">
DELETE
FROM
erp_accounthead
WHERE
id = #{orderId}
</delete>
<delete id="deleteIfsOrderItemMationByOrderId">
DELETE
FROM
erp_accountitem
WHERE
header_id = #{orderId}
</delete>
<select id="queryIfsOrderMationDetailsById" resultType="java.util.Map">
SELECT
a.id,
FORMAT(a.change_amount, 2) changeAmount,
FORMAT(a.total_price, 2) totalPrice,
a.bill_no billNo,
CONVERT (a.bill_time, CHAR) operTime,
a.remark,
s.supplier supplierName,
group_concat(distinct b.user_name) hansPersonName,
t.`name` accountName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
LEFT JOIN erp_account t ON a.account_id = t.id
LEFT JOIN sys_eve_user_staff b ON INSTR(CONCAT(',', a.hands_person_id, ','), CONCAT(',', b.user_id, ','))
WHERE
a.delete_flag = '0'
AND a.id = #{orderId}
ORDER BY a.bill_time DESC
</select>
<select id="queryIfsOrderItemMationDetailsById" resultType="java.util.Map">
SELECT
a.id,
FORMAT(a.each_amount, 2) eachAmount,
a.remark,
c.`name` inoutitemName
FROM
erp_accountitem a
LEFT JOIN erp_inoutitem c ON a.in_out_item_id = c.id
WHERE
a.header_id = #{orderId}
AND a.delete_flag = '0'
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册