diff --git a/erp_web/pages/materials/materialcategory.html b/erp_web/pages/materials/materialcategory.html index 67c30147..d319fa09 100644 --- a/erp_web/pages/materials/materialcategory.html +++ b/erp_web/pages/materials/materialcategory.html @@ -195,11 +195,11 @@ ids: ids }), success: function (res) { - if(res && res.code === 200) { - $('#tt').tree('reload'); - } else { - $.messager.alert('删除提示', '删除商品类别信息失败,请稍后再试!', 'error'); + if(res.code!=200){ + $.messager.alert('提示', res.msg, 'error'); + return; } + $('#tt').tree('reload'); }, //此处添加错误处理 error: function () { diff --git a/sql/jsh_erp.sql b/sql/jsh_erp.sql index e497d142..6211d3ca 100644 --- a/sql/jsh_erp.sql +++ b/sql/jsh_erp.sql @@ -1146,8 +1146,11 @@ CREATE TABLE tbl_sequence ( -- ---------------------------- -- 添加表单据编号sequence +-- 插入数据前判断,防止数据重复插入 -- ---------------------------- -insert into tbl_sequence (seq_name, min_value, max_value, current_val, increment_val,remark) values ('depot_number_seq', 1, 999999999999999999, 1, 1,'单据编号sequence'); +insert into tbl_sequence (seq_name, min_value, max_value, current_val, increment_val,remark) +select 'depot_number_seq', 1, 999999999999999999, 1, 1,'单据编号sequence' from dual where not exists +(select * from tbl_sequence where seq_name='depot_number_seq'); -- ---------------------------- -- 创建function _nextval() 用于获取当前序列号 -- ---------------------------- @@ -1220,6 +1223,7 @@ ALTER TABLE jsh_materialcategory DROP FOREIGN KEY FK3EE7F725237A77D8; -- ---------------------------- -- 修改根目录父节点id为-1 +-- 设置根目录编号为1 -- ---------------------------- update jsh_materialcategory set ParentId='-1' where id='1'; @@ -1231,9 +1235,14 @@ delete from jsh_functions where id in (213,214,215,216); -- ---------------------------- -- 新增采购订单、销售订单的功能数据 -- 主键自增长,直接指定主键插入数据的方式可能会和本地数据冲突 +-- 插入数据前判断,防止数据重复插入 -- ---------------------------- -insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('050202', '采购订单', '0502', '../materials/purchase_orders_list.html', b'0', '0335',b'1', '电脑版', ''); -insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('060301', '销售订单', '0603', '../materials/sale_orders_list.html', b'0', '0392', b'1', '电脑版', ''); +insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) +select '050202', '采购订单', '0502', '../materials/purchase_orders_list.html', b'0', '0335',b'1', '电脑版', '' from dual where not exists +(select * from jsh_functions where Number='050202' and PNumber='0502'); +insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) +select '060301', '销售订单', '0603', '../materials/sale_orders_list.html', b'0', '0392', b'1', '电脑版', '' from dual where not exists +(select * from jsh_functions where Number='060301' and PNumber='0603'); -- ---------------------------- -- 改管理员的功能权限 @@ -1301,13 +1310,18 @@ CREATE TABLE `jsh_orga_user_rel` ( ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='机构用户关系表'; -- ---------------------------- -- 添加机构管理菜单 +-- 插入数据前判断,防止数据重复插入 -- ---------------------------- -INSERT INTO `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('000108', '机构管理', '0001', '../manage/organization.html', b'1', '0139', b'1', '电脑版', ''); +INSERT INTO `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) +select '000108', '机构管理', '0001', '../manage/organization.html', b'1', '0139', b'1', '电脑版', '' from dual where not exists +(select * from jsh_functions where Number='000108' and PNumber='0001'); -- ---------------------------- -- 添加根机构 +-- 插入时判断对应数据是否存在,防止多次执行产生重复数据 -- ---------------------------- -INSERT INTO `jsh_organization`(`org_no`, `org_full_name`, `org_abr`, `org_tpcd`, `org_stcd`, `org_parent_no`, `sort`, `remark`, `create_time`, `creator`, `update_time`, `updater`, `org_create_time`, `org_stop_time`) VALUES ('01', '根机构', '根机构', NULL, '2', '-1', '1', '根机构,初始化存在', NULL, NULL, NULL, NULL, NULL, NULL); - +INSERT INTO jsh_organization (org_no, org_full_name, org_abr, org_tpcd, org_stcd, org_parent_no, sort, remark, create_time, creator, update_time, updater, org_create_time, org_stop_time) +select '01', '根机构', '根机构', NULL, '2', '-1', '1', '根机构,初始化存在', NULL, NULL, NULL, NULL, NULL, NULL from dual where not exists +(select * from jsh_organization where org_no='01' and org_abr='根机构' and org_parent_no='-1' ); -- ---------------------------- -- 时间:2019年3月9日 -- version:1.0.6 @@ -1430,8 +1444,7 @@ declare continue handler for not found set done = 1; -- 清空用户表中的部门信息 update jsh_user set department=null; --- 设置status为0 -update jsh_user set status=0; + return _success_msg; end ;; @@ -1443,4 +1456,19 @@ select _buildOrgAndOrgUserRel('初始化机构数据,重建机构用户关系' -- ---------------------------- -- 删除一次性函数 -- ---------------------------- -DROP FUNCTION _buildOrgAndOrgUserRel; \ No newline at end of file +DROP FUNCTION _buildOrgAndOrgUserRel; + +-- ---------------------------- +-- 时间:2019年3月13日 +-- version:1.0.10 +-- 此次更新 +-- 1、设置用户表的用户状态status默认值为0 +-- 特别提醒:之后的sql都是在之前基础上迭代,可以对已存在的系统进行数据保留更新 +-- ---------------------------- + +alter table jsh_user change Status Status tinyint(4) DEFAULT '0' COMMENT '状态,0:正常,1:删除,2封禁'; +update jsh_user set status='0' where status is null; +-- ---------------------------- +-- 设置根目录编号为1 +-- ---------------------------- +update jsh_materialcategory set serial_no='1' where id='1'; diff --git a/sql/华夏ERP数据库设计汇总.xlsx b/sql/华夏ERP数据库设计汇总.xlsx index d4844b7b..ff0ead0c 100644 Binary files a/sql/华夏ERP数据库设计汇总.xlsx and b/sql/华夏ERP数据库设计汇总.xlsx differ diff --git a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java index 4be7fd17..771a9e43 100644 --- a/src/main/java/com/jsh/erp/constants/ExceptionConstants.java +++ b/src/main/java/com/jsh/erp/constants/ExceptionConstants.java @@ -61,6 +61,12 @@ public class ExceptionConstants { //商品类别编号已存在 public static final int MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE = 7500003; public static final String MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG = "商品类别编号已存在"; + //根目录不支持修改 + public static final int MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE = 7500004; + public static final String MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG = "根目录不支持修改"; + //根目录不支持删除 + public static final int MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE = 7500005; + public static final String MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG = "根目录不支持删除"; /** * 商品信息 diff --git a/src/main/java/com/jsh/erp/controller/DepotController.java b/src/main/java/com/jsh/erp/controller/DepotController.java index 1a809e18..b65a4b08 100644 --- a/src/main/java/com/jsh/erp/controller/DepotController.java +++ b/src/main/java/com/jsh/erp/controller/DepotController.java @@ -159,7 +159,7 @@ public class DepotController { if (currentPage == null || currentPage <= 0) { currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER; } - PageHelper.startPage(currentPage,pageSize,false); + PageHelper.startPage(currentPage,pageSize,true); List list = depotService.getDepotList(parameterMap); //获取分页查询后的数据 PageInfo pageInfo = new PageInfo<>(list); diff --git a/src/main/java/com/jsh/erp/controller/UserController.java b/src/main/java/com/jsh/erp/controller/UserController.java index 5fe1316e..390552fc 100644 --- a/src/main/java/com/jsh/erp/controller/UserController.java +++ b/src/main/java/com/jsh/erp/controller/UserController.java @@ -247,7 +247,7 @@ public class UserController { if (currentPage == null || currentPage <= 0) { currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER; } - PageHelper.startPage(currentPage,pageSize,false); + PageHelper.startPage(currentPage,pageSize,true); List list = userService.getUserList(parameterMap); //获取分页查询后的数据 PageInfo pageInfo = new PageInfo<>(list); diff --git a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java index 694cc20e..8dc3854b 100644 --- a/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java +++ b/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java @@ -138,20 +138,50 @@ public class MaterialCategoryService { } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int batchDeleteMaterialCategoryByIds(String ids) throws Exception { + //更新时间 Date updateDate =new Date(); //更新人 User userInfo=userService.getCurrentUser(); Long updater=userInfo==null?null:userInfo.getId(); - StringBuffer sb=new StringBuffer(); String strArray[]=ids.split(","); if(strArray.length<1){ return 0; } + /** + * create by: qiankunpingtai + * create time: 2019/3/13 14:49 + * description: + * 添加一个限制,根目录不允许删除 + */ + String rootIdStr=BusinessConstants.MATERIAL_CATEGORY_ROOT_ID.toString(); + for(String s:strArray){ + if(rootIdStr.equals(s)){ + logger.error("异常码[{}],异常提示[{}],参数,id:[{}]", + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE, + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG,s); + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE, + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG); + } + } return materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray); } @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int editMaterialCategory(MaterialCategory mc) { + /** + * create by: qiankunpingtai + * create time: 2019/3/13 14:49 + * description: + * 添加一个限制根目录不允许修改 + */ + if(BusinessConstants.MATERIAL_CATEGORY_ROOT_ID.equals(mc.getId())){ + logger.error("异常码[{}],异常提示[{}],参数,id:[{}]", + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE, + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG,mc.getId()); + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE, + ExceptionConstants.MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG); + + } //检查商品类型编号是否已存在 checkMaterialCategorySerialNo(mc); //更新时间 @@ -187,11 +217,15 @@ public class MaterialCategoryService { throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE, ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG); } - if(mc.getId()!=mList.get(0).getId()){ + /** + * 包装类型用equals来比较 + * */ + if(mc.getId().equals(mList.get(0).getId())){ //修改时,相同编号,id不同 throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE, ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG); } } + }