|
@@ -114,6 +114,15 @@ public class TOrderController {
|
|
|
}else {
|
|
|
if(data.getParentId()!=1){
|
|
|
query.eq(TOrder::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.size()==0){
|
|
|
+ return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
+ }
|
|
|
+ query.in(TOrder::getClientId,list);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1389,14 +1398,103 @@ public class TOrderController {
|
|
|
//0,线上
|
|
|
if(type.equals("0")){
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
- if(StringUtils.isNotEmpty(userName)&&!userName.equals("admin")){
|
|
|
+// if(StringUtils.isNotEmpty(userName)&&!userName.equals("admin")){
|
|
|
+// ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
+// TAdmin data = adminByUsername.getData();
|
|
|
+// if(data==null||data.getId()==null){
|
|
|
+// return R.fail(ResponseCodesEnum.A0001,"找不到商家");
|
|
|
+// }
|
|
|
+// query.eq(TOrder::getAdminId,data.getId());
|
|
|
+// }else if(StringUtils.isEmpty(userName)){
|
|
|
+// //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(TOrder::getAdminId,admidIdList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// if(admin.getType()>1){
|
|
|
+// //登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
+// TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
+// if(adminEquipment.getType().equals("0")){
|
|
|
+// //全部机器
|
|
|
+// TAdmin upAdmin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
+// query.eq(TOrder::getAdminId,upAdmin.getId());
|
|
|
+// }else {
|
|
|
+//// String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+//// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+//// query.in(TOrder::getClientId,equipmentIdList);
|
|
|
+// if(!adminEquipment.getType().equals("0")){
|
|
|
+// List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
+// if(list==null||list.size()==0){
|
|
|
+// return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
+// }
|
|
|
+// query.in(TOrder::getClientId,list);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }else {
|
|
|
+// //判断当前账号状态 公司还是商家
|
|
|
+// if(admin.getType()>1){
|
|
|
+// //商家 判断是否子账户
|
|
|
+// if(admin.getIsAdmined()){
|
|
|
+// //商家自己
|
|
|
+// query.eq(TOrder::getAdminId,adminId);
|
|
|
+// }else {
|
|
|
+// //商家 子账户
|
|
|
+// //登录账户为子账户 不查下级 只查对应机器的订单
|
|
|
+// TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getParentId())));
|
|
|
+// if(adminEquipment.getType().equals("0")){
|
|
|
+// //全部机器
|
|
|
+// TAdmin upAdmin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
|
|
|
+// query.eq(TOrder::getAdminId,upAdmin.getId());
|
|
|
+// }else {
|
|
|
+//// String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+//// List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+//// query.in(TOrder::getClientId,equipmentIdList);
|
|
|
+// if(!adminEquipment.getType().equals("0")){
|
|
|
+// List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
|
|
|
+// if(list==null||list.size()==0){
|
|
|
+// return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
+// }
|
|
|
+// query.in(TOrder::getClientId,list);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if(!userName.equals("admin")){
|
|
|
+ if(StringUtils.isNotEmpty(userName)){
|
|
|
ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
TAdmin data = adminByUsername.getData();
|
|
|
if(data==null||data.getId()==null){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"找不到商家");
|
|
|
}
|
|
|
- query.eq(TOrder::getAdminId,data.getId());
|
|
|
- }else if(StringUtils.isEmpty(userName)){
|
|
|
+ if(data.getIsAdmined()){
|
|
|
+ query.eq(TOrder::getAdminId,data.getId());
|
|
|
+ }else {
|
|
|
+ if(data.getParentId()!=1){
|
|
|
+ query.eq(TOrder::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.size()==0){
|
|
|
+ return R.fail(ResponseCodesEnum.A0001,"没有机器/no machine");
|
|
|
+ }
|
|
|
+ query.in(TOrder::getClientId,list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
//adminType="all"时,代表查全部下级 子账户没有这个权限 公司人员默认查所有人
|
|
|
if(StringUtils.isNotEmpty(adminType)){
|
|
|
if(admin.getIsAdmined()&&admin.getType()>1){
|
|
@@ -1447,7 +1545,8 @@ public class TOrderController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(payType)){
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(payType)){
|
|
|
query.eq(TOrder::getFrpCode,payType);
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(productNo)){
|
|
@@ -1627,6 +1726,15 @@ public class TOrderController {
|
|
|
return JsonMessage.success("导出错误");
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "同步订单到es中")
|
|
|
+ @PostMapping("/saveToEs")
|
|
|
+ public ResponseModel<?> saveToEs(@RequestBody TOrder order){
|
|
|
+ if(order==null){
|
|
|
+ return R.fail(ResponseCodesEnum.A0001);
|
|
|
+ }
|
|
|
+ esTOrderService.insertData(order);
|
|
|
+ return R.ok("同步es成功");
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取每天的开始时间 00:00:00:00
|
|
|
*
|