From 56cc93b59a9728e83308d7fb50d4b21d011c698a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 5 Sep 2021 20:25:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E6=89=80=E6=9C=89=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E9=83=BD=E5=A2=9E=E5=8A=A0=E5=AE=A1=E6=A0=B8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-boot/docs/jsh_erp.sql | 55 +++++---- .../docs/数据库更新记录-首次安装请勿使用.txt | 10 +- .../jsh/erp/constants/ExceptionConstants.java | 6 + .../erp/controller/AccountHeadController.java | 23 ++++ .../erp/datasource/entities/AccountHead.java | 10 ++ .../entities/AccountHeadExample.java | 70 +++++++++++ .../accountHead/AccountHeadService.java | 64 +++++++--- .../service/depotHead/DepotHeadService.java | 109 ++++++++---------- .../mapper_xml/AccountHeadMapper.xml | 25 +++- 9 files changed, 262 insertions(+), 110 deletions(-) diff --git a/jshERP-boot/docs/jsh_erp.sql b/jshERP-boot/docs/jsh_erp.sql index bd6510a8..d74324ae 100644 --- a/jshERP-boot/docs/jsh_erp.sql +++ b/jshERP-boot/docs/jsh_erp.sql @@ -56,6 +56,7 @@ CREATE TABLE `jsh_account_head` ( `bill_time` datetime DEFAULT NULL COMMENT '单据日期', `remark` varchar(100) DEFAULT NULL COMMENT '备注', `file_name` varchar(500) DEFAULT NULL COMMENT '附件名称', + `status` varchar(1) DEFAULT NULL COMMENT '状态,0未审核、1已审核', `tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id', `delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记,0未删除,1删除', PRIMARY KEY (`id`), @@ -67,12 +68,12 @@ CREATE TABLE `jsh_account_head` ( -- ---------------------------- -- Records of jsh_account_head -- ---------------------------- -INSERT INTO `jsh_account_head` VALUES ('118', '收入', '58', '16', '63', '55.000000', null, '55.000000', '17', 'SR00000000643', '2021-06-02 00:24:49', null, null, '63', '0'); -INSERT INTO `jsh_account_head` VALUES ('119', '支出', '68', '16', '63', '66.000000', null, '66.000000', '17', 'ZC00000000644', '2021-06-02 00:25:01', null, null, '63', '0'); -INSERT INTO `jsh_account_head` VALUES ('122', '转账', null, '17', '63', '11.000000', null, '11.000000', '17', 'ZZ00000000647', '2021-06-02 00:25:32', null, null, '63', '0'); -INSERT INTO `jsh_account_head` VALUES ('124', '收预付款', '60', '17', '63', '80.000000', '0.000000', '80.000000', null, 'SYF00000000649', '2021-07-06 23:43:48', null, null, '63', '0'); -INSERT INTO `jsh_account_head` VALUES ('125', '收款', '58', '17', '63', '10.000000', '0.000000', '10.000000', '17', 'SK00000000653', '2021-07-06 23:46:38', null, null, '63', '0'); -INSERT INTO `jsh_account_head` VALUES ('126', '付款', '57', '17', '63', '50.000000', '0.000000', '-50.000000', '17', 'FK00000000654', '2021-07-06 23:47:23', null, null, '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('118', '收入', '58', '16', '63', '55.000000', null, '55.000000', '17', 'SR00000000643', '2021-06-02 00:24:49', null, null, '0', '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('119', '支出', '68', '16', '63', '66.000000', null, '66.000000', '17', 'ZC00000000644', '2021-06-02 00:25:01', null, null, '0', '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('122', '转账', null, '17', '63', '11.000000', null, '11.000000', '17', 'ZZ00000000647', '2021-06-02 00:25:32', null, null, '0', '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('124', '收预付款', '60', '17', '63', '80.000000', '0.000000', '80.000000', null, 'SYF00000000649', '2021-07-06 23:43:48', null, null, '0', '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('125', '收款', '58', '17', '63', '10.000000', '0.000000', '10.000000', '17', 'SK00000000653', '2021-07-06 23:46:38', null, null, '0', '63', '0'); +INSERT INTO `jsh_account_head` VALUES ('126', '付款', '57', '17', '63', '50.000000', '0.000000', '-50.000000', '17', 'FK00000000654', '2021-07-06 23:47:23', null, null, '0', '63', '0'); -- ---------------------------- -- Table structure for jsh_account_item @@ -283,48 +284,48 @@ INSERT INTO `jsh_function` VALUES ('25', '01020101', '供应商信息', '0102', INSERT INTO `jsh_function` VALUES ('26', '010202', '仓库信息', '0102', '/system/depot', '/system/DepotList', '\0', '0270', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('31', '010206', '经手人管理', '0102', '/system/person', '/system/PersonList', '\0', '0284', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('32', '0502', '采购管理', '0', '/bill', '/layouts/TabLayout', '\0', '0330', '', '电脑版', '', 'retweet', '0'); -INSERT INTO `jsh_function` VALUES ('33', '050201', '采购入库', '0502', '/bill/purchase_in', '/bill/PurchaseInList', '\0', '0340', '', '电脑版', '1,2', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('33', '050201', '采购入库', '0502', '/bill/purchase_in', '/bill/PurchaseInList', '\0', '0340', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('38', '0603', '销售管理', '0', '/billB', '/layouts/TabLayout', '\0', '0390', '', '电脑版', '', 'shopping-cart', '0'); -INSERT INTO `jsh_function` VALUES ('40', '080107', '调拨出库', '0801', '/bill/allocation_out', '/bill/AllocationOutList', '\0', '0807', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('41', '060303', '销售出库', '0603', '/bill/sale_out', '/bill/SaleOutList', '\0', '0394', '', '电脑版', '1,2', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('40', '080107', '调拨出库', '0801', '/bill/allocation_out', '/bill/AllocationOutList', '\0', '0807', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('41', '060303', '销售出库', '0603', '/bill/sale_out', '/bill/SaleOutList', '\0', '0394', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('44', '0704', '财务管理', '0', '/financial', '/layouts/TabLayout', '\0', '0450', '', '电脑版', '', 'money-collect', '0'); INSERT INTO `jsh_function` VALUES ('59', '030101', '进销存统计', '0301', '/report/in_out_stock_report', '/report/InOutStockReport', '\0', '0658', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('194', '010204', '收支项目', '0102', '/system/in_out_item', '/system/InOutItemList', '\0', '0282', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('195', '010205', '结算账户', '0102', '/system/account', '/system/AccountList', '\0', '0283', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('197', '070402', '收入单', '0704', '/financial/item_in', '/financial/ItemInList', '\0', '0465', '', '电脑版', '1', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('197', '070402', '收入单', '0704', '/financial/item_in', '/financial/ItemInList', '\0', '0465', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('198', '0301', '报表查询', '0', '/report', '/layouts/TabLayout', '\0', '0570', '', '电脑版', null, 'pie-chart', '0'); -INSERT INTO `jsh_function` VALUES ('199', '050204', '采购退货', '0502', '/bill/purchase_back', '/bill/PurchaseBackList', '\0', '0345', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('200', '060305', '销售退货', '0603', '/bill/sale_back', '/bill/SaleBackList', '\0', '0396', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('201', '080103', '其它入库', '0801', '/bill/other_in', '/bill/OtherInList', '\0', '0803', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('202', '080105', '其它出库', '0801', '/bill/other_out', '/bill/OtherOutList', '\0', '0805', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('203', '070403', '支出单', '0704', '/financial/item_out', '/financial/ItemOutList', '\0', '0470', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('204', '070404', '收款单', '0704', '/financial/money_in', '/financial/MoneyInList', '\0', '0475', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('205', '070405', '付款单', '0704', '/financial/money_out', '/financial/MoneyOutList', '\0', '0480', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('206', '070406', '转账单', '0704', '/financial/giro', '/financial/GiroList', '\0', '0490', '', '电脑版', '1', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('199', '050204', '采购退货', '0502', '/bill/purchase_back', '/bill/PurchaseBackList', '\0', '0345', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('200', '060305', '销售退货', '0603', '/bill/sale_back', '/bill/SaleBackList', '\0', '0396', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('201', '080103', '其它入库', '0801', '/bill/other_in', '/bill/OtherInList', '\0', '0803', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('202', '080105', '其它出库', '0801', '/bill/other_out', '/bill/OtherOutList', '\0', '0805', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('203', '070403', '支出单', '0704', '/financial/item_out', '/financial/ItemOutList', '\0', '0470', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('204', '070404', '收款单', '0704', '/financial/money_in', '/financial/MoneyInList', '\0', '0475', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('205', '070405', '付款单', '0704', '/financial/money_out', '/financial/MoneyOutList', '\0', '0480', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('206', '070406', '转账单', '0704', '/financial/giro', '/financial/GiroList', '\0', '0490', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('207', '030102', '账户统计', '0301', '/report/account_report', '/report/AccountReport', '\0', '0610', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('208', '030103', '进货统计', '0301', '/report/buy_in_report', '/report/BuyInReport', '\0', '0620', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('209', '030104', '销售统计', '0301', '/report/sale_out_report', '/report/SaleOutReport', '\0', '0630', '', '电脑版', '', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('210', '040102', '零售出库', '0401', '/bill/retail_out', '/bill/RetailOutList', '\0', '0405', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('211', '040104', '零售退货', '0401', '/bill/retail_back', '/bill/RetailBackList', '\0', '0407', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('212', '070407', '收预付款', '0704', '/financial/advance_in', '/financial/AdvanceInList', '\0', '0495', '', '电脑版', '1', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('210', '040102', '零售出库', '0401', '/bill/retail_out', '/bill/RetailOutList', '\0', '0405', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('211', '040104', '零售退货', '0401', '/bill/retail_back', '/bill/RetailBackList', '\0', '0407', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('212', '070407', '收预付款', '0704', '/financial/advance_in', '/financial/AdvanceInList', '\0', '0495', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('217', '01020102', '客户信息', '0102', '/system/customer', '/system/CustomerList', '\0', '0262', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('218', '01020103', '会员信息', '0102', '/system/member', '/system/MemberList', '\0', '0263', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('220', '010103', '计量单位', '0101', '/system/unit', '/system/UnitList', '\0', '0245', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('225', '0401', '零售管理', '0', '/billC', '/layouts/TabLayout', '\0', '0101', '', '电脑版', '[]', 'gift', '0'); +INSERT INTO `jsh_function` VALUES ('225', '0401', '零售管理', '0', '/billC', '/layouts/TabLayout', '\0', '0101', '', '电脑版', '', 'gift', '0'); INSERT INTO `jsh_function` VALUES ('226', '030106', '入库明细', '0301', '/report/in_detail', '/report/InDetail', '\0', '0640', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('227', '030107', '出库明细', '0301', '/report/out_detail', '/report/OutDetail', '\0', '0645', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('228', '030108', '入库汇总', '0301', '/report/in_material_count', '/report/InMaterialCount', '\0', '0650', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('229', '030109', '出库汇总', '0301', '/report/out_material_count', '/report/OutMaterialCount', '\0', '0655', '', '电脑版', '', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('232', '080109', '组装单', '0801', '/bill/assemble', '/bill/AssembleList', '\0', '0809', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('233', '080111', '拆卸单', '0801', '/bill/disassemble', '/bill/DisassembleList', '\0', '0811', '', '电脑版', '1,2', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('232', '080109', '组装单', '0801', '/bill/assemble', '/bill/AssembleList', '\0', '0809', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('233', '080111', '拆卸单', '0801', '/bill/disassemble', '/bill/DisassembleList', '\0', '0811', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('234', '000105', '系统配置', '0001', '/system/system_config', '/system/SystemConfigList', '\0', '0165', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('235', '030110', '客户对账', '0301', '/report/customer_account', '/report/CustomerAccount', '\0', '0660', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('236', '000106', '商品属性', '0001', '/material/material_property', '/material/MaterialPropertyList', '\0', '0168', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('237', '030111', '供应商对账', '0301', '/report/vendor_account', '/report/VendorAccount', '\0', '0665', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('239', '0801', '仓库管理', '0', '/billD', '/layouts/TabLayout', '\0', '0420', '', '电脑版', '', 'hdd', '0'); INSERT INTO `jsh_function` VALUES ('240', '010104', '序列号', '0101', '/system/serial_number', '/system/SerialNumberList', '\0', '0246', '', '电脑版', '1', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('241', '050202', '采购订单', '0502', '/bill/purchase_order', '/bill/PurchaseOrderList', '\0', '0335', '', '电脑版', '1,2', 'profile', '0'); -INSERT INTO `jsh_function` VALUES ('242', '060301', '销售订单', '0603', '/bill/sale_order', '/bill/SaleOrderList', '\0', '0392', '', '电脑版', '1,2', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('241', '050202', '采购订单', '0502', '/bill/purchase_order', '/bill/PurchaseOrderList', '\0', '0335', '', '电脑版', '1,2,7', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('242', '060301', '销售订单', '0603', '/bill/sale_order', '/bill/SaleOrderList', '\0', '0392', '', '电脑版', '1,2,7', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('243', '000108', '机构管理', '0001', '/system/organization', '/system/OrganizationList', '', '0150', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('244', '030112', '库存预警', '0301', '/report/stock_warning_report', '/report/StockWarningReport', '\0', '0670', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('245', '000107', '插件管理', '0001', '/system/plugin', '/system/PluginList', '\0', '0170', '', '电脑版', '1', 'profile', '0'); @@ -944,8 +945,6 @@ INSERT INTO `jsh_user_business` VALUES ('35', 'UserRole', '117', '[10]', null, ' INSERT INTO `jsh_user_business` VALUES ('36', 'UserDepot', '117', '[8][9]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('37', 'UserCustomer', '117', '[52]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('38', 'UserRole', '120', '[4]', null, '0'); -INSERT INTO `jsh_user_business` VALUES ('39', 'UserDepot', '120', '[7][8][9][10][11][12][2][1][3]', null, '0'); -INSERT INTO `jsh_user_business` VALUES ('40', 'UserCustomer', '120', '[52][48][6][5][2]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('41', 'RoleFunctions', '12', '', null, '0'); INSERT INTO `jsh_user_business` VALUES ('48', 'RoleFunctions', '13', '[59][207][208][209][226][227][228][229][235][237][210][211][241][33][199][242][41][200]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('51', 'UserRole', '74', '[10]', null, '0'); diff --git a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt index beba7ce6..9002eb28 100644 --- a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt +++ b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt @@ -1207,4 +1207,12 @@ alter table jsh_tenant add expire_time datetime DEFAULT NULL COMMENT '到期时 -- by jishenghua -- 给日志表的ip字段改长度 -- -------------------------------------------------------- -alter table jsh_log change client_ip client_ip varchar(200) DEFAULT NULL COMMENT '客户端IP'; \ No newline at end of file +alter table jsh_log change client_ip client_ip varchar(200) DEFAULT NULL COMMENT '客户端IP'; + +-- -------------------------------------------------------- +-- 时间 2021年9月5日 +-- by jishenghua +-- 给财务表增加状态字段,给历史数据赋值为0 +-- -------------------------------------------------------- +alter table jsh_account_head add status varchar(1) DEFAULT NULL COMMENT '状态,0未审核、1已审核' after file_name; +update jsh_account_head set status=0; \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 867eb49a..fb538e7e 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -327,6 +327,9 @@ public class ExceptionConstants { //单据录入-调入仓库与原仓库不能重复 public static final int DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_CODE = 8500010; public static final String DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_MSG = "调入仓库与原仓库不能重复"; + //单据删除-只有未审核的单据才能删除 + public static final int DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE = 8500011; + public static final String DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG = "抱歉,只有未审核的单据才能删除"; /** * 单据明细信息 * type = 90 @@ -356,6 +359,9 @@ public class ExceptionConstants { //单据录入-明细不能为空 public static final int ACCOUNT_HEAD_ROW_FAILED_CODE = 9500003; public static final String ACCOUNT_HEAD_ROW_FAILED_MSG = "单据明细不能为空"; + //单据删除-只有未审核的单据才能删除 + public static final int ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_CODE = 9500004; + public static final String ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_MSG = "抱歉,只有未审核的单据才能删除"; /** * 财务明细信息 * type = 100 diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountHeadController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountHeadController.java index a1023eca..83906685 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountHeadController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/AccountHeadController.java @@ -7,6 +7,7 @@ import com.jsh.erp.datasource.entities.AccountHeadVo4Body; import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx; import com.jsh.erp.service.accountHead.AccountHeadService; import com.jsh.erp.utils.BaseResponseInfo; +import com.jsh.erp.utils.ErpInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; @@ -17,6 +18,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; + /** * @author jishenghua 752*718*920 */ @@ -28,6 +31,26 @@ public class AccountHeadController { @Resource private AccountHeadService accountHeadService; + /** + * 批量设置状态-审核或者反审核 + * @param jsonObject + * @param request + * @return + */ + @PostMapping(value = "/batchSetStatus") + public String batchSetStatus(@RequestBody JSONObject jsonObject, + HttpServletRequest request) throws Exception{ + Map objectMap = new HashMap<>(); + String status = jsonObject.getString("status"); + String ids = jsonObject.getString("ids"); + int res = accountHeadService.batchSetStatus(status, ids); + if(res > 0) { + return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); + } else { + return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code); + } + } + /** * 新增财务主表及财务子表信息 * @param body 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 3befe022..1fed1391 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 @@ -30,6 +30,8 @@ public class AccountHead { private String fileName; + private String status; + private Long tenantId; private String deleteFlag; @@ -138,6 +140,14 @@ public class AccountHead { this.fileName = fileName == null ? null : fileName.trim(); } + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status == null ? null : status.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 b11be264..6b78e064 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 @@ -926,6 +926,76 @@ public class AccountHeadExample { return (Criteria) this; } + public Criteria andStatusIsNull() { + addCriterion("status is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("status is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(String value) { + addCriterion("status =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(String value) { + addCriterion("status <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(String value) { + addCriterion("status >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(String value) { + addCriterion("status >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(String value) { + addCriterion("status <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(String value) { + addCriterion("status <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLike(String value) { + addCriterion("status like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotLike(String value) { + addCriterion("status not like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("status in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("status not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(String value1, String value2) { + addCriterion("status between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(String value1, String value2) { + addCriterion("status not between", value1, value2, "status"); + 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/service/accountHead/AccountHeadService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java index 1310a767..0eb05e7d 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java @@ -2,13 +2,12 @@ package com.jsh.erp.service.accountHead; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.constants.BusinessConstants; -import com.jsh.erp.datasource.entities.AccountHead; -import com.jsh.erp.datasource.entities.AccountHeadExample; -import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx; -import com.jsh.erp.datasource.entities.User; +import com.jsh.erp.constants.ExceptionConstants; +import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.AccountHeadMapper; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx; import com.jsh.erp.datasource.mappers.AccountItemMapperEx; +import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; import com.jsh.erp.service.accountItem.AccountItemService; import com.jsh.erp.service.log.LogService; @@ -197,21 +196,20 @@ public class AccountHeadService { List list = getAccountHeadListByIds(ids); for(AccountHead accountHead: list){ sb.append("[").append(accountHead.getBillNo()).append("]"); + if("1".equals(accountHead.getStatus())) { + throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_CODE, + String.format(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_MSG)); + } } - logService.insertLog("财务", sb.toString(), - ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); User userInfo=userService.getCurrentUser(); String [] idArray=ids.split(","); - int result = 0; - try{ - //删除主表 - result = accountItemMapperEx.batchDeleteAccountItemByHeadIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); - //删除子表 - result = accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); - }catch(Exception e){ - JshException.writeFail(logger, e); - } - return result; + //删除主表 + accountItemMapperEx.batchDeleteAccountItemByHeadIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); + //删除子表 + accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); + logService.insertLog("财务", sb.toString(), + ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); + return 1; } public int checkIsNameExist(Long id, String name)throws Exception { @@ -226,11 +224,45 @@ public class AccountHeadService { return list==null?0:list.size(); } + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int batchSetStatus(String status, String accountHeadIds)throws Exception { + int result = 0; + try{ + List ahIds = new ArrayList<>(); + List ids = StringUtil.strToLongList(accountHeadIds); + for(Long id: ids) { + AccountHead accountHead = getAccountHead(id); + if("0".equals(status)){ + if("1".equals(accountHead.getStatus())) { + ahIds.add(id); + } + } else if("1".equals(status)){ + if("0".equals(accountHead.getStatus())) { + ahIds.add(id); + } + } + } + if(ahIds.size()>0) { + AccountHead accountHead = new AccountHead(); + accountHead.setStatus(status); + AccountHeadExample example = new AccountHeadExample(); + example.createCriteria().andIdIn(ahIds); + result = accountHeadMapper.updateByExampleSelective(accountHead, example); + } else { + return 1; + } + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + @Transactional(value = "transactionManager", rollbackFor = Exception.class) public void addAccountHeadAndDetail(String beanJson, String rows, HttpServletRequest request) throws Exception { AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class); User userInfo=userService.getCurrentUser(); accountHead.setCreator(userInfo==null?null:userInfo.getId()); + accountHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT); accountHeadMapper.insertSelective(accountHead); //根据单据编号查询单据id AccountHeadExample dhExample = new AccountHeadExample(); 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 a932c05d..e0e046f7 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 @@ -106,7 +106,7 @@ public class DepotHeadService { List list=new ArrayList<>(); try{ String depotIds = depotService.findDepotStrByCurrentUser(); - String [] depotArray=depotIds.split(","); + String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null; String [] creatorArray = getCreatorArray(roleType); Map personMap = personService.getPersonMap(); Map accountMap = accountService.getAccountMap(); @@ -155,7 +155,7 @@ public class DepotHeadService { Long result=null; try{ String depotIds = depotService.findDepotStrByCurrentUser(); - String [] depotArray=depotIds.split(","); + String [] depotArray=StringUtil.isNotEmpty(depotIds)?depotIds.split(","):null; String [] creatorArray = getCreatorArray(roleType); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME); @@ -248,70 +248,59 @@ public class DepotHeadService { @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteBillByIds(String ids)throws Exception { - int result=0; - try{ - StringBuffer sb = new StringBuffer(); - sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); - List dhList = getDepotHeadListByIds(ids); - for(DepotHead depotHead: dhList){ - sb.append("[").append(depotHead.getNumber()).append("]"); - } - logService.insertLog("单据", sb.toString(), - ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); - if(StringUtil.isNotEmpty(ids)){ - String [] headIds=ids.split(","); - for(int i=0;i depotItemList = null; - try { - depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id, BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED); - } catch (Exception e) { - JshException.readFail(logger, e); - } + StringBuffer sb = new StringBuffer(); + sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE); + List dhList = getDepotHeadListByIds(ids); + for(DepotHead depotHead: dhList){ + sb.append("[").append(depotHead.getNumber()).append("]"); + //只有未审核的单据才能被删除 + if("0".equals(depotHead.getStatus())) { + User userInfo = userService.getCurrentUser(); + //删除出库数据回收序列号 + if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) + && !BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) { + //查询单据子表列表 + List depotItemList = null; + try { + depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(depotHead.getId(), BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED); + } catch (Exception e) { + JshException.readFail(logger, e); + } - /**回收序列号*/ - if (depotItemList != null && depotItemList.size() > 0) { - for (DepotItem depotItem : depotItemList) { - //BasicNumber=OperNumber*ratio - serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(), (depotItem.getBasicNumber() == null ? 0 : depotItem.getBasicNumber()).intValue(), userInfo); - } - } + /**回收序列号*/ + if (depotItemList != null && depotItemList.size() > 0) { + for (DepotItem depotItem : depotItemList) { + //BasicNumber=OperNumber*ratio + serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(), (depotItem.getBasicNumber() == null ? 0 : depotItem.getBasicNumber()).intValue(), userInfo); } - //对于零售出库单据,更新会员的预收款信息 - if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) - && BusinessConstants.SUB_TYPE_RETAIL.equals(depotHead.getSubType())){ - if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())) { - if (depotHead.getOrganId() != null) { - supplierService.updateAdvanceIn(depotHead.getOrganId(), depotHead.getTotalPrice().abs()); - } - } - } - /**删除单据子表数据*/ - depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{id}); - //更新当前库存 - List list = depotItemService.getListByHeaderId(id); - for (DepotItem depotItem : list) { - depotItemService.updateCurrentStock(depotItem); - } - /**删除单据主表信息*/ - batchDeleteDepotHeadByIds(id.toString()); } } + //对于零售出库单据,更新会员的预收款信息 + if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType()) + && BusinessConstants.SUB_TYPE_RETAIL.equals(depotHead.getSubType())){ + if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())) { + if (depotHead.getOrganId() != null) { + supplierService.updateAdvanceIn(depotHead.getOrganId(), depotHead.getTotalPrice().abs()); + } + } + } + /**删除单据子表数据*/ + depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long[]{depotHead.getId()}); + //更新当前库存 + List list = depotItemService.getListByHeaderId(depotHead.getId()); + for (DepotItem depotItem : list) { + depotItemService.updateCurrentStock(depotItem); + } + /**删除单据主表信息*/ + batchDeleteDepotHeadByIds(depotHead.getId().toString()); + } else { + throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE, + String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG)); } - result = 1; - }catch(Exception e){ - JshException.writeFail(logger, e); } - return result; + logService.insertLog("单据", sb.toString(), + ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); + return 1; } /** diff --git a/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml b/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml index ae90f260..6b669c25 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/AccountHeadMapper.xml @@ -15,6 +15,7 @@ + @@ -78,7 +79,7 @@ id, type, organ_id, hands_person_id, creator, change_amount, discount_money, total_price, - account_id, bill_no, bill_time, remark, file_name, tenant_id, delete_flag + account_id, bill_no, bill_time, remark, file_name, status, tenant_id, delete_flag