| | |
| | | package com.matrix.system.app.action; |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.app.dto.BusinessesDto; |
| | | import com.matrix.system.app.vo.BusinessesDataShowVo; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.SysBusinessData; |
| | | import com.matrix.system.hive.dao.SysBusinessDataDao; |
| | | import com.matrix.system.hive.service.imp.DataAnalysisCustomerServiceImpl; |
| | | import com.matrix.system.hiveErp.analysUtil.Caculate; |
| | | import com.matrix.system.hiveErp.analysUtil.StatisticsParamVo; |
| | | import com.matrix.system.hiveErp.analysUtil.StatisticsTimeDaoParam; |
| | | import com.matrix.system.hiveErp.dao.TjVipSumDao; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @RestController |
| | | @RequestMapping(value = "/api/statistics") |
| | | public class ApiStatisticsAction { |
| | | |
| | | @Autowired |
| | | TjVipSumDao tjVipSumDao; |
| | | |
| | | @Autowired |
| | | private SysBusinessDataDao sysBusinessDataDao; |
| | | |
| | | @Autowired |
| | | private DataAnalysisCustomerServiceImpl dataAnalysisCustomerService; |
| | | |
| | | @ApiOperation(value = "公司经营报表/门店经营报表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = BusinessesDataShowVo.class) |
| | | }) |
| | | @PostMapping(value = "/findShopBusinessesData") |
| | | public AjaxResult findShopBusinessesData(@RequestBody BusinessesDto businessesDto) { |
| | | SysBusinessData sysBusinessData = new SysBusinessData(); |
| | | // 若shopId为空,则查询门店经营报表 |
| | | if (businessesDto.getShopId() == null) { |
| | | sysBusinessData.setShopId(businessesDto.getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(sysBusinessData); |
| | | |
| | | if (BusinessesDto.DAY.equals(businessesDto.getType())) { |
| | | sysBusinessData.setT1("%Y-%m-%d"); |
| | | } else { |
| | | sysBusinessData.setT1("%Y-%m"); |
| | | } |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset((businessesDto.getPageNum() - 1) * businessesDto.getPageSize()); |
| | | pageVo.setLimit(businessesDto.getPageSize()); |
| | | |
| | | return AjaxResult.buildSuccessInstance(sysBusinessDataDao.selectApiBusinessDataInPage(sysBusinessData, pageVo), sysBusinessDataDao.selectApiBusinessDataTotal(sysBusinessData)); |
| | | } |
| | | |
| | | @ApiOperation(value = "专项 - 营业收入", notes = "专项 - 营业收入") |
| | | @PostMapping(value = "/findBusinessInCome") |
| | | public AjaxResult findBusinessInCome(@RequestBody @Validated StatisticsParamVo statisticsParam) { |
| | | if (statisticsParam.getShopId() != null) { |
| | | return dataAnalysisCustomerService.getAnalysisResult(statisticsParam, new Caculate<BigDecimal>() { |
| | | @Override |
| | | public Map<String, BigDecimal> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | switch (statisticsParam.getType()) { |
| | | case "1" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "2" : |
| | | return tjVipSumDao.selectCashIncome(timeSpaceParam, shopId, null); |
| | | case "3" : |
| | | return tjVipSumDao.selectCardUse(timeSpaceParam, shopId, null); |
| | | case "4" : |
| | | return tjVipSumDao.selectHisConsume(timeSpaceParam, shopId, null); |
| | | case "5" : |
| | | return tjVipSumDao.selectFreeConsume(timeSpaceParam, shopId, null); |
| | | case "6" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "7" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | case "8" : |
| | | return tjVipSumDao.selectArrears(timeSpaceParam, shopId, null); |
| | | default : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, shopId, null); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | return dataAnalysisCustomerService.getCompanyAnalysisResult(statisticsParam, new Caculate<BigDecimal>() { |
| | | @Override |
| | | public Map<String, BigDecimal> exec(List<StatisticsTimeDaoParam> timeSpaceParam, Long shopId, Long companyId) { |
| | | switch (statisticsParam.getType()) { |
| | | case "1" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "2" : |
| | | return tjVipSumDao.selectCashIncome(timeSpaceParam, null, companyId); |
| | | case "3" : |
| | | return tjVipSumDao.selectCardUse(timeSpaceParam, null, companyId); |
| | | case "4" : |
| | | return tjVipSumDao.selectHisConsume(timeSpaceParam, null, companyId); |
| | | case "5" : |
| | | return tjVipSumDao.selectFreeConsume(timeSpaceParam, null, companyId); |
| | | case "6" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "7" : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | case "8" : |
| | | return tjVipSumDao.selectArrears(timeSpaceParam, null, companyId); |
| | | default : |
| | | return tjVipSumDao.selectBusinessInCome(timeSpaceParam, null, companyId); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |