|
|
@@ -11,15 +11,13 @@ import com.usoftchina.saas.money.po.CustomerCheckView;
|
|
|
import com.usoftchina.saas.money.po.VendorAcountView;
|
|
|
import com.usoftchina.saas.money.po.VendOrCustAdd;
|
|
|
import com.usoftchina.saas.money.service.MoneyReportService;
|
|
|
+import com.usoftchina.saas.page.PageDefault;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author heqw
|
|
|
@@ -39,6 +37,10 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
private CustomerCheckViewMapper customerCheckViewMapper;
|
|
|
@Autowired
|
|
|
private AccountDetailsViewMapper accountDetailsViewMapper;
|
|
|
+ @Autowired
|
|
|
+ private VendmonthMapper vendmonthMapper;
|
|
|
+ @Autowired
|
|
|
+ private CustmonthMapper custmonthMapper;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> vendorCheck(PageRequest page, ListReqDTO req) {
|
|
|
@@ -70,22 +72,59 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
return getListDATA(page, req, "accountdetails");
|
|
|
}
|
|
|
|
|
|
- private Map<String, Object> getListDATA(PageRequest page, ListReqDTO req, String type) {
|
|
|
- //设置默认分页
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> vendormonthdetails(PageRequest page, ListReqDTO req) {
|
|
|
+ return getListDATA(page, req, "vendormonthdetails");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> custormonthdetails(PageRequest page, ListReqDTO req) {
|
|
|
+ return getListDATA(page, req, "custormonthdetails");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> othrinoutdetails(PageRequest page, ListReqDTO req) {
|
|
|
+ return getListDATA(page, req, "othrinoutdetails");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> profitdetails(PageRequest page, ListReqDTO req) {
|
|
|
+ return getListDATA(page, req, "profitdetails");
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> getListDATA(@PageDefault(size = 10) PageRequest page, ListReqDTO req, String type) {
|
|
|
+ if ("custormonthdetails".equals(type)){
|
|
|
+ Map map1 = this.getYm(req.getCondition());
|
|
|
+ Map<String, Integer> map = new HashMap();
|
|
|
+ map.put("v_YearMonth", Integer.valueOf((String) map1.get("yearmonth")));
|
|
|
+ map.put("v_YearMonthTo", Integer.valueOf((String) map1.get("yearmonthTo")));
|
|
|
+ map.put("v_companyid", Math.toIntExact(BaseContextHolder.getCompanyId()));
|
|
|
+ custmonthMapper.callCustm(map);
|
|
|
+ }else if ("vendormonthdetails".equals(type)){
|
|
|
+ Map map1 = this.getYm(req.getCondition());
|
|
|
+ Map<String, Integer> map = new HashMap();
|
|
|
+ map.put("v_YearMonth", Integer.valueOf((String) map1.get("yearmonth")));
|
|
|
+ map.put("v_YearMonthTo", Integer.valueOf((String) map1.get("yearmonthTo")));
|
|
|
+ map.put("v_companyid", Math.toIntExact(BaseContextHolder.getCompanyId()));
|
|
|
+ vendmonthMapper.callVend(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* //设置默认分页
|
|
|
if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
|
|
|
page = new PageRequest();
|
|
|
page.setNumber(1);
|
|
|
page.setSize(10);
|
|
|
- }
|
|
|
- PageHelper.startPage(page.getNumber(), page.getSize());
|
|
|
-
|
|
|
- //查询数据
|
|
|
- Map<String, Object> map = getListByType(req, type);
|
|
|
- //取分页信息
|
|
|
- PageInfo lists = new PageInfo((List) map.get("list"));
|
|
|
- map.remove("list");
|
|
|
- map.put("list", lists);
|
|
|
- return map;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ PageHelper.startPage(page.getNumber(), page.getSize());
|
|
|
+
|
|
|
+ //查询数据
|
|
|
+ Map<String, Object> map = getListByType(req, type);
|
|
|
+ //取分页信息
|
|
|
+ PageInfo lists = new PageInfo((List) map.get("list"));
|
|
|
+ map.remove("list");
|
|
|
+ map.put("list", lists);
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
private Map<String, Object> getListByType(ListReqDTO req, String type) {
|
|
|
@@ -179,6 +218,13 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
if (!StringUtils.isEmpty(calculateFieldsSql)) {
|
|
|
res = accountDetailsViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
|
|
|
}
|
|
|
+ }else if("vendormonthdetails".equals(type)){
|
|
|
+ list = vendmonthMapper.selectByCondition(con, companyId);
|
|
|
+ res = null;
|
|
|
+ }else if ("custormonthdetails".equals(type)){
|
|
|
+ System.out.println("companyid"+companyId);
|
|
|
+ list = custmonthMapper.selectByCondition(con, companyId);
|
|
|
+ res = null;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
@@ -207,13 +253,41 @@ public class MoneyReportServiceImpl implements MoneyReportService {
|
|
|
Object type = jsonObject.get("type");
|
|
|
if ("date".equals(type)){
|
|
|
String value = (String) jsonObject.get("value");
|
|
|
- System.out.println("value" + value);
|
|
|
value = value.replace(",", "' and '");
|
|
|
con = " a.sl_date between '" + value + "'" ;
|
|
|
- System.out.println("con"+con);
|
|
|
+ return con;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return con;
|
|
|
}
|
|
|
+
|
|
|
+ //取两个期间
|
|
|
+ public Map<String, String> getYm(String cons){
|
|
|
+ System.out.println("cons:" + 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 yearmonth = "yearmonth";
|
|
|
+// String yearmonthTo = "yearmonthTo";
|
|
|
+// if (st.equals("vend")){
|
|
|
+// yearmonth = "vm_" + yearmonth;
|
|
|
+// yearmonthTo = "vm_" + yearmonthTo;
|
|
|
+// }else if (st.equals("cust")){
|
|
|
+// yearmonth = "cm_" + yearmonth;
|
|
|
+// yearmonthTo = "cm_" + yearmonthTo;
|
|
|
+// }
|
|
|
+ String value = (String) jsonObject.get("value");
|
|
|
+ String[] arr = value.split(",");
|
|
|
+ map.put("yearmonth", arr[0]);
|
|
|
+ map.put("yearmonthTo", arr[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("map:" + map);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|