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
16a42c2a
Commit
16a42c2a
authored
Apr 26, 2021
by
季圣华
Browse files
完善多账户和销售人员的展示
parent
b35243f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/PersonController.java
View file @
16a42c2a
...
...
@@ -48,17 +48,18 @@ public class PersonController {
/**
* 根据Id获取经手人信息
* @param personI
D
s
* @param personI
d
s
* @param request
* @return
*/
@GetMapping
(
value
=
"/getPersonByIds"
)
public
BaseResponseInfo
getPersonByIds
(
@RequestParam
(
"personI
D
s"
)
String
personI
D
s
,
public
BaseResponseInfo
getPersonByIds
(
@RequestParam
(
"personI
d
s"
)
String
personI
d
s
,
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
try
{
String
names
=
personService
.
getPersonByIds
(
personIDs
);
Map
<
Long
,
String
>
personMap
=
personService
.
getPersonMap
();
String
names
=
personService
.
getPersonByMapAndIds
(
personMap
,
personIds
);
map
.
put
(
"names"
,
names
);
res
.
code
=
200
;
res
.
data
=
map
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotHeadVo4List.java
View file @
16a42c2a
...
...
@@ -19,6 +19,8 @@ public class DepotHeadVo4List extends DepotHead{
private
String
materialsList
;
private
String
salesManStr
;
private
String
operTimeStr
;
public
String
getProjectName
()
{
...
...
@@ -69,6 +71,14 @@ public class DepotHeadVo4List extends DepotHead{
this
.
materialsList
=
materialsList
;
}
public
String
getSalesManStr
()
{
return
salesManStr
;
}
public
void
setSalesManStr
(
String
salesManStr
)
{
this
.
salesManStr
=
salesManStr
;
}
public
String
getOperTimeStr
()
{
return
operTimeStr
;
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
16a42c2a
...
...
@@ -514,6 +514,28 @@ public class AccountService {
return
result
;
}
public
Map
<
Long
,
String
>
getAccountMap
()
throws
Exception
{
List
<
Account
>
accountList
=
getAccount
();
Map
<
Long
,
String
>
accountMap
=
new
HashMap
<>();
for
(
Account
account
:
accountList
){
accountMap
.
put
(
account
.
getId
(),
account
.
getName
());
}
return
accountMap
;
}
public
String
getAccountStrByIdAndMoney
(
Map
<
Long
,
String
>
accountMap
,
String
accountIdList
,
String
accountMoneyList
){
StringBuffer
sb
=
new
StringBuffer
();
accountIdList
=
accountIdList
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replace
(
"\""
,
""
);
accountMoneyList
=
accountMoneyList
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replace
(
"\""
,
""
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
accountIdList
);
List
<
Long
>
moneyList
=
StringUtil
.
strToLongList
(
accountMoneyList
);
for
(
int
i
=
0
;
i
<
idList
.
size
();
i
++)
{
Long
id
=
idList
.
get
(
i
);
sb
.
append
(
accountMap
.
get
(
id
)
+
"("
+
moneyList
.
get
(
i
)
+
"元) "
);
}
return
sb
.
toString
();
}
public
Map
<
String
,
Object
>
getStatistics
(
String
name
,
String
serialNo
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
16a42c2a
...
...
@@ -13,9 +13,11 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import
com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.JshException
;
import
com.jsh.erp.service.account.AccountService
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.person.PersonService
;
import
com.jsh.erp.service.redis.RedisService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.supplier.SupplierService
;
...
...
@@ -32,9 +34,7 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
import
static
com
.
jsh
.
erp
.
utils
.
Tools
.
getCenternTime
;
...
...
@@ -57,6 +57,10 @@ public class DepotHeadService {
@Resource
private
OrgaUserRelService
orgaUserRelService
;
@Resource
private
PersonService
personService
;
@Resource
private
AccountService
accountService
;
@Resource
DepotItemMapperEx
depotItemMapperEx
;
@Resource
private
LogService
logService
;
...
...
@@ -88,39 +92,44 @@ public class DepotHeadService {
public
List
<
DepotHeadVo4List
>
select
(
String
type
,
String
subType
,
String
roleType
,
String
status
,
String
number
,
String
beginTime
,
String
endTime
,
String
materialParam
,
String
depotIds
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
DepotHeadVo4List
>
resList
=
new
ArrayList
<
DepotHeadVo4List
>();
List
<
DepotHeadVo4List
>
list
=
n
ull
;
List
<
DepotHeadVo4List
>
list
=
n
ew
ArrayList
<>()
;
try
{
String
[]
creatorArray
=
getCreatorArray
(
roleType
);
Map
<
Long
,
String
>
personMap
=
personService
.
getPersonMap
();
Map
<
Long
,
String
>
accountMap
=
accountService
.
getAccountMap
();
list
=
depotHeadMapperEx
.
selectByConditionDepotHead
(
type
,
subType
,
creatorArray
,
status
,
number
,
beginTime
,
endTime
,
materialParam
,
depotIds
,
offset
,
rows
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
if
(
null
!=
list
)
{
for
(
DepotHeadVo4List
dh
:
list
)
{
if
(
dh
.
getAccountIdList
()
!=
null
)
{
String
accountidlistStr
=
dh
.
getAccountIdList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
dh
.
setAccountIdList
(
accountidlistStr
);
}
if
(
dh
.
getAccountMoneyList
()
!=
null
)
{
String
accountmoneylistStr
=
dh
.
getAccountMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
dh
.
setAccountMoneyList
(
accountmoneylistStr
);
}
if
(
dh
.
getOtherMoneyList
()
!=
null
)
{
String
otherMoneyListStr
=
dh
.
getOtherMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
dh
.
setOtherMoneyList
(
otherMoneyListStr
);
}
if
(
dh
.
getChangeAmount
()
!=
null
)
{
dh
.
setChangeAmount
(
dh
.
getChangeAmount
().
abs
());
}
if
(
dh
.
getTotalPrice
()
!=
null
)
{
dh
.
setTotalPrice
(
dh
.
getTotalPrice
().
abs
());
}
if
(
dh
.
getOperTime
()
!=
null
)
{
dh
.
setOperTimeStr
(
getCenternTime
(
dh
.
getOperTime
()));
if
(
null
!=
list
)
{
for
(
DepotHeadVo4List
dh
:
list
)
{
if
(
accountMap
!=
null
&&
StringUtil
.
isNotEmpty
(
dh
.
getAccountIdList
())
&&
StringUtil
.
isNotEmpty
(
dh
.
getAccountMoneyList
()))
{
String
accountStr
=
accountService
.
getAccountStrByIdAndMoney
(
accountMap
,
dh
.
getAccountIdList
(),
dh
.
getAccountMoneyList
());
dh
.
setAccountName
(
accountStr
);
}
if
(
dh
.
getAccountIdList
()
!=
null
)
{
String
accountidlistStr
=
dh
.
getAccountIdList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
dh
.
setAccountIdList
(
accountidlistStr
);
}
if
(
dh
.
getAccountMoneyList
()
!=
null
)
{
String
accountmoneylistStr
=
dh
.
getAccountMoneyList
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replaceAll
(
"\""
,
""
);
dh
.
setAccountMoneyList
(
accountmoneylistStr
);
}
if
(
dh
.
getChangeAmount
()
!=
null
)
{
dh
.
setChangeAmount
(
dh
.
getChangeAmount
().
abs
());
}
if
(
dh
.
getTotalPrice
()
!=
null
)
{
dh
.
setTotalPrice
(
dh
.
getTotalPrice
().
abs
());
}
if
(
StringUtil
.
isNotEmpty
(
dh
.
getSalesMan
()))
{
dh
.
setSalesManStr
(
personService
.
getPersonByMapAndIds
(
personMap
,
dh
.
getSalesMan
()));
}
if
(
dh
.
getOperTime
()
!=
null
)
{
dh
.
setOperTimeStr
(
getCenternTime
(
dh
.
getOperTime
()));
}
dh
.
setMaterialsList
(
findMaterialsListByHeaderId
(
dh
.
getId
()));
resList
.
add
(
dh
);
}
dh
.
setMaterialsList
(
findMaterialsListByHeaderId
(
dh
.
getId
()));
resList
.
add
(
dh
);
}
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
}
return
resList
;
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/person/PersonService.java
View file @
16a42c2a
...
...
@@ -23,9 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
@Service
public
class
PersonService
{
...
...
@@ -198,24 +196,22 @@ public class PersonService {
return
list
==
null
?
0
:
list
.
size
();
}
public
String
getPersonByIds
(
String
personIDs
)
throws
Exception
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
personIDs
);
PersonExample
example
=
new
PersonExample
();
example
.
createCriteria
().
andIdIn
(
ids
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"id asc"
);
List
<
Person
>
list
=
null
;
try
{
list
=
personMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
public
Map
<
Long
,
String
>
getPersonMap
()
throws
Exception
{
List
<
Person
>
personList
=
getPerson
();
Map
<
Long
,
String
>
personMap
=
new
HashMap
<>();
for
(
Person
person
:
personList
){
personMap
.
put
(
person
.
getId
(),
person
.
getName
());
}
return
personMap
;
}
public
String
getPersonByMapAndIds
(
Map
<
Long
,
String
>
personMap
,
String
personIds
)
throws
Exception
{
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
personIds
);
StringBuffer
sb
=
new
StringBuffer
();
if
(
null
!=
list
)
{
for
(
Person
person
:
list
)
{
sb
.
append
(
person
.
getName
()
+
" "
);
}
for
(
Long
id:
ids
){
sb
.
append
(
personMap
.
get
(
id
)
+
" "
);
}
return
sb
.
toString
();
return
sb
.
toString
();
}
public
List
<
Person
>
getPersonByType
(
String
type
)
throws
Exception
{
...
...
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