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

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

parent 1764ee66
...@@ -22,6 +22,7 @@ public interface DepotHeadMapperEx { ...@@ -22,6 +22,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type, @Param("type") String type,
@Param("subType") String subType, @Param("subType") String subType,
@Param("creatorArray") String[] creatorArray, @Param("creatorArray") String[] creatorArray,
@Param("hasDebt") String hasDebt,
@Param("statusArray") String[] statusArray, @Param("statusArray") String[] statusArray,
@Param("purchaseStatusArray") String[] purchaseStatusArray, @Param("purchaseStatusArray") String[] purchaseStatusArray,
@Param("number") String number, @Param("number") String number,
...@@ -43,6 +44,7 @@ public interface DepotHeadMapperEx { ...@@ -43,6 +44,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type, @Param("type") String type,
@Param("subType") String subType, @Param("subType") String subType,
@Param("creatorArray") String[] creatorArray, @Param("creatorArray") String[] creatorArray,
@Param("hasDebt") String hasDebt,
@Param("statusArray") String[] statusArray, @Param("statusArray") String[] statusArray,
@Param("purchaseStatusArray") String[] purchaseStatusArray, @Param("purchaseStatusArray") String[] purchaseStatusArray,
@Param("number") String number, @Param("number") String number,
......
...@@ -43,6 +43,11 @@ public class DepotHeadVo4List extends DepotHead{ ...@@ -43,6 +43,11 @@ public class DepotHeadVo4List extends DepotHead{
private BigDecimal materialCount; private BigDecimal materialCount;
/**
* 是否有付款单或收款单
*/
private Boolean hasFinancialFlag;
public String getProjectName() { public String getProjectName() {
return projectName; return projectName;
} }
...@@ -186,4 +191,12 @@ public class DepotHeadVo4List extends DepotHead{ ...@@ -186,4 +191,12 @@ public class DepotHeadVo4List extends DepotHead{
public void setMaterialCount(BigDecimal materialCount) { public void setMaterialCount(BigDecimal materialCount) {
this.materialCount = 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 { ...@@ -34,6 +34,7 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type"); String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType"); String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType"); String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status"); String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus"); String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
String number = StringUtil.getInfo(search, "number"); String number = StringUtil.getInfo(search, "number");
...@@ -46,8 +47,8 @@ public class DepotHeadComponent implements ICommonQuery { ...@@ -46,8 +47,8 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId")); Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId")); Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.select(type, subType, roleType, status, purchaseStatus, number, linkNumber, beginTime, endTime, materialParam, return depotHeadService.select(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map)); beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@Override @Override
...@@ -56,6 +57,7 @@ public class DepotHeadComponent implements ICommonQuery { ...@@ -56,6 +57,7 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type"); String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType"); String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType"); String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status"); String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus"); String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
String number = StringUtil.getInfo(search, "number"); String number = StringUtil.getInfo(search, "number");
...@@ -68,8 +70,8 @@ public class DepotHeadComponent implements ICommonQuery { ...@@ -68,8 +70,8 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId")); Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId")); Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.countDepotHead(type, subType, roleType, status, purchaseStatus, number, linkNumber, beginTime, endTime, materialParam, return depotHeadService.countDepotHead(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
organId, creator, depotId, accountId, remark); beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark);
} }
@Override @Override
......
...@@ -14,6 +14,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount; ...@@ -14,6 +14,7 @@ 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.account.AccountService;
import com.jsh.erp.service.accountHead.AccountHeadService;
import com.jsh.erp.service.accountItem.AccountItemService; import com.jsh.erp.service.accountItem.AccountItemService;
import com.jsh.erp.service.depot.DepotService; import com.jsh.erp.service.depot.DepotService;
import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.depotItem.DepotItemService;
...@@ -77,6 +78,8 @@ public class DepotHeadService { ...@@ -77,6 +78,8 @@ public class DepotHeadService {
@Resource @Resource
private AccountService accountService; private AccountService accountService;
@Resource @Resource
private AccountHeadService accountHeadService;
@Resource
private AccountItemService accountItemService; private AccountItemService accountItemService;
@Resource @Resource
DepotItemMapperEx depotItemMapperEx; DepotItemMapperEx depotItemMapperEx;
...@@ -105,7 +108,7 @@ public class DepotHeadService { ...@@ -105,7 +108,7 @@ public class DepotHeadService {
return list; 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 { 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> resList = new ArrayList<>();
List<DepotHeadVo4List> list=new ArrayList<>(); List<DepotHeadVo4List> list=new ArrayList<>();
...@@ -119,7 +122,7 @@ public class DepotHeadService { ...@@ -119,7 +122,7 @@ public class DepotHeadService {
Map<Long,String> accountMap = accountService.getAccountMap(); Map<Long,String> accountMap = accountService.getAccountMap();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_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); materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark, offset, rows);
if (null != list) { if (null != list) {
for (DepotHeadVo4List dh : list) { for (DepotHeadVo4List dh : list) {
...@@ -145,6 +148,14 @@ public class DepotHeadService { ...@@ -145,6 +148,14 @@ public class DepotHeadService {
dh.setDeposit(BigDecimal.ZERO); dh.setDeposit(BigDecimal.ZERO);
} }
dh.setFinishDeposit(depotHeadMapperEx.getFinishDepositByNumber(dh.getNumber())); 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())) { if(StringUtil.isNotEmpty(dh.getSalesMan())) {
dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan())); dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan()));
} }
...@@ -170,7 +181,7 @@ public class DepotHeadService { ...@@ -170,7 +181,7 @@ public class DepotHeadService {
return resList; 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{ String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark) throws Exception{
Long result=null; Long result=null;
try{ try{
...@@ -181,7 +192,7 @@ public class DepotHeadService { ...@@ -181,7 +192,7 @@ public class DepotHeadService {
String [] organArray = getOrganArray(subType, purchaseStatus); String [] organArray = getOrganArray(subType, purchaseStatus);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_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); materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
......
...@@ -134,6 +134,12 @@ ...@@ -134,6 +134,12 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/> <bind name="bindAccountId" value="'%'+accountId+'%'"/>
and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId}) and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId})
</if> </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 !=''"> <if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/> <bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark}) and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
...@@ -224,6 +230,12 @@ ...@@ -224,6 +230,12 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/> <bind name="bindAccountId" value="'%'+accountId+'%'"/>
and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId}) and (dh.account_id=#{accountId} or dh.account_id_list like #{bindAccountId})
</if> </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 !=''"> <if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/> <bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark}) 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