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 {
// int userId=user.getId();
// TODO 根据用户类型管理订单
// 如果当前用户是商户 限制搜索范围
byte userType = user.getByte("userType");
int userType = user.getIntValue("userType");
//
// 订单渠道过滤
List<Integer> dataRight =null;
// 非服务商用户 按数据权限获取订单数据
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) {
// 集团下无商户
logger.info("");
......@@ -873,8 +873,11 @@ public class OrderServiceImpl implements IOrderService {
Map<String, Object> params = new HashMap<>();
List<Long> bizAmount = new ArrayList<>();
JSONObject user = userClient.getUserById(userId);
boolean isMer = BizConstants.USER_TYPE_MERCHANT != user.getByteValue("userType") ? false : true;
// JSONObject user = userClient.getUserById(userId);
SysUser user = sysUserDao.selectByPrimaryKey(userId);
logger.info("*************"+ user.getUserType());
boolean isMer = BizConstants.USER_TYPE_MERCHANT != user.getUserType()? false : true;
// 当前用户:服务商或者门店
// 数据权限
List<Integer> dataRight = new ArrayList<>();
......@@ -960,32 +963,32 @@ public class OrderServiceImpl implements IOrderService {
for (int i = firstDayOfWeek; i < currentDay; i++) {
SysOrderExample orderExample = new SysOrderExample();
Criteria criteria = orderExample.createCriteria();
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1);
if(isMer){
if (isMer) {
criteria.andMerchantIdEqualTo(userId);
}else{
criteria.andShopIdIn(dataRight);
}
} else {
criteria.andShopIdIn(dataRight);
}
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1);
Date beginDate = new Date();
beginDate.setDate(i);
beginDate.setHours(0);
beginDate.setMinutes(0);
beginDate.setSeconds(0);
endDate = new Date();
beginDate.setDate(i);
if (i < currentDay) {
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
} else {
endDate = new Date();
}
endDate.setDate(i);
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
beginDate.setTime(beginDate.getTime() / 1000 * 1000);
// endDate.setTime(endDate.getTime()/1000*1000);
criteria.andCreateTimeGreaterThanOrEqualTo(beginDate).andCreateTimeLessThanOrEqualTo(endDate);
// criteria.andCreateTimeBetween(beginDate, endDate);
long businessAmount = orderDao.countByExample(orderExample);
bizAmount.add(businessAmount);
}
}
}else{
// 本周不跨月份
int pastMonthLastDay = DateUtil.getPastMonthLastDay(1).getDate();
......@@ -1087,12 +1090,11 @@ public class OrderServiceImpl implements IOrderService {
beginDate.setSeconds(0);
endDate = new Date();
if (i < currentDay) {
endDate.setDate(i);
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
}
endDate.setDate(i);
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
beginDate.setTime(beginDate.getTime() / 1000 * 1000);
// endDate.setTime(endDate.getTime()/1000*1000);
......@@ -1113,6 +1115,7 @@ public class OrderServiceImpl implements IOrderService {
break;
// 按照年计算
case "y":
bizAmountResp.setType("y");
int currentMonth = DateUtil.getCurrentDate().getMonth()+1;
// 本周第一天 日期
......@@ -1127,22 +1130,19 @@ public class OrderServiceImpl implements IOrderService {
criteria.andShopIdIn(dataRight);
}
criteria.andActiveStatusNotEqualTo((byte) 9).andCanceledEqualTo((byte) 1);
beginDate = new Date();
beginDate.setMonth(i);
beginDate.setDate(1);
beginDate.setHours(0);
beginDate.setMinutes(0);
beginDate.setSeconds(0);
endDate = DateUtil.getPastMonthLastDay(currentMonth-i);
if (i < currentMonth) {
endDate.setHours(23);
endDate.setMinutes(59);
endDate.setSeconds(59);
} else {
endDate = new Date();
}
criteria.andCreateTimeGreaterThanOrEqualTo(beginDate).andCreateTimeLessThanOrEqualTo(endDate);
Date begin = DateUtil.getPastMonthFirstDay(currentMonth - i);
// begin.setMonth(i-1);
// begin.setDate(1);
begin.setHours(0);
begin.setMinutes(0);
begin.setSeconds(0);
Date end= DateUtil.getPastMonthLastDay(currentMonth - i);
end.setHours(23);
end.setMinutes(59);
end.setSeconds(59);
criteria.andCreateTimeGreaterThanOrEqualTo(begin).andCreateTimeLessThanOrEqualTo(end);
long businessAmount = orderDao.countByExample(orderExample);
bizAmount.add(businessAmount);
}
......@@ -1167,11 +1167,14 @@ public class OrderServiceImpl implements IOrderService {
// 商户订单量排名统计
List<ShopBizAmount> shopBizAmounts = orderDao.countByParams(params);
for (ShopBizAmount shopBizAmount : shopBizAmounts) {
SysMerchantExample example = new SysMerchantExample();
example.createCriteria().andUserIdEqualTo(shopBizAmount.getShopId());
shopBizAmount.setShopName(sysMerchantDao.selectByExample(example).get(0).getShopName());
if(shopBizAmounts.size()>0){
for (ShopBizAmount shopBizAmount : shopBizAmounts) {
SysMerchantExample example = new SysMerchantExample();
example.createCriteria().andUserIdEqualTo(shopBizAmount.getShopId());
shopBizAmount.setShopName(sysMerchantDao.selectByExample(example).get(0).getShopName());
}
}
bizAmountResp.setShopBizAmount(shopBizAmounts);
return bizAmountResp;
......@@ -1184,7 +1187,7 @@ public class OrderServiceImpl implements IOrderService {
JSONObject user = getUserInfo(userId);
// SysUser user = sysUserDao.selectByPrimaryKey(userId);
byte userType = user.getByte("userType");
int userType = user.getInteger("userType");
// 用户类型(0:系统管理员,1:服务商,2:门店,3:技工)
// SysMerchant sysMerchant = null;
// 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!