|
|
@@ -176,40 +176,49 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
String res = null;
|
|
|
List<Map<String, Double>> list1 = new ArrayList<>();
|
|
|
if ("Supplier".equals(type)) {
|
|
|
- list = vendorAcountViewMapper.selectByCondition(con, companyId);
|
|
|
- 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()));
|
|
|
- List<VendOrCustAdd> vendOrCustAdds = vendorAcountViewMapper.selectVendAdd(vid, cons, Long.valueOf(vendorAcountView.getCompanyId()));
|
|
|
- //封装成list
|
|
|
- Map<String, Double> map1 = new HashMap<>();
|
|
|
- map1.put("beginamount", new Double(0));
|
|
|
- Map<String, Double> map2 = new HashMap<>();
|
|
|
- map2.put("nowamount", new Double(0));
|
|
|
- Map<String, Double> map3 = new HashMap<>();
|
|
|
- map3.put("nowpay", new Double(0));
|
|
|
- Map<String, Double> map4 = new HashMap<>();
|
|
|
- map4.put("nowbalance", new Double(0));
|
|
|
- if (vendOrCustAdds != null) {
|
|
|
- Iterator vlist = vendOrCustAdds.iterator();
|
|
|
- while (vlist.hasNext()) {
|
|
|
- VendOrCustAdd vendOrCustAdd = (VendOrCustAdd) vlist.next();
|
|
|
- map1.put("beginamount", vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount());
|
|
|
- list1.add(map1);
|
|
|
-
|
|
|
- map2.put("nowamount", vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount() + map2.get("nowamount"));
|
|
|
- list1.add(map2);
|
|
|
-
|
|
|
- map3.put("nowpay", vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay() + map3.get("nowpay"));
|
|
|
- list1.add(map3);
|
|
|
-
|
|
|
- map4.put("nowbalance", map1.get("beginamount") + map2.get("nowamount") - map3.get("nowpay"));
|
|
|
- list1.add(map4);
|
|
|
+ if (this.getVendOrCust(req.getCondition())){
|
|
|
+ list = vendorAcountViewMapper.selectByCondition(con, companyId);
|
|
|
+ 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()));
|
|
|
+ List<VendOrCustAdd> vendOrCustAdds = vendorAcountViewMapper.selectVendAdd(vid, cons, Long.valueOf(vendorAcountView.getCompanyId()));
|
|
|
+ //封装成list
|
|
|
+ Map<String, Double> map1 = new HashMap<>();
|
|
|
+ map1.put("beginamount", new Double(0));
|
|
|
+ Map<String, Double> map2 = new HashMap<>();
|
|
|
+ map2.put("nowamount", new Double(0));
|
|
|
+ Map<String, Double> map3 = new HashMap<>();
|
|
|
+ map3.put("nowpay", new Double(0));
|
|
|
+ Map<String, Double> map4 = new HashMap<>();
|
|
|
+ map4.put("nowbalance", new Double(0));
|
|
|
+ if (vendOrCustAdds != null) {
|
|
|
+ Iterator vlist = vendOrCustAdds.iterator();
|
|
|
+ while (vlist.hasNext()) {
|
|
|
+ VendOrCustAdd vendOrCustAdd = (VendOrCustAdd) vlist.next();
|
|
|
+ map1.put("beginamount", vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount());
|
|
|
+ list1.add(map1);
|
|
|
+
|
|
|
+ map2.put("nowamount", vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount() + map2.get("nowamount"));
|
|
|
+ list1.add(map2);
|
|
|
+
|
|
|
+ map3.put("nowpay", vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay() + map3.get("nowpay"));
|
|
|
+ list1.add(map3);
|
|
|
+
|
|
|
+ map4.put("nowbalance", map1.get("beginamount") + map2.get("nowamount") - map3.get("nowpay"));
|
|
|
+ list1.add(map4);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ Map<String, Object> maps = new HashMap<String, Object>();
|
|
|
+ String[] arrs = {};
|
|
|
+ list = Arrays.asList(arrs);
|
|
|
+ maps.put("list", list);
|
|
|
+ maps.put("calculate", null);
|
|
|
+ return maps;
|
|
|
}
|
|
|
} else if("payDetail".equals(type)){
|
|
|
list = payablesdetailMapper.selectByCondition(con, companyId);
|
|
|
@@ -227,42 +236,48 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
res = acountbalanceViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
|
|
|
}
|
|
|
}else if ("customercheck".equals(type)){
|
|
|
- list = customerCheckViewMapper.selectByCondition(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()));
|
|
|
- List<VendOrCustAdd> vendOrCustAdds = customerCheckViewMapper.selectCustAdd(vid, cons, Long.valueOf(customerCheckView.getCompanyId()));
|
|
|
- //封装成list
|
|
|
- Map<String, Double> map1 = new HashMap<>();
|
|
|
- map1.put("beginamount", new Double(0));
|
|
|
- Map<String, Double> map2 = new HashMap<>();
|
|
|
- map2.put("nowamount", new Double(0));
|
|
|
- Map<String, Double> map3 = new HashMap<>();
|
|
|
- map3.put("nowpay", new Double(0));
|
|
|
- Map<String, Double> map4 = new HashMap<>();
|
|
|
- map4.put("nowbalance", new Double(0));
|
|
|
- if (vendOrCustAdds != null) {
|
|
|
- Iterator vlist = vendOrCustAdds.iterator();
|
|
|
- while (vlist.hasNext()) {
|
|
|
- VendOrCustAdd vendOrCustAdd = (VendOrCustAdd) vlist.next();
|
|
|
- map1.put("beginamount", vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount());
|
|
|
- list1.add(map1);
|
|
|
-
|
|
|
- map2.put("nowamount", vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount() + map2.get("nowamount"));
|
|
|
- list1.add(map2);
|
|
|
-
|
|
|
- map3.put("nowpay", vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay() + map3.get("nowpay"));
|
|
|
- list1.add(map3);
|
|
|
-
|
|
|
- map4.put("nowbalance", map1.get("beginamount") + map2.get("nowamount") - map3.get("nowpay"));
|
|
|
- list1.add(map4);
|
|
|
+ if (this.getVendOrCust(req.getCondition())) {
|
|
|
+ list = customerCheckViewMapper.selectByCondition(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()));
|
|
|
+ List<VendOrCustAdd> vendOrCustAdds = customerCheckViewMapper.selectCustAdd(vid, cons, Long.valueOf(customerCheckView.getCompanyId()));
|
|
|
+ //封装成list
|
|
|
+ Map<String, Double> map1 = new HashMap<>();
|
|
|
+ map1.put("beginamount", new Double(0));
|
|
|
+ Map<String, Double> map2 = new HashMap<>();
|
|
|
+ map2.put("nowamount", new Double(0));
|
|
|
+ Map<String, Double> map3 = new HashMap<>();
|
|
|
+ map3.put("nowpay", new Double(0));
|
|
|
+ Map<String, Double> map4 = new HashMap<>();
|
|
|
+ map4.put("nowbalance", new Double(0));
|
|
|
+ if (vendOrCustAdds != null) {
|
|
|
+ Iterator vlist = vendOrCustAdds.iterator();
|
|
|
+ while (vlist.hasNext()) {
|
|
|
+ VendOrCustAdd vendOrCustAdd = (VendOrCustAdd) vlist.next();
|
|
|
+ map1.put("beginamount", vendOrCustAdd.getBeginamount() == null ? new Double(0) : vendOrCustAdd.getBeginamount());
|
|
|
+ list1.add(map1);
|
|
|
+
|
|
|
+ map2.put("nowamount", vendOrCustAdd.getNowamount() == null ? new Double(0) : vendOrCustAdd.getNowamount() + map2.get("nowamount"));
|
|
|
+ list1.add(map2);
|
|
|
+
|
|
|
+ map3.put("nowpay", vendOrCustAdd.getNowpay() == null ? new Double(0) : vendOrCustAdd.getNowpay() + map3.get("nowpay"));
|
|
|
+ list1.add(map3);
|
|
|
+
|
|
|
+ map4.put("nowbalance", map1.get("beginamount") + map2.get("nowamount") - map3.get("nowpay"));
|
|
|
+ list1.add(map4);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ Map<String, Object> maps = new HashMap<String, Object>();
|
|
|
+ String[] arrs = {};
|
|
|
+ list = Arrays.asList(arrs);
|
|
|
+ maps.put("list", list);
|
|
|
+ maps.put("calculate", null);
|
|
|
+ return maps;
|
|
|
}
|
|
|
}else if ("accountdetails".equals(type)){
|
|
|
list = accountDetailsViewMapper.selectByCondition(con, companyId);
|
|
|
@@ -365,4 +380,21 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ //判断是否有传入客户或供应商
|
|
|
+ public Boolean getVendOrCust(String cons){
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(cons);
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ if (null != jsonArray && jsonArray.size() > 0) {
|
|
|
+ StringBuffer finalCondition = new StringBuffer();
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
+ String type = (String) jsonObject.get("type");
|
|
|
+ if ("enum".equals(type)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|