|
|
@@ -1,22 +1,19 @@
|
|
|
package com.usoftchina.saas.money.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.money.mapper.*;
|
|
|
+import com.usoftchina.saas.money.po.CustomerCheckView;
|
|
|
import com.usoftchina.saas.money.po.VendorAcountView;
|
|
|
-import com.usoftchina.saas.money.po.VendorAdd;
|
|
|
+import com.usoftchina.saas.money.po.VendOrCustAdd;
|
|
|
import com.usoftchina.saas.money.service.MoneyReportService;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
-import com.usoftchina.saas.utils.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
-import springfox.documentation.spring.web.json.Json;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
@@ -101,41 +98,36 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
}
|
|
|
|
|
|
String res = null;
|
|
|
- VendorAdd vendorAdd = new VendorAdd();
|
|
|
+ VendOrCustAdd vendOrCustAdd = new VendOrCustAdd();
|
|
|
List<Map<String, Double>> list1 = new ArrayList<>();
|
|
|
if ("Supplier".equals(type)) {
|
|
|
list = vendorAcountViewMapper.selectByCondition(con, companyId);
|
|
|
-// if (!StringUtils.isEmpty(calculateFieldsSql)) {
|
|
|
-// res = vendorAcountViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
|
|
|
-// }
|
|
|
-
|
|
|
- VendorAcountView vendorAcountView = (VendorAcountView) list.get(0);
|
|
|
- Integer vid = new Integer(0);
|
|
|
- if (list.size() >0){
|
|
|
+ if (list.size() >0) {
|
|
|
+ VendorAcountView vendorAcountView = (VendorAcountView) list.get(0);
|
|
|
+ Integer vid = new Integer(0);
|
|
|
vid = vendorAcountViewMapper.getId(vendorAcountView.getPi_vendcode(), Long.valueOf(vendorAcountView.getCompanyId()));
|
|
|
+ Integer ym = Integer.valueOf(req.getYm());
|
|
|
+ vendOrCustAdd = vendorAcountViewMapper.selectVendAdd(vid, ym, Long.valueOf(vendorAcountView.getCompanyId()));
|
|
|
+ vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
|
|
|
+ + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
|
|
|
+ - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
|
|
|
+ //封装成list
|
|
|
+ Map<String, Double> map1 = new HashMap<>();
|
|
|
+ map1.put("beginamount", vendOrCustAdd.getBeginamount());
|
|
|
+ list1.add(map1);
|
|
|
+
|
|
|
+ Map<String, Double> map2 = new HashMap<>();
|
|
|
+ map2.put("nowamount", vendOrCustAdd.getNowamount());
|
|
|
+ list1.add(map2);
|
|
|
+
|
|
|
+ Map<String, Double> map3 = new HashMap<>();
|
|
|
+ map3.put("nowpay", vendOrCustAdd.getNowpay());
|
|
|
+ list1.add(map3);
|
|
|
+
|
|
|
+ Map<String, Double> map4 = new HashMap<>();
|
|
|
+ map4.put("nowbalance", vendOrCustAdd.getNowbalance());
|
|
|
+ list1.add(map4);
|
|
|
}
|
|
|
- Integer ym = Integer.valueOf(req.getYm());
|
|
|
- vendorAdd = vendorAcountViewMapper.selectVendAdd(vid, ym, Long.valueOf(vendorAcountView.getCompanyId()));
|
|
|
- vendorAdd.setNowbalance((vendorAdd.getBeginamount() == null ? new Double(0) : vendorAdd.getBeginamount())
|
|
|
- + (vendorAdd.getNowamount() == null ? new Double(0) : vendorAdd.getNowamount())
|
|
|
- - (vendorAdd.getNowpay() == null ? new Double(0) : vendorAdd.getNowpay()));
|
|
|
- //封装成list
|
|
|
- Map<String, Double> map1 = new HashMap<>();
|
|
|
- map1.put("beginamount", vendorAdd.getBeginamount());
|
|
|
- list1.add(map1);
|
|
|
-
|
|
|
- Map<String, Double> map2 = new HashMap<>();
|
|
|
- map2.put("nowamount" ,vendorAdd.getNowamount());
|
|
|
- list1.add(map2);
|
|
|
-
|
|
|
- Map<String, Double> map3 = new HashMap<>();
|
|
|
- map3.put("nowpay" ,vendorAdd.getNowpay());
|
|
|
- list1.add(map3);
|
|
|
-
|
|
|
- Map<String, Double> map4 = new HashMap<>();
|
|
|
- map4.put("nowbalance",vendorAdd.getNowbalance());
|
|
|
- list1.add(map4);
|
|
|
-
|
|
|
} else if("payDetail".equals(type)){
|
|
|
list = paydetailViewMapper.selectByCondition(con, companyId);
|
|
|
if (!StringUtils.isEmpty(calculateFieldsSql)) {
|
|
|
@@ -153,8 +145,35 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
}
|
|
|
}else if ("customercheck".equals(type)){
|
|
|
list = customerCheckViewMapper.selectByCondition(con, companyId);
|
|
|
- if (!StringUtils.isEmpty(calculateFieldsSql)) {
|
|
|
- res = customerCheckViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
|
|
|
+// if (!StringUtils.isEmpty(calculateFieldsSql)) {
|
|
|
+// res = customerCheckViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
|
|
|
+// }
|
|
|
+ if (list.size() >0) {
|
|
|
+ CustomerCheckView customerCheckView = (CustomerCheckView) list.get(0);
|
|
|
+ Integer vid = new Integer(0);
|
|
|
+
|
|
|
+ vid = customerCheckViewMapper.getId(customerCheckView.getPi_custcode(), Long.valueOf(customerCheckView.getCompanyId()));
|
|
|
+ Integer ym = Integer.valueOf(req.getYm());
|
|
|
+ vendOrCustAdd = customerCheckViewMapper.selectCustAdd(vid, ym, Long.valueOf(customerCheckView.getCompanyId()));
|
|
|
+ vendOrCustAdd.setNowbalance((vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount())
|
|
|
+ + (vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount())
|
|
|
+ - (vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay()));
|
|
|
+ //封装成list
|
|
|
+ Map<String, Double> map1 = new HashMap<>();
|
|
|
+ map1.put("beginamount", vendOrCustAdd.getBeginamount());
|
|
|
+ list1.add(map1);
|
|
|
+
|
|
|
+ Map<String, Double> map2 = new HashMap<>();
|
|
|
+ map2.put("nowamount", vendOrCustAdd.getNowamount());
|
|
|
+ list1.add(map2);
|
|
|
+
|
|
|
+ Map<String, Double> map3 = new HashMap<>();
|
|
|
+ map3.put("nowpay", vendOrCustAdd.getNowpay());
|
|
|
+ list1.add(map3);
|
|
|
+
|
|
|
+ Map<String, Double> map4 = new HashMap<>();
|
|
|
+ map4.put("nowbalance", vendOrCustAdd.getNowbalance());
|
|
|
+ list1.add(map4);
|
|
|
}
|
|
|
}else if ("accountdetails".equals(type)){
|
|
|
list = accountDetailsViewMapper.selectByCondition(con, companyId);
|