添加收藏模块
This commit is contained in:
parent
20fa736d26
commit
1c54eaff29
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : 本机MySQL
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 80034 (8.0.34)
|
||||
Source Host : localhost:3306
|
||||
Source Schema : elm
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 80034 (8.0.34)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 22/04/2024 14:40:21
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for collect
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `collect`;
|
||||
CREATE TABLE `collect` (
|
||||
`collectId` int NOT NULL AUTO_INCREMENT,
|
||||
`businessId` int NULL DEFAULT NULL,
|
||||
`userId` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`collectId`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
@ -21,6 +21,7 @@ import SearchResults from "../views/SearchResults";
|
|||
import PointStore from '../views/PointStore.vue';
|
||||
import CouponDetails from '../views/CouponDetails.vue';
|
||||
import CouponSelect from '../views/CouponSelect.vue';
|
||||
import CollectList from '../views/CollectList.vue'
|
||||
|
||||
|
||||
const routes = [{
|
||||
|
|
@ -104,6 +105,11 @@ const routes = [{
|
|||
path: '/CouponSelect',
|
||||
name: 'CouponSelect',
|
||||
component: CouponSelect
|
||||
},
|
||||
{
|
||||
path: '/collectList',
|
||||
name: 'CollectList',
|
||||
component: CollectList
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@
|
|||
<p>¥{{business.starPrice}}起送 ¥{{business.deliveryPrice}}配送</p>
|
||||
<p>{{business.businessExplain}}</p>
|
||||
</div>
|
||||
<!-- 添加收藏按钮 -->
|
||||
<div v-if="this.isCollected" @click="toggleCollect(business)" class="collect-button0">
|
||||
取消收藏
|
||||
</div>
|
||||
<div v-if="!this.isCollected" @click="toggleCollect(business)" class="collect-button1">
|
||||
收藏
|
||||
</div>
|
||||
|
||||
<!-- 食品列表部分 -->
|
||||
<ul class="food">
|
||||
|
|
@ -84,7 +91,8 @@
|
|||
longPress: false,
|
||||
pressTimer: null,
|
||||
interval: 200,
|
||||
clickTimeouts: [] // 用于存储每个按钮的定时器
|
||||
clickTimeouts: [], // 用于存储每个按钮的定时器
|
||||
isCollected: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -104,11 +112,26 @@
|
|||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
this.listCollect()
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
},
|
||||
async listCollect() {
|
||||
let url = `CollectController/listCollect/${this.user.userId}`
|
||||
await this.$axios.get(url).then(response => {
|
||||
this.collectList = response.data.result;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
for(let i of this.collectList){
|
||||
if(`${i.businessId}`===this.businessId){
|
||||
this.isCollected=true
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
listCart() {
|
||||
let url=`CartController/listCart/${this.user.userId}/${this.businessId}`
|
||||
this.$axios.get(url).then(response => {
|
||||
|
|
@ -214,6 +237,17 @@
|
|||
businessId: this.business.businessId
|
||||
}
|
||||
});
|
||||
},
|
||||
toggleCollect(business) {
|
||||
this.isCollected = !this.isCollected; // 切换收藏状态
|
||||
let method = this.isCollected ? 'post' : 'delete';
|
||||
let url = `CollectController/${method === 'post' ? 'add' : 'delete'}Collect/${this.user.userId}/${this.businessId}`;
|
||||
this.$axios({
|
||||
method: method,
|
||||
url: url
|
||||
}).then().catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -317,6 +351,31 @@
|
|||
margin-top: 1.2vw;
|
||||
}
|
||||
|
||||
/****************收藏按钮***************/
|
||||
.wrapper .collect-button0 {
|
||||
position: fixed;
|
||||
font-size: 3vw;
|
||||
color: white;
|
||||
background-color: gray;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 1vw;
|
||||
right: 0;
|
||||
top: 13vw;
|
||||
}
|
||||
|
||||
.wrapper .collect-button1 {
|
||||
position: fixed;
|
||||
font-size: 3vw;
|
||||
color: white;
|
||||
background-color: #01B0F2;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 1vw;
|
||||
right: 0;
|
||||
top: 13vw;
|
||||
}
|
||||
|
||||
/****************食品信息部分***************/
|
||||
.wrapper .food {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,189 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
|
||||
<!-- header部分 -->
|
||||
<header>
|
||||
<i class="fa fa-angle-left" @click="back"></i>
|
||||
<p>我的收藏</p>
|
||||
|
||||
</header>
|
||||
<!-- 收藏列表 -->
|
||||
<ul class="business">
|
||||
<li v-for="item in businessArr" @click="toBusinessInfo(item.businessId)">
|
||||
<div class="border">
|
||||
<div class="business-img">
|
||||
<img :src="item.businessImg">
|
||||
</div>
|
||||
<div class="business-info">
|
||||
<h3>{{item.businessName}}</h3>
|
||||
<p>¥{{item.starPrice}}起送 | ¥{{item.deliveryPrice}}配送</p>
|
||||
<p>{{item.businessExplain}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<Footer></Footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Footer from "../components/Footer.vue";
|
||||
export default {
|
||||
name: 'CollectList',
|
||||
data() {
|
||||
return {
|
||||
collectList: [],
|
||||
businessArr: [],
|
||||
user: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.user = this.$getSessionStorage('user');
|
||||
|
||||
this.listCollect();
|
||||
},
|
||||
components: {
|
||||
Footer
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
},
|
||||
async listCollect() {
|
||||
let url = `CollectController/listCollect/${this.user.userId}`
|
||||
await this.$axios.get(url).then(response => {
|
||||
this.collectList = response.data.result;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
this.listBusinesses()
|
||||
},
|
||||
listBusinesses(){
|
||||
for(let collect of this.collectList){
|
||||
let url=`BusinessController/getBusinessById/${collect.businessId}`
|
||||
this.$axios.get(url).then(response => {
|
||||
this.businessArr.push(response.data.result);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
toBusinessInfo(businessId) {
|
||||
this.$router.push({
|
||||
path: '/businessInfo',
|
||||
query: {
|
||||
businessId: businessId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/****************总容器***************/
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/****************header部分***************/
|
||||
.wrapper header {
|
||||
width: 100%;
|
||||
height: 12vw;
|
||||
background-color: #01B0F2;
|
||||
font-size: 4.8vw;
|
||||
color: #fff;
|
||||
|
||||
z-index: 10;
|
||||
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.wrapper header i {
|
||||
margin: 0vw 0vw 0vw 3vw;
|
||||
font-size: 6vw;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wrapper header p {
|
||||
margin: 0vw 0vw 0vw 33.5vw;
|
||||
}
|
||||
|
||||
/****************商家列表部分***************/
|
||||
.wrapper .business {
|
||||
width: 100%;
|
||||
margin-top: 12vw;
|
||||
padding-bottom: 14vw;
|
||||
}
|
||||
|
||||
.wrapper .business li {
|
||||
width: 100%;
|
||||
padding: 2vw 2vw 0vw 2vw;
|
||||
background-color: #F4F8Fb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wrapper .business li .border {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 2vw;
|
||||
user-select: none;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 2vw;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img img {
|
||||
width: 20vw;
|
||||
height: 20vw;
|
||||
border-radius: 2vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img .business-img-quantity {
|
||||
width: 5vw;
|
||||
height: 5vw;
|
||||
background-color: red;
|
||||
color: #fff;
|
||||
font-size: 3.6vw;
|
||||
border-radius: 2.5vw;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
position: absolute;
|
||||
right: -1.5vw;
|
||||
top: -1.5vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info {
|
||||
margin-left: 3vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info h3 {
|
||||
font-size: 3.8vw;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info p {
|
||||
font-size: 3vw;
|
||||
color: #888;
|
||||
margin-top: 2vw;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<li @click="toCollect()">
|
||||
<div class="favourite">
|
||||
<img src="../assets/img/爱心.png">
|
||||
<p>我的收藏</p>
|
||||
|
|
@ -140,6 +140,7 @@
|
|||
|
||||
<script>
|
||||
import Footer from '../components/Footer.vue';
|
||||
|
||||
export default {
|
||||
name: 'My',
|
||||
data() {
|
||||
|
|
@ -197,13 +198,18 @@
|
|||
path: '/PointStore'
|
||||
});
|
||||
},
|
||||
toCouponDetails()
|
||||
{
|
||||
toCouponDetails() {
|
||||
this.$router.push(
|
||||
{
|
||||
path: '/CouponDetails'
|
||||
}
|
||||
);
|
||||
},
|
||||
//收藏部分
|
||||
toCollect() {
|
||||
this.$router.push({
|
||||
path: '/CollectList'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@
|
|||
<module name="food_server_10201" />
|
||||
<module name="eureka_server_13001" />
|
||||
<module name="eureka_server_13000" />
|
||||
<module name="orders_server_10601" />
|
||||
<module name="config_server_15001" />
|
||||
<module name="orders_server_10601" />
|
||||
<module name="collect_server_10800" />
|
||||
<module name="cart_server_10401" />
|
||||
<module name="cart_server_10400" />
|
||||
<module name="orders_server_10600" />
|
||||
<module name="config_server_15000" />
|
||||
<module name="orders_server_10600" />
|
||||
<module name="user_server_10100" />
|
||||
<module name="gateway_server_14000" />
|
||||
<module name="business_server_10301" />
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
<file url="file://$PROJECT_DIR$/cart_server_10400/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/cart_server_10401/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/cart_server_10401/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/collect_server_10800/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/collect_server_10800/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/config_server_15000/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/config_server_15000/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/config_server_15001/src/main/java" charset="UTF-8" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="collect_server_10800" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||
<module name="collect_server_10800" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.neusoft.MyApplication" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.neusoft.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/orders_server_10600/src/main/resources/mapper/OrdersDetailetMapper.xml" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.neusoft</groupId>
|
||||
<artifactId>springcloud_elm</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>collect_server_10800</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.20</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- 热部署 gav -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.neusoft</groupId>
|
||||
<artifactId>business_server_10300</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.neusoft;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class MyApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MyApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.neusoft.controller;
|
||||
|
||||
import com.neusoft.po.Collect;
|
||||
import com.neusoft.po.CommonResult;
|
||||
import com.neusoft.service.CollectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
@RefreshScope
|
||||
@RestController
|
||||
@RequestMapping("/CollectController")
|
||||
public class CollectController {
|
||||
@Autowired
|
||||
private CollectService collectService;
|
||||
|
||||
@GetMapping("/listCollect/{userId}")
|
||||
public CommonResult<List<Collect>> listCollect(@PathVariable("userId") String userId) throws Exception {
|
||||
Collect param = new Collect();
|
||||
param.setUserId(userId);
|
||||
List<Collect> list = collectService.getCollectList(param);
|
||||
return new CommonResult<>(200, "success", list);
|
||||
}
|
||||
@PostMapping("/addCollect/{userId}/{businessId}")
|
||||
public CommonResult<Integer> addCollect(
|
||||
@PathVariable("userId") String userId,
|
||||
@PathVariable("businessId") Integer businessId) throws Exception {
|
||||
Collect param = new Collect();
|
||||
param.setUserId(userId);
|
||||
param.setBusinessId(businessId);
|
||||
Integer result = collectService.addCollect(param);
|
||||
return new CommonResult<>(200,"success", result);
|
||||
}
|
||||
@DeleteMapping("/deleteCollect/{userId}/{businessId}")
|
||||
public CommonResult<Integer> deleteCollect(@PathVariable("userId") String userId,
|
||||
@PathVariable("businessId") Integer businessId) throws Exception {
|
||||
Collect param = new Collect();
|
||||
param.setUserId(userId);
|
||||
param.setBusinessId(businessId);
|
||||
Integer result = collectService.deleteCollect(param);
|
||||
return new CommonResult<>(200, "success", result);
|
||||
}
|
||||
@PostMapping("/updateCollect/{userId}/{foodId}")
|
||||
public CommonResult<Integer> updateCollectFood(@PathVariable("userId") String userId,
|
||||
@PathVariable("businessId") Integer businessId) throws Exception {
|
||||
Collect param = new Collect();
|
||||
param.setUserId(userId);
|
||||
param.setBusinessId(businessId);
|
||||
Integer result = collectService.updateCollect(param);
|
||||
return new CommonResult<>(200, "success", result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.neusoft.mapper;
|
||||
|
||||
import com.neusoft.po.Business;
|
||||
import com.neusoft.po.Collect;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CollectMapper {
|
||||
//public List<Collect> listCollect(Collect collect);
|
||||
|
||||
//@Select("select * from collect where userId=#{userId}")
|
||||
public List<Collect> listCollect(Collect collect);
|
||||
//@Delete("delete from collect where collectId=#{collectId}")
|
||||
public Integer deleteCollectById(Collect collect);
|
||||
@Select("insert into collect(userId,businessId) values(#{userId},#{businessId})")
|
||||
public Integer insertCollect(Collect collect);
|
||||
@Update("update collect set businessId=#{businessId} where collectId={collectId}")
|
||||
public Integer updateCollectById(Collect collect);
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Business {
|
||||
private Integer businessId;
|
||||
private String businessName;
|
||||
private String businessAddress;
|
||||
private String businessExplain;
|
||||
private String businessImg;
|
||||
private Integer orderTypeId;
|
||||
private double starPrice;
|
||||
private double deliveryPrice;
|
||||
private String remarks;
|
||||
private List<Food> foodList;
|
||||
|
||||
public Integer getBusinessId() {
|
||||
return businessId;
|
||||
}
|
||||
|
||||
public void setBusinessId(Integer businessId) {
|
||||
this.businessId = businessId;
|
||||
}
|
||||
|
||||
public String getBusinessName() {
|
||||
return businessName;
|
||||
}
|
||||
|
||||
public void setBusinessName(String businessName) {
|
||||
this.businessName = businessName;
|
||||
}
|
||||
|
||||
public String getBusinessAddress() {
|
||||
return businessAddress;
|
||||
}
|
||||
|
||||
public void setBusinessAddress(String businessAddress) {
|
||||
this.businessAddress = businessAddress;
|
||||
}
|
||||
|
||||
public String getBusinessExplain() {
|
||||
return businessExplain;
|
||||
}
|
||||
|
||||
public void setBusinessExplain(String businessExplain) {
|
||||
this.businessExplain = businessExplain;
|
||||
}
|
||||
|
||||
public String getBusinessImg() {
|
||||
return businessImg;
|
||||
}
|
||||
|
||||
public void setBusinessImg(String businessImg) {
|
||||
this.businessImg = businessImg;
|
||||
}
|
||||
|
||||
public Integer getOrderTypeId() {
|
||||
return orderTypeId;
|
||||
}
|
||||
|
||||
public void setOrderTypeId(Integer orderTypeId) {
|
||||
this.orderTypeId = orderTypeId;
|
||||
}
|
||||
|
||||
public double getStarPrice() {
|
||||
return starPrice;
|
||||
}
|
||||
|
||||
public void setStarPrice(double starPrice) {
|
||||
this.starPrice = starPrice;
|
||||
}
|
||||
|
||||
public double getDeliveryPrice() {
|
||||
return deliveryPrice;
|
||||
}
|
||||
|
||||
public void setDeliveryPrice(double deliveryPrice) {
|
||||
this.deliveryPrice = deliveryPrice;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public List<Food> getFoodList() {
|
||||
return foodList;
|
||||
}
|
||||
|
||||
public void setFoodList(List<Food> foodList) {
|
||||
this.foodList = foodList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Collect {
|
||||
private Integer collectId;
|
||||
private Integer businessId;
|
||||
private String userId;
|
||||
|
||||
|
||||
private Business business;
|
||||
|
||||
public Integer getCollectId() {
|
||||
return collectId;
|
||||
}
|
||||
|
||||
public void setCollectId(Integer collectId) {
|
||||
this.collectId = collectId;
|
||||
}
|
||||
|
||||
public Integer getBusinessId() {
|
||||
return businessId;
|
||||
}
|
||||
|
||||
public void setBusinessId(Integer businessId) {
|
||||
this.businessId = businessId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Business getBusiness() {
|
||||
return business;
|
||||
}
|
||||
|
||||
public void setBusiness(Business business) {
|
||||
this.business = business;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CommonResult<T> implements Serializable {
|
||||
private Integer code;
|
||||
private String message;
|
||||
private T result;
|
||||
|
||||
public CommonResult() {}
|
||||
|
||||
public CommonResult(Integer code, String message, T result) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(T result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.neusoft.service;
|
||||
|
||||
import com.neusoft.po.Business;
|
||||
import com.neusoft.po.Collect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface CollectService {
|
||||
public List<Collect> getCollectList(Collect collect);
|
||||
|
||||
public Integer addCollect(Collect collect);
|
||||
|
||||
public Integer deleteCollect(Collect collect);
|
||||
|
||||
public Integer updateCollect(Collect collect);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.neusoft.service.impl;
|
||||
|
||||
import com.neusoft.mapper.CollectMapper;
|
||||
import com.neusoft.po.Collect;
|
||||
import com.neusoft.service.CollectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qq
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class CollectServiceImpl implements CollectService {
|
||||
@Autowired
|
||||
private CollectMapper collectMapper;
|
||||
|
||||
@Override
|
||||
public List<Collect> getCollectList(Collect collect) {
|
||||
return collectMapper.listCollect(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer addCollect(Collect collect) {
|
||||
return collectMapper.insertCollect(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteCollect(Collect collect) {
|
||||
return collectMapper.deleteCollectById(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateCollect(Collect collect) {
|
||||
return collectMapper.updateCollectById(collect);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
spring:
|
||||
cloud:
|
||||
config:
|
||||
name: collect_server_10800
|
||||
profile: dev
|
||||
label: master
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config-server
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true #使用ip地址向eureka server进行注册
|
||||
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
|
||||
lease-renewal-interval-in-seconds: 5
|
||||
lease-expiration-duration-in-seconds: 15
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.neusoft.mapper.CollectMapper">
|
||||
<select id="listCollect" resultType="Collect">
|
||||
select * from collect
|
||||
<where>
|
||||
userId=#{userId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteCollectById">
|
||||
delete from collect
|
||||
<where>
|
||||
userId=#{userId} and businessId=#{businessId}
|
||||
</where>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
spring:
|
||||
cloud:
|
||||
config:
|
||||
name: collect_server_10800
|
||||
profile: dev
|
||||
label: master
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config-server
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true #使用ip地址向eureka server进行注册
|
||||
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
|
||||
lease-renewal-interval-in-seconds: 5
|
||||
lease-expiration-duration-in-seconds: 15
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.neusoft.mapper.CollectMapper">
|
||||
<select id="listCollect" resultType="Collect">
|
||||
select * from collect
|
||||
<where>
|
||||
userId=#{userId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteCollectById">
|
||||
delete from collect
|
||||
<where>
|
||||
userId=#{userId} and businessId=#{businessId}
|
||||
</where>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -16,6 +16,7 @@ spring:
|
|||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- PATCH
|
||||
default-filters:
|
||||
- name: Hystrix
|
||||
args:
|
||||
|
|
@ -67,6 +68,11 @@ spring:
|
|||
predicates:
|
||||
- Path=/CouponController/*/**
|
||||
|
||||
- id: collectServer
|
||||
uri: lb://collect-server
|
||||
predicates:
|
||||
- Path=/CollectController/*/**
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ spring:
|
|||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- PATCH
|
||||
default-filters:
|
||||
- name: Hystrix
|
||||
args:
|
||||
|
|
@ -67,6 +68,11 @@ spring:
|
|||
predicates:
|
||||
- Path=/CouponController/*/**
|
||||
|
||||
- id: collectServer
|
||||
uri: lb://collect-server
|
||||
predicates:
|
||||
- Path=/CollectController/*/**
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>orders_server_10600</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.apt.aptEnabled=false
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
boot.validation.initialized=true
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -50,6 +50,8 @@ public class OrdersController {
|
|||
int result=ordersService.payOrdersById(orderId, null, null, null);
|
||||
return new CommonResult<>(200,"success",result);
|
||||
}
|
||||
|
||||
|
||||
// @PutMapping("/Orders")
|
||||
// public int payOrdersById(OrderState orderState, @RequestHeader("Authorization") String token) throws Exception {
|
||||
// return ordersService.payOrdersById(orderState.getOrderId(), orderState.getUserId(), orderState.getOrderTotal(), orderState.getReduction(),token);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>orders_server_10601</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.apt.aptEnabled=false
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
boot.validation.initialized=true
|
||||
eclipse.preferences.version=1
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
<module>search_server_11600</module>
|
||||
<module>point_server_10900</module>
|
||||
<module>coupon_server_10950</module>
|
||||
<module>collect_server_10800</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,10 @@ public class SearchServiceImpl implements SearchService {
|
|||
Result res = ToAnalysis.parse(query);
|
||||
List<String> keywords=new ArrayList<>();
|
||||
for(Term term:res){
|
||||
if(!term.getName().matches("^\\s+$")){
|
||||
keywords.add(term.getName());
|
||||
}
|
||||
}
|
||||
return businessMapper.listBusinessByKeyword(keywords);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue