完善多账户和销售人员的展示
This commit is contained in:
@@ -48,17 +48,18 @@ public class PersonController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据Id获取经手人信息
|
* 根据Id获取经手人信息
|
||||||
* @param personIDs
|
* @param personIds
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getPersonByIds")
|
@GetMapping(value = "/getPersonByIds")
|
||||||
public BaseResponseInfo getPersonByIds(@RequestParam("personIDs") String personIDs,
|
public BaseResponseInfo getPersonByIds(@RequestParam("personIds") String personIds,
|
||||||
HttpServletRequest request)throws Exception {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
try {
|
try {
|
||||||
String names = personService.getPersonByIds(personIDs);
|
Map<Long,String> personMap = personService.getPersonMap();
|
||||||
|
String names = personService.getPersonByMapAndIds(personMap, personIds);
|
||||||
map.put("names", names);
|
map.put("names", names);
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = map;
|
res.data = map;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class DepotHeadVo4List extends DepotHead{
|
|||||||
|
|
||||||
private String materialsList;
|
private String materialsList;
|
||||||
|
|
||||||
|
private String salesManStr;
|
||||||
|
|
||||||
private String operTimeStr;
|
private String operTimeStr;
|
||||||
|
|
||||||
public String getProjectName() {
|
public String getProjectName() {
|
||||||
@@ -69,6 +71,14 @@ public class DepotHeadVo4List extends DepotHead{
|
|||||||
this.materialsList = materialsList;
|
this.materialsList = materialsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSalesManStr() {
|
||||||
|
return salesManStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalesManStr(String salesManStr) {
|
||||||
|
this.salesManStr = salesManStr;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOperTimeStr() {
|
public String getOperTimeStr() {
|
||||||
return operTimeStr;
|
return operTimeStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -514,6 +514,28 @@ public class AccountService {
|
|||||||
return result;
|
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) {
|
public Map<String, Object> getStatistics(String name, String serialNo) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
|||||||
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.exception.JshException;
|
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.depotItem.DepotItemService;
|
||||||
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.person.PersonService;
|
||||||
import com.jsh.erp.service.redis.RedisService;
|
import com.jsh.erp.service.redis.RedisService;
|
||||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||||
import com.jsh.erp.service.supplier.SupplierService;
|
import com.jsh.erp.service.supplier.SupplierService;
|
||||||
@@ -32,9 +34,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.jsh.erp.utils.Tools.getCenternTime;
|
import static com.jsh.erp.utils.Tools.getCenternTime;
|
||||||
|
|
||||||
@@ -57,6 +57,10 @@ public class DepotHeadService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrgaUserRelService orgaUserRelService;
|
private OrgaUserRelService orgaUserRelService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private PersonService personService;
|
||||||
|
@Resource
|
||||||
|
private AccountService accountService;
|
||||||
|
@Resource
|
||||||
DepotItemMapperEx depotItemMapperEx;
|
DepotItemMapperEx depotItemMapperEx;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
@@ -88,15 +92,18 @@ public class DepotHeadService {
|
|||||||
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String status, String number, String beginTime, String endTime,
|
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 {
|
String materialParam, String depotIds, int offset, int rows)throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
||||||
List<DepotHeadVo4List> list=null;
|
List<DepotHeadVo4List> list=new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
String [] creatorArray = getCreatorArray(roleType);
|
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);
|
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotIds, offset, rows);
|
||||||
}catch(Exception e){
|
|
||||||
JshException.readFail(logger, e);
|
|
||||||
}
|
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (DepotHeadVo4List dh : 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) {
|
if(dh.getAccountIdList() != null) {
|
||||||
String accountidlistStr = dh.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
String accountidlistStr = dh.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||||
dh.setAccountIdList(accountidlistStr);
|
dh.setAccountIdList(accountidlistStr);
|
||||||
@@ -105,16 +112,15 @@ public class DepotHeadService {
|
|||||||
String accountmoneylistStr = dh.getAccountMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
String accountmoneylistStr = dh.getAccountMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
||||||
dh.setAccountMoneyList(accountmoneylistStr);
|
dh.setAccountMoneyList(accountmoneylistStr);
|
||||||
}
|
}
|
||||||
if(dh.getOtherMoneyList() != null) {
|
|
||||||
String otherMoneyListStr = dh.getOtherMoneyList().replace("[", "").replace("]", "").replaceAll("\"", "");
|
|
||||||
dh.setOtherMoneyList(otherMoneyListStr);
|
|
||||||
}
|
|
||||||
if(dh.getChangeAmount() != null) {
|
if(dh.getChangeAmount() != null) {
|
||||||
dh.setChangeAmount(dh.getChangeAmount().abs());
|
dh.setChangeAmount(dh.getChangeAmount().abs());
|
||||||
}
|
}
|
||||||
if(dh.getTotalPrice() != null) {
|
if(dh.getTotalPrice() != null) {
|
||||||
dh.setTotalPrice(dh.getTotalPrice().abs());
|
dh.setTotalPrice(dh.getTotalPrice().abs());
|
||||||
}
|
}
|
||||||
|
if(StringUtil.isNotEmpty(dh.getSalesMan())) {
|
||||||
|
dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan()));
|
||||||
|
}
|
||||||
if(dh.getOperTime() != null) {
|
if(dh.getOperTime() != null) {
|
||||||
dh.setOperTimeStr(getCenternTime(dh.getOperTime()));
|
dh.setOperTimeStr(getCenternTime(dh.getOperTime()));
|
||||||
}
|
}
|
||||||
@@ -122,6 +128,9 @@ public class DepotHeadService {
|
|||||||
resList.add(dh);
|
resList.add(dh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.readFail(logger, e);
|
||||||
|
}
|
||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PersonService {
|
public class PersonService {
|
||||||
@@ -198,22 +196,20 @@ public class PersonService {
|
|||||||
return list==null?0:list.size();
|
return list==null?0:list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPersonByIds(String personIDs)throws Exception {
|
public Map<Long,String> getPersonMap() throws Exception {
|
||||||
List<Long> ids = StringUtil.strToLongList(personIDs);
|
List<Person> personList = getPerson();
|
||||||
PersonExample example = new PersonExample();
|
Map<Long,String> personMap = new HashMap<>();
|
||||||
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
for(Person person : personList){
|
||||||
example.setOrderByClause("id asc");
|
personMap.put(person.getId(), person.getName());
|
||||||
List<Person> list =null;
|
|
||||||
try{
|
|
||||||
list=personMapper.selectByExample(example);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.readFail(logger, e);
|
|
||||||
}
|
}
|
||||||
|
return personMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersonByMapAndIds(Map<Long,String> personMap, String personIds)throws Exception {
|
||||||
|
List<Long> ids = StringUtil.strToLongList(personIds);
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
if (null != list) {
|
for(Long id: ids){
|
||||||
for (Person person : list) {
|
sb.append(personMap.get(id) + " ");
|
||||||
sb.append(person.getName() + " ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user