|
@@ -354,6 +354,10 @@ public class TOrderController {
|
|
|
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
if (!userName.equals("admin")) {
|
|
|
+ // 如果为账户
|
|
|
+ if (admin.getType() > 2) {
|
|
|
+ userName = null;
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(userName)) {
|
|
|
ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
TAdmin data = adminByUsername.getData();
|
|
@@ -392,28 +396,34 @@ public class TOrderController {
|
|
|
//判断当前账号状态 公司还是商家
|
|
|
if (admin.getType() > 1) {
|
|
|
//商家 判断是否子账户
|
|
|
- if (admin.getIsAdmined()) {
|
|
|
+ if (!admin.getIsAdmined()) {
|
|
|
//商家自己
|
|
|
// query.eq(TCoinOrder::getAdminId,adminId);
|
|
|
- } else {
|
|
|
+// } else {
|
|
|
//商家 子账户
|
|
|
//登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
- TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
+ TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(adminId)));
|
|
|
if (adminEquipment.getType().equals("0")) {
|
|
|
//全部机器
|
|
|
TAdmin upAdmin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
query.eq(TCoinOrder::getAdminId, upAdmin.getId());
|
|
|
} else {
|
|
|
String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
- List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
- query.in(TCoinOrder::getClientId, equipmentIdList);
|
|
|
+// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+ List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
|
|
|
+ query.in(TCoinOrder::getEquipmentId, equipmentIdList);
|
|
|
}
|
|
|
+ query.eq(TCoinOrder::getAdminId, admin.getParentId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(equipmentId)) {
|
|
|
+ query.eq(TCoinOrder::getEquipmentId, equipmentId);
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(payType)) {
|
|
|
query.eq(TCoinOrder::getPayType, payType);
|
|
|
}
|
|
@@ -491,6 +501,7 @@ public class TOrderController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ query.orderByDesc(TCoinOrder::getCreateDate);
|
|
|
Page<TCoinOrder> page = new Page<>(current, size, true);
|
|
|
IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
|
|
|
//显示订单所属机器的设备名称
|
|
@@ -627,9 +638,9 @@ public class TOrderController {
|
|
|
} else {
|
|
|
TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
|
|
|
// 如果是全部机器
|
|
|
- if (adminEquipment.getType().equals("0")) {
|
|
|
- param.setAdminId(admin.getParentId().toString());
|
|
|
- } else {
|
|
|
+ if (!adminEquipment.getType().equals("0")) {
|
|
|
+// param.setAdminId(admin.getParentId().toString());
|
|
|
+// } else {
|
|
|
// 查找属于这个商家子账户的设备
|
|
|
List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
param.setClientIds(list);
|
|
@@ -644,8 +655,9 @@ public class TOrderController {
|
|
|
.setData(null)
|
|
|
.setMessage("没有绑定机器/no machine"));
|
|
|
}
|
|
|
- param.setAdminId(null);
|
|
|
+// param.setAdminId(null);
|
|
|
}
|
|
|
+ param.setAdminId(String.valueOf(admin.getParentId()));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(param.getClientId())) {
|
|
|
param.setAdminId(null);
|
|
@@ -749,19 +761,6 @@ public class TOrderController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-// if (ElasticsearchRunner.ES_RUNNING) {
|
|
|
-// try {
|
|
|
-// // 查es
|
|
|
-// chartColumn = esTOrderService.getStatistics(param);
|
|
|
-// }catch (Exception e){
|
|
|
-// log.error("使用es 查询发生错误:{}",e);
|
|
|
-// // 查 mysql
|
|
|
-// chartColumn = tOrderService.getStatistics(param);
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// // 查 mysql
|
|
|
-// chartColumn = tOrderService.getStatistics(param);
|
|
|
-// }
|
|
|
return ResponseEntity
|
|
|
.status(HttpStatus.OK)
|
|
|
.body(new ResultMessage()
|
|
@@ -826,11 +825,11 @@ public class TOrderController {
|
|
|
|
|
|
} else {
|
|
|
TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
|
|
|
- if (adminEquipment.getType().equals("0")) {
|
|
|
+ if (!adminEquipment.getType().equals("0")) {
|
|
|
// TAdmin admin1 = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
// param.setAdminId(admin1.getId().toString());
|
|
|
- param.setAdminId(admin.getParentId().toString());
|
|
|
- } else {
|
|
|
+// param.setAdminId(admin.getParentId().toString());
|
|
|
+// } else {
|
|
|
List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
param.setClientIds(list);
|
|
|
if (StringUtils.isNotEmpty(adminEquipment.getEquipmentIds())) {
|
|
@@ -844,8 +843,9 @@ public class TOrderController {
|
|
|
.setData(null)
|
|
|
.setMessage("没有绑定机器/no machine"));
|
|
|
}
|
|
|
- param.setAdminId(null);
|
|
|
+// param.setAdminId(null);
|
|
|
}
|
|
|
+ param.setAdminId(String.valueOf(admin.getParentId()));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(param.getClientId())) {
|
|
|
param.setAdminId(null);
|