给收付款增加对供应商和客户期初收款的接口

This commit is contained in:
季圣华
2023-03-20 01:47:36 +08:00
parent 71e3d1fe95
commit b8cfcdcac6
10 changed files with 181 additions and 12 deletions

View File

@@ -1234,7 +1234,7 @@ public class DepotHeadService {
}
public List<DepotHeadVo4List> debtList(Long organId, String materialParam, String number, String beginTime, String endTime,
String type, String subType, String roleType, String status) {
String type, String subType, String roleType, String status, Integer offset, Integer rows) {
List<DepotHeadVo4List> resList = new ArrayList<>();
try{
String depotIds = depotService.findDepotStrByCurrentUser();
@@ -1242,7 +1242,8 @@ public class DepotHeadService {
String [] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4List> list=depotHeadMapperEx.debtList(organId, type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotArray);
List<DepotHeadVo4List> list=depotHeadMapperEx.debtList(organId, type, subType, creatorArray, status, number,
beginTime, endTime, materialParam, depotArray, offset, rows);
if (null != list) {
List<Long> idList = new ArrayList<>();
for (DepotHeadVo4List dh : list) {
@@ -1301,4 +1302,22 @@ public class DepotHeadService {
}
return resList;
}
public int debtListCount(Long organId, String materialParam, String number, String beginTime, String endTime,
String type, String subType, String roleType, String status) {
int total = 0;
try {
String depotIds = depotService.findDepotStrByCurrentUser();
String[] depotArray = depotIds.split(",");
String[] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime, BusinessConstants.DAY_LAST_TIME);
total = depotHeadMapperEx.debtListCount(organId, type, subType, creatorArray, status, number,
beginTime, endTime, materialParam, depotArray);
} catch(Exception e){
JshException.readFail(logger, e);
}
return total;
}
}

View File

@@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
import com.jsh.erp.datasource.mappers.SupplierMapper;
import com.jsh.erp.datasource.mappers.SupplierMapperEx;
import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.accountHead.AccountHeadService;
@@ -56,6 +53,8 @@ public class SupplierService {
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
@Resource
private AccountItemMapperEx accountItemMapperEx;
@Resource
private DepotHeadService depotHeadService;
@Resource
private AccountHeadService accountHeadService;
@@ -403,6 +402,29 @@ public class SupplierService {
return list;
}
public Map<String, Object> getBeginNeedByOrganId(Long organId) throws Exception {
Supplier supplier = getSupplier(organId);
Map<String, Object> map = new HashMap<>();
BigDecimal needDebt = BigDecimal.ZERO;
if("供应商".equals(supplier.getType())) {
needDebt = supplier.getBeginNeedPay();
} else if("客户".equals(supplier.getType())) {
needDebt = supplier.getBeginNeedGet();
}
BigDecimal finishDebt = accountItemMapperEx.getFinishDebtByOrganId(organId);
BigDecimal eachAmount = BigDecimal.ZERO;
if(needDebt != null && finishDebt != null) {
eachAmount = needDebt.subtract(finishDebt);
}
//应收欠款
map.put("needDebt", needDebt);
//已收欠款
map.put("finishDebt", finishDebt);
//本次收款
map.put("eachAmount", eachAmount);
return map;
}
public void importVendor(MultipartFile file, HttpServletRequest request) throws Exception{
String type = "供应商";
Workbook workbook = Workbook.getWorkbook(file.getInputStream());