|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bosshand.virgo.api.dao.*;
|
|
|
import com.bosshand.virgo.api.model.*;
|
|
|
import com.bosshand.virgo.core.utils.StringUtil;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -362,7 +363,6 @@ public class PaymentService {
|
|
|
return paymentOrdinaryDao.update(paymentOrdinary);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public Map<String, Object> getCount(long projectId) {
|
|
|
Map<String, Object> m = new HashMap<>();
|
|
|
|
|
@@ -429,6 +429,84 @@ public class PaymentService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ //=============================================================================================
|
|
|
+
|
|
|
+ public int getTotalCount(JSONObject data) {
|
|
|
+ if (data.getIntValue("type") == 1) {
|
|
|
+ Payment p = new Payment();
|
|
|
+ p.setProjectId(data.getLongValue("projectId"));
|
|
|
+ if (data.containsKey("status")) {
|
|
|
+ p.setStatus(data.getIntValue("status"));
|
|
|
+ }
|
|
|
+ return paymentDao.getMonth(p);
|
|
|
+ }
|
|
|
+ if (data.getIntValue("type") == 2) {
|
|
|
+ return getTotalCountResult(data, 1);
|
|
|
+ }
|
|
|
+ if (data.getIntValue("type") == 3) {
|
|
|
+ return getTotalCountResult(data, 2);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int getTotalCountResult(JSONObject data, int type) {
|
|
|
+ PaymentOrdinary po = new PaymentOrdinary();
|
|
|
+ po.setProjectId(data.getLongValue("projectId"));
|
|
|
+ if (data.containsKey("status")) {
|
|
|
+ po.setStatus(data.getIntValue("status"));
|
|
|
+ }
|
|
|
+ po.setType(type);
|
|
|
+ return paymentOrdinaryDao.getMonth(po);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<T> getLimit(JSONObject data) {
|
|
|
+ if (data.getIntValue("type") == 1) {
|
|
|
+ long projectId = data.getLongValue("projectId");
|
|
|
+ Payment p = new Payment();
|
|
|
+ p.setProjectId(projectId);
|
|
|
+ if (data.containsKey("status")) {
|
|
|
+ p.setStatus(data.getIntValue("status"));
|
|
|
+ }
|
|
|
+ int currIndex = (data.getIntValue("currPage") - 1) * data.getIntValue("pageSize");
|
|
|
+ List<Payment> list = paymentDao.getMonthCountLimit(p, currIndex, data.getIntValue("pageSize"));
|
|
|
+ if (list.size() > 0) {
|
|
|
+ for (Payment pp : list) {
|
|
|
+ Map<String, BigDecimal> accumulate = paymentDao.getAccumulate(projectId, pp.getContractId());
|
|
|
+ pp.setReceived(accumulate.get("received"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ArrayList(list);
|
|
|
+ }
|
|
|
+ if (data.getIntValue("type") == 2) {
|
|
|
+ return new ArrayList(getLimitResult(data, 1));
|
|
|
+ }
|
|
|
+ if (data.getIntValue("type") == 3) {
|
|
|
+ return new ArrayList(getLimitResult(data, 2));
|
|
|
+ }
|
|
|
+ return new ArrayList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<PaymentOrdinary> getLimitResult(JSONObject data, int type) {
|
|
|
+ long projectId = data.getLongValue("projectId");
|
|
|
+ PaymentOrdinary po = new PaymentOrdinary();
|
|
|
+ po.setProjectId(projectId);
|
|
|
+ if (data.containsKey("status")) {
|
|
|
+ po.setStatus(data.getIntValue("status"));
|
|
|
+ }
|
|
|
+ po.setType(type);
|
|
|
+ int currIndex = (data.getIntValue("currPage") - 1) * data.getIntValue("pageSize");
|
|
|
+ List<PaymentOrdinary> list = paymentOrdinaryDao.getMonthCountLimit(po, currIndex, data.getIntValue("pageSize"));
|
|
|
+ if (list.size() > 0) {
|
|
|
+ for (PaymentOrdinary pp : list) {
|
|
|
+ Map<String, BigDecimal> accumulate = paymentOrdinaryDao.getAccumulate(projectId, po.getPayMerchantId(), pp.getPayClientId(), type);
|
|
|
+ pp.setReceived(accumulate.get("received"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|