|
|
@@ -503,12 +503,15 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
/**
|
|
|
* 对账获取客户信息
|
|
|
*
|
|
|
- * @param params 分页参数
|
|
|
+ * @param params 分页参数
|
|
|
* @param keyword 关键字
|
|
|
+ * @param checkDate 筛选日期
|
|
|
+ * @param fromDate 开始时间
|
|
|
+ * @param endDate 截止时间
|
|
|
* @return 搜索结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate) {
|
|
|
+ public SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate, Long fromDate, Long endDate) {
|
|
|
SPage<Vendor> vendorSPage = searchCustomerInfo(params, keyword);
|
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
vendorSPage.getContent().stream().filter(customer -> null != customer.getApcheck() && customer.getApcheck() == 1)
|
|
|
@@ -519,7 +522,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
customer.setTotalCount(totalTrades);
|
|
|
// 本月应收
|
|
|
if (null != checkDate) {
|
|
|
- List<TradeCount> thisMonthTrades = getThisMonthTrade(enUU, customerUU, checkDate);
|
|
|
+ List<TradeCount> thisMonthTrades = getThisMonthTrade(enUU, customerUU, checkDate, fromDate, endDate);
|
|
|
customer.setThisMonthCount(thisMonthTrades);
|
|
|
}
|
|
|
});
|
|
|
@@ -532,20 +535,38 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
|
|
|
* @param enUU 企业UU
|
|
|
* @param customerUU 客户企业UU
|
|
|
* @param checkDate 筛选月份
|
|
|
+ * @param fromDate 开始时间
|
|
|
+ * @param endDate 截止时间
|
|
|
* @return 统计结果
|
|
|
*/
|
|
|
- private List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate) {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
|
|
- Date date;
|
|
|
- Date checkTime;
|
|
|
- try {
|
|
|
- date = DateUtils.dateAddMonth(format.parse(checkDate), 1);
|
|
|
- checkTime = format.parse(checkDate);
|
|
|
- } catch (ParseException e) {
|
|
|
- throw new IllegalOperatorException("时间格式异常");
|
|
|
+ private List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) {
|
|
|
+ String sqlFromDate;
|
|
|
+ String sqlEndDate;
|
|
|
+ /*
|
|
|
+ * 1、 如果前端指定开始截止时间,直接使用
|
|
|
+ * 2、 如果前端未指定,采用选择月份,使用月份处理
|
|
|
+ * 3、 截止时间筛为指定月份加1,即下月一号,采用小于这天,能取到当月所有数据
|
|
|
+ */
|
|
|
+ final Integer oneDayMilliseconds = 86400000;
|
|
|
+ boolean onlyCheckDate = (null == fromDate || null == endDate) && null != checkDate;
|
|
|
+ if (null != fromDate && null != endDate ) {
|
|
|
+ sqlFromDate = DateFormatUtils.DATE_FORMAT.format(new Date(fromDate));
|
|
|
+ sqlEndDate = DateFormatUtils.DATE_FORMAT.format(new Date(endDate + oneDayMilliseconds));
|
|
|
+ } else if (onlyCheckDate) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
|
|
+ Date date;
|
|
|
+ Date checkTime;
|
|
|
+ try {
|
|
|
+ date = DateUtils.dateAddMonth(format.parse(checkDate), 1);
|
|
|
+ checkTime = format.parse(checkDate);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new IllegalOperatorException("时间格式异常");
|
|
|
+ }
|
|
|
+ sqlFromDate = DateFormatUtils.DATE_FORMAT.format(checkTime);
|
|
|
+ sqlEndDate = DateFormatUtils.DATE_FORMAT.format(date);
|
|
|
+ } else {
|
|
|
+ throw new IllegalOperatorException("请选择对账时间");
|
|
|
}
|
|
|
- String sqlFromDate = DateFormatUtils.DATE_FORMAT.format(checkTime);
|
|
|
- String sqlEndDate = DateFormatUtils.DATE_FORMAT.format(date);
|
|
|
List<TradeCount> totalTrades = new ArrayList<>();
|
|
|
ThreadUtils
|
|
|
// 货款调账
|