给收付款增加对供应商和客户期初收款的接口
This commit is contained in:
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@@ -55,7 +56,11 @@ public class AccountItemController {
|
||||
item.put("accountName", ai.getAccountName());
|
||||
item.put("inOutItemId", ai.getInOutItemId());
|
||||
item.put("inOutItemName", ai.getInOutItemName());
|
||||
item.put("billNumber", ai.getBillNumber());
|
||||
if(StringUtil.isNotEmpty(ai.getBillNumber())) {
|
||||
item.put("billNumber", ai.getBillNumber());
|
||||
} else {
|
||||
item.put("billNumber", "QiChu");
|
||||
}
|
||||
item.put("needDebt", ai.getNeedDebt());
|
||||
item.put("finishDebt", ai.getFinishDebt());
|
||||
BigDecimal eachAmount = ai.getEachAmount();
|
||||
|
||||
@@ -512,6 +512,8 @@ public class DepotHeadController {
|
||||
@GetMapping(value = "/debtList")
|
||||
@ApiOperation(value = "查询存在欠款的单据")
|
||||
public String debtList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||
@RequestParam("currentPage") Integer currentPage,
|
||||
@RequestParam("pageSize") Integer pageSize,
|
||||
HttpServletRequest request)throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
String organIdStr = StringUtil.getInfo(search, "organId");
|
||||
@@ -524,12 +526,17 @@ public class DepotHeadController {
|
||||
String subType = StringUtil.getInfo(search, "subType");
|
||||
String roleType = StringUtil.getInfo(search, "roleType");
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, type, subType, roleType, status);
|
||||
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, type,
|
||||
subType, roleType, status, (currentPage-1)*pageSize, pageSize);
|
||||
int total = depotHeadService.debtListCount(organId, materialParam, number, beginTime, endTime, type,
|
||||
subType, roleType, status);
|
||||
if (list != null) {
|
||||
objectMap.put("rows", list);
|
||||
objectMap.put("total", total);
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
objectMap.put("rows", new ArrayList<>());
|
||||
objectMap.put("total", 0);
|
||||
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,6 +277,30 @@ public class SupplierController {
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户或供应商查询期初、期初已收等信息
|
||||
* @param organId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping(value = "/getBeginNeedByOrganId")
|
||||
@ApiOperation(value = "根据客户或供应商查询期初、期初已收等信息")
|
||||
public BaseResponseInfo getBeginNeedByOrganId(@RequestParam("organId") Long organId,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
Map<String, Object> map = supplierService.getBeginNeedByOrganId(organId);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入供应商
|
||||
* @param file
|
||||
|
||||
@@ -37,4 +37,6 @@ public interface AccountItemMapperEx {
|
||||
int batchDeleteAccountItemByHeadIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
|
||||
|
||||
BigDecimal getEachAmountByBillId(@Param("billId") Long billId);
|
||||
|
||||
BigDecimal getFinishDebtByOrganId(@Param("organId") Long organId);
|
||||
}
|
||||
@@ -224,6 +224,20 @@ public interface DepotHeadMapperEx {
|
||||
@Param("forceFlag") Boolean forceFlag);
|
||||
|
||||
List<DepotHeadVo4List> debtList(
|
||||
@Param("organId") Long organId,
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType,
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("status") String status,
|
||||
@Param("number") String number,
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotArray") String[] depotArray,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("rows") Integer rows);
|
||||
|
||||
int debtListCount(
|
||||
@Param("organId") Long organId,
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType,
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user