|
|
@@ -38,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -258,76 +259,76 @@ public class UserBillingController extends BaseController
|
|
|
@RequestParam Integer page,
|
|
|
@RequestParam Integer size,
|
|
|
@RequestParam boolean sort,
|
|
|
- @RequestParam(defaultValue = "") String type)
|
|
|
- {
|
|
|
+ @RequestParam(defaultValue = "") String type) {
|
|
|
JwtUtil jwtUtil = new JwtUtil();
|
|
|
DateUtil dateUtil = new DateUtil();
|
|
|
String id = jwtUtil.getusid(token);
|
|
|
- if (!"".equals(type)){
|
|
|
+ BigDecimal sum = userBillingService.getUserBalance(Long.valueOf(id));
|
|
|
+ if (!"".equals(type)) {
|
|
|
JSONObject org = new JSONObject();
|
|
|
- IPage<UserBilling> palist = new Page<>(page,size);
|
|
|
+ IPage<UserBilling> palist = new Page<>(page, size);
|
|
|
QueryWrapper<UserBilling> wrapper = new QueryWrapper<>();
|
|
|
int sumlist = userBillingMapper.gettypesum(Long.valueOf(id), Long.valueOf(type));
|
|
|
- wrapper.eq("user_id",id);
|
|
|
- wrapper.eq("type",type);
|
|
|
+ wrapper.eq("user_id", id);
|
|
|
+ wrapper.eq("type", type);
|
|
|
wrapper.orderBy(true, sort, "cretim");
|
|
|
- IPage<UserBilling> mmlist = userBillingService.page(palist,wrapper);
|
|
|
+ IPage<UserBilling> mmlist = userBillingService.page(palist, wrapper);
|
|
|
List<UserBilling> list = mmlist.getRecords();
|
|
|
JSONArray arr = new JSONArray();
|
|
|
- for(int i=0;i<list.size();i++){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
JSONObject ject = new JSONObject();
|
|
|
- ject.put("id",list.get(i).getId());
|
|
|
- ject.put("user",infoUserService.getById(list.get(i).getUserId()));
|
|
|
- ject.put("type",list.get(i).getType());
|
|
|
+ ject.put("id", list.get(i).getId());
|
|
|
+ ject.put("user", infoUserService.getById(list.get(i).getUserId()));
|
|
|
+ ject.put("type", list.get(i).getType());
|
|
|
PosOrder order = posOrderService.getById(list.get(i).getDdId());
|
|
|
- ject.put("ddId",order==null?list.get(i).getDdId():order.getDdId());
|
|
|
- ject.put("amount",list.get(i).getAmount());
|
|
|
- ject.put("divvy",list.get(i).getDivvy());
|
|
|
- ject.put("state",list.get(i).getState());
|
|
|
- ject.put("mdId",list.get(i).getMdId());
|
|
|
- ject.put("illustrate",list.get(i).getIllustrate());
|
|
|
- ject.put("paymentMethod",list.get(i).getPaymentMethod());
|
|
|
- ject.put("accountNumber",list.get(i).getAccountNumber());
|
|
|
- ject.put("url",list.get(i).getUrl());
|
|
|
- ject.put("cretim",dateUtil.setDate(list.get(i).getCretim()));
|
|
|
+ ject.put("ddId", order == null ? list.get(i).getDdId() : order.getDdId());
|
|
|
+ ject.put("amount", list.get(i).getAmount());
|
|
|
+ ject.put("divvy", list.get(i).getDivvy());
|
|
|
+ ject.put("state", list.get(i).getState());
|
|
|
+ ject.put("mdId", list.get(i).getMdId());
|
|
|
+ ject.put("illustrate", list.get(i).getIllustrate());
|
|
|
+ ject.put("paymentMethod", list.get(i).getPaymentMethod());
|
|
|
+ ject.put("accountNumber", list.get(i).getAccountNumber());
|
|
|
+ ject.put("url", list.get(i).getUrl());
|
|
|
+ ject.put("cretim", dateUtil.setDate(list.get(i).getCretim()));
|
|
|
arr.add(ject);
|
|
|
}
|
|
|
- org.put("sum",sumlist);
|
|
|
- org.put("list",arr);
|
|
|
+ org.put("sum", sum);
|
|
|
+ org.put("list", arr);
|
|
|
return success(MessageUtils.message("no.success"), org);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
JSONObject org = new JSONObject();
|
|
|
- IPage<UserBilling> palist = new Page<>(page,size);
|
|
|
+ IPage<UserBilling> palist = new Page<>(page, size);
|
|
|
QueryWrapper<UserBilling> wrapper = new QueryWrapper<>();
|
|
|
int zlist = userBillingMapper.gettypesum(Long.valueOf(id), 1L);
|
|
|
int txlist = userBillingMapper.gettypesum(Long.valueOf(id), 2L);
|
|
|
int xfei = userBillingMapper.gettypesum(Long.valueOf(id), 3L);
|
|
|
- wrapper.eq("user_id",id);
|
|
|
+ wrapper.eq("user_id", id);
|
|
|
wrapper.orderBy(true, sort, "cretim");
|
|
|
- IPage<UserBilling> mmlist = userBillingService.page(palist,wrapper);
|
|
|
+ IPage<UserBilling> mmlist = userBillingService.page(palist, wrapper);
|
|
|
List<UserBilling> list = mmlist.getRecords();
|
|
|
JSONArray arr = new JSONArray();
|
|
|
- for(int i=0;i<list.size();i++){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
JSONObject ject = new JSONObject();
|
|
|
- ject.put("id",list.get(i).getId());
|
|
|
- ject.put("user",infoUserService.getById(list.get(i).getUserId()));
|
|
|
- ject.put("type",list.get(i).getType());
|
|
|
+ ject.put("id", list.get(i).getId());
|
|
|
+ ject.put("user", infoUserService.getById(list.get(i).getUserId()));
|
|
|
+ ject.put("type", list.get(i).getType());
|
|
|
PosOrder order = posOrderService.getById(list.get(i).getDdId());
|
|
|
- ject.put("ddId",order==null?list.get(i).getDdId():order.getDdId());
|
|
|
- ject.put("amount",list.get(i).getAmount());
|
|
|
- ject.put("divvy",list.get(i).getDivvy());
|
|
|
- ject.put("state",list.get(i).getState());
|
|
|
- ject.put("mdId",list.get(i).getMdId());
|
|
|
- ject.put("illustrate",list.get(i).getIllustrate());
|
|
|
- ject.put("paymentMethod",list.get(i).getPaymentMethod());
|
|
|
- ject.put("accountNumber",list.get(i).getAccountNumber());
|
|
|
- ject.put("cretim",dateUtil.setDate(list.get(i).getCretim()));
|
|
|
- ject.put("url",list.get(i).getUrl());
|
|
|
+ ject.put("ddId", order == null ? list.get(i).getDdId() : order.getDdId());
|
|
|
+ ject.put("amount", list.get(i).getAmount());
|
|
|
+ ject.put("divvy", list.get(i).getDivvy());
|
|
|
+ ject.put("state", list.get(i).getState());
|
|
|
+ ject.put("mdId", list.get(i).getMdId());
|
|
|
+ ject.put("illustrate", list.get(i).getIllustrate());
|
|
|
+ ject.put("paymentMethod", list.get(i).getPaymentMethod());
|
|
|
+ ject.put("accountNumber", list.get(i).getAccountNumber());
|
|
|
+ ject.put("cretim", dateUtil.setDate(list.get(i).getCretim()));
|
|
|
+ ject.put("url", list.get(i).getUrl());
|
|
|
arr.add(ject);
|
|
|
}
|
|
|
- int sum = zlist-txlist-xfei;
|
|
|
- org.put("sum",sum);
|
|
|
- org.put("list",arr);
|
|
|
+// int sum = zlist-txlist-xfei;
|
|
|
+ org.put("sum", sum);
|
|
|
+ org.put("list", arr);
|
|
|
return success(MessageUtils.message("no.success"), org);
|
|
|
}
|
|
|
}
|