给收付款单增加销售采购单号的接口查询

This commit is contained in:
季圣华
2022-11-21 00:26:07 +08:00
parent 2bdfc18c9d
commit c0a3a6a0ec
5 changed files with 55 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ public interface AccountHeadMapperEx {
@Param("accountId") Long accountId,
@Param("status") String status,
@Param("remark") String remark,
@Param("ahIdList") List<Long> ahIdList,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -37,7 +38,8 @@ public interface AccountHeadMapperEx {
@Param("handsPersonId") Long handsPersonId,
@Param("accountId") Long accountId,
@Param("status") String status,
@Param("remark") String remark);
@Param("remark") String remark,
@Param("ahIdList") List<Long> ahIdList);
BigDecimal findAllMoney(
@Param("supplierId") Integer supplierId,

View File

@@ -42,8 +42,9 @@ public class AccountHeadComponent implements ICommonQuery {
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String status = StringUtil.getInfo(search, "status");
String remark = StringUtil.getInfo(search, "remark");
String number = StringUtil.getInfo(search, "number");
return accountHeadService.select(type, roleType, billNo, beginTime, endTime, organId, creator, handsPersonId,
accountId, status, remark, QueryUtils.offset(map), QueryUtils.rows(map));
accountId, status, remark, number, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@@ -60,8 +61,9 @@ public class AccountHeadComponent implements ICommonQuery {
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String status = StringUtil.getInfo(search, "status");
String remark = StringUtil.getInfo(search, "remark");
String number = StringUtil.getInfo(search, "number");
return accountHeadService.countAccountHead(type, roleType, billNo, beginTime, endTime, organId, creator, handsPersonId,
accountId, status, remark);
accountId, status, remark, number);
}
@Override

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.accountItem.AccountItemService;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
import com.jsh.erp.service.supplier.SupplierService;
@@ -44,6 +45,8 @@ public class AccountHeadService {
@Resource
private AccountItemService accountItemService;
@Resource
private DepotHeadService depotHeadService;
@Resource
private UserService userService;
@Resource
private SupplierService supplierService;
@@ -88,14 +91,15 @@ public class AccountHeadService {
public List<AccountHeadVo4ListEx> select(String type, String roleType, String billNo, String beginTime, String endTime,
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
String remark, int offset, int rows) throws Exception{
String remark, String number, int offset, int rows) throws Exception{
List<AccountHeadVo4ListEx> resList = new ArrayList<>();
try{
String [] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<Long> ahIdList = accountItemService.getAhIdListByBillNumber(number);
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, offset, rows);
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, ahIdList, offset, rows);
if (null != list) {
for (AccountHeadVo4ListEx ah : list) {
if(ah.getChangeAmount() != null) {
@@ -118,14 +122,15 @@ public class AccountHeadService {
public Long countAccountHead(String type, String roleType, String billNo, String beginTime, String endTime,
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
String remark) throws Exception{
String remark, String number) throws Exception{
Long result=null;
try{
String [] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<Long> ahIdList = accountItemService.getAhIdListByBillNumber(number);
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo,
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark);
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, ahIdList);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -6,6 +6,7 @@ import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.AccountItem;
import com.jsh.erp.datasource.entities.AccountItemExample;
import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AccountItemMapper;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
@@ -26,6 +27,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -259,4 +261,29 @@ public class AccountItemService {
public BigDecimal getEachAmountByBillId(Long billId) {
return accountItemMapperEx.getEachAmountByBillId(billId).abs();
}
public List<Long> getAhIdListByBillNumber(String number) throws Exception {
if(StringUtil.isNotEmpty(number)) {
DepotHead depotHead = depotHeadService.getDepotHead(number);
if(depotHead.getId()!=null) {
List<Long> ahIdList = new ArrayList<>();
AccountItemExample example = new AccountItemExample();
example.createCriteria().andBillIdEqualTo(depotHead.getId()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<AccountItem> list = accountItemMapper.selectByExample(example);
if (list != null && list.size() > 0) {
for(AccountItem accountItem: list) {
ahIdList.add(accountItem.getHeaderId());
}
return ahIdList;
} else {
return null;
}
} else {
return null;
}
} else {
return null;
}
}
}

View File

@@ -56,6 +56,12 @@
<bind name="bindRemark" value="'%'+remark+'%'"/>
and ah.remark like #{bindRemark}
</if>
<if test="ahIdList!=null and ahIdList.size()>0">
and ah.id in
<foreach collection="ahIdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(ah.delete_flag,'0') !='1'
order by ah.id desc
<if test="offset != null and rows != null">
@@ -108,6 +114,12 @@
<bind name="bindRemark" value="'%'+remark+'%'"/>
and remark like #{bindRemark}
</if>
<if test="ahIdList!=null and ahIdList.size()>0">
and id in
<foreach collection="ahIdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(delete_flag,'0') !='1'
</select>