Commit b6215fc4 authored by 季圣华's avatar 季圣华
Browse files

给单据接口增加有无欠款的筛选

parent 1764ee66
......@@ -22,6 +22,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type,
@Param("subType") String subType,
@Param("creatorArray") String[] creatorArray,
@Param("hasDebt") String hasDebt,
@Param("statusArray") String[] statusArray,
@Param("purchaseStatusArray") String[] purchaseStatusArray,
@Param("number") String number,
......@@ -43,6 +44,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type,
@Param("subType") String subType,
@Param("creatorArray") String[] creatorArray,
@Param("hasDebt") String hasDebt,
@Param("statusArray") String[] statusArray,
@Param("purchaseStatusArray") String[] purchaseStatusArray,
@Param("number") String number,
......
......@@ -43,6 +43,11 @@ public class DepotHeadVo4List extends DepotHead{
private BigDecimal materialCount;
/**
* 是否有付款单或收款单
*/
private Boolean hasFinancialFlag;
public String getProjectName() {
return projectName;
}
......@@ -186,4 +191,12 @@ public class DepotHeadVo4List extends DepotHead{
public void setMaterialCount(BigDecimal materialCount) {
this.materialCount = materialCount;
}
public Boolean getHasFinancialFlag() {
return hasFinancialFlag;
}
public void setHasFinancialFlag(Boolean hasFinancialFlag) {
this.hasFinancialFlag = hasFinancialFlag;
}
}
\ No newline at end of file
......@@ -34,6 +34,7 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
String number = StringUtil.getInfo(search, "number");
......@@ -46,8 +47,8 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.select(type, subType, roleType, status, purchaseStatus, number, linkNumber, beginTime, endTime, materialParam,
organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map));
return depotHeadService.select(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
......@@ -56,6 +57,7 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
String number = StringUtil.getInfo(search, "number");
......@@ -68,8 +70,8 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.countDepotHead(type, subType, roleType, status, purchaseStatus, number, linkNumber, beginTime, endTime, materialParam,
organId, creator, depotId, accountId, remark);
return depotHeadService.countDepotHead(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark);
}
@Override
......
......@@ -14,6 +14,7 @@ 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.accountHead.AccountHeadService;
import com.jsh.erp.service.accountItem.AccountItemService;
import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotItem.DepotItemService;
......@@ -77,6 +78,8 @@ public class DepotHeadService {
@Resource
private AccountService accountService;
@Resource
private AccountHeadService accountHeadService;
@Resource
private AccountItemService accountItemService;
@Resource
DepotItemMapperEx depotItemMapperEx;
......@@ -105,7 +108,7 @@ public class DepotHeadService {
return list;
}
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String status, String purchaseStatus, String number, String linkNumber,
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark, int offset, int rows) throws Exception {
List<DepotHeadVo4List> resList = new ArrayList<>();
List<DepotHeadVo4List> list=new ArrayList<>();
......@@ -119,7 +122,7 @@ public class DepotHeadService {
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,
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, hasDebt, statusArray, purchaseStatusArray, number, linkNumber, beginTime, endTime,
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark, offset, rows);
if (null != list) {
for (DepotHeadVo4List dh : list) {
......@@ -145,6 +148,14 @@ public class DepotHeadService {
dh.setDeposit(BigDecimal.ZERO);
}
dh.setFinishDeposit(depotHeadMapperEx.getFinishDepositByNumber(dh.getNumber()));
//欠款计算
BigDecimal discountLastMoney = dh.getDiscountLastMoney()!=null?dh.getDiscountLastMoney():BigDecimal.ZERO;
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount():BigDecimal.ZERO;
dh.setDebt(discountLastMoney.add(otherMoney).subtract((dh.getDeposit().add(changeAmount))));
//是否有付款单或收款单
int financialBillNoSize = accountHeadService.getFinancialBillNoByBillId(dh.getId()).size();
dh.setHasFinancialFlag(financialBillNoSize>0);
if(StringUtil.isNotEmpty(dh.getSalesMan())) {
dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan()));
}
......@@ -170,7 +181,7 @@ public class DepotHeadService {
return resList;
}
public Long countDepotHead(String type, String subType, String roleType, String status, String purchaseStatus, String number, String linkNumber,
public Long countDepotHead(String type, String subType, String roleType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark) throws Exception{
Long result=null;
try{
......@@ -181,7 +192,7 @@ public class DepotHeadService {
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,
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, hasDebt, statusArray, purchaseStatusArray, number, linkNumber, beginTime, endTime,
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark);
}catch(Exception e){
JshException.readFail(logger, e);
......
......@@ -134,6 +134,12 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/>
and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId})
</if>
<if test="hasDebt != null and hasDebt ==1">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))>0)
</if>
<if test="hasDebt != null and hasDebt ==0">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))=0)
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
......@@ -224,6 +230,12 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/>
and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId})
</if>
<if test="hasDebt != null and hasDebt ==1">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))>0)
</if>
<if test="hasDebt != null and hasDebt ==0">
and (ifnull(dh.discount_last_money,0)+ifnull(dh.other_money,0)-ifnull(dh.deposit,0)-abs(ifnull(dh.change_amount,0))=0)
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment