提交 3d672a8b 编写于 作者: doc_wei's avatar doc_wei

财务模块修改为工厂类完成第一步

上级 43c87c11
......@@ -97,12 +97,14 @@ public class ErpConstants {
PICK_RETURN("退料单", "TLDD", "21", "", "", 0, true, null),
/*****************************财务模块********************************/
EXPENDITURE_ORDER("支出订单", "CWZCDD", "22", "", "", 0, true, null),
EXPENDITURE_ORDER("支出订单", "CWZCDD", "22", "com.skyeye.factory.impl.ExpenditureFactory",
"", 0, true, null),
INCOME_ORDER("收入订单", "CWSRDD", "23", "", "", 0, true, null),
RECEIVABLES_ORDER("收款订单", "CWSKDD", "24", "", "", 0, true, null),
PAYMENT_ORDER("付款订单", "CWFKDD", "25", "", "", 0, true, null),
TRANSFER_ORDER("转账订单", "CWZZDD", "26", "", "", 0, true, null),
ADVANCE_ORDER("收预付款", "CWYFDD", "27", "", "", 0, true, null);
ADVANCE_ORDER("收预付款", "CWYFDD", "27", "com.skyeye.factory.impl.AdvanceChargeFactory",
"", 0, true, null);
// 单据标题
private String title;
......
......@@ -9,7 +9,7 @@ import java.util.Map;
/**
* @ClassName: ErpOrderFactoryResult
* @Description:
* @Description: ERP进销存模块
* @author: skyeye云系列--卫志强
* @date: 2021/7/9 22:16
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
......
......@@ -12,7 +12,7 @@ import java.lang.reflect.Constructor;
/**
* @ClassName: ErpRunFactory
* @Description:
* @Description: ERP进销存模块启动工厂类
* @author: skyeye云系列--卫志强
* @date: 2021/7/9 20:21
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
......
......@@ -19,8 +19,6 @@ import java.util.Map;
*/
public interface AdvanceChargeDao {
public List<Map<String, Object>> queryAdvanceChargeByList(Map<String, Object> params) throws Exception;
public int insertAdvanceCharge(Map<String, Object> params) throws Exception;
public int insertAdvanceChargeItem(List<Map<String, Object>> entitys) throws Exception;
......
......@@ -14,8 +14,6 @@ import java.util.Map;
*/
public interface ExpenditureDao {
public List<Map<String, Object>> queryExpenditureByList(Map<String, Object> params) throws Exception;
public int insertExpenditure(Map<String, Object> params) throws Exception;
public int insertExpenditureItem(List<Map<String, Object>> entitys) throws Exception;
......
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.dao;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IfsCommonDao
* @Description: 财务模块公共部分
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 23:21
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface IfsCommonDao {
/**
* 根据条件查询单据列表
*
* @param params 条件参数
* @return 单据列表
* @throws Exception
*/
List<Map<String, Object>> queryIfsOrderList(Map<String, Object> params) throws Exception;
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.factory;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.SpringUtils;
import com.skyeye.dao.IfsCommonDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IfsOrderFactory
* @Description: IFS单据工厂类
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 22:51
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public abstract class IfsOrderFactory {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected IfsCommonDao ifsCommonDao;
protected InputObject inputObject;
protected OutputObject outputObject;
/**
* 单据类型
*/
protected String orderType;
protected IfsOrderFactory(String orderType) {
this.orderType = orderType;
}
protected IfsOrderFactory(InputObject inputObject, OutputObject outputObject, String orderType) {
this.orderType = orderType;
this.inputObject = inputObject;
this.outputObject = outputObject;
this.initObject();
}
/**
* 初始化数据
*/
protected void initObject(){
ifsCommonDao = SpringUtils.getBean(IfsCommonDao.class);
}
/**
* 获取订单列表
*
* @throws Exception
*/
public List<Map<String, Object>> queryOrderList() throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("orderType", orderType);
// 获取分页信息
Page pages = PageHelper.startPage(Integer.parseInt(params.get("page").toString()), Integer.parseInt(params.get("limit").toString()));
List<Map<String, Object>> result = this.queryOrderListSqlRun(params);
outputObject.setBeans(result);
outputObject.settotal(pages.getTotal());
return result;
}
/**
* 获取订单列表的执行sql
*
* @param params 入参
* @return 订单列表
*/
protected List<Map<String, Object>> queryOrderListSqlRun(Map<String, Object> params) throws Exception {
return ifsCommonDao.queryIfsOrderList(params);
}
/**
* 新增订单数据
*
* @throws Exception
*/
public void insertOrderMation() throws Exception {
}
/**
* 新增订单时操作其他数据
*
* @param inputParams 前台传递的参数
* @param orderId 订单id
* @throws Exception
*/
protected void insertOrderOtherMation(Map<String, Object> inputParams, String orderId) throws Exception{
}
/**
* 编辑时获取订单数据进行回显
*
* @return 订单数据
* @throws Exception
*/
public Map<String, Object> queryOrderMationToEditById() throws Exception{
return null;
}
/**
* 编辑时获取订单数据进行回显时,获取其他数据
*
* @param bean 单据信息
* @param orderId 订单id
* @throws Exception
*/
protected void quertOrderOtherMationToEditById(Map<String, Object> bean, String orderId) throws Exception{
}
/**
* 编辑订单数据
*
* @throws Exception
*/
public void editOrderMationById() throws Exception{
}
/**
* 编辑订单数据时,进行其他操作
*
* @param inputParams 前台传递的入参
* @param orderId 订单id
* @throws Exception
*/
protected void editOrderOtherMationById(Map<String, Object> inputParams, String orderId) throws Exception{
}
/**
* 删除订单数据
*
* @throws Exception
*/
public void deleteOrderMationById() throws Exception{
}
/**
* 删除订单数据,操作其他数据
*
* @param orderMation 订单信息
* @throws Exception
*/
protected void deleteOrderOtherMationById(Map<String, Object> orderMation) throws Exception{
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.factory;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IfsOrderFactoryResult
* @Description: IFS财务模块
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 22:51
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface IfsOrderFactoryResult {
/**
* 获取订单列表
*
* @throws Exception
*/
List<Map<String, Object>> queryOrderList() throws Exception;
/**
* 新增订单数据
*
* @throws Exception
*/
void insertOrderMation() throws Exception;
/**
* 编辑时获取订单数据进行回显
*
* @return 订单数据
* @throws Exception
*/
Map<String, Object> queryOrderMationToEditById() throws Exception;
/**
* 编辑订单数据
*
* @throws Exception
*/
void editOrderMationById() throws Exception;
/**
* 删除订单数据
*
* @throws Exception
*/
void deleteOrderMationById() throws Exception;
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.factory;
import com.skyeye.common.constans.ErpConstants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import java.lang.reflect.Constructor;
/**
* @ClassName: IfsOrderRunFactory
* @Description: IFS财务模块启动工厂类
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 22:52
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public class IfsOrderRunFactory {
public static IfsOrderFactoryResult run(InputObject inputObject, OutputObject outputObject, String orderType) {
try {
String classPath = ErpConstants.DepoTheadSubType.getFactoryClassPath(orderType);
Class<?> clazz = Class.forName(classPath);
Constructor<?> constructor = clazz.getConstructor(InputObject.class, OutputObject.class, String.class);
return (IfsOrderFactoryResult) constructor.newInstance(inputObject, outputObject, orderType);
} catch (Exception ex) {
throw new RuntimeException("ErpRunFactory error", ex);
}
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.factory.impl;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.factory.IfsOrderFactory;
import com.skyeye.factory.IfsOrderFactoryResult;
/**
* @ClassName: AdvanceChargeFactory
* @Description: 收预付款服务工厂类
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 23:09
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public class AdvanceChargeFactory extends IfsOrderFactory implements IfsOrderFactoryResult {
public AdvanceChargeFactory(InputObject inputObject, OutputObject outputObject, String orderType) {
super(inputObject, outputObject, orderType);
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.factory.impl;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.factory.IfsOrderFactory;
import com.skyeye.factory.IfsOrderFactoryResult;
/**
* @ClassName: ExpenditureFactory
* @Description: 支出单服务工厂类
* @author: skyeye云系列--卫志强
* @date: 2021/11/28 23:42
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public class ExpenditureFactory extends IfsOrderFactory implements IfsOrderFactoryResult {
public ExpenditureFactory(InputObject inputObject, OutputObject outputObject, String orderType) {
super(inputObject, outputObject, orderType);
}
}
......@@ -5,8 +5,6 @@
package com.skyeye.service.impl;
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;
......@@ -14,6 +12,7 @@ import com.skyeye.common.util.ExcelUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.dao.AdvanceChargeDao;
import com.skyeye.eve.dao.SysEveUserStaffDao;
import com.skyeye.factory.IfsOrderRunFactory;
import com.skyeye.service.AdvanceChargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -51,18 +50,14 @@ public class AdvanceChargeServiceImpl implements AdvanceChargeService {
/**
* 查询收预付款列表信息
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
@Override
public void queryAdvanceChargeByList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("type", ORDER_TYPE);
Page pages = PageHelper.startPage(Integer.parseInt(params.get("page").toString()), Integer.parseInt(params.get("limit").toString()));
List<Map<String, Object>> beans = advanceChargeDao.queryAdvanceChargeByList(params);
outputObject.setBeans(beans);
outputObject.settotal(pages.getTotal());
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).queryOrderList();
}
/**
......
......@@ -5,8 +5,6 @@
package com.skyeye.service.impl;
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;
......@@ -14,6 +12,7 @@ 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;
......@@ -57,12 +56,7 @@ public class ExpenditureServiceImpl implements ExpenditureService {
*/
@Override
public void queryExpenditureByList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("type", ORDER_TYPE);
Page pages = PageHelper.startPage(Integer.parseInt(params.get("page").toString()), Integer.parseInt(params.get("limit").toString()));
List<Map<String, Object>> beans = expenditureDao.queryExpenditureByList(params);
outputObject.setBeans(beans);
outputObject.settotal(pages.getTotal());
IfsOrderRunFactory.run(inputObject, outputObject, ORDER_TYPE).queryOrderList();
}
/**
......
......@@ -2,31 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.dao.AdvanceChargeDao">
<select id="queryAdvanceChargeByList" 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>
<insert id="insertAdvanceCharge" 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
......
......@@ -2,31 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.dao.ExpenditureDao">
<select id="queryExpenditureByList" 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>
<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
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.dao.IfsCommonDao">
<select id="queryIfsOrderList" 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 = #{orderType}
<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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册