Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "故障内容") |
| | | @Length(max = 200, message = "故障内容长度不能超过200") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "故障时间") |
| | | @TableField("down_time") |
| | | private LocalDateTime downTime; |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteQuery对象",description = "站点查询条件") |
| | | public class SiteQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "站点名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "排序方式 1=离我最近 2=价格较低 3=空闲较多") |
| | | @NotNull(message = "排序方式不能为空") |
| | | private Integer sortType; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @NotNull(message = "地址经度不能为空") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @NotNull(message = "地址纬度不能为空") |
| | | private String lat; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteVO对象", description = "站点信息") |
| | | public class SiteVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "快充数量") |
| | | private Integer fastCount; |
| | | @ApiModelProperty(value = "超充数量") |
| | | private Integer superCount; |
| | | @ApiModelProperty(value = "慢充数量") |
| | | private Integer slowCount; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | | private BigDecimal vipElectrovalence; |
| | | |
| | | } |
| | |
| | | @ApiModel(value = "TAccountingStrategyDetailVO",description = "计费策略明细") |
| | | public class TAccountingStrategyDetailVO extends TAccountingStrategyDetail { |
| | | |
| | | @ApiModelProperty(value = "原价服务费") |
| | | @ApiModelProperty(value = "总价") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty(value = "会员折扣") |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum SiteStatusEnum { |
| | | |
| | | |
| | | NORMAL_USE(1, "正常使用"), |
| | | IN_MAINTENANCE(2, "维修中"), |
| | | CLOSE_OFFLINE(3, "关闭下线"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | SiteStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SiteStatusEnum fromCode(Integer code) { |
| | | SiteStatusEnum[] resultTypes = SiteStatusEnum.values(); |
| | | for (SiteStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSiteList") |
| | |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getCostServiceCharge().add(detail.getElectrovalence())); |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-accounting-strategy-detail") |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | | |
| | | /** |
| | | * 通过电站id查询计费策略明细列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | // TODO 修改 |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-charging-pile") |
| | | public class TChargingPileController { |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | |
| | | @Autowired |
| | | public TChargingPileController(TChargingPileService chargingPileService) { |
| | | this.chargingPileService = chargingPileService; |
| | | } |
| | | |
| | | /** |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TChargingPile>> list(@RequestParam(name = "siteId",value = "站点id",required = false)Integer siteId) { |
| | | return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @RequestMapping("/t-fault-message") |
| | | public class TFaultMessageController { |
| | | |
| | | private final TFaultMessageService faultMessageService; |
| | | |
| | | @Autowired |
| | | public TFaultMessageController(TFaultMessageService faultMessageService) { |
| | | this.faultMessageService = faultMessageService; |
| | | } |
| | | |
| | | /** |
| | | * 添加故障报修管理 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TFaultMessage dto) { |
| | | return AjaxResult.ok(faultMessageService.save(dto)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<GetSiteListDTO> getSiteList(PageInfo<GetSiteListDTO> pageInfo, @Param("item") GetSiteList siteList); |
| | | |
| | | /** |
| | | * 获取站点分页列表 |
| | | * @return |
| | | */ |
| | | List<SiteVO> pageList(@Param("query")SiteQuery query,@Param("pageInfo")PageInfo<SiteVO> pageInfo); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | * @return |
| | | */ |
| | | AjaxResult delSite(Integer id); |
| | | |
| | | /** |
| | | * 获取站点分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<SiteVO> pageList(SiteQuery query); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | this.updateById(site); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SiteVO> pageList(SiteQuery query) { |
| | | PageInfo<SiteVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="partner_id" property="partnerId" /> |
| | | <result column="`code`" property="code" /> |
| | | <result column="name" property="name" /> |
| | | <result column="`name`" property="name" /> |
| | | <result column="site_type" property="siteType" /> |
| | | <result column="business_category" property="businessCategory" /> |
| | | <result column="status" property="status" /> |
| | |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, partner_id, code, `name`, site_type, business_category, status, construction_site, img_url, province, province_code, city, city_code, districts, districts_code, lon, lat, address, country_code, phone, service_phone, guide, start_service_time, end_service_time, service_description, vehicle_description, parking_space, rate_description, space_charge_explain, accounting_strategy_id, establishment_time, sort, remark, create_time, del_flag, mark |
| | | </sql> |
| | | |
| | | <select id="getSiteList" resultType="com.ruoyi.chargingPile.api.dto.GetSiteListDTO"> |
| | | select |
| | |
| | | </if> |
| | | order by a.sort desc, a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | </select> |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.SiteVO"> |
| | | select |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - ts.lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(ts.lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - ts.lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | from t_site ts |
| | | left join ( |
| | | select site_id, |
| | | SUM(CASE WHEN charge_mode = 1 THEN 1 ELSE 0 END) AS superCount, |
| | | SUM(CASE WHEN charge_mode = 2 THEN 1 ELSE 0 END) AS fastCount, |
| | | SUM(CASE WHEN charge_mode = 3 THEN 1 ELSE 0 END) AS slowCount |
| | | from |
| | | t_charging_gun |
| | | where |
| | | del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | group by |
| | | site_id) tcg on (ts.id = tcg.site_id) |
| | | left join ( |
| | | select |
| | | a.accounting_strategy_id, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*a.discount) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | | t_accounting_strategy b on (a.accounting_strategy_id = b.id) |
| | | where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND DATE_FORMAT(NOW(), '%H:%i:%s') between b.start_time and b.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
| | | <if test="query.sortType != null"> |
| | | <choose> |
| | | <when test="query.sortType == 1"> |
| | | ORDER BY ts.distance ASC |
| | | </when> |
| | | <when test="query.sortType == 2"> |
| | | ORDER BY tasd.electrovalence ASC |
| | | </when> |
| | | <when test="query.sortType == 3"> |
| | | ORDER BY (tcg.fastCount + tcg.slowCount + tcg.superCount) DESC |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | </mapper> |