|
@@ -3,21 +3,23 @@ package com.willalp.canteen.service.impl;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
-import com.willalp.canteen.domain.HsCanteenCuisine;
|
|
|
|
-import com.willalp.canteen.domain.HsCanteenOrder;
|
|
|
|
-import com.willalp.canteen.domain.HsCanteenOrderDetail;
|
|
|
|
|
|
+import com.willalp.canteen.domain.*;
|
|
import com.willalp.canteen.domain.resp.CustomGetOrderResp;
|
|
import com.willalp.canteen.domain.resp.CustomGetOrderResp;
|
|
import com.willalp.canteen.domain.vo.CustomGetOrderVo;
|
|
import com.willalp.canteen.domain.vo.CustomGetOrderVo;
|
|
import com.willalp.canteen.domain.vo.HsCanteenOrderInfoVo;
|
|
import com.willalp.canteen.domain.vo.HsCanteenOrderInfoVo;
|
|
import com.willalp.canteen.domain.vo.MenuCountVo;
|
|
import com.willalp.canteen.domain.vo.MenuCountVo;
|
|
import com.willalp.canteen.mapper.HsCanteenOrderMapper;
|
|
import com.willalp.canteen.mapper.HsCanteenOrderMapper;
|
|
|
|
+import com.willalp.canteen.service.IHsCanteenDiningPlaceService;
|
|
|
|
+import com.willalp.canteen.service.IHsCanteenMenuService;
|
|
import com.willalp.canteen.service.IHsCanteenOrderDetailService;
|
|
import com.willalp.canteen.service.IHsCanteenOrderDetailService;
|
|
import com.willalp.canteen.service.IHsCanteenOrderService;
|
|
import com.willalp.canteen.service.IHsCanteenOrderService;
|
|
import com.willalp.common.core.domain.AjaxResult;
|
|
import com.willalp.common.core.domain.AjaxResult;
|
|
import com.willalp.common.enums.ConsumeChangeEnum;
|
|
import com.willalp.common.enums.ConsumeChangeEnum;
|
|
import com.willalp.common.enums.NumberRuleEnum;
|
|
import com.willalp.common.enums.NumberRuleEnum;
|
|
|
|
+import com.willalp.common.enums.SysOrgCodeEnum;
|
|
import com.willalp.common.exception.base.BaseException;
|
|
import com.willalp.common.exception.base.BaseException;
|
|
import com.willalp.common.utils.DateUtils;
|
|
import com.willalp.common.utils.DateUtils;
|
|
import com.willalp.common.utils.SecurityUtils;
|
|
import com.willalp.common.utils.SecurityUtils;
|
|
@@ -65,6 +67,15 @@ public class HsCanteenOrderServiceImpl extends ServiceImpl<HsCanteenOrderMapper,
|
|
@Autowired
|
|
@Autowired
|
|
ISysUserOrganizationService sysUserOrganizationService;
|
|
ISysUserOrganizationService sysUserOrganizationService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IHsCanteenMenuService menuService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IHsCanteenDiningPlaceService diningPlaceService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ISysUserOrganizationService userOrganizationService;
|
|
|
|
+
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
@@ -158,6 +169,90 @@ public class HsCanteenOrderServiceImpl extends ServiceImpl<HsCanteenOrderMapper,
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Object jcdStat(String menuCode) {
|
|
|
|
+ if (StringUtils.isBlank(menuCode)) {
|
|
|
|
+ throw new BaseException("菜单编号不能为空");
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ HsCanteenMenu canteenMenu = menuService.getBaseMapper().selectOne(new QueryWrapper<HsCanteenMenu>().eq("menu_number", menuCode));
|
|
|
|
+ map.put("menuName", canteenMenu.getMenuName());
|
|
|
|
+ List<HsCanteenOrder> orders = baseMapper.selectList(new QueryWrapper<HsCanteenOrder>().eq("menu_number", menuCode));
|
|
|
|
+ return jcdTj(map, orders);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Object jcdMonthStat(int year, int month) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ List<HsCanteenOrder> orders = baseMapper.selectList(new QueryWrapper<HsCanteenOrder>()
|
|
|
|
+ .eq("YEAR(paytime) ", year)
|
|
|
|
+ .eq("MONTH(paytime)", month));
|
|
|
|
+ return jcdTj(map, orders);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, Object> jcdTj(Map<String, Object> map, List<HsCanteenOrder> orders) {
|
|
|
|
+ if (0 == orders.size()) {
|
|
|
|
+ throw new BaseException("暂无统计数据");
|
|
|
|
+ }
|
|
|
|
+ List<HsCanteenDiningPlace> hsCanteenDiningPlaces = diningPlaceService.getBaseMapper().selectList(
|
|
|
|
+ new QueryWrapper<HsCanteenDiningPlace>()
|
|
|
|
+ .eq("jgid", SysOrgCodeEnum.MLHuiZhuLi.getCode())
|
|
|
|
+ .notIn("parent_id", 0));
|
|
|
|
+ if (0 == hsCanteenDiningPlaces.size()) {
|
|
|
|
+ throw new BaseException("暂无统计数据");
|
|
|
|
+ }
|
|
|
|
+ List<SysUserOrganization> sysUserOrganizations = userOrganizationService.getBaseMapper().selectList(
|
|
|
|
+ new QueryWrapper<SysUserOrganization>().eq("organization_code", SysOrgCodeEnum.MLHuiZhuLi.getCode()));
|
|
|
|
+ if (0 == sysUserOrganizations.size()) {
|
|
|
|
+ throw new BaseException("暂无统计数据");
|
|
|
|
+ }
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
+ for (HsCanteenDiningPlace hsCanteenDiningPlace : hsCanteenDiningPlaces) {
|
|
|
|
+ Map<String, Object> mapJcd = new HashMap<String, Object>();
|
|
|
|
+ mapJcd.put("placeName", hsCanteenDiningPlace.getPlaceName());
|
|
|
|
+ //就餐地总数
|
|
|
|
+ List<HsCanteenOrder> jdcSumList = orders.stream().filter(o ->
|
|
|
|
+ null != o.getPlaceNumber() &&
|
|
|
|
+ o.getZfbz() != 1 &&
|
|
|
|
+ o.getPlaceNumber().equals(hsCanteenDiningPlace.getPlaceNumber())).collect(Collectors.toList());
|
|
|
|
+ mapJcd.put("count", jdcSumList.size());
|
|
|
|
+ //用户类型计算
|
|
|
|
+ int sybq = 0;
|
|
|
|
+ int fsybq = 0;
|
|
|
|
+ int dsflwwb = 0;
|
|
|
|
+ for (HsCanteenOrder hsCanteenOrder : jdcSumList) {
|
|
|
|
+ for (SysUserOrganization userOrganization : sysUserOrganizations) {
|
|
|
|
+ if (hsCanteenOrder.getUserNumber().equals(userOrganization.getLoginName()) &&
|
|
|
|
+ hsCanteenOrder.getZfbz() != 1) {
|
|
|
|
+ switch (userOrganization.getUserType()) {
|
|
|
|
+ case "1":
|
|
|
|
+ //事业编群
|
|
|
|
+ sybq++;
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ //非事业编群
|
|
|
|
+ fsybq++;
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ case "4":
|
|
|
|
+ //第三方劳务外包
|
|
|
|
+ dsflwwb++;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ mapJcd.put("sybq", sybq);
|
|
|
|
+ mapJcd.put("fsybq", fsybq);
|
|
|
|
+ mapJcd.put("dsflwwb", dsflwwb);
|
|
|
|
+ list.add(mapJcd);
|
|
|
|
+ }
|
|
|
|
+ map.put("place", list);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<MenuCountVo> getTheMenuItemsAndQuantitiesPerPerson(String menuCode) {
|
|
public List<MenuCountVo> getTheMenuItemsAndQuantitiesPerPerson(String menuCode) {
|
|
if (StringUtils.isBlank(menuCode)) {
|
|
if (StringUtils.isBlank(menuCode)) {
|