Commit 829ee5ef by zhengxj

finish 修正安装单总量统计 on 20190322 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18821 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent e1a290b8
...@@ -229,13 +229,13 @@ public class OrderServiceImpl implements IOrderService { ...@@ -229,13 +229,13 @@ public class OrderServiceImpl implements IOrderService {
// int userId=user.getId(); // int userId=user.getId();
// TODO 根据用户类型管理订单 // TODO 根据用户类型管理订单
// 如果当前用户是商户 限制搜索范围 // 如果当前用户是商户 限制搜索范围
byte userType = user.getByte("userType"); int userType = user.getIntValue("userType");
// //
// 订单渠道过滤 // 订单渠道过滤
List<Integer> dataRight =null; List<Integer> dataRight =null;
// 非服务商用户 按数据权限获取订单数据 // 非服务商用户 按数据权限获取订单数据
if (BizConstants.USER_TYPE_MERCHANT != userType){ if (BizConstants.USER_TYPE_MERCHANT != userType){
dataRight=orderChannelService.getDataRight(userId, userType, oueryOrderReq.getOrderChannel()); dataRight=orderChannelService.getDataRight(userId, (byte)userType, oueryOrderReq.getOrderChannel());
if (dataRight == null || dataRight.size() == 0) { if (dataRight == null || dataRight.size() == 0) {
// 集团下无商户 // 集团下无商户
logger.info(""); logger.info("");
...@@ -873,8 +873,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -873,8 +873,11 @@ public class OrderServiceImpl implements IOrderService {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
List<Long> bizAmount = new ArrayList<>(); List<Long> bizAmount = new ArrayList<>();
JSONObject user = userClient.getUserById(userId); // JSONObject user = userClient.getUserById(userId);
boolean isMer = BizConstants.USER_TYPE_MERCHANT != user.getByteValue("userType") ? false : true; SysUser user = sysUserDao.selectByPrimaryKey(userId);
logger.info("*************"+ user.getUserType());
boolean isMer = BizConstants.USER_TYPE_MERCHANT != user.getUserType()? false : true;
// 当前用户:服务商或者门店 // 当前用户:服务商或者门店
// 数据权限 // 数据权限
List<Integer> dataRight = new ArrayList<>(); List<Integer> dataRight = new ArrayList<>();
...@@ -960,12 +963,12 @@ public class OrderServiceImpl implements IOrderService { ...@@ -960,12 +963,12 @@ public class OrderServiceImpl implements IOrderService {
for (int i = firstDayOfWeek; i < currentDay; i++) { for (int i = firstDayOfWeek; i < currentDay; i++) {
SysOrderExample orderExample = new SysOrderExample(); SysOrderExample orderExample = new SysOrderExample();
Criteria criteria = orderExample.createCriteria(); Criteria criteria = orderExample.createCriteria();
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1); if (isMer) {
if(isMer){
criteria.andMerchantIdEqualTo(userId); criteria.andMerchantIdEqualTo(userId);
}else{ } else {
criteria.andShopIdIn(dataRight); criteria.andShopIdIn(dataRight);
} }
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1);
Date beginDate = new Date(); Date beginDate = new Date();
beginDate.setDate(i); beginDate.setDate(i);
beginDate.setHours(0); beginDate.setHours(0);
...@@ -973,16 +976,16 @@ public class OrderServiceImpl implements IOrderService { ...@@ -973,16 +976,16 @@ public class OrderServiceImpl implements IOrderService {
beginDate.setSeconds(0); beginDate.setSeconds(0);
endDate = new Date(); endDate = new Date();
beginDate.setDate(i); endDate.setDate(i);
if (i < currentDay) {
endDate.setHours(23); endDate.setHours(23);
endDate.setMinutes(59); endDate.setMinutes(59);
endDate.setSeconds(59); endDate.setSeconds(59);
} else {
endDate = new Date();
}
beginDate.setTime(beginDate.getTime() / 1000 * 1000); beginDate.setTime(beginDate.getTime() / 1000 * 1000);
// endDate.setTime(endDate.getTime()/1000*1000);
criteria.andCreateTimeGreaterThanOrEqualTo(beginDate).andCreateTimeLessThanOrEqualTo(endDate); criteria.andCreateTimeGreaterThanOrEqualTo(beginDate).andCreateTimeLessThanOrEqualTo(endDate);
// criteria.andCreateTimeBetween(beginDate, endDate);
long businessAmount = orderDao.countByExample(orderExample); long businessAmount = orderDao.countByExample(orderExample);
bizAmount.add(businessAmount); bizAmount.add(businessAmount);
} }
...@@ -1087,12 +1090,11 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1087,12 +1090,11 @@ public class OrderServiceImpl implements IOrderService {
beginDate.setSeconds(0); beginDate.setSeconds(0);
endDate = new Date(); endDate = new Date();
if (i < currentDay) {
endDate.setDate(i); endDate.setDate(i);
endDate.setHours(23); endDate.setHours(23);
endDate.setMinutes(59); endDate.setMinutes(59);
endDate.setSeconds(59); endDate.setSeconds(59);
}
beginDate.setTime(beginDate.getTime() / 1000 * 1000); beginDate.setTime(beginDate.getTime() / 1000 * 1000);
// endDate.setTime(endDate.getTime()/1000*1000); // endDate.setTime(endDate.getTime()/1000*1000);
...@@ -1113,6 +1115,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1113,6 +1115,7 @@ public class OrderServiceImpl implements IOrderService {
break; break;
// 按照年计算 // 按照年计算
case "y": case "y":
bizAmountResp.setType("y"); bizAmountResp.setType("y");
int currentMonth = DateUtil.getCurrentDate().getMonth()+1; int currentMonth = DateUtil.getCurrentDate().getMonth()+1;
// 本周第一天 日期 // 本周第一天 日期
...@@ -1127,22 +1130,19 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1127,22 +1130,19 @@ public class OrderServiceImpl implements IOrderService {
criteria.andShopIdIn(dataRight); criteria.andShopIdIn(dataRight);
} }
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1); criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1);
beginDate = new Date(); Date begin = DateUtil.getPastMonthFirstDay(currentMonth - i);
beginDate.setMonth(i); // begin.setMonth(i-1);
beginDate.setDate(1); // begin.setDate(1);
beginDate.setHours(0); begin.setHours(0);
beginDate.setMinutes(0); begin.setMinutes(0);
beginDate.setSeconds(0); begin.setSeconds(0);
endDate = DateUtil.getPastMonthLastDay(currentMonth-i); Date end= DateUtil.getPastMonthLastDay(currentMonth - i);
if (i < currentMonth) { end.setHours(23);
endDate.setHours(23); end.setMinutes(59);
endDate.setMinutes(59); end.setSeconds(59);
endDate.setSeconds(59);
} else { criteria.andCreateTimeGreaterThanOrEqualTo(begin).andCreateTimeLessThanOrEqualTo(end);
endDate = new Date();
}
criteria.andCreateTimeGreaterThanOrEqualTo(beginDate).andCreateTimeLessThanOrEqualTo(endDate);
long businessAmount = orderDao.countByExample(orderExample); long businessAmount = orderDao.countByExample(orderExample);
bizAmount.add(businessAmount); bizAmount.add(businessAmount);
} }
...@@ -1167,11 +1167,14 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1167,11 +1167,14 @@ public class OrderServiceImpl implements IOrderService {
// 商户订单量排名统计 // 商户订单量排名统计
List<ShopBizAmount> shopBizAmounts = orderDao.countByParams(params); List<ShopBizAmount> shopBizAmounts = orderDao.countByParams(params);
if(shopBizAmounts.size()>0){
for (ShopBizAmount shopBizAmount : shopBizAmounts) { for (ShopBizAmount shopBizAmount : shopBizAmounts) {
SysMerchantExample example = new SysMerchantExample(); SysMerchantExample example = new SysMerchantExample();
example.createCriteria().andUserIdEqualTo(shopBizAmount.getShopId()); example.createCriteria().andUserIdEqualTo(shopBizAmount.getShopId());
shopBizAmount.setShopName(sysMerchantDao.selectByExample(example).get(0).getShopName()); shopBizAmount.setShopName(sysMerchantDao.selectByExample(example).get(0).getShopName());
} }
}
bizAmountResp.setShopBizAmount(shopBizAmounts); bizAmountResp.setShopBizAmount(shopBizAmounts);
return bizAmountResp; return bizAmountResp;
...@@ -1184,7 +1187,7 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1184,7 +1187,7 @@ public class OrderServiceImpl implements IOrderService {
JSONObject user = getUserInfo(userId); JSONObject user = getUserInfo(userId);
// SysUser user = sysUserDao.selectByPrimaryKey(userId); // SysUser user = sysUserDao.selectByPrimaryKey(userId);
byte userType = user.getByte("userType"); int userType = user.getInteger("userType");
// 用户类型(0:系统管理员,1:服务商,2:门店,3:技工) // 用户类型(0:系统管理员,1:服务商,2:门店,3:技工)
// SysMerchant sysMerchant = null; // SysMerchant sysMerchant = null;
// com.glsx.ordercenter.pojo.user.SysMerchantExample.Criteria // com.glsx.ordercenter.pojo.user.SysMerchantExample.Criteria
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!