补充上一个

This commit is contained in:
Administrator 2024-12-24 15:32:28 +08:00
parent 652fd909df
commit 08ef590c4f
7 changed files with 299 additions and 0 deletions

View File

@ -0,0 +1,62 @@
package com.evotech.hd.common.core.entity.cloud.vo;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(name = "小程序查询换电站返回结果")
public class BatteryStationVO implements Serializable {
private static final long serialVersionUID = 4629351941147810984L;
@Schema(description = "站点名称")
private String name;
@Schema(description = "站点编码")
private String code;
@Schema(description = "状态1-正常营业2-正常停运3-故障停运4-指令停运9-其它")
private Integer status;
@Schema(description = "站点类型ID")
private Integer type;
@Schema(description = "地址")
private String address;
@Schema(description = "地址-省")
private String addressProvince;
@Schema(description = "地址-市")
private String addressCity;
@Schema(description = "地址-区县")
private String addressArea;
@Schema(description = "注册日期")
private String registerDate;
@Schema(description = "联系人")
private String contacts;
@Schema(description = "联系电话")
private String phone;
@Schema(description = "服务车辆类型")
private String carTypeCode;
@Schema(description = "是否适合该车辆")
private Boolean isSuitable;
@Schema(description = "激活日期")
private String activeDate;
@Schema(description = "经纬度信息")
private String locationPoint;
@Schema(description = "全天营业1-是0-否")
private Integer openAllDay;
}

View File

@ -0,0 +1,19 @@
package com.evotech.hd.resource.service;
import java.util.List;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
public interface WechatAgreementService {
public Result<Integer> add(WechatAgreement wa);
public Result<Integer> delete(Integer id);
public Result<Integer> update(WechatAgreement wa);
public Result<List<WechatAgreement>> list(String appid, Integer type, Integer status);
}

View File

@ -0,0 +1,19 @@
package com.evotech.hd.resource.service;
import java.util.List;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
public interface WechatSwiperService {
public Result<Integer> add(WechatSwiper ws);
public Result<Integer> delete(Integer id);
public Result<Integer> update(WechatSwiper ws);
public Result<List<WechatSwiper>> list(String appid, Integer type, Integer status);
}

View File

@ -0,0 +1,64 @@
package com.evotech.hd.resource.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
import com.evotech.hd.common.core.enums.CodeMsg;
import com.evotech.hd.resource.dao.WechatAgreementDao;
import com.evotech.hd.resource.service.WechatAgreementService;
import jakarta.annotation.Resource;
@Service
public class WechatAgreementServiceImpl implements WechatAgreementService {
@Resource
private WechatAgreementDao wechatAgreementDao;
@Override
public Result<Integer> add(WechatAgreement wa) {
wa.setCtime(new Date());
int n = wechatAgreementDao.insert(wa);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("添加协议出错!");
}
@Override
public Result<Integer> delete(Integer id) {
int n = wechatAgreementDao.deleteById(id);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("删除协议出错!");
}
@Override
public Result<Integer> update(WechatAgreement wa) {
int n = wechatAgreementDao.updateById(wa);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("更新类型失败!");
}
@Override
public Result<List<WechatAgreement>> list(String appid, Integer type, Integer status) {
List<WechatAgreement> list = wechatAgreementDao.selectList(new QueryWrapper<WechatAgreement>()
.eq(type != null, "type", type)
.eq(status != null, "status", status)
.eq(StringUtils.hasText(appid), "appid", appid));
if (list.isEmpty()) {
return new Result<List<WechatAgreement>>().error(CodeMsg.DATABASE_RESULT_NULL);
}
return new Result<List<WechatAgreement>>().success(list);
}
}

View File

@ -0,0 +1,64 @@
package com.evotech.hd.resource.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
import com.evotech.hd.common.core.enums.CodeMsg;
import com.evotech.hd.resource.dao.WechatSwiperDao;
import com.evotech.hd.resource.service.WechatSwiperService;
import jakarta.annotation.Resource;
@Service
public class WechatSwiperServiceImpl implements WechatSwiperService {
@Resource
private WechatSwiperDao wechatSwiperDao;
@Override
public Result<Integer> add(WechatSwiper ws) {
ws.setCtime(new Date());
int n = wechatSwiperDao.insert(ws);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("添加轮播图出错!");
}
@Override
public Result<Integer> delete(Integer id) {
int n = wechatSwiperDao.deleteById(id);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("删除轮播图出错!");
}
@Override
public Result<Integer> update(WechatSwiper ws) {
int n = wechatSwiperDao.updateById(ws);
if (n == 1) {
return new Result<Integer>().success(n);
}
return new Result<Integer>().error("更新类型失败!");
}
@Override
public Result<List<WechatSwiper>> list(String appid, Integer type, Integer status) {
List<WechatSwiper> list = wechatSwiperDao.selectList(new QueryWrapper<WechatSwiper>()
.eq(type != null, "type", type)
.eq(status != null, "status", status)
.eq(StringUtils.hasText(appid), "appid", appid));
if (list.isEmpty()) {
return new Result<List<WechatSwiper>>().error(CodeMsg.DATABASE_RESULT_NULL);
}
return new Result<List<WechatSwiper>>().success(list);
}
}

View File

@ -0,0 +1,47 @@
package com.evotech.hd.wechat.controller;
import java.util.List;
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 com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
import com.evotech.hd.wechat.service.ResourceService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Tag(name = "资源服务API")
@ApiSupport(order = 14)
@RestController
@RequestMapping("/resource")
public class ResourceServerController {
@Resource
private ResourceService resourceService;
@Operation(summary = "小程序协议查询")
@GetMapping("/agreement/list")
@ApiOperationSupport(order = 1)
public Result<List<WechatAgreement>> listAgreement(@NotBlank @RequestParam String appid, @NotNull @RequestParam Integer type) {
return resourceService.listAgreement(appid, type, 1);
}
@Operation(summary = "小程序轮播图查询")
@GetMapping("/swiper/list")
@ApiOperationSupport(order = 2)
public Result<List<WechatSwiper>> listSwiper(@NotBlank @RequestParam String appid, @NotNull @RequestParam Integer type) {
return resourceService.listSwiper(appid, type, 1);
}
}

View File

@ -0,0 +1,24 @@
package com.evotech.hd.wechat.service;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.evotech.hd.common.core.entity.Result;
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
@FeignClient(value = "resource-server")
public interface ResourceService {
@GetMapping(value = "/resource/wechat/agreement/list",
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
public Result<List<WechatAgreement>> listAgreement(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status);
@GetMapping(value = "/resource/wechat/swiper/list",
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
public Result<List<WechatSwiper>> listSwiper(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status);
}