|
@@ -125,7 +125,7 @@ public class TOrderController {
|
|
|
TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
|
|
|
if (!adminEquipment.getType().equals("0")) {
|
|
|
List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
- if (list == null || list.size() == 0) {
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "没有机器/no machine");
|
|
|
}
|
|
|
query.in(TOrder::getClientId, list);
|
|
@@ -310,7 +310,7 @@ public class TOrderController {
|
|
|
//显示订单所属机器的设备名称
|
|
|
List<TOrder> orderList = iPage.getRecords();
|
|
|
List<OrderDetailsVo> orderDetailsVos = new ArrayList<>();
|
|
|
- if (orderList.size() > 0) {
|
|
|
+ if (!orderList.isEmpty()) {
|
|
|
// 设备编号集合
|
|
|
List<String> clientIds = new ArrayList<>();
|
|
|
for (TOrder order : orderList) {
|
|
@@ -356,13 +356,6 @@ public class TOrderController {
|
|
|
|
|
|
//1,海外
|
|
|
if (type.equals("1")) {
|
|
|
- // 如果是线上 Airwallex
|
|
|
-// if ("1".equals(isAir)) {
|
|
|
-//
|
|
|
-// } else {
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
if (!userName.equals("admin")) {
|
|
|
// 如果为账户
|
|
@@ -375,17 +368,30 @@ public class TOrderController {
|
|
|
if (data == null || data.getId() == null) {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "找不到商家");
|
|
|
}
|
|
|
- query.eq(TCoinOrder::getAdminId, data.getId());
|
|
|
+ if (data.getIsAdmined()) {
|
|
|
+ query.eq(TCoinOrder::getAdminId, data.getId());
|
|
|
+ } else {
|
|
|
+ if (data.getParentId() != 1) {
|
|
|
+ query.eq(TCoinOrder::getAdminId, data.getParentId());
|
|
|
+ //查找子账户所管理的机器
|
|
|
+ TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
|
|
|
+ if (!adminEquipment.getType().equals("0")) {
|
|
|
+ List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return R.fail(ResponseCodesEnum.A0001, "没有机器/no machine");
|
|
|
+ }
|
|
|
+ query.in(TCoinOrder::getClientId, list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
//adminType="all"时,代表查全部下级 子账户没有这个权限 公司人员默认查所有人
|
|
|
if (StringUtils.isNotEmpty(adminType)) {
|
|
|
if (admin.getIsAdmined() && admin.getType() > 1) {
|
|
|
- if (admin.getType() > 1) {
|
|
|
- if (adminType.equals("all")) {
|
|
|
- //查找所有下级
|
|
|
- List<Long> admidIdList = R.getDataIfSuccess(szwlFeign.getAdminIdList(adminId));
|
|
|
- query.in(TCoinOrder::getAdminId, admidIdList);
|
|
|
- }
|
|
|
+ if ("all".equals(adminType)) {
|
|
|
+ //查找所有下级
|
|
|
+ List<Long> admidIdList = R.getDataIfSuccess(szwlFeign.getAdminIdList(adminId));
|
|
|
+ query.in(TCoinOrder::getAdminId, admidIdList);
|
|
|
}
|
|
|
} else {
|
|
|
if (admin.getType() > 1) {
|
|
@@ -407,25 +413,21 @@ public class TOrderController {
|
|
|
//判断当前账号状态 公司还是商家
|
|
|
if (admin.getType() > 1) {
|
|
|
//商家 判断是否子账户
|
|
|
- if (!admin.getIsAdmined()) {
|
|
|
+ if (admin.getIsAdmined()) {
|
|
|
//商家自己
|
|
|
-// query.eq(TCoinOrder::getAdminId,adminId);
|
|
|
-// } else {
|
|
|
+ query.eq(TCoinOrder::getAdminId, adminId);
|
|
|
+ } else {
|
|
|
//商家 子账户
|
|
|
//登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
- TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(adminId)));
|
|
|
- if (adminEquipment != null) {
|
|
|
- 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);
|
|
|
- List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
|
|
|
- query.in(TCoinOrder::getEquipmentId, equipmentIdList);
|
|
|
- }
|
|
|
- query.eq(TCoinOrder::getAdminId, admin.getParentId());
|
|
|
+ TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
+ if ("0".equals(adminEquipment.getType())) {
|
|
|
+ //全部机器
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -489,33 +491,58 @@ public class TOrderController {
|
|
|
return R.fail(ResponseCodesEnum.A0001, "设备不存在");
|
|
|
}
|
|
|
}
|
|
|
-// if (startDate != null) {
|
|
|
-// query.gt(TCoinOrder::getPayDate, startDate);
|
|
|
-// }
|
|
|
-// if (endDate != null) {
|
|
|
-// query.lt(TCoinOrder::getPayDate, endDate);
|
|
|
-// }
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- if (StringUtils.isNotEmpty(startDate)) {
|
|
|
- try {
|
|
|
- query.gt(TCoinOrder::getPayDate, simpleDateFormat.parse(startDate));
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(endDate)) {
|
|
|
- try {
|
|
|
- query.lt(TCoinOrder::getPayDate, simpleDateFormat.parse(endDate));
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (StringUtils.isNotEmpty(dateType)) {
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if (dateType.equals("0")) {
|
|
|
+ //创建时间
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ try {
|
|
|
+ query.gt(TCoinOrder::getCreateDate, simpleDateFormat.parse(startDate));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ try {
|
|
|
+ query.lt(TCoinOrder::getCreateDate, simpleDateFormat.parse(endDate));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(startDate) && StringUtils.isEmpty(endDate) && StringUtils.isEmpty(sn) && StringUtils.isEmpty(trxNo) && StringUtils.isEmpty(clientId) && StringUtils.isEmpty(userName)) {
|
|
|
+ try {
|
|
|
+ query.gt(TCoinOrder::getCreateDate, getStartTime(new Date()));
|
|
|
+ query.lt(TCoinOrder::getCreateDate, getEndTime(new Date()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(startDate) && StringUtils.isEmpty(endDate) && StringUtils.isEmpty(sn) && StringUtils.isEmpty(trxNo) && StringUtils.isEmpty(clientId) && StringUtils.isEmpty(userName)) {
|
|
|
- try {
|
|
|
- query.gt(TCoinOrder::getPayDate, getStartTime(new Date()));
|
|
|
- query.lt(TCoinOrder::getPayDate, getEndTime(new Date()));
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (dateType.equals("1")) {
|
|
|
+ //退款时间
|
|
|
+ if (StringUtils.isNotEmpty(startDate)) {
|
|
|
+ try {
|
|
|
+ query.gt(TCoinOrder::getRefundDate, simpleDateFormat.parse(startDate));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(endDate)) {
|
|
|
+ try {
|
|
|
+ query.lt(TCoinOrder::getRefundDate, simpleDateFormat.parse(startDate));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(startDate) && StringUtils.isEmpty(endDate) && StringUtils.isEmpty(sn) && StringUtils.isEmpty(trxNo) && StringUtils.isEmpty(clientId) && StringUtils.isEmpty(userName)) {
|
|
|
+ try {
|
|
|
+ query.gt(TCoinOrder::getRefundDate, getStartTime(new Date()));
|
|
|
+ query.lt(TCoinOrder::getRefundDate, getEndTime(new Date()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
query.orderByDesc(TCoinOrder::getCreateDate);
|
|
@@ -524,7 +551,7 @@ public class TOrderController {
|
|
|
IPage<CoinOrderDetailsVo> pageList = new Page<>();
|
|
|
List<TCoinOrder> coinOrderList = iPage.getRecords();
|
|
|
ArrayList<CoinOrderDetailsVo> coinOrderDetailsVos = new ArrayList<>();
|
|
|
- if (coinOrderList.size() > 0) {
|
|
|
+ if (!coinOrderList.isEmpty()) {
|
|
|
// 设备编号集合
|
|
|
List<String> clientIds = new ArrayList<>();
|
|
|
for (TCoinOrder coinOrder : coinOrderList) {
|