diff --git a/base-commons/common-core/src/main/java/com/evotech/hd/common/core/entity/cloud/vo/BatteryStationVO.java b/base-commons/common-core/src/main/java/com/evotech/hd/common/core/entity/cloud/vo/BatteryStationVO.java new file mode 100644 index 0000000..2c90184 --- /dev/null +++ b/base-commons/common-core/src/main/java/com/evotech/hd/common/core/entity/cloud/vo/BatteryStationVO.java @@ -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; + +} diff --git a/resource-server/src/main/java/com/evotech/hd/resource/service/WechatAgreementService.java b/resource-server/src/main/java/com/evotech/hd/resource/service/WechatAgreementService.java new file mode 100644 index 0000000..58dc59d --- /dev/null +++ b/resource-server/src/main/java/com/evotech/hd/resource/service/WechatAgreementService.java @@ -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 add(WechatAgreement wa); + + + public Result delete(Integer id); + + public Result update(WechatAgreement wa); + + public Result> list(String appid, Integer type, Integer status); + +} diff --git a/resource-server/src/main/java/com/evotech/hd/resource/service/WechatSwiperService.java b/resource-server/src/main/java/com/evotech/hd/resource/service/WechatSwiperService.java new file mode 100644 index 0000000..a5f118a --- /dev/null +++ b/resource-server/src/main/java/com/evotech/hd/resource/service/WechatSwiperService.java @@ -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 add(WechatSwiper ws); + + + public Result delete(Integer id); + + public Result update(WechatSwiper ws); + + public Result> list(String appid, Integer type, Integer status); + +} diff --git a/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatAgreementServiceImpl.java b/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatAgreementServiceImpl.java new file mode 100644 index 0000000..48a8fae --- /dev/null +++ b/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatAgreementServiceImpl.java @@ -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 add(WechatAgreement wa) { + wa.setCtime(new Date()); + int n = wechatAgreementDao.insert(wa); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("添加协议出错!"); + } + + @Override + public Result delete(Integer id) { + int n = wechatAgreementDao.deleteById(id); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("删除协议出错!"); + } + + @Override + public Result update(WechatAgreement wa) { + int n = wechatAgreementDao.updateById(wa); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("更新类型失败!"); + } + + @Override + public Result> list(String appid, Integer type, Integer status) { + List list = wechatAgreementDao.selectList(new QueryWrapper() + .eq(type != null, "type", type) + .eq(status != null, "status", status) + .eq(StringUtils.hasText(appid), "appid", appid)); + if (list.isEmpty()) { + return new Result>().error(CodeMsg.DATABASE_RESULT_NULL); + } + return new Result>().success(list); + } + +} diff --git a/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatSwiperServiceImpl.java b/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatSwiperServiceImpl.java new file mode 100644 index 0000000..94e74e9 --- /dev/null +++ b/resource-server/src/main/java/com/evotech/hd/resource/service/impl/WechatSwiperServiceImpl.java @@ -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 add(WechatSwiper ws) { + ws.setCtime(new Date()); + int n = wechatSwiperDao.insert(ws); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("添加轮播图出错!"); + } + + @Override + public Result delete(Integer id) { + int n = wechatSwiperDao.deleteById(id); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("删除轮播图出错!"); + } + + @Override + public Result update(WechatSwiper ws) { + int n = wechatSwiperDao.updateById(ws); + if (n == 1) { + return new Result().success(n); + } + return new Result().error("更新类型失败!"); + } + + @Override + public Result> list(String appid, Integer type, Integer status) { + List list = wechatSwiperDao.selectList(new QueryWrapper() + .eq(type != null, "type", type) + .eq(status != null, "status", status) + .eq(StringUtils.hasText(appid), "appid", appid)); + if (list.isEmpty()) { + return new Result>().error(CodeMsg.DATABASE_RESULT_NULL); + } + return new Result>().success(list); + } + +} diff --git a/wechat-server/src/main/java/com/evotech/hd/wechat/controller/ResourceServerController.java b/wechat-server/src/main/java/com/evotech/hd/wechat/controller/ResourceServerController.java new file mode 100644 index 0000000..a91c5f6 --- /dev/null +++ b/wechat-server/src/main/java/com/evotech/hd/wechat/controller/ResourceServerController.java @@ -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> 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> listSwiper(@NotBlank @RequestParam String appid, @NotNull @RequestParam Integer type) { + return resourceService.listSwiper(appid, type, 1); + } + +} diff --git a/wechat-server/src/main/java/com/evotech/hd/wechat/service/ResourceService.java b/wechat-server/src/main/java/com/evotech/hd/wechat/service/ResourceService.java new file mode 100644 index 0000000..34448fe --- /dev/null +++ b/wechat-server/src/main/java/com/evotech/hd/wechat/service/ResourceService.java @@ -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> listAgreement(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status); + + @GetMapping(value = "/resource/wechat/swiper/list", + consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE}) + public Result> listSwiper(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status); +}