给对账单和销售单据的接口增加客户传参字段
This commit is contained in:
parent
b9b647e0cf
commit
b7be1b020a
@ -104,6 +104,7 @@ public class DepotHeadController {
|
||||
@RequestParam("endTime") String endTime,
|
||||
@RequestParam(value = "roleType", required = false) String roleType,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam(value = "subType",required = false) String subType,
|
||||
@RequestParam("remark") String remark,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
@ -122,12 +123,13 @@ public class DepotHeadController {
|
||||
}
|
||||
List<DepotHeadVo4InDetail> resList = new ArrayList<DepotHeadVo4InDetail>();
|
||||
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
|
||||
String [] organArray = depotHeadService.getOrganArray(subType, "");
|
||||
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
List<DepotHeadVo4InDetail> list = depotHeadService.findByAll(beginTime, endTime, type, creatorArray,
|
||||
materialParam, depotList, oId, number, remark, (currentPage-1)*pageSize, pageSize);
|
||||
organArray, materialParam, depotList, oId, number, remark, (currentPage-1)*pageSize, pageSize);
|
||||
int total = depotHeadService.findByAllCount(beginTime, endTime, type, creatorArray,
|
||||
materialParam, depotList, oId, number, remark);
|
||||
organArray, materialParam, depotList, oId, number, remark);
|
||||
map.put("total", total);
|
||||
//存放数据json数组
|
||||
if (null != list) {
|
||||
@ -307,11 +309,12 @@ public class DepotHeadController {
|
||||
type = "出库";
|
||||
subType = "销售";
|
||||
}
|
||||
String [] organArray = depotHeadService.getOrganArray(subType, "");
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
List<DepotHeadVo4StatementAccount> list = depotHeadService.getStatementAccount(beginTime, endTime, organId,
|
||||
List<DepotHeadVo4StatementAccount> list = depotHeadService.getStatementAccount(beginTime, endTime, organId, organArray,
|
||||
supplierType, type, subType, (currentPage-1)*pageSize, pageSize);
|
||||
int total = depotHeadService.getStatementAccountCount(beginTime, endTime, organId,
|
||||
int total = depotHeadService.getStatementAccountCount(beginTime, endTime, organId, organArray,
|
||||
supplierType, type, subType);
|
||||
for(DepotHeadVo4StatementAccount item: list) {
|
||||
BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreBackMoney());
|
||||
@ -321,7 +324,7 @@ public class DepotHeadController {
|
||||
}
|
||||
map.put("rows", list);
|
||||
map.put("total", total);
|
||||
List<DepotHeadVo4StatementAccount> totalPayList = depotHeadService.getStatementAccountTotalPay(beginTime, endTime, organId, supplierType, type, subType);
|
||||
List<DepotHeadVo4StatementAccount> totalPayList = depotHeadService.getStatementAccountTotalPay(beginTime, endTime, organId, organArray, supplierType, type, subType);
|
||||
if(totalPayList.size()>0) {
|
||||
DepotHeadVo4StatementAccount totalPayItem = totalPayList.get(0);
|
||||
BigDecimal firstMoney = BigDecimal.ZERO;
|
||||
|
||||
@ -30,6 +30,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("organId") Long organId,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("creator") Long creator,
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("depotArray") String[] depotArray,
|
||||
@ -50,6 +51,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("organId") Long organId,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("creator") Long creator,
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("depotArray") String[] depotArray,
|
||||
@ -64,6 +66,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("type") String type,
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("oId") Integer oId,
|
||||
@ -77,6 +80,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("type") String type,
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("oId") Integer oId,
|
||||
@ -91,6 +95,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("oId") Integer oId,
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
@ -101,7 +106,8 @@ public interface DepotHeadMapperEx {
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("oId") Integer oId,
|
||||
@Param("creatorArray") String[] creatorArray);
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("organArray") String[] organArray);
|
||||
|
||||
List<DepotHeadVo4InDetail> findAllocationDetail(
|
||||
@Param("beginTime") String beginTime,
|
||||
@ -131,6 +137,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("organId") Integer organId,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("supplierType") String supplierType,
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType,
|
||||
@ -141,6 +148,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("organId") Integer organId,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("supplierType") String supplierType,
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType);
|
||||
@ -149,6 +157,7 @@ public interface DepotHeadMapperEx {
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("organId") Integer organId,
|
||||
@Param("organArray") String[] organArray,
|
||||
@Param("supplierType") String supplierType,
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType);
|
||||
|
||||
@ -23,7 +23,9 @@ 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;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@ -60,6 +62,10 @@ public class DepotHeadService {
|
||||
@Resource
|
||||
private SupplierService supplierService;
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
@Resource
|
||||
private SerialNumberService serialNumberService;
|
||||
@Resource
|
||||
private OrgaUserRelService orgaUserRelService;
|
||||
@ -107,12 +113,13 @@ public class DepotHeadService {
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||
String [] purchaseStatusArray = StringUtil.isNotEmpty(purchaseStatus) ? purchaseStatus.split(",") : null;
|
||||
String [] organArray = getOrganArray(subType, purchaseStatus);
|
||||
Map<Long,String> personMap = personService.getPersonMap();
|
||||
Map<Long,String> accountMap = accountService.getAccountMap();
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, statusArray, purchaseStatusArray, number, linkNumber, beginTime, endTime,
|
||||
materialParam, organId, creator, depotId, depotArray, accountId, remark, offset, rows);
|
||||
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark, offset, rows);
|
||||
if (null != list) {
|
||||
for (DepotHeadVo4List dh : list) {
|
||||
if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) {
|
||||
@ -161,10 +168,11 @@ public class DepotHeadService {
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||
String [] purchaseStatusArray = StringUtil.isNotEmpty(purchaseStatus) ? purchaseStatus.split(",") : null;
|
||||
String [] organArray = getOrganArray(subType, purchaseStatus);
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, statusArray, purchaseStatusArray, number, linkNumber, beginTime, endTime,
|
||||
materialParam, organId, creator, depotId, depotArray, accountId, remark);
|
||||
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@ -201,6 +209,37 @@ public class DepotHeadService {
|
||||
return creatorArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构数组
|
||||
* @return
|
||||
*/
|
||||
public String[] getOrganArray(String subType, String purchaseStatus) throws Exception {
|
||||
String [] organArray = null;
|
||||
String type = "UserCustomer";
|
||||
Long userId = userService.getCurrentUser().getId();
|
||||
//获取权限信息
|
||||
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
|
||||
List<Supplier> supplierList = supplierService.findBySelectCus();
|
||||
if(BusinessConstants.SUB_TYPE_SALES_ORDER.equals(subType) || BusinessConstants.SUB_TYPE_SALES.equals(subType)
|
||||
||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(subType) ) {
|
||||
//采购订单里面选择销售订单的时候不要过滤
|
||||
if(StringUtil.isEmpty(purchaseStatus)) {
|
||||
if (null != supplierList) {
|
||||
boolean customerFlag = systemConfigService.getCustomerFlag();
|
||||
List<String> organList = new ArrayList<>();
|
||||
for (Supplier supplier : supplierList) {
|
||||
boolean flag = ubValue.contains("[" + supplier.getId().toString() + "]");
|
||||
if (!customerFlag || flag) {
|
||||
organList.add(supplier.getId().toString());
|
||||
}
|
||||
}
|
||||
organArray = StringUtil.listToStringArray(organList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return organArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色类型获取操作员
|
||||
* @param roleType
|
||||
@ -448,11 +487,11 @@ public class DepotHeadService {
|
||||
}
|
||||
|
||||
public List<DepotHeadVo4InDetail> findByAll(String beginTime, String endTime, String type, String [] creatorArray,
|
||||
String materialParam, List<Long> depotList, Integer oId, String number,
|
||||
String [] organArray, String materialParam, List<Long> depotList, Integer oId, String number,
|
||||
String remark, Integer offset, Integer rows) throws Exception{
|
||||
List<DepotHeadVo4InDetail> list = null;
|
||||
try{
|
||||
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, creatorArray, materialParam, depotList, oId, number, remark, offset, rows);
|
||||
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, creatorArray, organArray, materialParam, depotList, oId, number, remark, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@ -460,11 +499,11 @@ public class DepotHeadService {
|
||||
}
|
||||
|
||||
public int findByAllCount(String beginTime, String endTime, String type, String [] creatorArray,
|
||||
String materialParam, List<Long> depotList, Integer oId, String number,
|
||||
String [] organArray, String materialParam, List<Long> depotList, Integer oId, String number,
|
||||
String remark) throws Exception{
|
||||
int result = 0;
|
||||
try{
|
||||
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, creatorArray, materialParam, depotList, oId, number, remark);
|
||||
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, creatorArray, organArray, materialParam, depotList, oId, number, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@ -476,7 +515,10 @@ public class DepotHeadService {
|
||||
List<DepotHeadVo4InOutMCount> list = null;
|
||||
try{
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotList, oId, creatorArray, offset, rows);
|
||||
String subType = "出库".equals(type)? "销售" : "";
|
||||
String [] organArray = getOrganArray(subType, "");
|
||||
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, materialParam, depotList, oId,
|
||||
creatorArray, organArray, offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@ -488,7 +530,10 @@ public class DepotHeadService {
|
||||
int result = 0;
|
||||
try{
|
||||
String [] creatorArray = getCreatorArray(roleType);
|
||||
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotList, oId, creatorArray);
|
||||
String subType = "出库".equals(type)? "销售" : "";
|
||||
String [] organArray = getOrganArray(subType, "");
|
||||
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, materialParam, depotList, oId,
|
||||
creatorArray, organArray);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@ -521,33 +566,34 @@ public class DepotHeadService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DepotHeadVo4StatementAccount> getStatementAccount(String beginTime, String endTime, Integer organId, String supplierType,
|
||||
String type, String subType, Integer offset, Integer rows) {
|
||||
public List<DepotHeadVo4StatementAccount> getStatementAccount(String beginTime, String endTime, Integer organId, String [] organArray,
|
||||
String supplierType, String type, String subType, Integer offset, Integer rows) {
|
||||
List<DepotHeadVo4StatementAccount> list = null;
|
||||
try{
|
||||
list = depotHeadMapperEx.getStatementAccount(beginTime, endTime, organId, supplierType, type, subType, offset, rows);
|
||||
list = depotHeadMapperEx.getStatementAccount(beginTime, endTime, organId, organArray, supplierType, type, subType, offset, rows);
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public int getStatementAccountCount(String beginTime, String endTime, Integer organId, String supplierType,
|
||||
String type, String subType) {
|
||||
public int getStatementAccountCount(String beginTime, String endTime, Integer organId,
|
||||
String [] organArray, String supplierType, String type, String subType) {
|
||||
int result = 0;
|
||||
try{
|
||||
result = depotHeadMapperEx.getStatementAccountCount(beginTime, endTime, organId, supplierType, type, subType);
|
||||
result = depotHeadMapperEx.getStatementAccountCount(beginTime, endTime, organId, organArray, supplierType, type, subType);
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DepotHeadVo4StatementAccount> getStatementAccountTotalPay(String beginTime, String endTime, Integer organId, String supplierType,
|
||||
public List<DepotHeadVo4StatementAccount> getStatementAccountTotalPay(String beginTime, String endTime, Integer organId,
|
||||
String [] organArray, String supplierType,
|
||||
String type, String subType) {
|
||||
List<DepotHeadVo4StatementAccount> list = null;
|
||||
try{
|
||||
list = depotHeadMapperEx.getStatementAccountTotalPay(beginTime, endTime, organId, supplierType, type, subType);
|
||||
list = depotHeadMapperEx.getStatementAccountTotalPay(beginTime, endTime, organId, organArray, supplierType, type, subType);
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@ -100,6 +100,13 @@
|
||||
<if test="organId != null">
|
||||
and dh.organ_id=#{organId}
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
and dh.creator=#{creator}
|
||||
</if>
|
||||
@ -183,6 +190,13 @@
|
||||
<if test="organId != null">
|
||||
and dh.organ_id=#{organId}
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
and dh.creator=#{creator}
|
||||
</if>
|
||||
@ -251,6 +265,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="number != null and number !=''">
|
||||
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||
and dh.number like #{bindNumber}
|
||||
@ -299,6 +320,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="number != null and number !=''">
|
||||
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||
and dh.number like #{bindNumber}
|
||||
@ -338,6 +366,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="depotList.size()>0">
|
||||
<if test="type == '入库'">
|
||||
and ((
|
||||
@ -388,6 +423,13 @@
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and dh.organ_id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="depotList.size()>0">
|
||||
<if test="type == '入库'">
|
||||
and ((
|
||||
@ -549,6 +591,13 @@
|
||||
<if test="organId != null">
|
||||
and s.id = #{organId}
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and s.id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and ifnull(s.delete_flag,'0') !='1') tb
|
||||
where begin_need+preDebtMoney-preBackMoney+debtMoney-backMoney>0
|
||||
order by begin_need+preDebtMoney-preBackMoney+debtMoney-backMoney desc
|
||||
@ -591,6 +640,13 @@
|
||||
<if test="organId != null">
|
||||
and s.id = #{organId}
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and s.id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and ifnull(s.delete_flag,'0') !='1') tb
|
||||
where begin_need+preDebtMoney-preBackMoney+debtMoney-backMoney>0
|
||||
</select>
|
||||
@ -630,6 +686,13 @@
|
||||
<if test="organId != null">
|
||||
and s.id = #{organId}
|
||||
</if>
|
||||
<if test="organArray != null and organArray !=''">
|
||||
and s.id in (
|
||||
<foreach collection="organArray" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and ifnull(s.delete_flag,'0') !='1') tb
|
||||
where begin_need+preDebtMoney-preBackMoney+debtMoney-backMoney>0
|
||||
</select>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user