Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
5c60bd5d24 |
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-buy/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-facility/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-sell/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-shopList/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-models/bwie-user/src/main/java" charset="UTF-8" />
|
||||
|
@ -13,5 +14,6 @@
|
|||
<file url="file://$PROJECT_DIR$/bwie-mq/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,17 +1,5 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.github.pagehelper.page.PageMethod,startPage" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -5,12 +5,8 @@
|
|||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/bwie-models/bwie-buy/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/bwie-models/bwie-shopList/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -39,6 +39,11 @@
|
|||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!-- 邮箱依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.bwie.common.pojo.VO;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VoFacility {
|
||||
private String facilityType; //设备类型
|
||||
private String facilityStatic; //设备状态
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=3;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<?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.bwie</groupId>
|
||||
<artifactId>bwie-models</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bwie-facility</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>com.bwie</groupId>
|
||||
<artifactId>bwie-common</artifactId>
|
||||
</dependency>
|
||||
<!-- SpringBoot Web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- Mybatis 依赖配置 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.bwie.facility;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class FacilityApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FacilityApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.bwie.facility.controller;
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.bwie.common.pojo.Facility;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.common.pojo.User;
|
||||
import com.bwie.common.pojo.VO.VoFacility;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.facility.feign.FacilityFeign;
|
||||
import com.bwie.facility.service.FacilityServce;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class FacilityControlller {
|
||||
@Autowired
|
||||
FacilityServce facilityServce;
|
||||
@Autowired
|
||||
FacilityFeign facilityFeign;
|
||||
/**
|
||||
* 查询售货机列表
|
||||
* @param voFacility;
|
||||
* @return ;
|
||||
*/
|
||||
@PostMapping("/listFacility")
|
||||
public Result<PageResult<Facility>> listFacility(@RequestBody VoFacility voFacility){
|
||||
return facilityServce.listFacility(voFacility);
|
||||
}
|
||||
/**
|
||||
* 删除售货机
|
||||
* @param id;
|
||||
* @return ;
|
||||
*/
|
||||
@PostMapping("/deleteFacility/{id}")
|
||||
public Result deleteFacility(@PathVariable Integer id){
|
||||
return facilityServce.deleteFacility(id);
|
||||
}
|
||||
/**
|
||||
* 添加/修改售货机
|
||||
* @param facility;
|
||||
* @return ;
|
||||
*/
|
||||
@PostMapping("/updateFacility")
|
||||
private Result updateFacility(@RequestBody Facility facility){
|
||||
return facilityServce.updateFacility(facility);
|
||||
}
|
||||
/**
|
||||
* 回显售货机信息
|
||||
* @param ;
|
||||
* @return ;
|
||||
*/
|
||||
@PostMapping("/echoFacility/{id}")
|
||||
private Result<Facility> echoFacility(@RequestBody Integer id){
|
||||
return facilityServce.echoFacility(id);
|
||||
}
|
||||
/**
|
||||
* 库存不足发邮件
|
||||
* @param ;
|
||||
* @return ;
|
||||
*/
|
||||
@PostMapping("/mailFacility")
|
||||
private void mailFacility(){
|
||||
List<String> users=facilityServce.user();
|
||||
facilityFeign.mailFacility(users);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.facility.feign;
|
||||
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient("bwie-mq")
|
||||
public interface FacilityFeign {
|
||||
@PostMapping("/mailFacility")
|
||||
void mailFacility(@RequestBody List<String> goods);
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.bwie.facility.mapper;
|
||||
|
||||
import com.bwie.common.pojo.Facility;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.common.pojo.VO.VoFacility;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FacilityMapper {
|
||||
|
||||
List<Facility> listFacility(VoFacility voFacility);
|
||||
|
||||
Integer updateFacility(Facility facility);
|
||||
|
||||
Integer insertFacility(Facility facility);
|
||||
|
||||
Integer deleteFacility(Integer id);
|
||||
|
||||
Facility echoFacility(@Param("id") Integer id);
|
||||
|
||||
List<String> user();
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.bwie.facility.service;
|
||||
|
||||
import com.bwie.common.pojo.Facility;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.common.pojo.User;
|
||||
import com.bwie.common.pojo.VO.VoFacility;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FacilityServce {
|
||||
Result<PageResult<Facility>> listFacility(VoFacility voFacility);
|
||||
|
||||
Result updateFacility(Facility facility);
|
||||
|
||||
Result deleteFacility(Integer id);
|
||||
|
||||
Result<Facility> echoFacility(Integer id);
|
||||
|
||||
|
||||
List<String> user();
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.bwie.facility.service.impl;
|
||||
|
||||
import com.bwie.common.pojo.Facility;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.common.pojo.User;
|
||||
import com.bwie.common.pojo.VO.VoFacility;
|
||||
import com.bwie.common.result.PageResult;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.facility.service.FacilityServce;
|
||||
import com.bwie.facility.mapper.FacilityMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FacilityServceImpl implements FacilityServce {
|
||||
@Autowired
|
||||
FacilityMapper facilityMapper;
|
||||
/**
|
||||
* 查询售货机列表
|
||||
* @param voFacility;
|
||||
* @return ;
|
||||
*/
|
||||
@Override
|
||||
public Result<PageResult<Facility>> listFacility(VoFacility voFacility) {
|
||||
PageHelper.startPage(voFacility.getPageNum(),voFacility.getPageSize());
|
||||
List<Facility> facilities=facilityMapper.listFacility(voFacility);
|
||||
PageInfo<Facility> info = new PageInfo<>();
|
||||
return PageResult.toResult(info.getTotal(),facilities);
|
||||
}
|
||||
/**
|
||||
* 添加/修改售货机
|
||||
* @param facility;
|
||||
* @return ;
|
||||
*/
|
||||
@Override
|
||||
public Result updateFacility(Facility facility) {
|
||||
if (facility.getFacilityId()!=null){
|
||||
Integer i=facilityMapper.updateFacility(facility);
|
||||
if (i>0){
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
}
|
||||
Integer i=facilityMapper.insertFacility(facility);
|
||||
if (i>0){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.error();
|
||||
}
|
||||
/**
|
||||
* 删除售货机
|
||||
* @param id;
|
||||
* @return ;
|
||||
*/
|
||||
@Override
|
||||
public Result deleteFacility(Integer id) {
|
||||
Integer i=facilityMapper.deleteFacility(id);
|
||||
if (i<0){
|
||||
|
||||
}
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Facility> echoFacility(Integer id) {
|
||||
Facility facility=facilityMapper.echoFacility(id);
|
||||
return Result.success(facility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> user() {
|
||||
List<String> strings=facilityMapper.user();
|
||||
return strings;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9002
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-list
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 124.222.234.39:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 124.222.234.39:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,45 @@
|
|||
<?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.bwie.facility.mapper.FacilityMapper">
|
||||
<insert id="insertFacility">
|
||||
insert into t_facility
|
||||
values (0,#{facilityType},#{facilitySite},0,0,0,0)
|
||||
</insert>
|
||||
<update id="updateFacility">
|
||||
update t_facility set
|
||||
facility_type = #{facilityType},
|
||||
facility_site = #{facilitySite},
|
||||
replenishment_user_id = 0,
|
||||
maintain_user_id = 0,
|
||||
facility_static = 0,
|
||||
del_id = 0
|
||||
where facility_id=#{facilityId}
|
||||
</update>
|
||||
<update id="deleteFacility">
|
||||
update t_facility set
|
||||
del_id = 1
|
||||
where facility_id=#{id}
|
||||
</update>
|
||||
<select id="listFacility" resultType="com.bwie.common.pojo.Facility">
|
||||
select*from t_facility
|
||||
<where>
|
||||
and del_id = 0
|
||||
<if test="facilityType !=null and facilityType!=''">
|
||||
and facility_type = #{facilityType}
|
||||
</if>
|
||||
<if test="facilityStatic !=null and facilityStatic!=''">
|
||||
and facility_static = #{facilityStatic}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="echoFacility" resultType="com.bwie.common.pojo.Facility">
|
||||
select * from t_facility where facility_id=#{id}
|
||||
</select>
|
||||
<select id="user" resultType="java.lang.String">
|
||||
select u.email from t_goods g
|
||||
left join t_facility f on g.facility_id=f.facility_id
|
||||
left join t_user u on f.maintain_user_id=u.user_id
|
||||
left join t_shop s on g.shop_id=s.shop_id
|
||||
where goods_num>20 group by u.email
|
||||
</select>
|
||||
</mapper>
|
|
@ -16,6 +16,7 @@
|
|||
<module>bwie-sell</module>
|
||||
<module>bwie-buy</module>
|
||||
<module>bwie-shopList</module>
|
||||
<module>bwie-facility</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package com.bwie.mq.consumer;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.common.utils.TelSmsUtils;
|
||||
import com.bwie.mq.config.RabbitMQConfig;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RabbitListener(queues = RabbitMQConfig.DELQUEUE)
|
||||
@Component
|
||||
@Log4j2
|
||||
public class FacilityConsumer {
|
||||
@Autowired
|
||||
RedisTemplate<String,String> redisTemplate;
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
|
||||
@RabbitHandler
|
||||
public void sendCode(List<String> goods, Message message, Channel channel) throws IOException {
|
||||
long tag = message.getMessageProperties().getDeliveryTag();
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
|
||||
if (redisTemplate.hasKey(messageId)){
|
||||
redisTemplate.opsForValue().set("aa"+messageId,tag+"");
|
||||
}
|
||||
|
||||
try {
|
||||
Long add = redisTemplate.opsForSet().add("bb" + messageId, messageId);
|
||||
if (add==1){
|
||||
for (String good : goods) {
|
||||
try {
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage);
|
||||
helper.setSubject("缺货提醒");
|
||||
helper.setText("quehuotixing1");
|
||||
helper.setTo(good);
|
||||
helper.setFrom(good);
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("成功消费");
|
||||
channel.basicAck(tag,false);
|
||||
}else{
|
||||
System.out.println("重复消费");
|
||||
channel.basicReject(tag,false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("消息为消费");
|
||||
String s = redisTemplate.opsForValue().get("bb" + messageId);
|
||||
long parseLong = Long.parseLong(s);
|
||||
if (tag==(parseLong+2)){
|
||||
System.out.println("信息确实没有消费");
|
||||
channel.basicNack(tag,false,false);
|
||||
}else{
|
||||
System.out.println("信息再次进入队列");
|
||||
channel.basicNack(tag,false,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.bwie.mq.controller;
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.bwie.common.pojo.Goods;
|
||||
import com.bwie.mq.config.RabbitMQConfig;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
public class FacilityControllrt {
|
||||
@Autowired
|
||||
RabbitTemplate rabbitTemplate;
|
||||
@PostMapping("/mailFacility")
|
||||
private void mailFacility(@RequestBody List<String> goods){
|
||||
rabbitTemplate.convertAndSend(RabbitMQConfig.delExchange, RabbitMQConfig.routingKey, goods, message -> {
|
||||
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||
return message;
|
||||
}, new CorrelationData(UUID.randomUUID().toString()));
|
||||
}
|
||||
}
|
|
@ -3,6 +3,11 @@ server:
|
|||
port: 9672
|
||||
# Spring
|
||||
spring:
|
||||
mail:
|
||||
host: smtp.qq.com
|
||||
port: 587
|
||||
username: 1344502479@qq.com
|
||||
password: tufeusychfykbach
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-mq
|
||||
|
@ -21,17 +26,17 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 110.42.214.8:8848
|
||||
server-addr: 124.222.234.39:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 110.42.214.8:8848
|
||||
server-addr: 124.222.234.39:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
rabbitmq:
|
||||
host: 110.42.214.8
|
||||
host: 124.222.234.39
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
|
@ -46,4 +51,4 @@ spring:
|
|||
enabled: true # 是否支持重试
|
||||
template:
|
||||
# 只要消息抵达Queue,就会异步发送优先回调return firm
|
||||
mandatory: true
|
||||
mandatory: true
|
||||
|
|
Loading…
Reference in New Issue