| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '../../utils/request' |
| | | |
| | | export function allList (data) { |
| | | return request.post('/business/workbench/businessData', data, { |
| | | trim: true |
| | | }) |
| | | } |
| | |
| | | return { |
| | | tabs2: [{ index: 0, name: 'æéé' }, { index: 1, name: 'æéå®é¢' } ], |
| | | tabs1: [{ index: 0, name: 'æè®¢åé' }, { index: 1, name: 'æéå®é¢' }, { index: 2, name: 'æä¼åæ°' }], |
| | | tabs: [{ index: 0, name: '仿¥' }, { index: 1, name: 'è¿7æ¥' }, { index: 2, name: 'è¿30æ¥' }, { index: 3, name: 'è¿1å¹´' }], |
| | | tabs: [{ index: 0, name: '仿¥' }, { index: 1, name: 'è¿7æ¥' }, { index: 2, name: 'è¿30æ¥' }, { index: 3, name: 'è¿12æ' }], |
| | | tabName: '仿¥', |
| | | tabIndex: 0, |
| | | tabIndex1: 0, |
| | |
| | | topYear:null, |
| | | topMonth:null, |
| | | topYear2:null, |
| | | }, |
| | | topData:{ |
| | | |
| | | }, |
| | | countData: { |
| | | totalPrice: 1000, |
| | |
| | | myChart0: null, |
| | | myChart1: null |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'å·¥ä½å°æ°æ®ç»è®¡', |
| | | api: '/business/workbench', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | }, |
| | | mounted () { |
| | | this.initCountData() |
| | |
| | | data: this.orderCorderCount |
| | | }] |
| | | }) |
| | | }, |
| | | changeCount (page) { |
| | | if (page == 7) { |
| | | this.orderCorderCount = [10, 10, 20, 10, 40, 10, 30] |
| | | this.opinionData = ['3.20', '3.21', '3.22', '3.23', '3.24', '3.25', '3.26'] |
| | | } else { |
| | | this.orderCorderCount = [11, 10, 20, 10, 40, 10, 30, 20, 10, 20, 10, 40, 10, 30, 10, 10, 20, 10, 40, 10, 30, 10, 10, 20, 10, 40, 10, 30, 20, 40] |
| | | this.opinionData = ['3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.08', '3.09', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17', '3.18', '3.19', '3.20', '3.21', '3.22', '3.23', '3.24', '3.25', '3.26', '3.27', '3.28', '3.28', '3.30'] |
| | | } |
| | | // this.orderCorderCount.push(1) |
| | | // this.opinionData.push(1) |
| | | this.renderOrderChange() |
| | | } |
| | | } |
| | | } |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/businessData") |
| | | @RequiresPermissions("business:fund:create") |
| | | public ApiResponse<BusinessDataCountVO> create(@RequestBody CountDataDTO param) { |
| | | return ApiResponse.success(workbenchService.businessData(param)); |
| | | } |
| | |
| | | @ApiModelProperty(value = "订åç¼ç ï¼å
³ègoodsorder表ï¼", example = "1") |
| | | @ExcelColumn(name="订åç¼ç ï¼å
³ègoodsorder表ï¼") |
| | | private Integer orderId; |
| | | @ApiModelProperty(value = "ååç¼ç ï¼gooods表ï¼", example = "1") |
| | | @ExcelColumn(name="ååç¼ç ï¼gooods表ï¼") |
| | | private Integer goodsId; |
| | | |
| | | @ApiModelProperty(value = "SKUå表å¾") |
| | | @ExcelColumn(name="SKUå表å¾") |
| | |
| | | @ApiModelProperty(value = "ç»è®¡æ°é(è®¢åæ°ãééãæ¶è积åé)") |
| | | private Long num; |
| | | @ApiModelProperty(value = "ç»è®¡æ°é2 (ä¼åæ°ï¼") |
| | | private Long num2; |
| | | private Long num1; |
| | | @ApiModelProperty(value = "éå®é¢ï¼ä¼æ éé¢") |
| | | private BigDecimal price; |
| | | @ApiModelProperty(value = "éå®é¢ï¼ä¿æäº¤æéé¢éé¢") |
| | |
| | | private List<CountDataVO> dataList; |
| | | @ApiModelProperty(value = "ç»è®¡åè¡¨æ°æ®2") |
| | | private List<CountDataVO> dataList2; |
| | | @ApiModelProperty(value = "ç»è®¡åè¡¨æ°æ®åç±»2") |
| | | private List<String> cateList; |
| | | @ApiModelProperty(value = "ç»è®¡åè¡¨æ°æ®3") |
| | | private List<BigDecimal[]> numList; |
| | | } |
| | |
| | | private BigDecimal price1; |
| | | @ApiModelProperty(value = "ç»è®¡ç»´åº¦åç§°") |
| | | private String name; |
| | | @ApiModelProperty(value = "ç»è®¡ç»´åº¦æ¶é´åç§°") |
| | | private String dateStr; |
| | | } |
| | |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | |
| | | public class WorkbenchServiceImpl implements WorkbenchService { |
| | | @Autowired |
| | | private GoodsorderMapper goodsorderMapper; |
| | | @Autowired |
| | | private GoodsorderDetailMapper goodsorderDetailMapper; |
| | | |
| | | @Override |
| | | public BusinessDataCountVO businessData(CountDataDTO param) { |
| | | BusinessDataCountVO data = new BusinessDataCountVO(); |
| | | int dataType = param.getDateType();//0仿¥ 1è¿ä¸æ¥ 2è¿30æ¥ 3è¿1å¹´ |
| | | int days = 1; |
| | | String name = "HOUR(CREATE_DATE)"; |
| | | List<String> dateList = new ArrayList<>(); |
| | | Date date = Utils.Date.getEnd(new Date());//仿¥ 23:59:59 |
| | | Date startDate = DateUtil.addDaysToDate(date,-1); |
| | | switch (dataType) { |
| | | case 1: { |
| | | days = 7; |
| | | name = "DATE_FORMAT(t.CREATE_DATE, '%Y-%m-%d')"; |
| | | for(int i=1;i<=7;i++){ |
| | | dateList.add(DateUtil.getPlusTime2(DateUtil.addDaysToDate(date,7-i))); |
| | | } |
| | | startDate = DateUtil.addDaysToDate(date,7); |
| | | break; |
| | | } case 2: { |
| | | days =30; |
| | | name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m-%d')"; |
| | | for(int i=1;i<=30;i++){ |
| | | dateList.add(DateUtil.getPlusTime2(DateUtil.addDaysToDate(date,30-i))); |
| | | } |
| | | startDate = DateUtil.addDaysToDate(date,30); |
| | | break; |
| | | } case 3: { |
| | | days = 365; |
| | | startDate = DateUtil.increaseMonth(date,-12); |
| | | name = "DATE_FORMAT(GoodsCREATE_DATE, '%Y-%m')"; |
| | | for(int i=1;i<=12;i++){ |
| | | dateList.add(DateUtil.getPlusTime2(DateUtil.increaseMonth(date,12-i))); |
| | | } |
| | | break; |
| | | } default:{ |
| | | |
| | | for(int i=0;i<=23;i++){ |
| | | dateList.add(i+""); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Date startDate = DateUtil.addDaysToDate(Utils.Date.getStart(new Date()),-days); |
| | | //订åéé |
| | | CountDataVO r= goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>() |
| | | .select("(select count(t.id) )",CountDataVO::getNum) |
| | | .select("(select sum(t.totalPrice) )",CountDataVO::getPrice) |
| | | .ge(Goodsorder::getCreateDate,startDate) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.DONE.getKey()) |
| | | ); |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) ); |
| | | if (r != null) { |
| | | data.setNum(Constants.formatLongNum(r.getNum()));//订åé |
| | | data.setPrice(Constants.formatBigdecimal(r.getPrice()));//订åéé¢ |
| | | } |
| | | //鿬¾ç»è®¡ |
| | | CountDataVO r1 = goodsorderMapper.selectJoinOne(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>() |
| | | .select("(select count(t.id) )",CountDataVO::getNum) |
| | | .select("(select sum(t.reundMoney) )",CountDataVO::getPrice) |
| | | .ge(Goodsorder::getRefundTime,startDate) |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.REFUND.getKey()) ); |
| | | |
| | | |
| | | if (r1 != null) { |
| | | data.setNum1(Constants.formatLongNum(r1.getNum()));//鿬¾åé |
| | | data.setPrice1(Constants.formatBigdecimal(r1.getPrice()));//鿬¾éé¢ |
| | | } |
| | | |
| | | //ç»è®¡è®¢åééåéå®é¢éå |
| | | List<CountDataVO> list1 = goodsorderMapper.selectJoinList(CountDataVO.class,new MPJLambdaWrapper<Goodsorder>() |
| | | .select("(select "+name+")",CountDataVO::getDateStr) |
| | | .select("(select count(t.id) )",CountDataVO::getNum) |
| | | .select("(select sum(t.totalPrice) )",CountDataVO::getPrice) |
| | | .ge(Goodsorder::getRefundTime,startDate) |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) |
| | | .groupBy(name) ); |
| | | |
| | | List<CountDataVO> datalist1 = new ArrayList<>(); |
| | | for(String str : dateList){ |
| | | CountDataVO tmp = new CountDataVO(); |
| | | tmp.setDateStr(str); |
| | | tmp.setNum(0l); |
| | | tmp.setPrice(new BigDecimal(0)); |
| | | if(list1!=null){ |
| | | for(CountDataVO p : list1){ |
| | | if(StringUtils.equals(p.getDateStr(),str)){ |
| | | tmp.setNum(Constants.formatLongNum(p.getNum())); |
| | | tmp.setPrice(Constants.formatBigdecimal(p.getPrice())); |
| | | } |
| | | } |
| | | } |
| | | datalist1.add(tmp); |
| | | } |
| | | data.setDataList(datalist1 ); |
| | | |
| | | //ç»è®¡åç±»ååæ°æ®éå |
| | | List<CountDataVO> list2 = goodsorderDetailMapper.selectJoinList(CountDataVO.class,new MPJLambdaWrapper<GoodsorderDetail>() |
| | | .select("(select "+name+")",CountDataVO::getDateStr) |
| | | .selectAs(Labels::getName,CountDataVO::getName) |
| | | .select("(select sum(t.totalPrice) )",CountDataVO::getPrice) |
| | | .leftJoin(Goods.class,Goods::getId,GoodsorderDetail::getGoodsId) |
| | | .leftJoin(Labels.class,Labels::getId,Goods::getCategoryId) |
| | | .leftJoin(Goodsorder.class,Goodsorder::getId,GoodsorderDetail::getOrderId) |
| | | .ge(Goodsorder::getRefundTime,startDate) |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) |
| | | .groupBy(name +",t2.category_id")); |
| | | |
| | | List<BigDecimal[]> datalist2 = new ArrayList<>(); |
| | | List<String> cateList = getCateListFromDataList(list2); |
| | | if(list2!=null &&list2.size()>0 && cateList!=null && cateList.size()>0){ |
| | | BigDecimal[] temp = new BigDecimal[dateList.size()]; |
| | | for(String cate : cateList){ |
| | | for(int i=0;i<dateList.size();i++){ |
| | | temp[i] = new BigDecimal(0); |
| | | for(CountDataVO model : list2){ |
| | | if(StringUtils.equals(model.getDateStr(),dateList.get(i)) && StringUtils.equals(model.getName(),cate)){ |
| | | temp[i] = temp[i].add(Constants.formatBigdecimal(model.getPrice())); |
| | | } |
| | | } |
| | | } |
| | | datalist2.add(temp); |
| | | } |
| | | } |
| | | data.setCateList(cateList); |
| | | data.setNumList(datalist2 ); |
| | | return data; |
| | | } |
| | | |
| | | private List<String> getCateListFromDataList(List<CountDataVO> list2) { |
| | | List<String> list = new ArrayList<>(); |
| | | for(CountDataVO model :list2){ |
| | | boolean isnew = true; |
| | | for(String str :list){ |
| | | if(StringUtils.equals(str,model.getName())){ |
| | | isnew = false; |
| | | } |
| | | |
| | | } |
| | | if(isnew ){ |
| | | list.add(model.getName()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |