|
@@ -90,63 +90,67 @@ public class TOrderController {
|
|
|
//0,线上
|
|
|
if(type.equals("0")){
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
- //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);
|
|
|
- }
|
|
|
+
|
|
|
+ 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,"找不到商家");
|
|
|
}
|
|
|
- }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);
|
|
|
+ query.eq(TOrder::getAdminId,data.getId());
|
|
|
+ }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(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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }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(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(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());
|
|
|
- }
|
|
|
if(StringUtils.isNotEmpty(payType)){
|
|
|
query.eq(TOrder::getFrpCode,payType);
|
|
|
}
|
|
@@ -193,7 +197,7 @@ public class TOrderController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(startDate)&&StringUtils.isEmpty(endDate)){
|
|
|
+ if(StringUtils.isEmpty(startDate)&&StringUtils.isEmpty(endDate)&&StringUtils.isEmpty(sn)&&StringUtils.isEmpty(trxNo)&&StringUtils.isEmpty(clientId)&&StringUtils.isEmpty(userName)){
|
|
|
try {
|
|
|
query.gt(TOrder::getCreateDate,getStartTime(new Date()));
|
|
|
query.lt(TOrder::getCreateDate,getEndTime(new Date()));
|
|
@@ -218,7 +222,7 @@ public class TOrderController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(startDate)&&StringUtils.isEmpty(endDate)){
|
|
|
+ if(StringUtils.isEmpty(startDate)&&StringUtils.isEmpty(endDate)&&StringUtils.isEmpty(sn)&&StringUtils.isEmpty(trxNo)&&StringUtils.isEmpty(clientId)&&StringUtils.isEmpty(userName)){
|
|
|
try {
|
|
|
query.gt(TOrder::getRefundDate,getStartTime(new Date()));
|
|
|
query.lt(TOrder::getRefundDate,getEndTime(new Date()));
|
|
@@ -237,63 +241,67 @@ public class TOrderController {
|
|
|
//1,线下
|
|
|
if(type.equals("1")){
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
- //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(!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,"找不到商家");
|
|
|
}
|
|
|
- }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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
- }else {
|
|
|
- String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
- List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
- query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ query.eq(TCoinOrder::getAdminId,data.getId());
|
|
|
+ }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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
+ }else {
|
|
|
+ String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+ List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+ query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }else {
|
|
|
- //判断当前账号状态 公司还是商家
|
|
|
- if(admin.getType()>1){
|
|
|
- //商家 判断是否子账户
|
|
|
- if(admin.getIsAdmined()){
|
|
|
- //商家自己
|
|
|
-// query.eq(TCoinOrder::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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
- }else {
|
|
|
- String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
- List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
- query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ //判断当前账号状态 公司还是商家
|
|
|
+ if(admin.getType()>1){
|
|
|
+ //商家 判断是否子账户
|
|
|
+ if(admin.getIsAdmined()){
|
|
|
+ //商家自己
|
|
|
+// query.eq(TCoinOrder::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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
+ }else {
|
|
|
+ String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+ List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+ query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- 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(TCoinOrder::getAdminId,data.getId());
|
|
|
- }
|
|
|
+
|
|
|
if(StringUtils.isNotEmpty(payType)){
|
|
|
query.eq(TCoinOrder::getPayType,payType);
|
|
|
}
|
|
@@ -333,7 +341,7 @@ public class TOrderController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(startDate)&&StringUtils.isEmpty(endDate)){
|
|
|
+ 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()));
|
|
@@ -489,7 +497,7 @@ public class TOrderController {
|
|
|
if(param.getUsername().equals("all")){
|
|
|
//商家查全部
|
|
|
//判断是不是商家账户
|
|
|
- if(admin.getType()==3){
|
|
|
+ if(admin.getType()==2){
|
|
|
//查下级账户id集合
|
|
|
List<Long> list = R.getDataIfSuccess(szwlFeign.getAdminIdList(param.getAdminId()));
|
|
|
if(list.size()>0){
|
|
@@ -911,7 +919,7 @@ public class TOrderController {
|
|
|
*/
|
|
|
@ApiOperation(value = "订单数据导出-查询")
|
|
|
@RequestMapping(value = "/orderSelect", method = RequestMethod.GET)
|
|
|
- public ResponseModel<?> orderSelect(String type, String clientId, String username,String ifForeign, Date startDate, Date endDate, long current, long size) {
|
|
|
+ public ResponseModel<?> orderSelect(String type, String clientId, String username,String ifForeign, String startDate, String endDate, long current, long size) {
|
|
|
if(size>100){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"请求数量过大");
|
|
|
}
|
|
@@ -920,12 +928,17 @@ public class TOrderController {
|
|
|
page0.setSize(size);
|
|
|
page0.setCurrent(current);
|
|
|
if (startDate!=null&&endDate!=null) {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date begin = null;
|
|
|
Date end = null;
|
|
|
Long adminId = null;
|
|
|
- begin = startDate;
|
|
|
- end = endDate;
|
|
|
+ try {
|
|
|
+ begin = simpleDateFormat.parse(startDate);
|
|
|
+ end = simpleDateFormat.parse(endDate);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
long time = end.getTime() - begin.getTime();
|
|
|
if(time>31*24*60*60*1000l){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"时间跨度过长");
|
|
@@ -1053,30 +1066,40 @@ public class TOrderController {
|
|
|
* 订单数据导出
|
|
|
*/
|
|
|
@ApiOperation(value = "订单数据导出-导出")
|
|
|
- @RequestMapping(value = "/orderExport", method = RequestMethod.GET)
|
|
|
- public Object orderExport(HttpServletResponse response, String type, String clientId, String ifForeign, String username, Date startDate, Date endDate, long current, long size) {
|
|
|
- if(size>100){
|
|
|
- return JsonMessage.success("页数过大");
|
|
|
- }
|
|
|
+ @RequestMapping(value = "/onlineExport", method = RequestMethod.GET)
|
|
|
+ public Object onlineExport(HttpServletResponse response, String type, String clientId, String ifForeign, String userName, String startDate, String endDate, long current, long size) {
|
|
|
+// if(size>100){
|
|
|
+// return JsonMessage.success("页数过大");
|
|
|
+// }
|
|
|
+ current = 1l;
|
|
|
+ size = 1000l;
|
|
|
if (startDate!=null&&endDate!=null) {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date begin = null;
|
|
|
Date end = null;
|
|
|
Long adminId = null;
|
|
|
- begin = startDate;
|
|
|
- end = endDate;
|
|
|
+ try {
|
|
|
+ begin = simpleDateFormat.parse(startDate);
|
|
|
+ end = simpleDateFormat.parse(endDate);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
long time = end.getTime() - begin.getTime();
|
|
|
if(time>31*24*60*60*1000l){
|
|
|
return JsonMessage.success("时间跨度过长");
|
|
|
}
|
|
|
- if(!StringUtils.isEmpty(username)){
|
|
|
- ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(username);
|
|
|
+ if(!StringUtils.isEmpty(userName)){
|
|
|
+ ResponseModel<TAdmin> adminByUsername = szwlFeign.getAdminByUsername(userName);
|
|
|
TAdmin data = adminByUsername.getData();
|
|
|
+ if(StringUtils.isEmpty(ifForeign)){
|
|
|
+ ifForeign =data.getIfForeign();
|
|
|
+ }
|
|
|
if(data==null||data.getId()==null){
|
|
|
return R.fail(ResponseCodesEnum.A0001,"找不到商家");
|
|
|
}
|
|
|
adminId = data.getId();
|
|
|
}
|
|
|
+
|
|
|
List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
|
|
|
if(ifForeign.equals("0")) {
|
|
|
//大陆
|
|
@@ -1182,71 +1205,87 @@ public class TOrderController {
|
|
|
return JsonMessage.success("导出成功");
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/onlineExport", method = RequestMethod.GET)
|
|
|
- public Object onlineExport(HttpServletResponse response, String adminId,String adminType,String type,String userName,String payType,String productNo,String clientId,String dateType, Date stratDate, Date endDate, long current, long size) {
|
|
|
+ @RequestMapping(value = "/orderExport", method = RequestMethod.GET)
|
|
|
+ public Object orderExport(HttpServletResponse response, String adminId,String adminType,String type,String userName,String payType,String productNo,String clientId,String dateType, String startDate, String endDate, long current, long size) {
|
|
|
+ current = 1l;
|
|
|
+ size = 1000l;
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date begin = null;
|
|
|
+ Date end = null;
|
|
|
+ try {
|
|
|
+ begin = simpleDateFormat.parse(startDate);
|
|
|
+ end = simpleDateFormat.parse(endDate);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ long time = end.getTime() - begin.getTime();
|
|
|
+ if(time>31*24*60*60*1000l){
|
|
|
+ return JsonMessage.success("时间跨度过长");
|
|
|
+ }
|
|
|
//判断当前账号状态
|
|
|
TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
|
|
|
//类型
|
|
|
//0,线上
|
|
|
if(type.equals("0")){
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
- //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);
|
|
|
- }
|
|
|
+ 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,"找不到商家");
|
|
|
}
|
|
|
- }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);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }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(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(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());
|
|
|
- }
|
|
|
if(StringUtils.isNotEmpty(payType)){
|
|
|
query.eq(TOrder::getFrpCode,payType);
|
|
|
}
|
|
@@ -1268,16 +1307,16 @@ public class TOrderController {
|
|
|
if(StringUtils.isNotEmpty(dateType)){
|
|
|
if(dateType.equals("0")){
|
|
|
//创建时间
|
|
|
- if(stratDate!=null&&endDate!=null){
|
|
|
- query.gt(TOrder::getCreateDate,stratDate);
|
|
|
- query.lt(TOrder::getCreateDate,endDate);
|
|
|
+ if(begin!=null&&end!=null){
|
|
|
+ query.gt(TOrder::getCreateDate,begin);
|
|
|
+ query.lt(TOrder::getCreateDate,end);
|
|
|
}
|
|
|
}
|
|
|
if(dateType.equals("1")){
|
|
|
//退款时间
|
|
|
- if(stratDate!=null&&endDate!=null){
|
|
|
- query.gt(TOrder::getRefundDate,stratDate);
|
|
|
- query.lt(TOrder::getRefundDate,endDate);
|
|
|
+ if(begin!=null&&end!=null){
|
|
|
+ query.gt(TOrder::getRefundDate,begin);
|
|
|
+ query.lt(TOrder::getRefundDate,end);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1296,10 +1335,10 @@ public class TOrderController {
|
|
|
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("订单记录数据导出" + format.format(new Date()) + ".xls", "UTF-8"));
|
|
|
workbook.write(os);
|
|
|
- return JsonMessage.success("导出成功");
|
|
|
+// return JsonMessage.success("导出成功");
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return JsonMessage.success("导出错误");
|
|
|
+// return JsonMessage.success("导出错误");
|
|
|
} finally {
|
|
|
try {
|
|
|
os.close();
|
|
@@ -1314,63 +1353,64 @@ public class TOrderController {
|
|
|
//1,线下
|
|
|
if(type.equals("1")){
|
|
|
LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
|
|
|
- //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(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,"找不到商家");
|
|
|
}
|
|
|
- }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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
- }else {
|
|
|
- String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
- List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
- query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ query.eq(TCoinOrder::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(TCoinOrder::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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
+ }else {
|
|
|
+ String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+ List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+ query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }else {
|
|
|
- //判断当前账号状态 公司还是商家
|
|
|
- if(admin.getType()>1){
|
|
|
- //商家 判断是否子账户
|
|
|
- if(admin.getIsAdmined()){
|
|
|
- //商家自己
|
|
|
- query.eq(TCoinOrder::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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
- }else {
|
|
|
- String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
- List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
- query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ //判断当前账号状态 公司还是商家
|
|
|
+ if(admin.getType()>1){
|
|
|
+ //商家 判断是否子账户
|
|
|
+ if(admin.getIsAdmined()){
|
|
|
+ //商家自己
|
|
|
+ query.eq(TCoinOrder::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(TCoinOrder::getAdminId,upAdmin.getId());
|
|
|
+ }else {
|
|
|
+ String equipmentIds = adminEquipment.getEquipmentIds();
|
|
|
+ List<String> equipmentIdList = JSON.parseArray(equipmentIds, String.class);
|
|
|
+ query.in(TCoinOrder::getClientId,equipmentIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- 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(TCoinOrder::getAdminId,data.getId());
|
|
|
- }
|
|
|
if(StringUtils.isNotEmpty(payType)){
|
|
|
query.eq(TCoinOrder::getPayType,payType);
|
|
|
}
|
|
@@ -1389,9 +1429,9 @@ public class TOrderController {
|
|
|
query.eq(TCoinOrder::getClientId,equipment.getClientId());
|
|
|
}
|
|
|
}
|
|
|
- if(stratDate!=null&&endDate!=null){
|
|
|
- query.gt(TCoinOrder::getPayDate,stratDate);
|
|
|
- query.lt(TCoinOrder::getPayDate,endDate);
|
|
|
+ if(begin!=null&&end!=null){
|
|
|
+ query.gt(TCoinOrder::getPayDate,begin);
|
|
|
+ query.lt(TCoinOrder::getPayDate,end);
|
|
|
}
|
|
|
Page<TCoinOrder> page = new Page<>(current, size, true);
|
|
|
IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
|
|
@@ -1442,7 +1482,7 @@ public class TOrderController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取每天的开始时间 23:59:59:999
|
|
|
+ * 获取每天的时间 23:59:59:999
|
|
|
*
|
|
|
* @param date
|
|
|
* @return
|