diff --git a/.idea/.gitignore b/.idea/.gitignore index 13566b8..35410ca 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -1,7 +1,7 @@ -# Default ignored files +# 默认忽略的文件 /shelf/ /workspace.xml -# Editor-based HTTP Client requests +# 基于编辑器的 HTTP 客户端请求 /httpRequests/ # Datasource local storage ignored files /dataSources/ diff --git a/.idea/cangqiong-takeout-master.iml b/.idea/cangqiong-takeout-master.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/cangqiong-takeout-master.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 33612a7..333bb34 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -15,11 +15,4 @@ - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 23968dc..556bb1f 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/sky/sky-pojo/src/main/resources/META-INF/maven/archetype.xml b/sky/sky-pojo/src/main/resources/META-INF/maven/archetype.xml new file mode 100644 index 0000000..6ba6707 --- /dev/null +++ b/sky/sky-pojo/src/main/resources/META-INF/maven/archetype.xml @@ -0,0 +1,9 @@ + + sky-pojo + + src/main/java/App.java + + + src/test/java/AppTest.java + + diff --git a/sky/sky-pojo/src/main/resources/archetype-resources/pom.xml b/sky/sky-pojo/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000..786c452 --- /dev/null +++ b/sky/sky-pojo/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + $com + $sky-pojo + $0.0.1-SNAPSHOT + + + junit + junit + 3.8.1 + test + + + diff --git a/sky/sky-pojo/src/main/resources/archetype-resources/src/main/java/App.java b/sky/sky-pojo/src/main/resources/archetype-resources/src/main/java/App.java new file mode 100644 index 0000000..eebb89b --- /dev/null +++ b/sky/sky-pojo/src/main/resources/archetype-resources/src/main/java/App.java @@ -0,0 +1,13 @@ +package $com; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/sky/sky-pojo/src/main/resources/archetype-resources/src/test/java/AppTest.java b/sky/sky-pojo/src/main/resources/archetype-resources/src/test/java/AppTest.java new file mode 100644 index 0000000..9d9855b --- /dev/null +++ b/sky/sky-pojo/src/main/resources/archetype-resources/src/test/java/AppTest.java @@ -0,0 +1,38 @@ +package $com; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/sky/sky-server/src/main/resources/application-dev.yml b/sky/sky-server/src/main/resources/application-dev.yml new file mode 100644 index 0000000..5c8705d --- /dev/null +++ b/sky/sky-server/src/main/resources/application-dev.yml @@ -0,0 +1,28 @@ +sky: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + host: localhost + port: 3306 + database: sky_take_out + username: root + password: root + alioss: + endpoint: oss-cn-beijing.aliyuncs.com + access-key-id: LTAI5tPeuNEqfEv8FjWSbSxh + access-key-secret: nFwotFS7o05vy6VkLPooGP45yJbyNS + bucket-name: skybucketoss + upload-path: dish/ + redis: + host: localhost + port: 6379 + database: 10 + wechat: + appid: wxee3110d9ddfa6c12 + secret: cd1316f4647b11b1ac095500a57a762e + excel: + filePath: C:\Users\Administrator\Desktop\学习资料\学习笔记\项目笔记\苍穹外卖\1、黑马程序员Java项目《苍穹外卖》企业级开发实战\资料\day12\运营数据报表模板.xlsx + sheet: + Sheet1, + sheet2, + sheet3, + sheet4 \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/application.yml b/sky/sky-server/src/main/resources/application.yml new file mode 100644 index 0000000..5ebe383 --- /dev/null +++ b/sky/sky-server/src/main/resources/application.yml @@ -0,0 +1,63 @@ + +server: + port: 8080 + +spring: + profiles: + active: dev + main: + allow-circular-references: true + datasource: + druid: + driver-class-name: ${sky.datasource.driver-class-name} + url: jdbc:mysql://${sky.datasource.host}:${sky.datasource.port}/${sky.datasource.database}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + username: ${sky.datasource.username} + password: ${sky.datasource.password} + redis: + host: ${sky.redis.host} + port: ${sky.redis.port} + database: ${sky.redis.database} +mybatis: + #mapper???? + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.sky.entity + configuration: + #?????? + map-underscore-to-camel-case: true + +logging: + level: + com: + sky: + mapper: debug + service: info + controller: info +sky: + jwt: + # ??jwt?????????? + admin-secret-key: itcast + # jwt有效时间 + admin-ttl: 7200000 + # 令牌名字,令牌存放在请求头中,通过令牌名字获取请求头中的鹰牌 + admin-token-name: token + # 服务器私钥 + user-secret-key: itheima + # 生效时间 + user-ttl: 7200000 + user-token-name: authentication + alioss: + endpoint: ${sky.alioss.endpoint} + access-key-id: ${sky.alioss.access-key-id} + access-key-secret: ${sky.alioss.access-key-secret} + bucket-name: ${sky.alioss.bucket-name} + upload-path: ${sky.alioss.upload-path} + wechat: + appid: ${sky.wechat.appid} + secret: ${sky.wechat.secret} + shop: + address: ??????????10? + baidu: + ak: your-ak + excel: + filePath: ${sky.excel.filePath} + sheet: ${sky.excel.sheet} diff --git a/sky/sky-server/src/main/resources/mapper/AddressBookMapper.xml b/sky/sky-server/src/main/resources/mapper/AddressBookMapper.xml new file mode 100644 index 0000000..4c034a5 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/AddressBookMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + update address_book + + + consignee = #{consignee}, + + + sex = #{sex}, + + + phone = #{phone}, + + + detail = #{detail}, + + + label = #{label}, + + + is_default = #{isDefault}, + + + where id = #{id} + + + diff --git a/sky/sky-server/src/main/resources/mapper/CategoryMapper.xml b/sky/sky-server/src/main/resources/mapper/CategoryMapper.xml new file mode 100644 index 0000000..8eaa069 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/CategoryMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + update category + + + name=#{name}, + + + type=#{type}, + + + sort=#{sort}, + + + status=#{status}, + + + update_time=#{updateTime}, + + + update_user=#{updateUser}, + + + where id=#{id} + + + + + \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/mapper/DishMapper.xml b/sky/sky-server/src/main/resources/mapper/DishMapper.xml new file mode 100644 index 0000000..3d5af77 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/DishMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + insert into dish(name, category_id, price, image, description, create_time, update_time, create_user, + update_user, status) + values (#{name}, #{categoryId}, #{price}, #{image}, #{description}, #{createTime}, #{updateTime}, #{createUser}, + #{updateUser}, #{status}) + + + + insert into dish_flavor(dish_id, name, value) + values + + (#{flavor.dishId},#{flavor.name},#{flavor.value}) + + + + + delete from dish where id in + + #{id} + + + + + + + + + update dish + + + name=#{name}, + + + category_id=#{categoryId}, + + + description=#{description}, + + + image=#{image}, + + + price=#{price}, + + + status=#{status} + + + where id=#{id} + + + + delete from dish_flavor where dish_id in + + #{flavor.dishId} + + + + + + + + \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/mapper/EmployeeMapper.xml b/sky/sky-server/src/main/resources/mapper/EmployeeMapper.xml new file mode 100644 index 0000000..0f38f07 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/EmployeeMapper.xml @@ -0,0 +1,30 @@ + + + + + + + update employee + + name = #{name}, + username = #{username}, + password = #{password}, + phone = #{phone}, + sex = #{sex}, + id_Number = #{idNumber}, + update_Time = #{updateTime}, + update_User = #{updateUser}, + status = #{status}, + + where id = #{id} + + diff --git a/sky/sky-server/src/main/resources/mapper/OrderDetailMapper.xml b/sky/sky-server/src/main/resources/mapper/OrderDetailMapper.xml new file mode 100644 index 0000000..cba8c16 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/OrderDetailMapper.xml @@ -0,0 +1,13 @@ + + + + + + + insert into order_detail(name,image,order_id,dish_id,setmeal_id,dish_flavor,number,amount) + values + + (#{item.name},#{item.image},#{item.orderId},#{item.dishId},#{item.setmealId},#{item.dishFlavor},#{item.number},#{item.amount}) + + + diff --git a/sky/sky-server/src/main/resources/mapper/OrderMapper.xml b/sky/sky-server/src/main/resources/mapper/OrderMapper.xml new file mode 100644 index 0000000..6bd932d --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/OrderMapper.xml @@ -0,0 +1,108 @@ + + + + + insert into orders(number, status, user_id, address_book_id, order_time, checkout_time, pay_method, pay_status, + amount, remark, phone, + address, consignee, estimated_delivery_time, delivery_status, pack_amount, tableware_number, + tableware_status) + values (#{number}, #{status}, #{userId}, #{addressBookId}, #{orderTime}, #{checkoutTime}, #{payMethod}, + #{payStatus}, #{amount}, + #{remark}, #{phone}, #{address}, #{consignee}, #{estimatedDeliveryTime}, #{deliveryStatus}, + #{packAmount}, #{tablewareNumber}, + #{tablewareStatus}) + + + + update orders + + + cancel_reason=#{cancelReason}, + + + rejection_reason=#{rejectionReason}, + + + cancel_time=#{cancelTime}, + + + pay_status=#{payStatus}, + + + pay_method=#{payMethod}, + + + checkout_time=#{checkoutTime}, + + + status = #{status}, + + + delivery_time = #{deliveryTime} + + + where id = #{id} + + + update orders set status=#{status} where id in + + #{order.id} + + + + + + + + + + diff --git a/sky/sky-server/src/main/resources/mapper/SetmealMapper.xml b/sky/sky-server/src/main/resources/mapper/SetmealMapper.xml new file mode 100644 index 0000000..9cfd690 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/SetmealMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + update setmeal + + + name=#{name}, + + + price=#{price}, + + + category_id=#{categoryId}, + + + image=#{image}, + + + description=#{description}, + + + create_time=#{createTime}, + + + create_user=#{createUser}, + + + update_time=#{updateTime}, + + + update_user=#{updateUser}, + + + status=#{status} + + + where id=#{id} + + + + insert into setmeal_dish(name,price,copies,setmeal_id,dish_id) + values + + (#{setmealDish.name},#{setmealDish.price},#{setmealDish.copies},#{setmealDish.setmealId},#{setmealDish.dishId}) + + + + + + delete from setmeal + where + id in + + #{id} + + + + + + + insert into setmeal(category_id, name, price, status, description, image, create_time, update_time, create_user, + update_user) + values (#{categoryId}, #{name}, #{price}, #{status}, + #{description}, #{image} + , #{createTime}, #{updateTime}, #{createUser}, #{updateUser}) + + + diff --git a/sky/sky-server/src/main/resources/mapper/ShoppingCartMapper.xml b/sky/sky-server/src/main/resources/mapper/ShoppingCartMapper.xml new file mode 100644 index 0000000..cfd317b --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/ShoppingCartMapper.xml @@ -0,0 +1,50 @@ + + + + + delete from shopping_cart + + + user_id=#{userId} + + + and dish_id=#{dishId} + + + and dish_flavor=#{dishFlavor} + + + and setmeal_id=#{setmealId} + + + + + + insert into shopping_cart + (name, image, user_id, dish_id, setmeal_id, dish_flavor, number, amount, create_time) + values + + (#{sc.name},#{sc.image},#{sc.userId},#{sc.dishId},#{sc.setmealId},#{sc.dishFlavor},#{sc.number},#{sc.amount},#{sc.createTime}) + + + + + \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/mapper/UserMapper.xml b/sky/sky-server/src/main/resources/mapper/UserMapper.xml new file mode 100644 index 0000000..345dec7 --- /dev/null +++ b/sky/sky-server/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,17 @@ + + + + + insert into user(openid, name, phone, sex, id_number, avatar, create_time) + values(#{openid},#{name},#{phone},#{sex},#{idNumber},#{avatar},#{createTime}) + + + \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/static/a.png b/sky/sky-server/src/main/resources/static/a.png new file mode 100644 index 0000000..401bf04 Binary files /dev/null and b/sky/sky-server/src/main/resources/static/a.png differ diff --git a/sky/sky-server/src/main/resources/static/苍穹外卖-管理端接口.html b/sky/sky-server/src/main/resources/static/苍穹外卖-管理端接口.html new file mode 100644 index 0000000..9dc2b95 --- /dev/null +++ b/sky/sky-server/src/main/resources/static/苍穹外卖-管理端接口.html @@ -0,0 +1,2492 @@ + + + + 苍穹外卖-管理端接口 + + + + + +
+
+ +
+ + + \ No newline at end of file diff --git a/sky/sky-server/src/main/resources/templates/a.png b/sky/sky-server/src/main/resources/templates/a.png new file mode 100644 index 0000000..401bf04 Binary files /dev/null and b/sky/sky-server/src/main/resources/templates/a.png differ diff --git a/sky/sky-server/src/test/java/com/sky/test/POITest.java b/sky/sky-server/src/test/java/com/sky/test/POITest.java new file mode 100644 index 0000000..41bc24e --- /dev/null +++ b/sky/sky-server/src/test/java/com/sky/test/POITest.java @@ -0,0 +1,85 @@ +package com.sky.test; + +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; +import org.junit.jupiter.api.Test; + +import javax.swing.filechooser.FileSystemView; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Date; + +public class POITest { + @Test + public void me() throws IOException { + POITest.createExcel(); + } + public static void createExcel() throws IOException { + // 获取桌面路径 + FileSystemView fsv = FileSystemView.getFileSystemView(); + String desktop = fsv.getHomeDirectory().getPath(); + String filePath = desktop + "/template.xls"; + + File file = new File(filePath); + OutputStream outputStream = new FileOutputStream(file); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("Sheet1"); + workbook.createSheet("Sheet2"); + HSSFRow row = sheet.createRow(0); + row.createCell(0).setCellValue("id"); + row.createCell(1).setCellValue("订单号"); + row.createCell(2).setCellValue("下单时间"); + row.createCell(3).setCellValue("个数"); + row.createCell(4).setCellValue("单价"); + row.createCell(5).setCellValue("订单金额"); + row.setHeightInPoints(30); // 设置行的高度 + + HSSFRow row1 = sheet.createRow(1); + row1.createCell(0).setCellValue("1"); + row1.createCell(1).setCellValue("NO00001"); + + // 日期格式化 + HSSFCellStyle cellStyle2 = workbook.createCellStyle(); + HSSFCreationHelper creationHelper = workbook.getCreationHelper(); + cellStyle2.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss")); + sheet.setColumnWidth(2, 20 * 256); // 设置列的宽度 + + HSSFCell cell2 = row1.createCell(2); + cell2.setCellStyle(cellStyle2); + cell2.setCellValue(new Date()); + + row1.createCell(3).setCellValue(2); + + + // 保留两位小数 + HSSFCellStyle cellStyle3 = workbook.createCellStyle(); + cellStyle3.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00")); + HSSFCell cell4 = row1.createCell(4); + cell4.setCellStyle(cellStyle3); + cell4.setCellValue(29.5); + + + // 货币格式化 + HSSFCellStyle cellStyle4 = workbook.createCellStyle(); + HSSFFont font = workbook.createFont(); + font.setFontName("宋体"); + font.setColor(HSSFColor.RED.index); + cellStyle4.setFont(font); + + HSSFCell cell5 = row1.createCell(5); + cell5.setCellFormula("D2*E2"); // 设置计算公式 + cell5.setCellStyle(cellStyle4); + + // 获取计算公式的值 + HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(workbook); + cell5 = e.evaluateInCell(cell5); + System.out.println(cell5.getNumericCellValue()); + + workbook.setActiveSheet(1); + workbook.write(outputStream); + outputStream.close(); + } + +} diff --git a/sky/sky-server/src/test/java/com/sky/test/RedisTest.java b/sky/sky-server/src/test/java/com/sky/test/RedisTest.java new file mode 100644 index 0000000..9eb8277 --- /dev/null +++ b/sky/sky-server/src/test/java/com/sky/test/RedisTest.java @@ -0,0 +1,29 @@ +package com.sky.test; + +import com.sky.entity.Dish; +import com.sky.entity.Orders; +import org.junit.jupiter.api.Test; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.*; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +@SpringBootTest +public class RedisTest { + + @Autowired + RedisTemplate redisTemplate; + + @Test + public void testString() throws CloneNotSupportedException { + + + } + + + +}