Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | |
| | | private Boolean delFlag; |
| | | @ApiModelProperty(value = " 是否删除0否1是 前端忽略") |
| | | private Long id; |
| | | private Long appUserId; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TChargingPile>> getChargingPileBySiteIds(List<Integer> siteIds) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<BigDecimal> getServiceMoney(String param) { |
| | | return R.fail("根据会员折扣、预付金额 计算服务费失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | @ApiOperation(value = "获取站点列表") |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteIds") |
| | | R<List<TChargingPile>> getChargingPileBySiteIds(@RequestParam("siteIds") List<Integer> siteIds); |
| | | |
| | | /** |
| | | * 小程序远程调用 根据会员折扣、预付金额 计算服务费 |
| | | * @return |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class TParkLotRecordCountVo { |
| | | @ApiModelProperty("从左到右依次") |
| | | int count1; |
| | | int count2; |
| | | int count3; |
| | | int count4; |
| | | BigDecimal count5; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class TParkLotRecordVO { |
| | | @ApiModelProperty("上方折线图") |
| | | List<Map<String,Object>> maps; |
| | | @ApiModelProperty("车辆类型饼图") |
| | | List<Map<String,Object>> carColor; |
| | | @ApiModelProperty("出场类型") |
| | | List<Map<String,Object>> outType; |
| | | @ApiModelProperty("进场充电占比") |
| | | List<Map<String,Object>> isCharge; |
| | | |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_settlement confirm") |
| | | @TableName("t_settlement_confirm") |
| | | @ApiModel(value="TSettlementConfirm对象", description="") |
| | | public class TSettlementConfirm extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableId(value = "id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | |
| | | @TableField("loss_electronic") |
| | | private BigDecimal lossElectronic; |
| | | @ApiModelProperty(value = "收入合计") |
| | | @TableField("收入合计") |
| | | @TableField("income") |
| | | private BigDecimal income; |
| | | |
| | | @ApiModelProperty(value = "场地费") |
| | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | @ApiModelProperty(value = "订单标题") |
| | | @TableField("title") |
| | | private String title; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class TCharingUserEquimentVO { |
| | | @ApiModelProperty("直流可用率") |
| | | List<Map<String,Object>> equipmentMap1; |
| | | @ApiModelProperty("交流可用率") |
| | | List<Map<String,Object>> equipmentMap2; |
| | | @ApiModelProperty("直流故障率") |
| | | List<Map<String,Object>> equipmentMapbroke1; |
| | | @ApiModelProperty("交流故障率") |
| | | List<Map<String,Object>> equipmentMapbroke2; |
| | | @ApiModelProperty("直流离网率") |
| | | List<Map<String,Object>> equipmentMapOut1; |
| | | @ApiModelProperty("交流离网率") |
| | | List<Map<String,Object>> equipmentMapOut2; |
| | | @ApiModelProperty("需求电流满足率") |
| | | List<Map<String,Object>> needElec; |
| | | } |
| | |
| | | List<Map<String,Object>> evaluate; |
| | | @ApiModelProperty("差评数量") |
| | | Long blackCount; |
| | | @ApiModelProperty("好评标签") |
| | | List<Map<String,Object>> goodTop; |
| | | @ApiModelProperty("差评标签") |
| | | List<Map<String,Object>> badTop; |
| | | @ApiModelProperty("流量分析") |
| | | List<Map<String,Object>> flow; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class TCharingWorkVO { |
| | | @ApiModelProperty("订单数量") |
| | | int count; |
| | | @ApiModelProperty("充电总收入") |
| | | BigDecimal totalPaymentAmount; |
| | | @ApiModelProperty("充电电费") |
| | | BigDecimal totalElectrovalence; |
| | | @ApiModelProperty("累计服务费") |
| | | BigDecimal totalServiceCharge; |
| | | @ApiModelProperty("充电度数综合") |
| | | BigDecimal totalChargingCapacity; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "上架状态(0=否,1=是)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "小程序id") |
| | | @TableField("applet_id") |
| | | private String appletId; |
| | | @ApiModelProperty(value = "小程序名称") |
| | | @TableField("applet_name") |
| | | private String appletName; |
| | | @ApiModelProperty(value = "活动状态 1未开始 2已开始 3已结束") |
| | | @TableField(exist = false) |
| | | private Integer startState; |
| | |
| | | public interface OtherClient { |
| | | |
| | | //单位分页 |
| | | @PostMapping(value = "/t-invoice-type/t-company/unit/page") |
| | | @PostMapping(value = "/t-company/unit/page") |
| | | R<Page<TCompany>> queryUnitPage(@RequestBody UnitListQueryDto unitListQueryDto); |
| | | //单位添加修改 |
| | | @PostMapping(value = "/t-company/unit/addOrUpdate") |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/wx/query/queryOrderInfo") |
| | | R<NotifyV3PayDecodeRespBody> queryOrderInfo(String orderId); |
| | | R<NotifyV3PayDecodeRespBody> queryOrderInfo(@RequestParam("orderId") String orderId); |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String notifyUrl ="http://192.168.110.80:9000/payment/wx/pay/notify"; |
| | | private String notifyUrl ="http://221.182.45.100:9000/payment/wx/pay/notify"; |
| | | } |
| | |
| | | BigDecimal discountPrice; |
| | | @ApiModelProperty(hidden =true) |
| | | BigDecimal vipDiscount; |
| | | @ApiModelProperty(hidden =true) |
| | | String title; |
| | | @ApiModelProperty(hidden =true) |
| | | String phone; |
| | | |
| | | |
| | | } |
| | |
| | | private Integer pageSize = 10; |
| | | |
| | | public Integer getPageCurr() { |
| | | if(null != pageCurr){ |
| | | pageCurr = (pageCurr - 1) * pageSize; |
| | | } |
| | | // if(null != pageCurr){ |
| | | // pageCurr = (pageCurr - 1) * pageSize; |
| | | // } |
| | | return pageCurr; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/addAppUserIntegralChange") |
| | | public R addAppUserIntegralChange(@RequestBody TAppUserIntegralChange appUserIntegralChange){ |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChangeService.save(appUserIntegralChange); |
| | | return R.ok(); |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | @ApiOperation(value = "标签管理列表", tags = {"用户管理-用户标签管理"}) |
| | | @GetMapping(value = "/tags/select") |
| | | public R<List<TUserTag>> select() { |
| | | TagListQueryDto tagListQueryDto = new TagListQueryDto(); |
| | | tagListQueryDto.setPageCurr(1); |
| | | tagListQueryDto.setPageSize(999); |
| | | R<Page<TUserTag>> pageR = otherClient.queryTagPage(tagListQueryDto); |
| | | return R.ok(pageR.getData().getRecords()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "标签添加或修改", tags = {"用户管理-用户标签管理"}) |
| | |
| | | |
| | | @Override |
| | | public List<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) { |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(2); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | QueryWrapper<TAppCoupon> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("coupon_id",dto.getCouponId()); |
| | | wrapper.in("ways_to_obtain",integers); |
| | | if (dto.getStatus()!=null){ |
| | | wrapper.eq("status",dto.getStatus()); |
| | | } |
| | | List<TAppCoupon> tAppCoupons = this.baseMapper.selectList(wrapper); |
| | | |
| | | List<ExchangeRecordVO> list = new ArrayList<>(); |
| | | // 订单ids |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | |
| | | list.add(exchangeRecordVO); |
| | | } |
| | | for (ExchangeRecordVO exchangeRecordVO : list) { |
| | | TAppUser tAppUser = tAppUserMapper.selectById(exchangeRecordVO.getAppUserId()); |
| | | if (tAppUser!=null)exchangeRecordVO.setPhone(tAppUser.getPhone()); |
| | | switch (exchangeRecordVO.getWaysToObtain()){ |
| | | case 1: |
| | | if (exchangeRecordVO.getId()!=null){ |
| | |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @PutMapping("/downloadSettlement") |
| | | @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | public R downloadSettlement(String uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData(); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | data.setSiteName(data1.get(0).getName()); |
| | |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | |
| | | @PostMapping(value = "/getChargingPileBySiteIds") |
| | | public R<List<TChargingPile>> getChargingPileBySiteIds(@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .in(!siteIds.isEmpty(),TChargingPile::getSiteId,siteIds))); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/pageChargingPileList") |
| | |
| | | return AjaxResult.success(chargeMonitoring); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getChargingGunCountMonitoring/{siteId}") |
| | | @ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"}) |
| | |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.api.vo.*; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto; |
| | | import com.ruoyi.chargingPile.export.TParkingRecordExport; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TCharingUserEquimentVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public void addParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.save(parkingRecord); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/data") |
| | | @ApiOperation(value = "统计", tags = {"管理后台-数据分析-车场运营分析"}) |
| | | public R<TParkLotRecordVO> data(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){ |
| | | //上方折线图 |
| | | TParkLotRecordVO tParkLotRecordVO = new TParkLotRecordVO(); |
| | | |
| | | if (parkingRecordQueryDto.getDayType()==1) { |
| | | List<Map<String, Object>> maps = parkingRecordService.parkingData(parkingRecordQueryDto); |
| | | tParkLotRecordVO.setMaps(maps); |
| | | }else { |
| | | List<Map<String, Object>> maps = parkingRecordService.parkingDataByDate(parkingRecordQueryDto); |
| | | tParkLotRecordVO.setMaps(maps); |
| | | } |
| | | |
| | | //车辆类型饼图 |
| | | List<Map<String, Object>> carColor = parkingRecordService.getCarColor(parkingRecordQueryDto); |
| | | |
| | | //出场类型 |
| | | List<Map<String, Object>> outType = parkingRecordService.getOutType(parkingRecordQueryDto); |
| | | |
| | | //进场充电占比 |
| | | List<Map<String, Object>> isCharge = parkingRecordService.getIsCharge(parkingRecordQueryDto); |
| | | |
| | | |
| | | tParkLotRecordVO.setCarColor(carColor); |
| | | tParkLotRecordVO.setOutType(outType); |
| | | tParkLotRecordVO.setIsCharge(isCharge); |
| | | return R.ok(tParkLotRecordVO); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/work") |
| | | @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"}) |
| | | public R<TParkLotRecordCountVo> work(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){ |
| | | List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId()) |
| | | .between(TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime(), parkingRecordQueryDto.getEndTime()).list(); |
| | | int count1 = list.size(); |
| | | //统计出list中chargingOrderId为null的数据个数 |
| | | int count2 = list.stream().filter(item -> item.getChargingOrderId() == null).collect(Collectors.toList()).size(); |
| | | int count3 = count1-count2; |
| | | //计算出list中parkingDuration的总和 |
| | | int count4 = 0; |
| | | for (TParkingRecord tParkingRecord : list) { |
| | | count4 = count4+tParkingRecord.getParkingDuration(); |
| | | } |
| | | //计算出list中orderAmount的总和 |
| | | BigDecimal count5 = list.stream().map(TParkingRecord::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | TParkLotRecordCountVo tParkLotRecordCountVo = new TParkLotRecordCountVo(); |
| | | tParkLotRecordCountVo.setCount1(count1); |
| | | tParkLotRecordCountVo.setCount2(count2); |
| | | tParkLotRecordCountVo.setCount3(count3); |
| | | tParkLotRecordCountVo.setCount4(count4); |
| | | tParkLotRecordCountVo.setCount5(count5); |
| | | |
| | | return R.ok(tParkLotRecordCountVo); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/income") |
| | | @ApiOperation(value = "停车收入统计", tags = {"管理后台-工作台"}) |
| | | public R income(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){ |
| | | |
| | | List<Map<String,Object>> maps = parkingRecordService.income(parkingRecordQueryDto); |
| | | return R.ok(maps); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class ParkingRecordQueryDto { |
| | | @ApiModelProperty("停车场Id") |
| | | private Integer parkingLotId; |
| | | @ApiModelProperty("1今日2本周3本月4今年5自定义") |
| | | private Integer dayType; |
| | | @ApiModelProperty("开始时间") |
| | | private LocalDate startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private LocalDate endTime; |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | TParkingRecordPageInfoVO getParkingRecordCount(@Param("query")ParkingRecordQuery query); |
| | | |
| | | List<Map<String, Object>> parkingData(@Param("parkingRecordQueryDto") ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> parkingDataByDate(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getCarColor(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getOutType(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getIsCharge(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> income(@Param("parkingRecordQueryDto")ParkingRecordQueryDto parkingRecordQueryDto); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | TParkingRecordPageInfoVO pageList(ParkingRecordQuery query); |
| | | |
| | | List<Map<String, Object>> parkingData(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> parkingDataByDate(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getCarColor(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getOutType(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> getIsCharge(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | |
| | | List<Map<String, Object>> income(ParkingRecordQueryDto parkingRecordQueryDto); |
| | | } |
| | |
| | | return chargeMonitoring; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取充电枪各种状态汇总 |
| | | * @param siteId 站点id |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingLotMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingRecordMapper; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | infoVO.setParkingRecordVOS(pageInfo); |
| | | return infoVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> parkingData(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.parkingData(parkingRecordQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> parkingDataByDate(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.parkingDataByDate(parkingRecordQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getCarColor(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.getCarColor(parkingRecordQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getOutType(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.getOutType(parkingRecordQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getIsCharge(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.getIsCharge(parkingRecordQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> income(ParkingRecordQueryDto parkingRecordQueryDto) { |
| | | return this.baseMapper.income(parkingRecordQueryDto); |
| | | } |
| | | } |
| | |
| | | group by create_time |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | <select id="parkingData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS TIME, |
| | | count( 1 ) AS orders, |
| | | SUM( timeout_amount ) AS timeoutAmount |
| | | FROM |
| | | t_parking_record |
| | | where DATE(create_time ) = CURDATE() |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | GROUP BY |
| | | TIME |
| | | ORDER BY |
| | | TIME |
| | | </select> |
| | | <select id="parkingDataByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) AS TIME, |
| | | count( 1 ) AS orders, |
| | | SUM( timeout_amount ) AS timeoutAmount |
| | | FROM |
| | | t_parking_record |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND co.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND co.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | TIME |
| | | ORDER BY |
| | | TIME |
| | | |
| | | |
| | | </select> |
| | | <select id="getCarColor" resultType="java.util.Map"> |
| | | SELECT |
| | | vehicle_color,count(1) as counts |
| | | FROM |
| | | t_parking_record |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND co.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND co.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY vehicle_color |
| | | |
| | | </select> |
| | | <select id="getOutType" resultType="java.util.Map"> |
| | | SELECT |
| | | out_parking_type,count(1) as counts |
| | | FROM |
| | | t_parking_record |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND co.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND co.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY out_parking_type |
| | | </select> |
| | | <select id="getIsCharge" resultType="java.util.Map"> |
| | | SELECT |
| | | CASE |
| | | WHEN charging_order_id IS NOT NULL THEN 'WithChargingOrder' |
| | | ELSE 'WithoutChargingOrder' |
| | | END AS order_status, |
| | | COUNT(*) AS counts |
| | | FROM |
| | | `t_parking_record` |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND co.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND co.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | order_status |
| | | </select> |
| | | <select id="income" resultType="java.util.Map"> |
| | | SELECT sum(pr.order_amount) as amount,pl.name |
| | | from t_parking_record pr |
| | | LEFT JOIN t_parking_lot pl on pr.parking_lot_id = pl.id |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND pr.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | |
| | | AND DATE( pr.create_time ) between #{parkingRecordQueryDto.startTime} and #{parkingRecordQueryDto.endTime} |
| | | |
| | | </where> |
| | | GROUP BY pl.name |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlate()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlateColor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlatenumber()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | String code = "TC" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlatecolor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | |
| | | } |
| | | @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"}) |
| | | @PutMapping("/export") |
| | | public void export(@RequestBody ChargingListQuery dto) |
| | | { |
| | | public void export(@RequestBody ChargingListQuery dto) { |
| | | ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); |
| | | List<TChargingOrderExport> tChargingOrderExports = new ArrayList<>(); |
| | | List<ChargingOrderListVO> exportList = res.getExportList(); |
| | |
| | | import com.google.common.collect.Lists; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/work/shop") |
| | | @ApiOperation(value = "购物收入", tags = {"后台-工作台"}) |
| | | public R workShop(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | //count近6个月的数据 |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | List<Map<String,Object >> shopData = shoppingOrderService.getData(statisticsQueryDto); |
| | | return R.ok(shopData); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/vip") |
| | | @ApiOperation(value = "vip收入", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixVipDto>> vip() { |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/watch/chargingOrder") |
| | | @ApiOperation(value = "监控订单", tags = {"管理后台-订单管理"}) |
| | | public AjaxResult<TCharingOrderVO> watchChargingOrder(@RequestBody ChargingOrderQuery dto) { |
| | | public R<List<ChargingOrderAndUploadRealTimeMonitoringDataDto>> watchChargingOrder(@RequestBody ChargingOrderQuery dto) { |
| | | Integer page = dto.getPageCurr(); |
| | | Integer pageSize = dto.getPageSize(); |
| | | List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | |
| | | } |
| | | |
| | | |
| | | return AjaxResult.success(res); |
| | | return R.ok(dtos); |
| | | } |
| | | |
| | | |
| | |
| | | tCharingUserEvaluateVO.setBlackCount(count); |
| | | |
| | | |
| | | //好评标签 |
| | | List<Map<String,Object>> goodTop = orderEvaluateService.goodTop(siteIds); |
| | | //差评标签 |
| | | List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds); |
| | | |
| | | //标签 |
| | | //查出好评ids |
| | | // orderEvaluateService.goodTop(); |
| | | |
| | | |
| | | |
| | | |
| | | //流量分析 |
| | | List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds); |
| | | tCharingUserEvaluateVO.setGoodTop(goodTop); |
| | | tCharingUserEvaluateVO.setBadTop(badTop); |
| | | tCharingUserEvaluateVO.setFlow(sourceMap); |
| | | //流量 |
| | | return R.ok(tCharingUserEvaluateVO); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/equipment") |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"}) |
| | | public R<TCharingUserEquimentVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | //直流可用率 |
| | | List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto); |
| | | //交流可用率 |
| | | List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto); |
| | | //直流故障率 |
| | | List<Map<String,Object>> equipmentMapbroke1 = chargingOrderService.equipmentMapbroke1(siteIds,statisticsQueryDto); |
| | | //交流故障率 |
| | | List<Map<String,Object>> equipmentMapbroke2 = chargingOrderService.equipmentMapbroke2(siteIds,statisticsQueryDto); |
| | | //直流离网率 |
| | | List<Map<String,Object>> equipmentMapOut1 = chargingOrderService.equipmentMapOut1(siteIds,statisticsQueryDto); |
| | | //交流离网率 |
| | | List<Map<String,Object>> equipmentMapOut2 = chargingOrderService.equipmentMapOut2(siteIds,statisticsQueryDto); |
| | | |
| | | |
| | | //需求电流满足率 |
| | | List<Map<String,Object>> needElec = chargingOrderService.needElec(siteIds,statisticsQueryDto); |
| | | |
| | | TCharingUserEquimentVO tCharingUserEquimentVO = new TCharingUserEquimentVO(); |
| | | tCharingUserEquimentVO.setEquipmentMap1(equipmentMap1); |
| | | tCharingUserEquimentVO.setEquipmentMap2(equipmentMap2); |
| | | tCharingUserEquimentVO.setEquipmentMapbroke1(equipmentMapbroke1); |
| | | tCharingUserEquimentVO.setEquipmentMapbroke2(equipmentMapbroke2); |
| | | tCharingUserEquimentVO.setEquipmentMapOut1(equipmentMapOut1); |
| | | tCharingUserEquimentVO.setEquipmentMapOut2(equipmentMapOut2); |
| | | tCharingUserEquimentVO.setNeedElec(needElec); |
| | | return R.ok(tCharingUserEquimentVO); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/charge") |
| | | @ApiOperation(value = "上方充电数据统计", tags = {"管理后台-工作台"}) |
| | | public R<TCharingWorkVO> workCharge(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); |
| | | //当日的订单总数 |
| | | int size = list.size(); |
| | | //计算list中paymentAmount的总和 |
| | | BigDecimal totalPaymentAmount = list.stream().map(TChargingOrder::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //计算list中electrovalence的总和 |
| | | BigDecimal totalElectrovalence = list.stream().map(TChargingOrder::getElectrovalence).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //计算list中serviceCharge的总和 |
| | | BigDecimal totalServiceCharge = list.stream().map(TChargingOrder::getServiceCharge).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //计算list中charging_capacity的总和 |
| | | BigDecimal totalChargingCapacity = list.stream().map(TChargingOrder::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | TCharingWorkVO tCharingWorkVO = new TCharingWorkVO(); |
| | | tCharingWorkVO.setCount(size); |
| | | tCharingWorkVO.setTotalPaymentAmount(totalPaymentAmount); |
| | | tCharingWorkVO.setTotalElectrovalence(totalElectrovalence); |
| | | tCharingWorkVO.setTotalServiceCharge(totalServiceCharge); |
| | | tCharingWorkVO.setTotalChargingCapacity(totalChargingCapacity); |
| | | return R.ok(tCharingWorkVO); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/chargeDetail") |
| | | @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"}) |
| | | public R workCharge(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (statisticsQueryDto.getDayType()==1) { |
| | | List<Map<String,Object>> charMap = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getDateType(siteIds,statisticsQueryDto); |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | return R.ok(); |
| | | |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/use") |
| | | @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"}) |
| | | public R workUse(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | List<Map<String,Object>> capMap = chargingOrderService.getchargingCapacity(siteIds,statisticsQueryDto); |
| | | List<TChargingPile> chargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | //获取chargingPiles的ratedPower的总和再乘以chargingPiles的数量再乘以24 |
| | | BigDecimal totalRatedPower = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(chargingPiles.size())).multiply(new BigDecimal(24)); |
| | | |
| | | //将capMap的chargingCapacity除以totalRatedPower保留两位数 |
| | | capMap.forEach(map -> { |
| | | BigDecimal chargingCapacity = (BigDecimal) map.get("chargingCapacity"); |
| | | BigDecimal result = chargingCapacity.divide(totalRatedPower, 2, RoundingMode.HALF_UP); |
| | | map.put("chargingCapacity", result); |
| | | }); |
| | | return R.ok(capMap); |
| | | |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/shopOrder") |
| | | @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"}) |
| | | public R shopOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | Long count = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 1).count(); |
| | | Long count1 = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 2).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | | counts.add(count); |
| | | counts.add(count1); |
| | | return R.ok(counts); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/invoice") |
| | | @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"}) |
| | | public R invoice(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | Long count = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 1).count(); |
| | | Long count1 = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 3).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | | counts.add(count); |
| | | counts.add(count1); |
| | | return R.ok(counts); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/users/count") |
| | | @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"}) |
| | | public R usersCount(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | List<Map<String,Object>> userMap = chargingOrderService.countAllUserData(); |
| | | return R.ok(userMap); |
| | | |
| | | } |
| | | public static void main(String[] args) { |
| | | // 示例数据 |
| | | List<TChargingOrder> list = getSampleData(); |
| | |
| | | /** |
| | | * 发票管理导出 |
| | | */ |
| | | @ApiOperation(value = "发票管理导出") |
| | | @ApiOperation(value = "发票管理导出", tags = {"管理后台-发票管理"}) |
| | | @Log(title = "发票管理导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @PutMapping("/export") |
| | | public void export(@RequestBody TOrderInvoiceQuery query) |
| | | { |
| | | List<TOrderInvoiceVO> list = orderInvoiceService.export(query); |
| | |
| | | for (TOrderInvoiceVO orderInvoiceVO : list) { |
| | | OrderInvoiceExport orderInvoiceExport = new OrderInvoiceExport(); |
| | | BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); |
| | | if (orderInvoiceVO.getBillingTime()!=null){ |
| | | orderInvoiceExport.setBillingTime(DateUtils.localDateTimeToString(orderInvoiceVO.getBillingTime())); |
| | | } |
| | | orderInvoiceExports.add(orderInvoiceExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), OrderInvoiceExport.class, orderInvoiceExports); |
| | |
| | | @PostMapping("/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | | shoppingOrder.setTitle(exchangeDto.getTitle()); |
| | | shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); |
| | | shoppingOrder.setAppUserId(exchangeDto.getUserId()); |
| | | shoppingOrder.setOrderType(exchangeDto.getGoodType()); |
| | |
| | | shoppingOrder.setPaymentType(exchangeDto.getPayMethod()); |
| | | shoppingOrder.setRemark(exchangeDto.getRemark()); |
| | | shoppingOrder.setStatus(1); |
| | | shoppingOrder.setPhone(exchangeDto.getPhone()); |
| | | shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | shoppingOrder.setDelFlag(false); |
| | | shoppingOrderService.save(shoppingOrder); |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class ChargingDetailQueryDto { |
| | | @ApiModelProperty("电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("1时2日3月") |
| | | private Integer dayType; |
| | | @ApiModelProperty("1开始或2结束") |
| | | private Integer type; |
| | | @ApiModelProperty("时用Date") |
| | | private LocalDate hourDate; |
| | | @ApiModelProperty("开始时间") |
| | | private LocalDate startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private LocalDate endTime; |
| | | |
| | | } |
| | |
| | | private LocalDate startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private LocalDate endTime; |
| | | @ApiModelProperty("工作台用查询参数") |
| | | private LocalDate selectDate; |
| | | } |
| | |
| | | Long getAver(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> countBySource(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> equipmentUserType1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentUserType2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapbroke1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapbroke2(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapOut1(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapOut2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> needElec(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getHourType(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getDateType(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getMonthType(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getchargingCapacity(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> countAllUserData(); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<TOrderEvaluateVO> getOrderEvaluateBySiteId(@Param("siteId")Integer siteId); |
| | | |
| | | List<Map<String, Object>> goodTop(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> badTop(List<Integer> siteIds); |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.dto.ChargingStatisticsQueryDto; |
| | | import com.ruoyi.order.dto.SixShopDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | List<SixShopDto> sixBefore(@Param("sixBefore")LocalDate sixBefore,@Param("status") Integer status); |
| | | |
| | | BigDecimal getSumAmount(@Param("sixBefore")LocalDate sixBefore); |
| | | |
| | | List<Map<String, Object>> getData(@Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | } |
| | |
| | | PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto); |
| | | |
| | | SettlementTotalVO settlementTotal(String time); |
| | | |
| | | List<Map<String, Object>> countBySource(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> needElec(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getHourType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getDateType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getMonthType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> getchargingCapacity(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> countAllUserData(); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType); |
| | | |
| | | List<Map<String, Object>> goodTop(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> badTop(List<Integer> siteIds); |
| | | } |
| | |
| | | List<SixShopDto> sixBefore(LocalDate sixBefore, Integer status); |
| | | |
| | | BigDecimal getSumAmount(LocalDate sixBefore); |
| | | |
| | | List<Map<String, Object>> getData(ChargingStatisticsQueryDto statisticsQueryDto); |
| | | } |
| | |
| | | //构建新的待支付订单 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | String code = "CD" + Math.random() * 1000 + sdf.format(new Date()); |
| | | String code = "CD" + Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); |
| | | chargingOrder.setCode(code); |
| | | chargingOrder.setOrderType(1); |
| | | chargingOrder.setOrderClassification(1); |
| | |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(chargingOrder.getId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + Double.valueOf(Math.random() * 1000).intValue()); |
| | | chargingOrderRefund.setRefundAmount(rechargeAmount); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(rechargePaymentType); |
| | |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(chargingOrder.getId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); |
| | | chargingOrderRefund.setRefundAmount(refundAmount); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(rechargePaymentType); |
| | |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Math.random() * 1000 + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | |
| | | tSettlementConfirm.setVenue(dto.getVenue()); |
| | | tSettlementConfirm.setMetering(dto.getMetering()); |
| | | tSettlementConfirm.setClean(dto.getClean()); |
| | | tSettlementConfirm.setLossElectronic(dto.getLossElectronic()); |
| | | tSettlementConfirm.setLossElectronic(dto.getMeteringElectronic().subtract(dto.getChargingElectronic())); |
| | | tSettlementConfirm.setMaintain(dto.getMaintain()); |
| | | |
| | | tSettlementConfirm.setMeteringElectronic(dto.getMeteringElectronic()); |
| | |
| | | List<TSettlementConfirm> list = tSettlementConfirmMapper.settlementList(pageInfo,dto); |
| | | for (TSettlementConfirm tSettlementConfirm : list) { |
| | | tSettlementConfirm.setUid(tSettlementConfirm.getId().toString()); |
| | | Partner data = siteClient.getPartnerR(tSettlementConfirm.getPartnerId()).getData(); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | tSettlementConfirm.setSiteName(data1.get(0).getName()); |
| | | } |
| | | Partner data = siteClient.getPartnerR(data1.get(0).getPartnerId()).getData(); |
| | | if (data!=null){ |
| | | tSettlementConfirm.setPartnerName(data.getName()); |
| | | } |
| | | } |
| | | |
| | | String format = tSettlementConfirm.getStartTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | | String format1 = tSettlementConfirm.getEndTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | | tSettlementConfirm.setTime(format+"至"+format1); |
| | |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> countBySource(List<Integer> siteIds) { |
| | | return this.baseMapper.countBySource(siteIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentUserType1(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentUserType2(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentMapbroke1(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentMapbroke2(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentMapOut1(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.equipmentMapOut2(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> needElec(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.needElec(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getHourType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.getHourType(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getDateType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.getDateType(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getMonthType(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.getMonthType(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getchargingCapacity(List<Integer> siteIds, ChargingDetailQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.getchargingCapacity(siteIds,statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> countAllUserData() { |
| | | return this.baseMapper.countAllUserData(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | | // String format1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | |
| | | wrapper.eq(TExchangeOrder::getStatus, query.getStatus()); |
| | | } |
| | | long count = this.count(wrapper); |
| | | List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + query.getPageCurr() + "," + query.getPageSize())); |
| | | Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); |
| | | List<TExchangeOrder> list = this.list(wrapper.orderByDesc(TExchangeOrder::getCreateTime).last(" limit " + pageCurr + "," + query.getPageSize())); |
| | | List<MyExchangeOrderList> pageList = new ArrayList<>(); |
| | | for (TExchangeOrder tExchangeOrder : list) { |
| | | MyExchangeOrderList exchangeOrderList = new MyExchangeOrderList(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> goodTop(List<Integer> siteIds) { |
| | | return this.baseMapper.goodTop(siteIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> badTop(List<Integer> siteIds) { |
| | | return this.baseMapper.badTop(siteIds); |
| | | } |
| | | } |
| | |
| | | return AjaxResult.error("不能重复申请开票,请刷新数据后重试"); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = Math.random() * 1000 + sdf.format(new Date()); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); |
| | | addOrderInvoice.setAppUserId(userId); |
| | | addOrderInvoice.setCode(code); |
| | | addOrderInvoice.setStatus(1); |
| | |
| | | @Override |
| | | public List<OrderInvoiceList> getMyOrderInvoiceList(GetOrderInvoiceList query) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); |
| | | List<TOrderInvoice> list = this.list(new LambdaQueryWrapper<TOrderInvoice>().eq(TOrderInvoice::getAppUserId, userId) |
| | | .eq(TOrderInvoice::getStatus, query.getStatus()).orderByDesc(TOrderInvoice::getCreateTime) |
| | | .last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); |
| | | .last(" limit " + pageCurr + ", " + query.getPageSize())); |
| | | List<OrderInvoiceList> pageList = new ArrayList<>(); |
| | | for (TOrderInvoice tOrderInvoice : list) { |
| | | OrderInvoiceList orderInvoiceList = new OrderInvoiceList(); |
| | |
| | | |
| | | @Override |
| | | public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) { |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ |
| | | tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(tAppUsers)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TOrderInvoiceVO tOrderInvoiceVO : list) { |
| | |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | |
| | | List<TAppUser> finalTAppUsers = tAppUsers; |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | if (e.getBillingUserId()!=null){ |
| | | e.setUserPhone(finalTAppUsers.stream().filter(t->t.getId()!=null).filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | } |
| | | }); |
| | | |
| | | pageInfo.setRecords(list); |
| | |
| | | @Override |
| | | public Map<String, Integer> statusCount(TOrderInvoiceQuery query) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | |
| | | if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ |
| | | tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(tAppUsers)){ |
| | | map.put("notAccepted",0); |
| | | map.put("processing",0); |
| | | map.put("finished",0); |
| | | return map; |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | map = this.baseMapper.statusCount(query); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) { |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | // 查询申请用户 |
| | | List<TAppUser> userList = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return new ArrayList<>(); |
| | | if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ |
| | | tAppUsers = appUserClient.selectByPhoneLike(query.getUserPhone()).getData(); |
| | | if(CollectionUtils.isEmpty(tAppUsers)){ |
| | | return new ArrayList<TOrderInvoiceVO>(); |
| | | } |
| | | query.setUserIds(userList.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | query.setUserIds(tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.export(query); |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | List<TAppUser> finalTAppUsers = tAppUsers; |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setUserPhone(userList.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | if (e.getBillingUserId()!=null){ |
| | | e.setUserPhone(finalTAppUsers.stream().filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | |
| | | wrapper.eq(TShoppingOrder::getStatus, query.getStatus()); |
| | | } |
| | | long count = this.count(wrapper); |
| | | List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + query.getPageCurr() + ", " + query.getPageSize())); |
| | | Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); |
| | | List<TShoppingOrder> list = this.list(wrapper.orderByDesc(TShoppingOrder::getCreateTime).last(" limit " + pageCurr + ", " + query.getPageSize())); |
| | | List<MyShoppingOrderList> pageList = new ArrayList<>(); |
| | | for (TShoppingOrder tShoppingOrder : list) { |
| | | MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); |
| | |
| | | shoppingOrderRefund.setPayType(shoppingOrder.getPaymentType()); |
| | | shoppingOrderRefund.setShoppingOrderId(shoppingOrder.getId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | shoppingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + Double.valueOf((Math.random() * 1000)).intValue()); |
| | | shoppingOrderRefund.setRefundAmount(refundAmount); |
| | | shoppingOrderRefund.setRefundStatus(1); |
| | | shoppingOrderRefund.setCode(shoppingOrder.getCode()); |
| | |
| | | @Override |
| | | public List<MyShoppingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), query.getPageCurr(), query.getPageSize()); |
| | | Integer pageCurr = (query.getPageCurr() - 1) * query.getPageSize(); |
| | | List<TShoppingOrder> list = this.baseMapper.getNoInvoicedOrder(userId, query.getMonth(), pageCurr, query.getPageSize()); |
| | | List<MyShoppingOrderList> pageList = new ArrayList<>(); |
| | | for (TShoppingOrder tShoppingOrder : list) { |
| | | MyShoppingOrderList myShoppingOrderList = new MyShoppingOrderList(); |
| | |
| | | return this.baseMapper.getSumAmount(sixBefore); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getData(ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.getData(statisticsQueryDto); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | and t1.id = #{req.uid} |
| | | </if> |
| | | and t1.billType = 1 |
| | | and t1.del_flag = 0 |
| | | </select> |
| | | <select id="chargingBillList1" resultType="com.ruoyi.order.api.vo.ChargingBillListVO"> |
| | | select t1.* from t_charging_bill t1 |
| | |
| | | and t1.id = #{req.uid} |
| | | </if> |
| | | and t1.billType = 2 |
| | | and t1.del_flag = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_charging_order UNION ALL |
| | | charging_pile_order.t_charging_order |
| | | where recharge_payment_status = 2 |
| | | UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | FROM |
| | | charging_pile_order.t_shopping_order UNION ALL |
| | | charging_pile_order.t_shopping_order |
| | | where payment_status = 2 |
| | | UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | |
| | | FROM |
| | | charging_pile_order.t_vip_order UNION ALL |
| | | charging_pile_order.t_vip_order |
| | | where payment_status = 2 |
| | | UNION ALL |
| | | SELECT |
| | | id, |
| | | `code`, |
| | |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | </if> |
| | | </select> |
| | | <select id="countBySource" resultType="java.util.Map"> |
| | | select |
| | | count(1) as counts, |
| | | source_name as source |
| | | from t_charging_order |
| | | where 1=1 |
| | | del_flag = 0 |
| | | AND recharge_payment_status = 2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | group by source_name |
| | | |
| | | |
| | | </select> |
| | | <select id="equipmentUserType1" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | |
| | | |
| | | |
| | | |
| | | </select> |
| | | <select id="equipmentUserType2" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | |
| | | |
| | | </select> |
| | | <select id="equipmentMapbroke1" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | |
| | | |
| | | </select> |
| | | <select id="equipmentMapbroke2" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | |
| | | |
| | | </select> |
| | | <select id="equipmentMapOut1" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | </select> |
| | | <select id="equipmentMapOut2" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1 |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | |
| | | </select> |
| | | <select id="needElec" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, |
| | | co.charging_gun_id, |
| | | tc.name, |
| | | cp.name AS gun_name |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id |
| | | <where> |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( co.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( co.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | AND MONTH( co.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | AND co.create_time >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | AND co.create_time <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | tc.name, |
| | | cp.name, |
| | | co.charging_gun_id; |
| | | |
| | | |
| | | </select> |
| | | <select id="getHourType" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | , '%Y-%m-%d %H' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | | |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 and DATE( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | ) = #{statisticsQueryDto.hourDate} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | <select id="getDateType" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | , '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | | |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 and DATE( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | <select id="getMonthType" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | , '%Y-%m' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | | |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 and DATE( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | |
| | | </select> |
| | | <select id="getchargingCapacity" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, |
| | | SUM(charging_capacity) as chargingCapacity |
| | | FROM |
| | | t_charging_order |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | <select id="countAllUserData" resultType="java.util.Map"> |
| | | SELECT |
| | | COUNT( DISTINCT app_user_id ) AS counts, |
| | | '1' AS type |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` UNION ALL |
| | | SELECT |
| | | COUNT(*) AS counts, |
| | | '2' AS type |
| | | FROM |
| | | `charging_pile_account`.`t_app_user` |
| | | WHERE |
| | | `vip_end_time` > NOW() |
| | | |
| | | UNION ALL |
| | | SELECT |
| | | COUNT(*) AS counts, |
| | | '3' AS type |
| | | FROM |
| | | `charging_pile_account`.`t_app_user` |
| | | WHERE |
| | | del_flag = 0 |
| | | |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | <select id="goodTop" resultType="java.util.Map"> |
| | | SELECT count(1) as counts ,ot.evaluation_tag_id |
| | | from t_order_evaluate_tag ot |
| | | left join t_order_evaluate te on ot.order_evaluate_id = te.id |
| | | left join t_charging_order co on te.order_id = co.id |
| | | WHERE ot.evaluation_tag_id in ( |
| | | SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 1 |
| | | ) <if test="null != siteIds"> |
| | | and co.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY ot.evaluation_tag_id |
| | | ORDER BY counts desc |
| | | limit 5 |
| | | |
| | | |
| | | |
| | | </select> |
| | | <select id="badTop" resultType="java.util.Map"> |
| | | SELECT count(1) as counts ,ot.evaluation_tag_id |
| | | from t_order_evaluate_tag ot |
| | | left join t_order_evaluate te on ot.order_evaluate_id = te.id |
| | | left join t_charging_order co on te.order_id = co.id |
| | | WHERE ot.evaluation_tag_id in ( |
| | | SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 3 |
| | | ) <if test="null != siteIds"> |
| | | and co.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY ot.evaluation_tag_id |
| | | ORDER BY counts desc |
| | | limit 5 |
| | | </select> |
| | | </mapper> |
| | |
| | | and (t1.end_time between #{req.startTime} and #{req.endTime} |
| | | </if> |
| | | </if> |
| | | and t1.del_flag = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | and DATE_FORMAT(create_time, '%Y-%m-%d') >= DATE_FORMAT(#{sixBefore}, '%Y-%m-%d') |
| | | </if> |
| | | </select> |
| | | <select id="getData" resultType="java.util.Map"> |
| | | |
| | | SELECT |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ) AS MONTH, |
| | | count(1) AS orderNum, |
| | | SUM(payment_amount) AS paymentAmount |
| | | FROM |
| | | ( |
| | | SELECT |
| | | create_time, |
| | | payment_amount |
| | | FROM |
| | | t_shopping_order |
| | | <where> |
| | | WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4 |
| | | |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | |
| | | |
| | | </where> |
| | | |
| | | ) AS subquery |
| | | GROUP BY |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ); |
| | | |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | @PostMapping("/exchangeRecord") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录") |
| | | public AjaxResult<List<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | | public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | | List<ExchangeRecordVO> data = appCouponClient.getExchangeRecordByCouponId(dto).getData(); |
| | | for (ExchangeRecordVO record : data) { |
| | | TCoupon byId = tCouponService.getById(record.getCouponId()); |
| | |
| | | record.setDetailsPicture(byId.getDetailsPicture()); |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | | PageInfo<ExchangeRecordVO> exchangeRecordVOPageInfo = new PageInfo<>(1, 99999999); |
| | | exchangeRecordVOPageInfo.setRecords(data); |
| | | return AjaxResult.ok(exchangeRecordVOPageInfo); |
| | | } |
| | | |
| | | |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @ApiOperation(tags = {"小程序-" + |
| | | "兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | //检查当前用户积分是否够 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer point = 0; |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | if (exchangeDto.getGoodType()==1) { |
| | | //查询当前商品信息 |
| | |
| | | if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { |
| | | return AjaxResult.error("当前用户已兑换"+count+"张"); |
| | | } |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | } |
| | | if (user.getPoints()<point){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | exchangeDto.setUserId(userId); |
| | | //生成积分兑换成功的订单 |
| | | R<Long> longR = orderClient.exchangeCreate(exchangeDto); |
| | | if (exchangeDto.getGoodType()==2) { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | |
| | | //如果是优惠卷,赠送优惠卷给用户 |
| | | GrantCouponDto grantCouponDto = new GrantCouponDto(); |
| | | grantCouponDto.setUserIds(userId.toString()); |
| | |
| | | grantCouponDto.setWaysToObtain(1); |
| | | grantCouponDto.setEndTime(LocalDateTime.now()); |
| | | grantCouponDto.setType(3); |
| | | switch (coupon.getValidityPeriodMode()){ |
| | | case 1: |
| | | grantCouponDto.setEndTime(coupon.getEndTime()); |
| | | break; |
| | | case 2: |
| | | grantCouponDto.setEndTime(LocalDateTime.now().plusDays(coupon.getDays())); |
| | | break; |
| | | } |
| | | appCouponClient.grantCoupon(grantCouponDto); |
| | | } |
| | | //生成消耗积分的记录 |
| | |
| | | if (exchangeDto.getGoodType()==1){ |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | BigDecimal originalPrice = good.getPreferentialPrice(); |
| | | exchangeDto.setTitle("【商品购买】"+good.getName()); |
| | | if (isVip){ |
| | | if (good.getVipPrice()!=null){ |
| | | vipDiscount = originalPrice.subtract(good.getVipPrice()).multiply(BigDecimal.valueOf(exchangeDto.getNum())); |
| | |
| | | } |
| | | orderPrice = orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum()))); |
| | | }else { |
| | | |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | exchangeDto.setTitle("【优惠卷购买】"+coupon.getName()); |
| | | BigDecimal originalPrice = coupon.getPaymentAmount(); |
| | | if (isVip){ |
| | | if (coupon.getVipPaymentAmount()!=null) { |
| | |
| | | } |
| | | payPrice = orderPrice.subtract(coupon.getDiscountAmount()); |
| | | discountPrice = coupon.getDiscountAmount(); |
| | | }else { |
| | | payPrice = orderPrice; |
| | | } |
| | | exchangeDto.setPayPrice(orderPrice); |
| | | exchangeDto.setPayPrice(payPrice); |
| | | exchangeDto.setDiscountPrice(discountPrice); |
| | | exchangeDto.setVipDiscount(vipDiscount); |
| | | exchangeDto.setUserId(userId); |
| | | exchangeDto.setPhone(user.getPhone()); |
| | | //创建订单 |
| | | TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData(); |
| | | if (exchangeDto.getPayMethod()==1) { |
| | |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.39.186.ALL</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.api.vo.WxRefundNotifyResp; |
| | | import com.ruoyi.payment.wx.enums.RefundEnum; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | |
| | | public class WxPayController { |
| | | @Autowired |
| | | private WxV3Pay wxV3Pay; |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 支付回调 |
| | | */ |
| | | @PostMapping("pay/notify") |
| | | @ApiOperation("订单回调") |
| | | public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { |
| | | try { |
| | | Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String outRefundNo = (String) params.get("transaction_id"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | R r = orderClient.callBack(out_trade_no, outRefundNo); |
| | | System.err.println("----收到购物回调"); |
| | | break; |
| | | case "HY": |