Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
85d96bb2
Commit
85d96bb2
authored
Jan 11, 2019
by
cjl
Browse files
添加事务控制
parent
5df1748c
Changes
25
Show whitespace changes
Inline
Side-by-side
erp_web/pages/common/main.html
View file @
85d96bb2
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<link
href=
"/js/HoorayOS_mini/img/ui/index.css"
rel=
"stylesheet"
/>
<link
href=
"/js/HoorayOS_mini/img/ui/index.css"
rel=
"stylesheet"
/>
<style>
<style>
#user-name-span
{
#user-name-span
{
text-align
:
left
;
text-align
:
center
;
color
:
white
;
color
:
white
;
position
:
absolute
;
position
:
absolute
;
top
:
435px
;
top
:
435px
;
...
...
src/main/java/com/jsh/erp/controller/AccountHeadController.java
View file @
85d96bb2
...
@@ -96,7 +96,7 @@ public class AccountHeadController {
...
@@ -96,7 +96,7 @@ public class AccountHeadController {
/**
/**
* 根据编号查询单据信息
* 根据编号查询单据信息
* @param
number
* @param
billNo
* @param request
* @param request
* @return
* @return
*/
*/
...
@@ -124,8 +124,8 @@ public class AccountHeadController {
...
@@ -124,8 +124,8 @@ public class AccountHeadController {
* 统计总金额
* 统计总金额
* @param getS
* @param getS
* @param type
* @param type
* @param subType
* @param mode 合计或者金额
* @param mode 合计或者金额
* @param endTime
* @return
* @return
*/
*/
public
Double
allMoney
(
String
getS
,
String
type
,
String
mode
,
String
endTime
)
{
public
Double
allMoney
(
String
getS
,
String
type
,
String
mode
,
String
endTime
)
{
...
...
src/main/java/com/jsh/erp/controller/AccountItemController.java
View file @
85d96bb2
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -31,7 +32,19 @@ public class AccountItemController {
...
@@ -31,7 +32,19 @@ public class AccountItemController {
@Resource
@Resource
private
AccountItemService
accountItemService
;
private
AccountItemService
accountItemService
;
/**
* create by: cjl
* description:
* 业务逻辑操作放在service层,controller只做参数解析和视图封装
* create time: 2019/1/11 15:08
* @Param: inserted
* @Param: deleted
* @Param: updated
* @Param: headerId
* @Param: listType
* @Param: request
* @return java.lang.String
*/
@PostMapping
(
value
=
"/saveDetials"
)
@PostMapping
(
value
=
"/saveDetials"
)
public
String
saveDetials
(
@RequestParam
(
"inserted"
)
String
inserted
,
public
String
saveDetials
(
@RequestParam
(
"inserted"
)
String
inserted
,
@RequestParam
(
"deleted"
)
String
deleted
,
@RequestParam
(
"deleted"
)
String
deleted
,
...
@@ -39,67 +52,10 @@ public class AccountItemController {
...
@@ -39,67 +52,10 @@ public class AccountItemController {
@RequestParam
(
"headerId"
)
Long
headerId
,
@RequestParam
(
"headerId"
)
Long
headerId
,
@RequestParam
(
"listType"
)
String
listType
,
@RequestParam
(
"listType"
)
String
listType
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
try
{
try
{
//转为json
accountItemService
.
saveDetials
(
inserted
,
deleted
,
updated
,
headerId
,
listType
);
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
AccountItem
accountItem
=
new
AccountItem
();
JSONObject
tempInsertedJson
=
JSONObject
.
parseObject
(
insertedJson
.
getString
(
i
));
accountItem
.
setHeaderid
(
headerId
);
if
(
tempInsertedJson
.
get
(
"AccountId"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"AccountId"
).
equals
(
""
))
{
accountItem
.
setAccountid
(
tempInsertedJson
.
getLong
(
"AccountId"
));
}
if
(
tempInsertedJson
.
get
(
"InOutItemId"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"InOutItemId"
).
equals
(
""
))
{
accountItem
.
setInoutitemid
(
tempInsertedJson
.
getLong
(
"InOutItemId"
));
}
if
(
tempInsertedJson
.
get
(
"EachAmount"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"EachAmount"
).
equals
(
""
))
{
Double
eachAmount
=
tempInsertedJson
.
getDouble
(
"EachAmount"
);
if
(
listType
.
equals
(
"付款"
))
{
eachAmount
=
0
-
eachAmount
;
}
accountItem
.
setEachamount
(
eachAmount
);
}
else
{
accountItem
.
setEachamount
(
0.0
);
}
accountItem
.
setRemark
(
tempInsertedJson
.
getString
(
"Remark"
));
accountItemService
.
insertAccountItemWithObj
(
accountItem
);
}
}
if
(
null
!=
deletedJson
)
{
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
accountItemService
.
deleteAccountItem
(
tempDeletedJson
.
getLong
(
"Id"
));
}
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
JSONObject
tempUpdatedJson
=
JSONObject
.
parseObject
(
updatedJson
.
getString
(
i
));
AccountItem
accountItem
=
accountItemService
.
getAccountItem
(
tempUpdatedJson
.
getLong
(
"Id"
));
accountItem
.
setId
(
tempUpdatedJson
.
getLong
(
"Id"
));
accountItem
.
setHeaderid
(
headerId
);
if
(
tempUpdatedJson
.
get
(
"AccountId"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"AccountId"
).
equals
(
""
))
{
accountItem
.
setAccountid
(
tempUpdatedJson
.
getLong
(
"AccountId"
));
}
if
(
tempUpdatedJson
.
get
(
"InOutItemId"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"InOutItemId"
).
equals
(
""
))
{
accountItem
.
setInoutitemid
(
tempUpdatedJson
.
getLong
(
"InOutItemId"
));
}
if
(
tempUpdatedJson
.
get
(
"EachAmount"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"EachAmount"
).
equals
(
""
))
{
Double
eachAmount
=
tempUpdatedJson
.
getDouble
(
"EachAmount"
);
if
(
listType
.
equals
(
"付款"
))
{
eachAmount
=
0
-
eachAmount
;
}
accountItem
.
setEachamount
(
eachAmount
);
}
else
{
accountItem
.
setEachamount
(
0.0
);
}
accountItem
.
setRemark
(
tempUpdatedJson
.
getString
(
"Remark"
));
accountItemService
.
updateAccountItemWithObj
(
accountItem
);
}
}
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
catch
(
DataAccessException
e
)
{
}
catch
(
DataAccessException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
85d96bb2
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.*;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -31,8 +32,7 @@ public class DepotItemController {
...
@@ -31,8 +32,7 @@ public class DepotItemController {
@Resource
@Resource
private
DepotItemService
depotItemService
;
private
DepotItemService
depotItemService
;
@Resource
private
MaterialService
materialService
;
/**
/**
* 根据材料信息获取
* 根据材料信息获取
...
@@ -258,163 +258,7 @@ public class DepotItemController {
...
@@ -258,163 +258,7 @@ public class DepotItemController {
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
try
{
try
{
//转为json
depotItemService
.
saveDetials
(
inserted
,
deleted
,
updated
,
headerId
);
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
DepotItem
depotItem
=
new
DepotItem
();
JSONObject
tempInsertedJson
=
JSONObject
.
parseObject
(
insertedJson
.
getString
(
i
));
depotItem
.
setHeaderid
(
headerId
);
depotItem
.
setMaterialid
(
tempInsertedJson
.
getLong
(
"MaterialId"
));
depotItem
.
setMunit
(
tempInsertedJson
.
getString
(
"Unit"
));
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"OperNumber"
).
toString
()))
{
depotItem
.
setOpernumber
(
tempInsertedJson
.
getDouble
(
"OperNumber"
));
try
{
String
Unit
=
tempInsertedJson
.
get
(
"Unit"
).
toString
();
Double
oNumber
=
tempInsertedJson
.
getDouble
(
"OperNumber"
);
Long
mId
=
Long
.
parseLong
(
tempInsertedJson
.
get
(
"MaterialId"
).
toString
());
//以下进行单位换算
String
UnitName
=
findUnitName
(
mId
);
//查询计量单位名称
if
(!
StringUtil
.
isEmpty
(
UnitName
))
{
String
UnitList
=
UnitName
.
substring
(
0
,
UnitName
.
indexOf
(
"("
));
String
RatioList
=
UnitName
.
substring
(
UnitName
.
indexOf
(
"("
));
String
basicUnit
=
UnitList
.
substring
(
0
,
UnitList
.
indexOf
(
","
));
//基本单位
String
otherUnit
=
UnitList
.
substring
(
UnitList
.
indexOf
(
","
)
+
1
);
//副单位
Integer
ratio
=
Integer
.
parseInt
(
RatioList
.
substring
(
RatioList
.
indexOf
(
":"
)
+
1
).
replace
(
")"
,
""
));
//比例
if
(
Unit
.
equals
(
basicUnit
))
{
//如果等于基础单位
depotItem
.
setBasicnumber
(
oNumber
);
//数量一致
}
else
if
(
Unit
.
equals
(
otherUnit
))
{
//如果等于副单位
depotItem
.
setBasicnumber
(
oNumber
*
ratio
);
//数量乘以比例
}
}
else
{
depotItem
.
setBasicnumber
(
oNumber
);
//其他情况
}
}
catch
(
Exception
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>>>设置基础数量异常"
,
e
);
}
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"UnitPrice"
).
toString
()))
{
depotItem
.
setUnitprice
(
tempInsertedJson
.
getDouble
(
"UnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxUnitPrice"
).
toString
()))
{
depotItem
.
setTaxunitprice
(
tempInsertedJson
.
getDouble
(
"TaxUnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"AllPrice"
).
toString
()))
{
depotItem
.
setAllprice
(
tempInsertedJson
.
getDouble
(
"AllPrice"
));
}
depotItem
.
setRemark
(
tempInsertedJson
.
getString
(
"Remark"
));
if
(
tempInsertedJson
.
get
(
"DepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"DepotId"
).
toString
()))
{
depotItem
.
setDepotid
(
tempInsertedJson
.
getLong
(
"DepotId"
));
}
if
(
tempInsertedJson
.
get
(
"AnotherDepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"AnotherDepotId"
).
toString
()))
{
depotItem
.
setAnotherdepotid
(
tempInsertedJson
.
getLong
(
"AnotherDepotId"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxRate"
).
toString
()))
{
depotItem
.
setTaxrate
(
tempInsertedJson
.
getDouble
(
"TaxRate"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxMoney"
).
toString
()))
{
depotItem
.
setTaxmoney
(
tempInsertedJson
.
getDouble
(
"TaxMoney"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxLastMoney"
).
toString
()))
{
depotItem
.
setTaxlastmoney
(
tempInsertedJson
.
getDouble
(
"TaxLastMoney"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField1"
)
!=
null
)
{
depotItem
.
setOtherfield1
(
tempInsertedJson
.
getString
(
"OtherField1"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField2"
)
!=
null
)
{
depotItem
.
setOtherfield2
(
tempInsertedJson
.
getString
(
"OtherField2"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField3"
)
!=
null
)
{
depotItem
.
setOtherfield3
(
tempInsertedJson
.
getString
(
"OtherField3"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField4"
)
!=
null
)
{
depotItem
.
setOtherfield4
(
tempInsertedJson
.
getString
(
"OtherField4"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField5"
)
!=
null
)
{
depotItem
.
setOtherfield5
(
tempInsertedJson
.
getString
(
"OtherField5"
));
}
if
(
tempInsertedJson
.
get
(
"MType"
)
!=
null
)
{
depotItem
.
setMtype
(
tempInsertedJson
.
getString
(
"MType"
));
}
depotItemService
.
insertDepotItemWithObj
(
depotItem
);
}
}
if
(
null
!=
deletedJson
)
{
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
depotItemService
.
deleteDepotItem
(
tempDeletedJson
.
getLong
(
"Id"
));
}
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
JSONObject
tempUpdatedJson
=
JSONObject
.
parseObject
(
updatedJson
.
getString
(
i
));
DepotItem
depotItem
=
depotItemService
.
getDepotItem
(
tempUpdatedJson
.
getLong
(
"Id"
));
depotItem
.
setId
(
tempUpdatedJson
.
getLong
(
"Id"
));
depotItem
.
setMaterialid
(
tempUpdatedJson
.
getLong
(
"MaterialId"
));
depotItem
.
setMunit
(
tempUpdatedJson
.
getString
(
"Unit"
));
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"OperNumber"
).
toString
()))
{
depotItem
.
setOpernumber
(
tempUpdatedJson
.
getDouble
(
"OperNumber"
));
try
{
String
Unit
=
tempUpdatedJson
.
get
(
"Unit"
).
toString
();
Double
oNumber
=
tempUpdatedJson
.
getDouble
(
"OperNumber"
);
Long
mId
=
Long
.
parseLong
(
tempUpdatedJson
.
get
(
"MaterialId"
).
toString
());
//以下进行单位换算
String
UnitName
=
findUnitName
(
mId
);
//查询计量单位名称
if
(!
StringUtil
.
isEmpty
(
UnitName
))
{
String
UnitList
=
UnitName
.
substring
(
0
,
UnitName
.
indexOf
(
"("
));
String
RatioList
=
UnitName
.
substring
(
UnitName
.
indexOf
(
"("
));
String
basicUnit
=
UnitList
.
substring
(
0
,
UnitList
.
indexOf
(
","
));
//基本单位
String
otherUnit
=
UnitList
.
substring
(
UnitList
.
indexOf
(
","
)
+
1
);
//副单位
Integer
ratio
=
Integer
.
parseInt
(
RatioList
.
substring
(
RatioList
.
indexOf
(
":"
)
+
1
).
replace
(
")"
,
""
));
//比例
if
(
Unit
.
equals
(
basicUnit
))
{
//如果等于基础单位
depotItem
.
setBasicnumber
(
oNumber
);
//数量一致
}
else
if
(
Unit
.
equals
(
otherUnit
))
{
//如果等于副单位
depotItem
.
setBasicnumber
(
oNumber
*
ratio
);
//数量乘以比例
}
}
else
{
depotItem
.
setBasicnumber
(
oNumber
);
//其他情况
}
}
catch
(
Exception
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>>>设置基础数量异常"
,
e
);
}
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"UnitPrice"
).
toString
()))
{
depotItem
.
setUnitprice
(
tempUpdatedJson
.
getDouble
(
"UnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxUnitPrice"
).
toString
()))
{
depotItem
.
setTaxunitprice
(
tempUpdatedJson
.
getDouble
(
"TaxUnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"AllPrice"
).
toString
()))
{
depotItem
.
setAllprice
(
tempUpdatedJson
.
getDouble
(
"AllPrice"
));
}
depotItem
.
setRemark
(
tempUpdatedJson
.
getString
(
"Remark"
));
if
(
tempUpdatedJson
.
get
(
"DepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"DepotId"
).
toString
()))
{
depotItem
.
setDepotid
(
tempUpdatedJson
.
getLong
(
"DepotId"
));
}
if
(
tempUpdatedJson
.
get
(
"AnotherDepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"AnotherDepotId"
).
toString
()))
{
depotItem
.
setAnotherdepotid
(
tempUpdatedJson
.
getLong
(
"AnotherDepotId"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxRate"
).
toString
()))
{
depotItem
.
setTaxrate
(
tempUpdatedJson
.
getDouble
(
"TaxRate"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxMoney"
).
toString
()))
{
depotItem
.
setTaxmoney
(
tempUpdatedJson
.
getDouble
(
"TaxMoney"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxLastMoney"
).
toString
()))
{
depotItem
.
setTaxlastmoney
(
tempUpdatedJson
.
getDouble
(
"TaxLastMoney"
));
}
depotItem
.
setOtherfield1
(
tempUpdatedJson
.
getString
(
"OtherField1"
));
depotItem
.
setOtherfield2
(
tempUpdatedJson
.
getString
(
"OtherField2"
));
depotItem
.
setOtherfield3
(
tempUpdatedJson
.
getString
(
"OtherField3"
));
depotItem
.
setOtherfield4
(
tempUpdatedJson
.
getString
(
"OtherField4"
));
depotItem
.
setOtherfield5
(
tempUpdatedJson
.
getString
(
"OtherField5"
));
depotItem
.
setMtype
(
tempUpdatedJson
.
getString
(
"MType"
));
depotItemService
.
updateDepotItemWithObj
(
depotItem
);
}
}
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
catch
(
DataAccessException
e
)
{
}
catch
(
DataAccessException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -423,26 +267,7 @@ public class DepotItemController {
...
@@ -423,26 +267,7 @@ public class DepotItemController {
}
}
}
}
/**
* 查询计量单位信息
*
* @return
*/
public
String
findUnitName
(
Long
mId
)
{
String
unitName
=
""
;
try
{
unitName
=
materialService
.
findUnitName
(
mId
);
if
(
unitName
!=
null
)
{
unitName
=
unitName
.
substring
(
1
,
unitName
.
length
()
-
1
);
if
(
unitName
.
equals
(
"null"
))
{
unitName
=
""
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
unitName
;
}
@GetMapping
(
value
=
"/getDetailList"
)
@GetMapping
(
value
=
"/getDetailList"
)
public
BaseResponseInfo
getDetailList
(
@RequestParam
(
"headerId"
)
Long
headerId
,
public
BaseResponseInfo
getDetailList
(
@RequestParam
(
"headerId"
)
Long
headerId
,
...
...
src/main/java/com/jsh/erp/service/CommonQueryManager.java
View file @
85d96bb2
...
@@ -2,6 +2,7 @@ package com.jsh.erp.service;
...
@@ -2,6 +2,7 @@ package com.jsh.erp.service;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -63,6 +64,7 @@ public class CommonQueryManager {
...
@@ -63,6 +64,7 @@ public class CommonQueryManager {
* @param beanJson
* @param beanJson
* @return
* @return
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
insert
(
beanJson
,
request
);
return
container
.
getCommonQuery
(
apiName
).
insert
(
beanJson
,
request
);
...
@@ -77,6 +79,7 @@ public class CommonQueryManager {
...
@@ -77,6 +79,7 @@ public class CommonQueryManager {
* @param id
* @param id
* @return
* @return
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
update
(
String
apiName
,
String
beanJson
,
Long
id
)
{
public
int
update
(
String
apiName
,
String
beanJson
,
Long
id
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
update
(
beanJson
,
id
);
return
container
.
getCommonQuery
(
apiName
).
update
(
beanJson
,
id
);
...
@@ -90,6 +93,7 @@ public class CommonQueryManager {
...
@@ -90,6 +93,7 @@ public class CommonQueryManager {
* @param id
* @param id
* @return
* @return
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
delete
(
String
apiName
,
Long
id
)
{
public
int
delete
(
String
apiName
,
Long
id
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
delete
(
id
);
return
container
.
getCommonQuery
(
apiName
).
delete
(
id
);
...
@@ -103,6 +107,7 @@ public class CommonQueryManager {
...
@@ -103,6 +107,7 @@ public class CommonQueryManager {
* @param ids
* @param ids
* @return
* @return
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDelete
(
String
apiName
,
String
ids
)
{
public
int
batchDelete
(
String
apiName
,
String
ids
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
batchDelete
(
ids
);
return
container
.
getCommonQuery
(
apiName
).
batchDelete
(
ids
);
...
...
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
85d96bb2
...
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
...
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -73,6 +74,7 @@ public class AccountService {
...
@@ -73,6 +74,7 @@ public class AccountService {
return
accountMapper
.
countsByAccount
(
name
,
serialNo
,
remark
);
return
accountMapper
.
countsByAccount
(
name
,
serialNo
,
remark
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertAccount
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertAccount
(
String
beanJson
,
HttpServletRequest
request
)
{
Account
account
=
JSONObject
.
parseObject
(
beanJson
,
Account
.
class
);
Account
account
=
JSONObject
.
parseObject
(
beanJson
,
Account
.
class
);
if
(
account
.
getInitialamount
()
==
null
)
{
if
(
account
.
getInitialamount
()
==
null
)
{
...
@@ -82,16 +84,19 @@ public class AccountService {
...
@@ -82,16 +84,19 @@ public class AccountService {
return
accountMapper
.
insertSelective
(
account
);
return
accountMapper
.
insertSelective
(
account
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAccount
(
String
beanJson
,
Long
id
)
{
public
int
updateAccount
(
String
beanJson
,
Long
id
)
{
Account
account
=
JSONObject
.
parseObject
(
beanJson
,
Account
.
class
);
Account
account
=
JSONObject
.
parseObject
(
beanJson
,
Account
.
class
);
account
.
setId
(
id
);
account
.
setId
(
id
);
return
accountMapper
.
updateByPrimaryKeySelective
(
account
);
return
accountMapper
.
updateByPrimaryKeySelective
(
account
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteAccount
(
Long
id
)
{
public
int
deleteAccount
(
Long
id
)
{
return
accountMapper
.
deleteByPrimaryKey
(
id
);
return
accountMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccount
(
String
ids
)
{
public
int
batchDeleteAccount
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AccountExample
example
=
new
AccountExample
();
AccountExample
example
=
new
AccountExample
();
...
@@ -296,6 +301,7 @@ public class AccountService {
...
@@ -296,6 +301,7 @@ public class AccountService {
return
accountMapper
.
findAccountInOutListCount
(
accountId
);
return
accountMapper
.
findAccountInOutListCount
(
accountId
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAmountIsDefault
(
Boolean
isDefault
,
Long
accountId
)
{
public
int
updateAmountIsDefault
(
Boolean
isDefault
,
Long
accountId
)
{
Account
account
=
new
Account
();
Account
account
=
new
Account
();
account
.
setIsdefault
(
isDefault
);
account
.
setIsdefault
(
isDefault
);
...
...
src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
85d96bb2
...
@@ -10,6 +10,7 @@ import com.jsh.erp.utils.Tools;
...
@@ -10,6 +10,7 @@ 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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -53,21 +54,25 @@ public class AccountHeadService {
...
@@ -53,21 +54,25 @@ public class AccountHeadService {
return
accountHeadMapper
.
countsByAccountHead
(
type
,
billNo
,
beginTime
,
endTime
);
return
accountHeadMapper
.
countsByAccountHead
(
type
,
billNo
,
beginTime
,
endTime
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertAccountHead
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertAccountHead
(
String
beanJson
,
HttpServletRequest
request
)
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
return
accountHeadMapper
.
insertSelective
(
accountHead
);
return
accountHeadMapper
.
insertSelective
(
accountHead
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAccountHead
(
String
beanJson
,
Long
id
)
{
public
int
updateAccountHead
(
String
beanJson
,
Long
id
)
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
accountHead
.
setId
(
id
);
accountHead
.
setId
(
id
);
return
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
return
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteAccountHead
(
Long
id
)
{
public
int
deleteAccountHead
(
Long
id
)
{
return
accountHeadMapper
.
deleteByPrimaryKey
(
id
);
return
accountHeadMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountHead
(
String
ids
)
{
public
int
batchDeleteAccountHead
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AccountHeadExample
example
=
new
AccountHeadExample
();
AccountHeadExample
example
=
new
AccountHeadExample
();
...
...
src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java
View file @
85d96bb2
package
com.jsh.erp.service.accountItem
;
package
com.jsh.erp.service.accountItem
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.utils.ErpInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
@Service
@Service
public
class
AccountItemService
{
public
class
AccountItemService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountItemService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountItemService
.
class
);
...
@@ -38,21 +44,25 @@ public class AccountItemService {
...
@@ -38,21 +44,25 @@ public class AccountItemService {
return
accountItemMapper
.
countsByAccountItem
(
name
,
type
,
remark
);
return
accountItemMapper
.
countsByAccountItem
(
name
,
type
,
remark
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertAccountItem
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertAccountItem
(
String
beanJson
,
HttpServletRequest
request
)
{
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
return
accountItemMapper
.
insertSelective
(
accountItem
);
return
accountItemMapper
.
insertSelective
(
accountItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAccountItem
(
String
beanJson
,
Long
id
)
{
public
int
updateAccountItem
(
String
beanJson
,
Long
id
)
{
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
accountItem
.
setId
(
id
);
accountItem
.
setId
(
id
);
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteAccountItem
(
Long
id
)
{
public
int
deleteAccountItem
(
Long
id
)
{
return
accountItemMapper
.
deleteByPrimaryKey
(
id
);
return
accountItemMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountItem
(
String
ids
)
{
public
int
batchDeleteAccountItem
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AccountItemExample
example
=
new
AccountItemExample
();
AccountItemExample
example
=
new
AccountItemExample
();
...
@@ -67,10 +77,12 @@ public class AccountItemService {
...
@@ -67,10 +77,12 @@ public class AccountItemService {
return
list
.
size
();
return
list
.
size
();
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertAccountItemWithObj
(
AccountItem
accountItem
)
{
public
int
insertAccountItemWithObj
(
AccountItem
accountItem
)
{
return
accountItemMapper
.
insertSelective
(
accountItem
);
return
accountItemMapper
.
insertSelective
(
accountItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAccountItemWithObj
(
AccountItem
accountItem
)
{
public
int
updateAccountItemWithObj
(
AccountItem
accountItem
)
{
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
}
}
...
@@ -78,4 +90,69 @@ public class AccountItemService {
...
@@ -78,4 +90,69 @@ public class AccountItemService {
public
List
<
AccountItemVo4List
>
getDetailList
(
Long
headerId
)
{
public
List
<
AccountItemVo4List
>
getDetailList
(
Long
headerId
)
{
return
accountItemMapper
.
getDetailList
(
headerId
);
return
accountItemMapper
.
getDetailList
(
headerId
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
String
listType
)
throws
DataAccessException
{
//转为json
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
AccountItem
accountItem
=
new
AccountItem
();
JSONObject
tempInsertedJson
=
JSONObject
.
parseObject
(
insertedJson
.
getString
(
i
));
accountItem
.
setHeaderid
(
headerId
);
if
(
tempInsertedJson
.
get
(
"AccountId"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"AccountId"
).
equals
(
""
))
{
accountItem
.
setAccountid
(
tempInsertedJson
.
getLong
(
"AccountId"
));
}
if
(
tempInsertedJson
.
get
(
"InOutItemId"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"InOutItemId"
).
equals
(
""
))
{
accountItem
.
setInoutitemid
(
tempInsertedJson
.
getLong
(
"InOutItemId"
));
}
if
(
tempInsertedJson
.
get
(
"EachAmount"
)
!=
null
&&
!
tempInsertedJson
.
get
(
"EachAmount"
).
equals
(
""
))
{
Double
eachAmount
=
tempInsertedJson
.
getDouble
(
"EachAmount"
);
if
(
listType
.
equals
(
"付款"
))
{
eachAmount
=
0
-
eachAmount
;
}
accountItem
.
setEachamount
(
eachAmount
);
}
else
{
accountItem
.
setEachamount
(
0.0
);
}
accountItem
.
setRemark
(
tempInsertedJson
.
getString
(
"Remark"
));
this
.
insertAccountItemWithObj
(
accountItem
);
}
}
if
(
null
!=
deletedJson
)
{
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
this
.
deleteAccountItem
(
tempDeletedJson
.
getLong
(
"Id"
));
}
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
JSONObject
tempUpdatedJson
=
JSONObject
.
parseObject
(
updatedJson
.
getString
(
i
));
AccountItem
accountItem
=
this
.
getAccountItem
(
tempUpdatedJson
.
getLong
(
"Id"
));
accountItem
.
setId
(
tempUpdatedJson
.
getLong
(
"Id"
));
accountItem
.
setHeaderid
(
headerId
);
if
(
tempUpdatedJson
.
get
(
"AccountId"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"AccountId"
).
equals
(
""
))
{
accountItem
.
setAccountid
(
tempUpdatedJson
.
getLong
(
"AccountId"
));
}
if
(
tempUpdatedJson
.
get
(
"InOutItemId"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"InOutItemId"
).
equals
(
""
))
{
accountItem
.
setInoutitemid
(
tempUpdatedJson
.
getLong
(
"InOutItemId"
));
}
if
(
tempUpdatedJson
.
get
(
"EachAmount"
)
!=
null
&&
!
tempUpdatedJson
.
get
(
"EachAmount"
).
equals
(
""
))
{
Double
eachAmount
=
tempUpdatedJson
.
getDouble
(
"EachAmount"
);
if
(
listType
.
equals
(
"付款"
))
{
eachAmount
=
0
-
eachAmount
;
}
accountItem
.
setEachamount
(
eachAmount
);
}
else
{
accountItem
.
setEachamount
(
0.0
);
}
accountItem
.
setRemark
(
tempUpdatedJson
.
getString
(
"Remark"
));
this
.
updateAccountItemWithObj
(
accountItem
);
}
}
return
null
;
}
}
}
src/main/java/com/jsh/erp/service/app/AppService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -53,21 +54,25 @@ public class AppService {
...
@@ -53,21 +54,25 @@ public class AppService {
return
appMapper
.
countsByApp
(
name
,
type
);
return
appMapper
.
countsByApp
(
name
,
type
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertApp
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertApp
(
String
beanJson
,
HttpServletRequest
request
)
{
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
return
appMapper
.
insertSelective
(
app
);
return
appMapper
.
insertSelective
(
app
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateApp
(
String
beanJson
,
Long
id
)
{
public
int
updateApp
(
String
beanJson
,
Long
id
)
{
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
app
.
setId
(
id
);
app
.
setId
(
id
);
return
appMapper
.
updateByPrimaryKeySelective
(
app
);
return
appMapper
.
updateByPrimaryKeySelective
(
app
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteApp
(
Long
id
)
{
public
int
deleteApp
(
Long
id
)
{
return
appMapper
.
deleteByPrimaryKey
(
id
);
return
appMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteApp
(
String
ids
)
{
public
int
batchDeleteApp
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
...
...
src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -43,21 +44,25 @@ public class DepotService {
...
@@ -43,21 +44,25 @@ public class DepotService {
return
depotMapper
.
countsByDepot
(
name
,
type
,
remark
);
return
depotMapper
.
countsByDepot
(
name
,
type
,
remark
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertDepot
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertDepot
(
String
beanJson
,
HttpServletRequest
request
)
{
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
return
depotMapper
.
insertSelective
(
depot
);
return
depotMapper
.
insertSelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateDepot
(
String
beanJson
,
Long
id
)
{
public
int
updateDepot
(
String
beanJson
,
Long
id
)
{
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
depot
.
setId
(
id
);
depot
.
setId
(
id
);
return
depotMapper
.
updateByPrimaryKeySelective
(
depot
);
return
depotMapper
.
updateByPrimaryKeySelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteDepot
(
Long
id
)
{
public
int
deleteDepot
(
Long
id
)
{
return
depotMapper
.
deleteByPrimaryKey
(
id
);
return
depotMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepot
(
String
ids
)
{
public
int
batchDeleteDepot
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
DepotExample
example
=
new
DepotExample
();
DepotExample
example
=
new
DepotExample
();
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
85d96bb2
...
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
...
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -71,6 +72,7 @@ public class DepotHeadService {
...
@@ -71,6 +72,7 @@ public class DepotHeadService {
return
depotHeadMapper
.
countsByDepotHead
(
type
,
subType
,
number
,
beginTime
,
endTime
,
dhIds
);
return
depotHeadMapper
.
countsByDepotHead
(
type
,
subType
,
number
,
beginTime
,
endTime
,
dhIds
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertDepotHead
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertDepotHead
(
String
beanJson
,
HttpServletRequest
request
)
{
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
//判断用户是否已经登录过,登录过不再处理
//判断用户是否已经登录过,登录过不再处理
...
@@ -85,16 +87,19 @@ public class DepotHeadService {
...
@@ -85,16 +87,19 @@ public class DepotHeadService {
return
depotHeadMapper
.
insertSelective
(
depotHead
);
return
depotHeadMapper
.
insertSelective
(
depotHead
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateDepotHead
(
String
beanJson
,
Long
id
)
{
public
int
updateDepotHead
(
String
beanJson
,
Long
id
)
{
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
depotHead
.
setId
(
id
);
depotHead
.
setId
(
id
);
return
depotHeadMapper
.
updateByPrimaryKeySelective
(
depotHead
);
return
depotHeadMapper
.
updateByPrimaryKeySelective
(
depotHead
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteDepotHead
(
Long
id
)
{
public
int
deleteDepotHead
(
Long
id
)
{
return
depotHeadMapper
.
deleteByPrimaryKey
(
id
);
return
depotHeadMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotHead
(
String
ids
)
{
public
int
batchDeleteDepotHead
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
DepotHeadExample
example
=
new
DepotHeadExample
();
DepotHeadExample
example
=
new
DepotHeadExample
();
...
@@ -109,6 +114,7 @@ public class DepotHeadService {
...
@@ -109,6 +114,7 @@ public class DepotHeadService {
return
list
.
size
();
return
list
.
size
();
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
Boolean
status
,
String
depotHeadIDs
)
{
public
int
batchSetStatus
(
Boolean
status
,
String
depotHeadIDs
)
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
DepotHead
depotHead
=
new
DepotHead
();
DepotHead
depotHead
=
new
DepotHead
();
...
...
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
85d96bb2
package
com.jsh.erp.service.depotItem
;
package
com.jsh.erp.service.depotItem
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.DepotItemMapper
;
import
com.jsh.erp.datasource.mappers.DepotItemMapper
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.utils.ErpInfo
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
@Service
@Service
public
class
DepotItemService
{
public
class
DepotItemService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
DepotItemService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
DepotItemService
.
class
);
...
@@ -25,6 +32,8 @@ public class DepotItemService {
...
@@ -25,6 +32,8 @@ public class DepotItemService {
@Resource
@Resource
private
DepotItemMapper
depotItemMapper
;
private
DepotItemMapper
depotItemMapper
;
@Resource
private
MaterialService
materialService
;
public
DepotItem
getDepotItem
(
long
id
)
{
public
DepotItem
getDepotItem
(
long
id
)
{
return
depotItemMapper
.
selectByPrimaryKey
(
id
);
return
depotItemMapper
.
selectByPrimaryKey
(
id
);
...
@@ -43,21 +52,25 @@ public class DepotItemService {
...
@@ -43,21 +52,25 @@ public class DepotItemService {
return
depotItemMapper
.
countsByDepotItem
(
name
,
type
,
remark
);
return
depotItemMapper
.
countsByDepotItem
(
name
,
type
,
remark
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertDepotItem
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertDepotItem
(
String
beanJson
,
HttpServletRequest
request
)
{
DepotItem
depotItem
=
JSONObject
.
parseObject
(
beanJson
,
DepotItem
.
class
);
DepotItem
depotItem
=
JSONObject
.
parseObject
(
beanJson
,
DepotItem
.
class
);
return
depotItemMapper
.
insertSelective
(
depotItem
);
return
depotItemMapper
.
insertSelective
(
depotItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateDepotItem
(
String
beanJson
,
Long
id
)
{
public
int
updateDepotItem
(
String
beanJson
,
Long
id
)
{
DepotItem
depotItem
=
JSONObject
.
parseObject
(
beanJson
,
DepotItem
.
class
);
DepotItem
depotItem
=
JSONObject
.
parseObject
(
beanJson
,
DepotItem
.
class
);
depotItem
.
setId
(
id
);
depotItem
.
setId
(
id
);
return
depotItemMapper
.
updateByPrimaryKeySelective
(
depotItem
);
return
depotItemMapper
.
updateByPrimaryKeySelective
(
depotItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteDepotItem
(
Long
id
)
{
public
int
deleteDepotItem
(
Long
id
)
{
return
depotItemMapper
.
deleteByPrimaryKey
(
id
);
return
depotItemMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotItem
(
String
ids
)
{
public
int
batchDeleteDepotItem
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
DepotItemExample
example
=
new
DepotItemExample
();
DepotItemExample
example
=
new
DepotItemExample
();
...
@@ -114,10 +127,12 @@ public class DepotItemService {
...
@@ -114,10 +127,12 @@ public class DepotItemService {
return
depotItemMapper
.
findStockNumByMaterialIdCounts
(
mId
,
monthTime
);
return
depotItemMapper
.
findStockNumByMaterialIdCounts
(
mId
,
monthTime
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertDepotItemWithObj
(
DepotItem
depotItem
)
{
public
int
insertDepotItemWithObj
(
DepotItem
depotItem
)
{
return
depotItemMapper
.
insertSelective
(
depotItem
);
return
depotItemMapper
.
insertSelective
(
depotItem
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateDepotItemWithObj
(
DepotItem
depotItem
)
{
public
int
updateDepotItemWithObj
(
DepotItem
depotItem
)
{
return
depotItemMapper
.
updateByPrimaryKeySelective
(
depotItem
);
return
depotItemMapper
.
updateByPrimaryKeySelective
(
depotItem
);
}
}
...
@@ -190,5 +205,184 @@ public class DepotItemService {
...
@@ -190,5 +205,184 @@ public class DepotItemService {
}
}
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
)
throws
DataAccessException
{
//转为json
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
if
(
null
!=
insertedJson
)
{
for
(
int
i
=
0
;
i
<
insertedJson
.
size
();
i
++)
{
DepotItem
depotItem
=
new
DepotItem
();
JSONObject
tempInsertedJson
=
JSONObject
.
parseObject
(
insertedJson
.
getString
(
i
));
depotItem
.
setHeaderid
(
headerId
);
depotItem
.
setMaterialid
(
tempInsertedJson
.
getLong
(
"MaterialId"
));
depotItem
.
setMunit
(
tempInsertedJson
.
getString
(
"Unit"
));
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"OperNumber"
).
toString
()))
{
depotItem
.
setOpernumber
(
tempInsertedJson
.
getDouble
(
"OperNumber"
));
try
{
String
Unit
=
tempInsertedJson
.
get
(
"Unit"
).
toString
();
Double
oNumber
=
tempInsertedJson
.
getDouble
(
"OperNumber"
);
Long
mId
=
Long
.
parseLong
(
tempInsertedJson
.
get
(
"MaterialId"
).
toString
());
//以下进行单位换算
String
UnitName
=
findUnitName
(
mId
);
//查询计量单位名称
if
(!
StringUtil
.
isEmpty
(
UnitName
))
{
String
UnitList
=
UnitName
.
substring
(
0
,
UnitName
.
indexOf
(
"("
));
String
RatioList
=
UnitName
.
substring
(
UnitName
.
indexOf
(
"("
));
String
basicUnit
=
UnitList
.
substring
(
0
,
UnitList
.
indexOf
(
","
));
//基本单位
String
otherUnit
=
UnitList
.
substring
(
UnitList
.
indexOf
(
","
)
+
1
);
//副单位
Integer
ratio
=
Integer
.
parseInt
(
RatioList
.
substring
(
RatioList
.
indexOf
(
":"
)
+
1
).
replace
(
")"
,
""
));
//比例
if
(
Unit
.
equals
(
basicUnit
))
{
//如果等于基础单位
depotItem
.
setBasicnumber
(
oNumber
);
//数量一致
}
else
if
(
Unit
.
equals
(
otherUnit
))
{
//如果等于副单位
depotItem
.
setBasicnumber
(
oNumber
*
ratio
);
//数量乘以比例
}
}
else
{
depotItem
.
setBasicnumber
(
oNumber
);
//其他情况
}
}
catch
(
Exception
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>>>设置基础数量异常"
,
e
);
}
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"UnitPrice"
).
toString
()))
{
depotItem
.
setUnitprice
(
tempInsertedJson
.
getDouble
(
"UnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxUnitPrice"
).
toString
()))
{
depotItem
.
setTaxunitprice
(
tempInsertedJson
.
getDouble
(
"TaxUnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"AllPrice"
).
toString
()))
{
depotItem
.
setAllprice
(
tempInsertedJson
.
getDouble
(
"AllPrice"
));
}
depotItem
.
setRemark
(
tempInsertedJson
.
getString
(
"Remark"
));
if
(
tempInsertedJson
.
get
(
"DepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"DepotId"
).
toString
()))
{
depotItem
.
setDepotid
(
tempInsertedJson
.
getLong
(
"DepotId"
));
}
if
(
tempInsertedJson
.
get
(
"AnotherDepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"AnotherDepotId"
).
toString
()))
{
depotItem
.
setAnotherdepotid
(
tempInsertedJson
.
getLong
(
"AnotherDepotId"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxRate"
).
toString
()))
{
depotItem
.
setTaxrate
(
tempInsertedJson
.
getDouble
(
"TaxRate"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxMoney"
).
toString
()))
{
depotItem
.
setTaxmoney
(
tempInsertedJson
.
getDouble
(
"TaxMoney"
));
}
if
(!
StringUtil
.
isEmpty
(
tempInsertedJson
.
get
(
"TaxLastMoney"
).
toString
()))
{
depotItem
.
setTaxlastmoney
(
tempInsertedJson
.
getDouble
(
"TaxLastMoney"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField1"
)
!=
null
)
{
depotItem
.
setOtherfield1
(
tempInsertedJson
.
getString
(
"OtherField1"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField2"
)
!=
null
)
{
depotItem
.
setOtherfield2
(
tempInsertedJson
.
getString
(
"OtherField2"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField3"
)
!=
null
)
{
depotItem
.
setOtherfield3
(
tempInsertedJson
.
getString
(
"OtherField3"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField4"
)
!=
null
)
{
depotItem
.
setOtherfield4
(
tempInsertedJson
.
getString
(
"OtherField4"
));
}
if
(
tempInsertedJson
.
get
(
"OtherField5"
)
!=
null
)
{
depotItem
.
setOtherfield5
(
tempInsertedJson
.
getString
(
"OtherField5"
));
}
if
(
tempInsertedJson
.
get
(
"MType"
)
!=
null
)
{
depotItem
.
setMtype
(
tempInsertedJson
.
getString
(
"MType"
));
}
this
.
insertDepotItemWithObj
(
depotItem
);
}
}
if
(
null
!=
deletedJson
)
{
for
(
int
i
=
0
;
i
<
deletedJson
.
size
();
i
++)
{
JSONObject
tempDeletedJson
=
JSONObject
.
parseObject
(
deletedJson
.
getString
(
i
));
this
.
deleteDepotItem
(
tempDeletedJson
.
getLong
(
"Id"
));
}
}
if
(
null
!=
updatedJson
)
{
for
(
int
i
=
0
;
i
<
updatedJson
.
size
();
i
++)
{
JSONObject
tempUpdatedJson
=
JSONObject
.
parseObject
(
updatedJson
.
getString
(
i
));
DepotItem
depotItem
=
this
.
getDepotItem
(
tempUpdatedJson
.
getLong
(
"Id"
));
depotItem
.
setId
(
tempUpdatedJson
.
getLong
(
"Id"
));
depotItem
.
setMaterialid
(
tempUpdatedJson
.
getLong
(
"MaterialId"
));
depotItem
.
setMunit
(
tempUpdatedJson
.
getString
(
"Unit"
));
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"OperNumber"
).
toString
()))
{
depotItem
.
setOpernumber
(
tempUpdatedJson
.
getDouble
(
"OperNumber"
));
try
{
String
Unit
=
tempUpdatedJson
.
get
(
"Unit"
).
toString
();
Double
oNumber
=
tempUpdatedJson
.
getDouble
(
"OperNumber"
);
Long
mId
=
Long
.
parseLong
(
tempUpdatedJson
.
get
(
"MaterialId"
).
toString
());
//以下进行单位换算
String
UnitName
=
findUnitName
(
mId
);
//查询计量单位名称
if
(!
StringUtil
.
isEmpty
(
UnitName
))
{
String
UnitList
=
UnitName
.
substring
(
0
,
UnitName
.
indexOf
(
"("
));
String
RatioList
=
UnitName
.
substring
(
UnitName
.
indexOf
(
"("
));
String
basicUnit
=
UnitList
.
substring
(
0
,
UnitList
.
indexOf
(
","
));
//基本单位
String
otherUnit
=
UnitList
.
substring
(
UnitList
.
indexOf
(
","
)
+
1
);
//副单位
Integer
ratio
=
Integer
.
parseInt
(
RatioList
.
substring
(
RatioList
.
indexOf
(
":"
)
+
1
).
replace
(
")"
,
""
));
//比例
if
(
Unit
.
equals
(
basicUnit
))
{
//如果等于基础单位
depotItem
.
setBasicnumber
(
oNumber
);
//数量一致
}
else
if
(
Unit
.
equals
(
otherUnit
))
{
//如果等于副单位
depotItem
.
setBasicnumber
(
oNumber
*
ratio
);
//数量乘以比例
}
}
else
{
depotItem
.
setBasicnumber
(
oNumber
);
//其他情况
}
}
catch
(
Exception
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>>>设置基础数量异常"
,
e
);
}
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"UnitPrice"
).
toString
()))
{
depotItem
.
setUnitprice
(
tempUpdatedJson
.
getDouble
(
"UnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxUnitPrice"
).
toString
()))
{
depotItem
.
setTaxunitprice
(
tempUpdatedJson
.
getDouble
(
"TaxUnitPrice"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"AllPrice"
).
toString
()))
{
depotItem
.
setAllprice
(
tempUpdatedJson
.
getDouble
(
"AllPrice"
));
}
depotItem
.
setRemark
(
tempUpdatedJson
.
getString
(
"Remark"
));
if
(
tempUpdatedJson
.
get
(
"DepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"DepotId"
).
toString
()))
{
depotItem
.
setDepotid
(
tempUpdatedJson
.
getLong
(
"DepotId"
));
}
if
(
tempUpdatedJson
.
get
(
"AnotherDepotId"
)
!=
null
&&
!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"AnotherDepotId"
).
toString
()))
{
depotItem
.
setAnotherdepotid
(
tempUpdatedJson
.
getLong
(
"AnotherDepotId"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxRate"
).
toString
()))
{
depotItem
.
setTaxrate
(
tempUpdatedJson
.
getDouble
(
"TaxRate"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxMoney"
).
toString
()))
{
depotItem
.
setTaxmoney
(
tempUpdatedJson
.
getDouble
(
"TaxMoney"
));
}
if
(!
StringUtil
.
isEmpty
(
tempUpdatedJson
.
get
(
"TaxLastMoney"
).
toString
()))
{
depotItem
.
setTaxlastmoney
(
tempUpdatedJson
.
getDouble
(
"TaxLastMoney"
));
}
depotItem
.
setOtherfield1
(
tempUpdatedJson
.
getString
(
"OtherField1"
));
depotItem
.
setOtherfield2
(
tempUpdatedJson
.
getString
(
"OtherField2"
));
depotItem
.
setOtherfield3
(
tempUpdatedJson
.
getString
(
"OtherField3"
));
depotItem
.
setOtherfield4
(
tempUpdatedJson
.
getString
(
"OtherField4"
));
depotItem
.
setOtherfield5
(
tempUpdatedJson
.
getString
(
"OtherField5"
));
depotItem
.
setMtype
(
tempUpdatedJson
.
getString
(
"MType"
));
this
.
updateDepotItemWithObj
(
depotItem
);
}
}
return
null
;
}
/**
* 查询计量单位信息
*
* @return
*/
public
String
findUnitName
(
Long
mId
)
{
String
unitName
=
""
;
try
{
unitName
=
materialService
.
findUnitName
(
mId
);
if
(
unitName
!=
null
)
{
unitName
=
unitName
.
substring
(
1
,
unitName
.
length
()
-
1
);
if
(
unitName
.
equals
(
"null"
))
{
unitName
=
""
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
unitName
;
}
}
}
src/main/java/com/jsh/erp/service/functions/FunctionsService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -37,21 +38,25 @@ public class FunctionsService {
...
@@ -37,21 +38,25 @@ public class FunctionsService {
return
functionsMapper
.
countsByFunctions
(
name
,
type
);
return
functionsMapper
.
countsByFunctions
(
name
,
type
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertFunctions
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertFunctions
(
String
beanJson
,
HttpServletRequest
request
)
{
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
return
functionsMapper
.
insertSelective
(
depot
);
return
functionsMapper
.
insertSelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateFunctions
(
String
beanJson
,
Long
id
)
{
public
int
updateFunctions
(
String
beanJson
,
Long
id
)
{
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
depot
.
setId
(
id
);
depot
.
setId
(
id
);
return
functionsMapper
.
updateByPrimaryKeySelective
(
depot
);
return
functionsMapper
.
updateByPrimaryKeySelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteFunctions
(
Long
id
)
{
public
int
deleteFunctions
(
Long
id
)
{
return
functionsMapper
.
deleteByPrimaryKey
(
id
);
return
functionsMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteFunctions
(
String
ids
)
{
public
int
batchDeleteFunctions
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
FunctionsExample
example
=
new
FunctionsExample
();
FunctionsExample
example
=
new
FunctionsExample
();
...
...
src/main/java/com/jsh/erp/service/inOutItem/InOutItemService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -37,21 +38,25 @@ public class InOutItemService {
...
@@ -37,21 +38,25 @@ public class InOutItemService {
return
inOutItemMapper
.
countsByInOutItem
(
name
,
type
,
remark
);
return
inOutItemMapper
.
countsByInOutItem
(
name
,
type
,
remark
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertInOutItem
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertInOutItem
(
String
beanJson
,
HttpServletRequest
request
)
{
InOutItem
depot
=
JSONObject
.
parseObject
(
beanJson
,
InOutItem
.
class
);
InOutItem
depot
=
JSONObject
.
parseObject
(
beanJson
,
InOutItem
.
class
);
return
inOutItemMapper
.
insertSelective
(
depot
);
return
inOutItemMapper
.
insertSelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateInOutItem
(
String
beanJson
,
Long
id
)
{
public
int
updateInOutItem
(
String
beanJson
,
Long
id
)
{
InOutItem
depot
=
JSONObject
.
parseObject
(
beanJson
,
InOutItem
.
class
);
InOutItem
depot
=
JSONObject
.
parseObject
(
beanJson
,
InOutItem
.
class
);
depot
.
setId
(
id
);
depot
.
setId
(
id
);
return
inOutItemMapper
.
updateByPrimaryKeySelective
(
depot
);
return
inOutItemMapper
.
updateByPrimaryKeySelective
(
depot
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteInOutItem
(
Long
id
)
{
public
int
deleteInOutItem
(
Long
id
)
{
return
inOutItemMapper
.
deleteByPrimaryKey
(
id
);
return
inOutItemMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteInOutItem
(
String
ids
)
{
public
int
batchDeleteInOutItem
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
InOutItemExample
example
=
new
InOutItemExample
();
InOutItemExample
example
=
new
InOutItemExample
();
...
...
src/main/java/com/jsh/erp/service/log/LogService.java
View file @
85d96bb2
...
@@ -11,6 +11,7 @@ import com.jsh.erp.utils.Tools;
...
@@ -11,6 +11,7 @@ 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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -43,21 +44,25 @@ public class LogService {
...
@@ -43,21 +44,25 @@ public class LogService {
return
logMapper
.
countsByLog
(
operation
,
usernameID
,
clientIp
,
status
,
beginTime
,
endTime
,
contentdetails
);
return
logMapper
.
countsByLog
(
operation
,
usernameID
,
clientIp
,
status
,
beginTime
,
endTime
,
contentdetails
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertLog
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertLog
(
String
beanJson
,
HttpServletRequest
request
)
{
Log
log
=
JSONObject
.
parseObject
(
beanJson
,
Log
.
class
);
Log
log
=
JSONObject
.
parseObject
(
beanJson
,
Log
.
class
);
return
logMapper
.
insertSelective
(
log
);
return
logMapper
.
insertSelective
(
log
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateLog
(
String
beanJson
,
Long
id
)
{
public
int
updateLog
(
String
beanJson
,
Long
id
)
{
Log
log
=
JSONObject
.
parseObject
(
beanJson
,
Log
.
class
);
Log
log
=
JSONObject
.
parseObject
(
beanJson
,
Log
.
class
);
log
.
setId
(
id
);
log
.
setId
(
id
);
return
logMapper
.
updateByPrimaryKeySelective
(
log
);
return
logMapper
.
updateByPrimaryKeySelective
(
log
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteLog
(
Long
id
)
{
public
int
deleteLog
(
Long
id
)
{
return
logMapper
.
deleteByPrimaryKey
(
id
);
return
logMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteLog
(
String
ids
)
{
public
int
batchDeleteLog
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
LogExample
example
=
new
LogExample
();
LogExample
example
=
new
LogExample
();
...
...
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
85d96bb2
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -9,6 +9,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -70,12 +71,14 @@ public class MaterialService {
...
@@ -70,12 +71,14 @@ public class MaterialService {
return
materialMapper
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
return
materialMapper
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setEnabled
(
true
);
material
.
setEnabled
(
true
);
return
materialMapper
.
insertSelective
(
material
);
return
materialMapper
.
insertSelective
(
material
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateMaterial
(
String
beanJson
,
Long
id
)
{
public
int
updateMaterial
(
String
beanJson
,
Long
id
)
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setId
(
id
);
material
.
setId
(
id
);
...
@@ -89,10 +92,12 @@ public class MaterialService {
...
@@ -89,10 +92,12 @@ public class MaterialService {
return
res
;
return
res
;
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteMaterial
(
Long
id
)
{
public
int
deleteMaterial
(
Long
id
)
{
return
materialMapper
.
deleteByPrimaryKey
(
id
);
return
materialMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterial
(
String
ids
)
{
public
int
batchDeleteMaterial
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
MaterialExample
example
=
new
MaterialExample
();
MaterialExample
example
=
new
MaterialExample
();
...
@@ -127,6 +132,7 @@ public class MaterialService {
...
@@ -127,6 +132,7 @@ public class MaterialService {
return
list
.
size
();
return
list
.
size
();
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetEnable
(
Boolean
enabled
,
String
materialIDs
)
{
public
int
batchSetEnable
(
Boolean
enabled
,
String
materialIDs
)
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
materialIDs
);
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
materialIDs
);
Material
material
=
new
Material
();
Material
material
=
new
Material
();
...
...
src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -44,21 +45,25 @@ public class MaterialCategoryService {
...
@@ -44,21 +45,25 @@ public class MaterialCategoryService {
return
materialCategoryMapper
.
countsByMaterialCategory
(
name
,
parentId
);
return
materialCategoryMapper
.
countsByMaterialCategory
(
name
,
parentId
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertMaterialCategory
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertMaterialCategory
(
String
beanJson
,
HttpServletRequest
request
)
{
MaterialCategory
materialCategory
=
JSONObject
.
parseObject
(
beanJson
,
MaterialCategory
.
class
);
MaterialCategory
materialCategory
=
JSONObject
.
parseObject
(
beanJson
,
MaterialCategory
.
class
);
return
materialCategoryMapper
.
insertSelective
(
materialCategory
);
return
materialCategoryMapper
.
insertSelective
(
materialCategory
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateMaterialCategory
(
String
beanJson
,
Long
id
)
{
public
int
updateMaterialCategory
(
String
beanJson
,
Long
id
)
{
MaterialCategory
materialCategory
=
JSONObject
.
parseObject
(
beanJson
,
MaterialCategory
.
class
);
MaterialCategory
materialCategory
=
JSONObject
.
parseObject
(
beanJson
,
MaterialCategory
.
class
);
materialCategory
.
setId
(
id
);
materialCategory
.
setId
(
id
);
return
materialCategoryMapper
.
updateByPrimaryKeySelective
(
materialCategory
);
return
materialCategoryMapper
.
updateByPrimaryKeySelective
(
materialCategory
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteMaterialCategory
(
Long
id
)
{
public
int
deleteMaterialCategory
(
Long
id
)
{
return
materialCategoryMapper
.
deleteByPrimaryKey
(
id
);
return
materialCategoryMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialCategory
(
String
ids
)
{
public
int
batchDeleteMaterialCategory
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
MaterialCategoryExample
example
=
new
MaterialCategoryExample
();
MaterialCategoryExample
example
=
new
MaterialCategoryExample
();
...
...
src/main/java/com/jsh/erp/service/materialProperty/MaterialPropertyService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -36,21 +37,25 @@ public class MaterialPropertyService {
...
@@ -36,21 +37,25 @@ public class MaterialPropertyService {
return
materialPropertyMapper
.
countsByMaterialProperty
(
name
);
return
materialPropertyMapper
.
countsByMaterialProperty
(
name
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertMaterialProperty
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertMaterialProperty
(
String
beanJson
,
HttpServletRequest
request
)
{
MaterialProperty
materialProperty
=
JSONObject
.
parseObject
(
beanJson
,
MaterialProperty
.
class
);
MaterialProperty
materialProperty
=
JSONObject
.
parseObject
(
beanJson
,
MaterialProperty
.
class
);
return
materialPropertyMapper
.
insertSelective
(
materialProperty
);
return
materialPropertyMapper
.
insertSelective
(
materialProperty
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateMaterialProperty
(
String
beanJson
,
Long
id
)
{
public
int
updateMaterialProperty
(
String
beanJson
,
Long
id
)
{
MaterialProperty
materialProperty
=
JSONObject
.
parseObject
(
beanJson
,
MaterialProperty
.
class
);
MaterialProperty
materialProperty
=
JSONObject
.
parseObject
(
beanJson
,
MaterialProperty
.
class
);
materialProperty
.
setId
(
id
);
materialProperty
.
setId
(
id
);
return
materialPropertyMapper
.
updateByPrimaryKeySelective
(
materialProperty
);
return
materialPropertyMapper
.
updateByPrimaryKeySelective
(
materialProperty
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteMaterialProperty
(
Long
id
)
{
public
int
deleteMaterialProperty
(
Long
id
)
{
return
materialPropertyMapper
.
deleteByPrimaryKey
(
id
);
return
materialPropertyMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialProperty
(
String
ids
)
{
public
int
batchDeleteMaterialProperty
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
MaterialPropertyExample
example
=
new
MaterialPropertyExample
();
MaterialPropertyExample
example
=
new
MaterialPropertyExample
();
...
...
src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
85d96bb2
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.utils.StringUtil;
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
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -37,21 +38,25 @@ public class PersonService {
...
@@ -37,21 +38,25 @@ public class PersonService {
return
personMapper
.
countsByPerson
(
name
,
type
);
return
personMapper
.
countsByPerson
(
name
,
type
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertPerson
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertPerson
(
String
beanJson
,
HttpServletRequest
request
)
{
Person
person
=
JSONObject
.
parseObject
(
beanJson
,
Person
.
class
);
Person
person
=
JSONObject
.
parseObject
(
beanJson
,
Person
.
class
);
return
personMapper
.
insertSelective
(
person
);
return
personMapper
.
insertSelective
(
person
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updatePerson
(
String
beanJson
,
Long
id
)
{
public
int
updatePerson
(
String
beanJson
,
Long
id
)
{
Person
person
=
JSONObject
.
parseObject
(
beanJson
,
Person
.
class
);
Person
person
=
JSONObject
.
parseObject
(
beanJson
,
Person
.
class
);
person
.
setId
(
id
);
person
.
setId
(
id
);
return
personMapper
.
updateByPrimaryKeySelective
(
person
);
return
personMapper
.
updateByPrimaryKeySelective
(
person
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deletePerson
(
Long
id
)
{
public
int
deletePerson
(
Long
id
)
{
return
personMapper
.
deleteByPrimaryKey
(
id
);
return
personMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeletePerson
(
String
ids
)
{
public
int
batchDeletePerson
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
PersonExample
example
=
new
PersonExample
();
PersonExample
example
=
new
PersonExample
();
...
...
src/main/java/com/jsh/erp/service/role/RoleService.java
View file @
85d96bb2
...
@@ -40,21 +40,25 @@ public class RoleService {
...
@@ -40,21 +40,25 @@ public class RoleService {
return
roleMapper
.
countsByRole
(
name
);
return
roleMapper
.
countsByRole
(
name
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertRole
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertRole
(
String
beanJson
,
HttpServletRequest
request
)
{
Role
role
=
JSONObject
.
parseObject
(
beanJson
,
Role
.
class
);
Role
role
=
JSONObject
.
parseObject
(
beanJson
,
Role
.
class
);
return
roleMapper
.
insertSelective
(
role
);
return
roleMapper
.
insertSelective
(
role
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateRole
(
String
beanJson
,
Long
id
)
{
public
int
updateRole
(
String
beanJson
,
Long
id
)
{
Role
role
=
JSONObject
.
parseObject
(
beanJson
,
Role
.
class
);
Role
role
=
JSONObject
.
parseObject
(
beanJson
,
Role
.
class
);
role
.
setId
(
id
);
role
.
setId
(
id
);
return
roleMapper
.
updateByPrimaryKeySelective
(
role
);
return
roleMapper
.
updateByPrimaryKeySelective
(
role
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteRole
(
Long
id
)
{
public
int
deleteRole
(
Long
id
)
{
return
roleMapper
.
deleteByPrimaryKey
(
id
);
return
roleMapper
.
deleteByPrimaryKey
(
id
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteRole
(
String
ids
)
{
public
int
batchDeleteRole
(
String
ids
)
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
RoleExample
example
=
new
RoleExample
();
RoleExample
example
=
new
RoleExample
();
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment