!48 修改注册时本地事务和远程调用问题

Merge pull request !48 from 乾坤平台/master
This commit is contained in:
乾坤平台
2019-04-10 21:45:35 +08:00
committed by 季圣华
35 changed files with 1138 additions and 117 deletions

View File

@@ -4,7 +4,6 @@
* 系统初始账号jsh密码123456部署如有问题请联系QQ752718920欢迎加入华夏ERP交流群群号码120725710 * 系统初始账号jsh密码123456部署如有问题请联系QQ752718920欢迎加入华夏ERP交流群群号码120725710
* 部署如遇到困难请参考Wiki文档 **https://gitee.com/jishenghua/JSH_ERP/wikis/pages** * 部署如遇到困难请参考Wiki文档 **https://gitee.com/jishenghua/JSH_ERP/wikis/pages**
* **本系统演示地址:[http://120.78.214.220:8080](http://120.78.214.220:8080)账号jsh密码123456欢迎登录如需试用欢迎注册** * **本系统演示地址:[http://120.78.214.220:8080](http://120.78.214.220:8080)账号jsh密码123456欢迎登录如需试用欢迎注册**
# 开发初衷 # 开发初衷
* 华夏ERP立志为中小企业提供开源好用的ERP软件降低企业的信息化成本 * 华夏ERP立志为中小企业提供开源好用的ERP软件降低企业的信息化成本
* 个人开发者也可以使用华夏ERP进行二次开发承接外包ERP项目 * 个人开发者也可以使用华夏ERP进行二次开发承接外包ERP项目

View File

@@ -495,7 +495,19 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=accountHeadID;
jsondata.deleteType='2';
var type='single';
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
return;
}else{
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
return;
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -553,29 +565,7 @@
} }
ids += row[i].id + ","; ids += row[i].id + ",";
} }
//批量更新会员的预收款信息
for(var i = 0;i < row.length; i ++) {
if(listType === "收预付款"){
$.ajax({
type:"post",
url: "/supplier/updateAdvanceIn",
dataType: "json",
data:{
supplierId: row[i].organid, //会员id
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
},
success: function(res){
if(res && res.code === 200) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
}
//批量删除 //批量删除
$.ajax({ $.ajax({
type:"post", type:"post",
@@ -590,15 +580,19 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
} var jsondata={};
}, jsondata.ids=ids;
success: function (res) { jsondata.deleteType='2';
if(res && res.code === 200) { var type='batch';
$("#searchBtn").click(); batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
$(":checkbox").attr("checked", false); }else if(res && res.code == 600){
} else { $.messager.alert('删除提示', res.msg, 'error');
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error'); return;
}else{
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
return;
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -606,13 +600,71 @@
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error'); $.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
return; return;
} }
}); });
//批量更新会员的预收款信息
for(var i = 0;i < row.length; i ++) {
if(listType === "收预付款"){
$.ajax({
type:"post",
url: "/supplier/updateAdvanceIn",
dataType: "json",
data:{
supplierId: row[i].organid, //会员id
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
},
success: function(res){
if(res && res.code === 200) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
}
} }
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
return;
}else {
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
return;
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//增加
//增加
function addAccountHead(){ function addAccountHead(){
$('#accountHeadFM').form('clear'); $('#accountHeadFM').form('clear');
var thisDateTime = getNowFormatDateTime(); //当前时间 var thisDateTime = getNowFormatDateTime(); //当前时间

View File

@@ -179,7 +179,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=supplierTotalInfo[0];
jsondata.deleteType='2';
var type='single';
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -224,7 +234,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -237,6 +257,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteSupplierForceConfirm(res,url,jsondata) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
return;
}
});
}
});
}
//批量启用 //批量启用
function setEnableFun() { function setEnableFun() {

View File

@@ -234,7 +234,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=accountTotalInfo[0];
jsondata.deleteType='2';
var type='single';
batDeleteAccountForceConfirm(res,"/account/batchDeleteAccountByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -278,7 +288,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeleteAccountForceConfirm(res,"/account/batchDeleteAccountByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -291,6 +311,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteAccountForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除结算账户异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//增加结算账户 //增加结算账户
var url; var url;

View File

@@ -264,7 +264,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除仓库信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=depotID;
jsondata.deleteType='2';
var type='single';
batDeleteDepotForceConfirm(res,"/depot/batchDeleteDepotByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除仓库信息异常,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -308,7 +318,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除仓库信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeleteDepotForceConfirm(res,"/depot/batchDeleteDepotByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除仓库信息异常,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -321,6 +341,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteDepotForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除仓库信息异常,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除仓库信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//增加 //增加
var url; var url;

View File

@@ -234,7 +234,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除收支项目失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=inOutItemTotalInfo[0];
jsondata.deleteType='2';
var type='single';
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -278,7 +288,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除收支项目失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除结算账户失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -291,6 +311,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteInOutItemForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除收支项目失败,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除收支项目失败,请稍后再试!', 'error');
return;
}
});
}
});
}
//增加收支项目 //增加收支项目
var url; var url;

View File

@@ -780,7 +780,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除商品信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=materialID;
jsondata.deleteType='2';
var type='single';
batDeleteMaterialForceConfirm(res,"/material/batchDeleteMaterialByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除商品信息异常,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -825,7 +835,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除商品信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeleteMaterialForceConfirm(res,"/material/batchDeleteMaterialByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除商品信息异常,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -838,6 +858,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeleteMaterialForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除商品信息异常,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除商品信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//批量启用 //批量启用
function setEnableFun() { function setEnableFun() {

View File

@@ -258,7 +258,17 @@
if(res && res.code == 200) { if(res && res.code == 200) {
$("#searchBtn").click(); $("#searchBtn").click();
} else { } else {
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=personID;
jsondata.deleteType='2';
var type='single';
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -303,7 +313,17 @@
$("#searchBtn").click(); $("#searchBtn").click();
$(":checkbox").attr("checked", false); $(":checkbox").attr("checked", false);
} else { } else {
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error'); if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
}
} }
}, },
//此处添加错误处理 //此处添加错误处理
@@ -316,6 +336,38 @@
}); });
} }
} }
/**
* 确认强制删除
* */
function batDeletePersonForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//增加 //增加
var url; var url;

View File

@@ -200,6 +200,14 @@ public class BusinessConstants {
public static final String TYPE_NAME_ROLE_APP = "RoleAPP"; public static final String TYPE_NAME_ROLE_APP = "RoleAPP";
public static final String TYPE_NAME_ROLE_FUNCTIONS = "RoleFunctions"; public static final String TYPE_NAME_ROLE_FUNCTIONS = "RoleFunctions";
/**
* 删除类型
* 1正常删除
* 2强制删除
* */
public static final String DELETE_TYPE_NORMAL = "1";
public static final String DELETE_TYPE_FORCE = "2";

View File

@@ -23,6 +23,17 @@ public class ExceptionConstants {
**/ **/
public static final int SERVICE_SYSTEM_ERROR_CODE = 500; public static final int SERVICE_SYSTEM_ERROR_CODE = 500;
public static final String SERVICE_SYSTEM_ERROR_MSG = "未知异常"; public static final String SERVICE_SYSTEM_ERROR_MSG = "未知异常";
/**
* 删除操作被拒绝,请联系管理员
**/
public static final int DELETE_REFUSED_CODE = 600;
public static final String DELETE_REFUSED_MSG = "删除操作被拒绝,请联系管理员";
/**
* 检测到存在依赖数据,是否强制删除?
**/
public static final int DELETE_FORCE_CONFIRM_CODE = 601;
public static final String DELETE_FORCE_CONFIRM_MSG = "检测到存在依赖数据,是否强制删除?";
/** /**
* 用户信息 * 用户信息
* type = 5 * type = 5

View File

@@ -1,7 +1,9 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Account; import com.jsh.erp.datasource.entities.Account;
import com.jsh.erp.datasource.vo.AccountVo4InOutList; import com.jsh.erp.datasource.vo.AccountVo4InOutList;
@@ -150,10 +152,28 @@ public class AccountController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteAccountByIds") @RequestMapping(value = "/batchDeleteAccountByIds")
public Object batchDeleteAccountByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteAccountByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= accountService.batchDeleteAccountByIds(ids); /**
* create by: qiankunpingtai
* create time: 2019/4/10 10:19
* websitehttps://qiankunpingtai.cn
* description:
* 出于兼容性考虑,没有传递删除类型时,默认为正常删除
*/
int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= accountService.batchDeleteAccountByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= accountService.batchDeleteAccountByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.ACCOUNT_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_DELETE_FAILED_MSG,ids); ExceptionConstants.ACCOUNT_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_DELETE_FAILED_MSG,ids);

View File

@@ -1,6 +1,7 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.AccountHead; import com.jsh.erp.datasource.entities.AccountHead;
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx; import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
@@ -158,10 +159,21 @@ public class AccountHeadController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteAccountHeadByIds") @RequestMapping(value = "/batchDeleteAccountHeadByIds")
public Object batchDeleteAccountHeadByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteAccountHeadByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= accountHeadService.batchDeleteAccountHeadByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= accountHeadService.batchDeleteAccountHeadByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= accountHeadService.batchDeleteAccountHeadByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG,ids); ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG,ids);

View File

@@ -185,9 +185,20 @@ public class DepotController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteDepotByIds") @RequestMapping(value = "/batchDeleteDepotByIds")
public Object batchDeleteDepotByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteDepotByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= depotService.batchDeleteDepotByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= depotService.batchDeleteDepotByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= depotService.batchDeleteDepotByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.DEPOT_DELETE_FAILED_CODE,ExceptionConstants.DEPOT_DELETE_FAILED_MSG,ids); ExceptionConstants.DEPOT_DELETE_FAILED_CODE,ExceptionConstants.DEPOT_DELETE_FAILED_MSG,ids);

View File

@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.InOutItem; import com.jsh.erp.datasource.entities.InOutItem;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
@@ -66,9 +67,20 @@ public class InOutItemController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteInOutItemByIds") @RequestMapping(value = "/batchDeleteInOutItemByIds")
public Object batchDeleteInOutItemByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteInOutItemByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= inOutItemService.batchDeleteInOutItemByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= inOutItemService.batchDeleteInOutItemByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= inOutItemService.batchDeleteInOutItemByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.IN_OUT_ITEM_DELETE_FAILED_CODE,ExceptionConstants.IN_OUT_ITEM_DELETE_FAILED_MSG,ids); ExceptionConstants.IN_OUT_ITEM_DELETE_FAILED_CODE,ExceptionConstants.IN_OUT_ITEM_DELETE_FAILED_MSG,ids);

View File

@@ -353,9 +353,20 @@ public class MaterialController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteMaterialByIds") @RequestMapping(value = "/batchDeleteMaterialByIds")
public Object batchDeleteMaterialByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteMaterialByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= materialService.batchDeleteMaterialByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= materialService.batchDeleteMaterialByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= materialService.batchDeleteMaterialByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.MATERIAL_DELETE_FAILED_CODE,ExceptionConstants.MATERIAL_DELETE_FAILED_MSG,ids); ExceptionConstants.MATERIAL_DELETE_FAILED_CODE,ExceptionConstants.MATERIAL_DELETE_FAILED_MSG,ids);

View File

@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Person; import com.jsh.erp.datasource.entities.Person;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
@@ -133,9 +134,20 @@ public class PersonController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeletePersonByIds") @RequestMapping(value = "/batchDeletePersonByIds")
public Object batchDeletePersonByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeletePersonByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= personService.batchDeletePersonByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= personService.batchDeletePersonByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= personService.batchDeletePersonByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.PERSON_DELETE_FAILED_CODE,ExceptionConstants.PERSON_DELETE_FAILED_MSG,ids); ExceptionConstants.PERSON_DELETE_FAILED_CODE,ExceptionConstants.PERSON_DELETE_FAILED_MSG,ids);

View File

@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Supplier; import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
@@ -452,9 +453,20 @@ public class SupplierController {
* @return java.lang.Object * @return java.lang.Object
*/ */
@RequestMapping(value = "/batchDeleteSupplierByIds") @RequestMapping(value = "/batchDeleteSupplierByIds")
public Object batchDeleteSupplierByIds(@RequestParam("ids") String ids) throws Exception { public Object batchDeleteSupplierByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
int i= supplierService.batchDeleteSupplierByIds(ids); int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= supplierService.batchDeleteSupplierByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= supplierService.batchDeleteSupplierByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){ if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]", logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.SUPPLIER_DELETE_FAILED_CODE,ExceptionConstants.SUPPLIER_DELETE_FAILED_MSG,ids); ExceptionConstants.SUPPLIER_DELETE_FAILED_CODE,ExceptionConstants.SUPPLIER_DELETE_FAILED_MSG,ids);

View File

@@ -7,15 +7,11 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx; import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.datasource.vo.TreeNodeEx; import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.exception.BusinessParamCheckingException; import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*; import com.jsh.erp.utils.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -25,11 +21,11 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@@ -39,7 +35,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@RestController @RestController
@RequestMapping(value = "/user") @RequestMapping(value = "/user")
public class UserController { public class UserController {
private Logger logger = LoggerFactory.getLogger(ResourceController.class); private Logger logger = LoggerFactory.getLogger(UserController.class);
@Value("${mybatis-plus.status}") @Value("${mybatis-plus.status}")
private String mybatisPlusStatus; private String mybatisPlusStatus;
@@ -56,9 +52,6 @@ public class UserController {
@Resource @Resource
private UserService userService; private UserService userService;
@Resource
private UserBusinessService userBusinessService;
private static String message = "成功"; private static String message = "成功";
private static final String HTTP = "http://"; private static final String HTTP = "http://";
private static final String CODE_OK = "200"; private static final String CODE_OK = "200";
@@ -357,31 +350,33 @@ public class UserController {
ue.setUsername(loginame); ue.setUsername(loginame);
ue.setLoginame(loginame); ue.setLoginame(loginame);
ue.setPassword(password); ue.setPassword(password);
ue = userService.registerUser(ue); ue = userService.registerUser(ue,manageRoleId);
/**
* create by: qiankunpingtai
* create time: 2019/4/9 17:17
* websitehttps://qiankunpingtai.cn
* description:
* 这里涉及到多个项目,需要用分布式事务去处理
* 为了不使问题复杂化,暂时另外开启一个线程去处理其它项目的数据操作
*/
final UserEx ueFinal=ue;
final ExecutorService executorService = Executors.newFixedThreadPool(1);
executorService.execute(() -> {
try{
//调第三方接口创建租户管理信息
String url = HTTP + manageIp + ":" + managePort + "/tenant/add";
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ueFinal.getId());
tenantObj.put("loginName",ueFinal.getLoginame());
String param = URLEncoder.encode(tenantObj.toString());
HttpClient.httpPost(url + "?info=" + param, param);
logger.info("===============创建租户信息完成===============");
}catch(Exception e){
//记录一下第三方接口创建租户管理信息创建失败
logger.debug("调用第三方接口创建租户管理信息失败tenantId[{}],loginName:[{}]",ueFinal.getId(),ueFinal.getLoginame());
}
});
//调第三方接口创建租户管理信息
String url = HTTP + manageIp + ":" + managePort + "/tenant/add";
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginame());
String param = URLEncoder.encode(tenantObj.toString());
HttpClient.httpPost(url + "?info=" + param, param);
logger.info("===============创建租户信息完成===============");
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), request);
return result; return result;
} }
/** /**

View File

@@ -36,5 +36,11 @@ public interface AccountHeadMapperEx {
List<AccountHeadVo4ListEx> getDetailByNumber( List<AccountHeadVo4ListEx> getDetailByNumber(
@Param("billNo") String billNo); @Param("billNo") String billNo);
int batchDeleteAccountHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteAccountHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
List<AccountHead> getAccountHeadListByAccountIds(@Param("accountIds") String[] accountIds);
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
} }

View File

@@ -25,5 +25,11 @@ public interface AccountItemMapperEx {
List<AccountItemVo4List> getDetailList( List<AccountItemVo4List> getDetailList(
@Param("headerId") Long headerId); @Param("headerId") Long headerId);
int batchDeleteAccountItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteAccountItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
List<AccountItem> getAccountItemListByAccountIds(@Param("accountIds") String[] accountIds);
List<AccountItem> getAccountItemListByHeaderIds(@Param("headerIds") String[] headerIds);
List<AccountItem> getAccountItemListByInOutItemIds(@Param("inOutItemIds") String[] inOutItemIds);
} }

View File

@@ -115,4 +115,12 @@ public interface DepotHeadMapperEx {
Long getBuildOnlyNumber(@Param("seq_name") String seq_name); Long getBuildOnlyNumber(@Param("seq_name") String seq_name);
int batchDeleteDepotHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteDepotHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<DepotHead> getDepotHeadListByAccountIds(@Param("accountIds") String[] accountIds);
List<DepotHead> getDepotHeadListByOrganIds(@Param("organIds") String[] organIds);
List<DepotHead> getDepotHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
List<DepotHead> getDepotHeadListByDepotIds(@Param("depotIds") String[] depotIds);
} }

View File

@@ -168,4 +168,8 @@ public interface DepotItemMapperEx {
int batchDeleteDepotItemByDepotHeadIds(@Param("depotheadIds")Long []depotHeadIds); int batchDeleteDepotItemByDepotHeadIds(@Param("depotheadIds")Long []depotHeadIds);
int batchDeleteDepotItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteDepotItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<DepotItem> getDepotItemListListByDepotIds(@Param("depotIds") String[] depotIds);
List<DepotItem> getDepotItemListListByMaterialIds(@Param("materialIds") String[] materialIds);
} }

View File

@@ -1,11 +1,14 @@
package com.jsh.erp.service.account; package com.jsh.erp.service.account;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.*; import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.vo.AccountVo4InOutList; import com.jsh.erp.datasource.vo.AccountVo4InOutList;
import com.jsh.erp.datasource.vo.AccountVo4List; import com.jsh.erp.datasource.vo.AccountVo4List;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
@@ -38,13 +41,19 @@ public class AccountService {
@Resource @Resource
private DepotHeadMapper depotHeadMapper; private DepotHeadMapper depotHeadMapper;
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
@Resource @Resource
private AccountHeadMapper accountHeadMapper; private AccountHeadMapper accountHeadMapper;
@Resource
private AccountHeadMapperEx accountHeadMapperEx;
@Resource @Resource
private AccountItemMapper accountItemMapper; private AccountItemMapper accountItemMapper;
@Resource @Resource
private AccountItemMapperEx accountItemMapperEx;
@Resource
private LogService logService; private LogService logService;
@Resource @Resource
private UserService userService; private UserService userService;
@@ -330,4 +339,64 @@ public class AccountService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 10:31
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountByIdsNormal(String ids) throws Exception{
/**
* 校验:
* 1、财务主表 jsh_accounthead
* 2、财务子表 jsh_accountitem
* 3、单据主表 jsh_depothead
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验财务主表 jsh_accounthead
* */
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByAccountIds(idArray);
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验财务子表 jsh_accountitem
* */
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByAccountIds(idArray);
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验单据主表 jsh_depothead
* */
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByAccountIds(idArray);
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteAccountByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,17 +1,17 @@
package com.jsh.erp.service.accountHead; package com.jsh.erp.service.accountHead;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.AccountHead; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.AccountHeadExample; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AccountHeadMapper; import com.jsh.erp.datasource.mappers.AccountHeadMapper;
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -39,6 +39,8 @@ public class AccountHeadService {
private UserService userService; private UserService userService;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private AccountItemMapperEx accountItemMapperEx;
public AccountHead getAccountHead(long id) { public AccountHead getAccountHead(long id) {
return accountHeadMapper.selectByPrimaryKey(id); return accountHeadMapper.selectByPrimaryKey(id);
@@ -142,4 +144,41 @@ public class AccountHeadService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 15:49
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHeadByIdsNormal(String ids) throws Exception {
/**
* 校验
* 1、财务子表 jsh_accountitem
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验财务子表 jsh_accountitem
* */
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByHeaderIds(idArray);
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteAccountHeadByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,13 +1,12 @@
package com.jsh.erp.service.depot; package com.jsh.erp.service.depot;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Depot; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotEx; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.entities.DepotExample; import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.datasource.mappers.DepotMapper;
import com.jsh.erp.datasource.mappers.DepotMapperEx;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
@@ -37,6 +36,10 @@ public class DepotService {
private UserService userService; private UserService userService;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
@Resource
private DepotItemMapperEx depotItemMapperEx;
public Depot getDepot(long id) { public Depot getDepot(long id) {
return depotMapper.selectByPrimaryKey(id); return depotMapper.selectByPrimaryKey(id);
@@ -122,4 +125,54 @@ public class DepotService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 16:52
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIdsNormal(String ids) throws Exception {
/**
* 校验
* 1、单据主表 jsh_depothead
* 2、单据子表 jsh_depotitem
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验单据主表 jsh_depothead
* */
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByDepotIds(idArray);
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验单据子表 jsh_depotitem
* */
List<DepotItem> depotItemList=depotItemMapperEx.getDepotItemListListByDepotIds(idArray);
if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteDepotByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,12 +1,17 @@
package com.jsh.erp.service.inOutItem; package com.jsh.erp.service.inOutItem;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.AccountItem;
import com.jsh.erp.datasource.entities.InOutItem; import com.jsh.erp.datasource.entities.InOutItem;
import com.jsh.erp.datasource.entities.InOutItemExample; import com.jsh.erp.datasource.entities.InOutItemExample;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.datasource.mappers.InOutItemMapper; import com.jsh.erp.datasource.mappers.InOutItemMapper;
import com.jsh.erp.datasource.mappers.InOutItemMapperEx; import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
@@ -35,6 +40,8 @@ public class InOutItemService {
private UserService userService; private UserService userService;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private AccountItemMapperEx accountItemMapperEx;
public InOutItem getInOutItem(long id) { public InOutItem getInOutItem(long id) {
return inOutItemMapper.selectByPrimaryKey(id); return inOutItemMapper.selectByPrimaryKey(id);
@@ -105,4 +112,42 @@ public class InOutItemService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 16:23
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteInOutItemByIdsNormal(String ids) throws Exception {
/**
* 校验
* 1、财务子表 jsh_accountitem
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验财务子表 jsh_accountitem
* */
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByInOutItemIds(idArray);
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,InOutItemIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteInOutItemByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,10 +1,14 @@
package com.jsh.erp.service.material; package com.jsh.erp.service.material;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
import com.jsh.erp.datasource.mappers.MaterialMapper; import com.jsh.erp.datasource.mappers.MaterialMapper;
import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
@@ -32,6 +36,8 @@ public class MaterialService {
private LogService logService; private LogService logService;
@Resource @Resource
private UserService userService; private UserService userService;
@Resource
private DepotItemMapperEx depotItemMapperEx;
public Material getMaterial(long id) { public Material getMaterial(long id) {
return materialMapper.selectByPrimaryKey(id); return materialMapper.selectByPrimaryKey(id);
@@ -217,4 +223,43 @@ public class MaterialService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 18:00
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIdsNormal(String ids) throws Exception{
/**
* 校验
* 1、单据子表 jsh_depotitem
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验单据子表 jsh_depotitem
* */
List<DepotItem> depotItemList=depotItemMapperEx.getDepotItemListListByMaterialIds(idArray);
if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteMaterialByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,12 +1,15 @@
package com.jsh.erp.service.person; package com.jsh.erp.service.person;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Person; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.PersonExample; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
import com.jsh.erp.datasource.mappers.PersonMapper; import com.jsh.erp.datasource.mappers.PersonMapper;
import com.jsh.erp.datasource.mappers.PersonMapperEx; import com.jsh.erp.datasource.mappers.PersonMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
@@ -35,6 +38,10 @@ public class PersonService {
private UserService userService; private UserService userService;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private AccountHeadMapperEx accountHeadMapperEx;
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
public Person getPerson(long id) { public Person getPerson(long id) {
return personMapper.selectByPrimaryKey(id); return personMapper.selectByPrimaryKey(id);
@@ -117,4 +124,52 @@ public class PersonService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 15:14
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeletePersonByIdsNormal(String ids) throws Exception {
/**
* 校验
* 1、财务主表 jsh_accounthead
* 2、单据主表 jsh_depothead
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验财务主表 jsh_accounthead
* */
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray);
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验单据主表 jsh_depothead
* */
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeletePersonByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,12 +1,15 @@
package com.jsh.erp.service.supplier; package com.jsh.erp.service.supplier;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Supplier; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.SupplierExample; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.entities.User; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
import com.jsh.erp.datasource.mappers.SupplierMapper; import com.jsh.erp.datasource.mappers.SupplierMapper;
import com.jsh.erp.datasource.mappers.SupplierMapperEx; import com.jsh.erp.datasource.mappers.SupplierMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
@@ -39,6 +42,10 @@ public class SupplierService {
private LogService logService; private LogService logService;
@Resource @Resource
private UserService userService; private UserService userService;
@Resource
private AccountHeadMapperEx accountHeadMapperEx;
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
public Supplier getSupplier(long id) { public Supplier getSupplier(long id) {
return supplierMapper.selectByPrimaryKey(id); return supplierMapper.selectByPrimaryKey(id);
@@ -187,4 +194,53 @@ public class SupplierService {
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
return supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray); return supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
} }
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
*正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 14:48
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSupplierByIdsNormal(String ids) throws Exception {
/**
* 校验
* 1、财务主表 jsh_accounthead
* 2、单据主表 jsh_depothead
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验财务主表 jsh_accounthead
* */
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验单据主表 jsh_depothead
* */
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteSupplierByIds(ids);
return deleteTotal;
}
} }

View File

@@ -1,6 +1,7 @@
package com.jsh.erp.service.user; package com.jsh.erp.service.user;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
@@ -15,6 +16,7 @@ import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService; import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*; import com.jsh.erp.utils.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -42,6 +44,12 @@ public class UserService {
private OrgaUserRelService orgaUserRelService; private OrgaUserRelService orgaUserRelService;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private UserService userService;
@Resource
private UserBusinessService userBusinessService;
public User getUser(long id) { public User getUser(long id) {
return userMapper.selectByPrimaryKey(id); return userMapper.selectByPrimaryKey(id);
@@ -272,7 +280,14 @@ public class UserService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public UserEx registerUser(UserEx ue) throws Exception{ public UserEx registerUser(UserEx ue, Integer manageRoleId) throws Exception{
/**
* create by: qiankunpingtai
* create time: 2019/4/9 18:00
* websitehttps://qiankunpingtai.cn
* description:
* 多次创建事务,事物之间无法协同,应该在入口处创建一个事务以做协调
*/
ue.setPassword(Tools.md5Encryp(ue.getPassword())); ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM); ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if(ue.getIsmanager()==null){ if(ue.getIsmanager()==null){
@@ -280,6 +295,19 @@ public class UserService {
} }
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL); ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int i=userMapperEx.addUser(ue); int i=userMapperEx.addUser(ue);
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(i>0){ if(i>0){
return ue; return ue;
} }

View File

@@ -7,7 +7,7 @@ spring.datasource.password=123456
project=src/main/java project=src/main/java
resource=src/main/resources resource=src/main/resources
web.front.baseDir=erp_web web.front.baseDir=erp_web
mybatis.type-aliases-package=com.chinamobile.model.* mybatis.type-aliases-package=com.jsh.erp.datasource.entities.*
mybatis.mapper-locations=classpath:./mapper_xml/*.xml mybatis.mapper-locations=classpath:./mapper_xml/*.xml
#开启sql打印 #开启sql打印
logging.level.com.jsh.erp.datasource.mappers=DEBUG logging.level.com.jsh.erp.datasource.mappers=DEBUG

View File

@@ -88,4 +88,28 @@
</foreach> </foreach>
) )
</update> </update>
<select id="getAccountHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
from jsh_accounthead
where 1=1
and organId in (
<foreach collection="organIds" item="organId" separator=",">
#{organId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getAccountHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
from jsh_accounthead
where 1=1
and handsPersonId in (
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
#{handsPersonId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper> </mapper>

View File

@@ -60,4 +60,40 @@
</foreach> </foreach>
) )
</update> </update>
<select id="getAccountItemListByAccountIds" resultMap="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountItemMapper.Base_Column_List" />
from jsh_accountitem
where 1=1
and accountId in (
<foreach collection="accountIds" item="accountId" separator=",">
#{accountId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getAccountItemListByHeaderIds" resultMap="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountItemMapper.Base_Column_List" />
from jsh_accountitem
where 1=1
and headerId in (
<foreach collection="headerIds" item="headerId" separator=",">
#{headerId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getAccountItemListByInOutItemIds" resultMap="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.AccountItemMapper.Base_Column_List" />
from jsh_accountitem
where 1=1
and inOutItemId in (
<foreach collection="inOutItemIds" item="inOutItemId" separator=",">
#{inOutItemId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper> </mapper>

View File

@@ -438,5 +438,61 @@
</foreach> </foreach>
) )
</update> </update>
<select id="getDepotHeadListByAccountIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
from jsh_depothead
where 1=1
and accountId in (
<foreach collection="accountIds" item="accountId" separator=",">
#{accountId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
from jsh_depothead
where 1=1
and organId in (
<foreach collection="organIds" item="organId" separator=",">
#{organId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
from jsh_depothead
where 1=1
and handsPersonId in (
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
#{handsPersonId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotHeadListByDepotIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
from jsh_depothead
where 1=1
and
(ProjectId in (
<foreach collection="depotIds" item="depotId" separator=",">
#{depotId}
</foreach>
)
OR
AllocationProjectId in (
<foreach collection="depotIds" item="depotId" separator=",">
#{depotId}
</foreach>
)
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper> </mapper>

View File

@@ -411,6 +411,30 @@
</foreach> </foreach>
) )
</update> </update>
<select id="getDepotItemListListByDepotIds" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotItemMapper.Base_Column_List" />
from jsh_depotitem
where 1=1
and DepotId in (
<foreach collection="depotIds" item="depotId" separator=",">
#{depotId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotItemListListByMaterialIds" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.DepotItemMapper.Base_Column_List" />
from jsh_depotitem
where 1=1
and materialId in (
<foreach collection="materialIds" item="materialId" separator=",">
#{materialId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>