Pārlūkot izejas kodu

详情页+APP接口

he.dujuan 3 gadi atpakaļ
vecāks
revīzija
c8872e212a
59 mainītis faili ar 1326 papildinājumiem un 129 dzēšanām
  1. 6 0
      eladmin-common/pom.xml
  2. 1 1
      eladmin-common/src/main/java/me/zhengjie/base/BaseEntity.java
  3. 41 0
      eladmin-common/src/main/java/me/zhengjie/utils/ConnectionUtil.java
  4. 15 0
      eladmin-system/pom.xml
  5. 11 0
      eladmin-system/src/main/java/me/zhengjie/AppRun.java
  6. 51 0
      eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolConfig.java
  7. 16 4
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/domain/DmDayPc.java
  8. 19 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/repository/DmDayPcRepository.java
  9. 9 2
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/DmDayPcController.java
  10. 89 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/ReceiveMsg.java
  11. 89 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/SendMsg.java
  12. 10 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/DmDayPcService.java
  13. 6 2
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/dto/DmDayPcDto.java
  14. 3 1
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/dto/DmDayPcQueryCriteria.java
  15. 74 13
      eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/impl/DmDayPcServiceImpl.java
  16. 4 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/device/domain/DmDevice.java
  17. 2 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/device/service/dto/DmDeviceDto.java
  18. 7 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/device/service/impl/DmDeviceServiceImpl.java
  19. 4 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/food/repository/DmFoodRepository.java
  20. 1 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/food/service/DmFoodService.java
  21. 4 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/domain/DmFoodPj.java
  22. 7 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/DmFoodPjService.java
  23. 2 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/dto/DmFoodPjDto.java
  24. 24 1
      eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/impl/DmFoodPjServiceImpl.java
  25. 32 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderItem.java
  26. 72 8
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderRecord.java
  27. 27 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/repository/DmOrderRecordRepository.java
  28. 7 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/DmOrderItemController.java
  29. 14 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/DmOrderRecordController.java
  30. 88 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/OrderReceiveMsg.java
  31. 92 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/OrderSendMsg.java
  32. 13 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/DmOrderRecordService.java
  33. 19 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemDto.java
  34. 3 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemQueryCriteria.java
  35. 22 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemSmallDto.java
  36. 60 11
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderRecordDto.java
  37. 8 3
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderRecordQueryCriteria.java
  38. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderItemServiceImpl.java
  39. 27 6
      eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderRecordServiceImpl.java
  40. 4 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/domain/DmServicePj.java
  41. 15 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/repository/DmServicePjRepository.java
  42. 9 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/rest/DmServicePjController.java
  43. 13 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/DmServicePjService.java
  44. 2 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/dto/DmServicePjDto.java
  45. 15 0
      eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/impl/DmServicePjServiceImpl.java
  46. 8 8
      eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmEvaluateRepository.java
  47. 20 20
      eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmHaveDinnerRepository.java
  48. 10 10
      eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmStatementRepository.java
  49. 0 33
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/AppDaypcController.java
  50. 59 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/domain/AppFoodPj.java
  51. 21 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/repository/AppFoodPjRepository.java
  52. 4 5
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/rest/AppDmServicePjController.java
  53. 49 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/rest/AppFoodPjController.java
  54. 14 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/AppFoodPjService.java
  55. 32 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/dto/AppFoodPjDto.java
  56. 10 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/dto/AppFoodPjQueryCriteria.java
  57. 20 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/impl/AppFoodPjServiceImpl.java
  58. 11 0
      eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/mapstruct/AppFoodPjMapper.java
  59. 30 0
      eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java

+ 6 - 0
eladmin-common/pom.xml

@@ -22,5 +22,11 @@
             <artifactId>hutool-all</artifactId>
             <version>${hutool.version}</version>
         </dependency>
+        <!-- rabbitmq -->
+        <dependency>
+            <groupId>com.rabbitmq</groupId>
+            <artifactId>amqp-client</artifactId>
+            <version>3.4.1</version>
+        </dependency>
     </dependencies>
 </project>

+ 1 - 1
eladmin-common/src/main/java/me/zhengjie/base/BaseEntity.java

@@ -50,7 +50,7 @@ public class BaseEntity implements Serializable {
     @LastModifiedBy
     @Column(name = "update_by")
     @ApiModelProperty(value = "更新人", hidden = true)
-    private String updatedBy;
+    private String updateBy;
 
     @CreationTimestamp
     @Column(name = "create_time", updatable = false)

+ 41 - 0
eladmin-common/src/main/java/me/zhengjie/utils/ConnectionUtil.java

@@ -0,0 +1,41 @@
+package me.zhengjie.utils;
+
+import com.rabbitmq.client.Connection;
+import com.rabbitmq.client.ConnectionFactory;
+
+import java.io.IOException;
+import java.util.concurrent.TimeoutException;
+
+
+/**
+ * @author wangmx
+ * 连接 RabbitMq  工具类
+ */
+public class ConnectionUtil {
+
+    public static Connection getConnection() {
+        //定义连接工厂
+        ConnectionFactory factory = new ConnectionFactory();
+        //设置服务地址
+        factory.setHost("127.0.0.1");
+        //端口
+        factory.setPort(5672);
+        //设置账号信息
+        //vhost(Virtual Host)
+//        factory.setVirtualHost("test");
+        //用户名
+        factory.setUsername("test");
+        //密码
+        factory.setPassword("test");
+        //通过工厂获得与mq的连接对象
+        Connection connection = null;
+        try {
+            connection = factory.newConnection();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return connection;
+    }
+
+}
+

+ 15 - 0
eladmin-system/pom.xml

@@ -19,6 +19,13 @@
     </properties>
 
     <dependencies>
+        <!-- rabbitmq -->
+        <dependency>
+            <groupId>com.rabbitmq</groupId>
+            <artifactId>amqp-client</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+
         <!-- 代码生成模块 -->
         <dependency>
             <groupId>me.zhengjie</groupId>
@@ -31,6 +38,10 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
 
         <!-- tools 模块包含了 common 和 logging 模块 -->
         <dependency>
@@ -93,6 +104,10 @@
             <artifactId>oshi-core</artifactId>
             <version>5.3.6</version>
         </dependency>
+        <dependency>
+            <groupId>com.rabbitmq</groupId>
+            <artifactId>amqp-client</artifactId>
+        </dependency>
     </dependencies>
 
     <!-- 打包 -->

+ 11 - 0
eladmin-system/src/main/java/me/zhengjie/AppRun.java

@@ -15,6 +15,7 @@
  */
 package me.zhengjie;
 
+
 import io.swagger.annotations.Api;
 import me.zhengjie.annotation.rest.AnonymousGetMapping;
 import me.zhengjie.utils.SpringContextHolder;
@@ -23,8 +24,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
 import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.task.TaskExecutor;
 import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -58,6 +62,13 @@ public class AppRun {
         return fa;
     }
 
+    @Primary
+    @Bean
+    public TaskExecutor primaryTaskExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        return executor;
+    }
+
     /**
      * 访问首页提示
      *

+ 51 - 0
eladmin-system/src/main/java/me/zhengjie/config/thread/ThreadPoolConfig.java

@@ -0,0 +1,51 @@
+package me.zhengjie.config.thread;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+/**
+ * 创建人:lyc
+ * 时间:2021-10-08
+ * 线程池配置
+ */
+@Configuration
+public class ThreadPoolConfig {
+
+    @Value("${thread.corePoolSize}")
+    private int corePoolSize;
+
+    @Value("${thread.maxPoolSize}")
+    private int maxPoolSize;
+
+    @Value("${thread.queueCapacity}")
+    private int queueCapacity;
+
+    @Value("${thread.keepAliveSeconds}")
+    private int keepAliveSeconds;
+
+    @Bean(name = "threadPoolTaskExecutor1")
+    public ThreadPoolTaskExecutor threadPoolTaskExecutor1() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setCorePoolSize(corePoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveSeconds);
+        // 线程池对拒绝任务(无线程可用)的处理策略
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        return executor;
+    }
+    @Bean(name = "threadPoolTaskExecutor2")
+    public ThreadPoolTaskExecutor threadPoolTaskExecutor2() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setCorePoolSize(corePoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveSeconds);
+        // 线程池对拒绝任务(无线程可用)的处理策略
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        return executor;
+    }
+}

+ 16 - 4
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/domain/DmDayPc.java

@@ -19,11 +19,15 @@ import lombok.Data;
 import cn.hutool.core.bean.BeanUtil;
 import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.modules.dm.food.domain.DmFood;
+import me.zhengjie.modules.dm.rfidTableware.domain.DmRfidTableware;
+
 import javax.persistence.*;
 import javax.validation.constraints.*;
 import java.sql.Timestamp;
 import java.math.BigDecimal;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
 * @website https://el-admin.vip
@@ -41,13 +45,17 @@ public class DmDayPc implements Serializable {
     @ApiModelProperty(value = "id")
     private Long id;
 
-    @Column(name = "pid")
+    @OneToOne
+    @JoinColumn(name = "pid")
     @ApiModelProperty(value = "菜品id")
-    private Integer pid;
+    private DmFood food;
+//    private Integer pid;
 
-    @Column(name = "cpid")
+    @OneToOne
+    @JoinColumn(name = "cpid")
     @ApiModelProperty(value = "餐盘id")
-    private Integer cpid;
+    private DmRfidTableware rfidTableware;
+//    private Integer cpid;
 
     @Column(name = "name")
     @ApiModelProperty(value = "菜品名称")
@@ -96,4 +104,8 @@ public class DmDayPc implements Serializable {
     public void copy(DmDayPc source){
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }
+    @PrePersist
+    public void prePersist() {
+        this.pcdate = new Timestamp(new Date().getTime());
+    }
 }

+ 19 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/repository/DmDayPcRepository.java

@@ -16,8 +16,12 @@
 package me.zhengjie.modules.dm.daypc.repository;
 
 import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
+import me.zhengjie.modules.dm.food.domain.DmFood;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
 
 /**
 * @website https://el-admin.vip
@@ -25,4 +29,19 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 * @date 2021-09-22
 **/
 public interface DmDayPcRepository extends JpaRepository<DmDayPc, Long>, JpaSpecificationExecutor<DmDayPc> {
+
+    @Query(value = "SELECT DISTINCT a.`id`, `pid`, `cpid`, a.`name`, a.`price`, `times`, `cate`, `cate_name`, `window`, `window_name`, `pstate`, " +
+            "`seq`, `pcdate`, `shopname`,0 as `food.id`,null as `food.code`,null as `food.name`,null as `food.type`,null as `food.price`," +
+            "null as `food.picture`,null as `food.remark`,null as `food.create_by`,null as `food.update_by`,null as `food.create_time`," +
+            "null as `food.update_time`,0 as `food.num` FROM dm_day_pc a " +
+            "LEFT JOIN dm_food b ON a.pid=b.id " +
+            "WHERE date_format(pcdate,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') ",nativeQuery = true)
+    List<DmDayPc> foodRepository();
+
+    /**
+     * 今日菜品数量
+     * @return
+     */
+    @Query(value = "SELECT COUNT(1) FROM dm_day_pc WHERE to_days(pcdate) = to_days(now()) ",nativeQuery = true)
+    Integer countDishesNumber();
 }

+ 9 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/DmDayPcController.java

@@ -55,7 +55,7 @@ public class DmDayPcController {
     @Log("查询daypc")
     @ApiOperation("查询daypc")
     @PreAuthorize("@el.check('dmDayPc:list')")
-    public ResponseEntity<Object> query(DmDayPcQueryCriteria criteria, Pageable pageable){
+    public ResponseEntity<Object> query(DmDayPcQueryCriteria criteria, Pageable pageable) throws Exception {
         return new ResponseEntity<>(dmDayPcService.queryAll(criteria,pageable),HttpStatus.OK);
     }
 
@@ -63,7 +63,7 @@ public class DmDayPcController {
     @Log("新增daypc")
     @ApiOperation("新增daypc")
     @PreAuthorize("@el.check('dmDayPc:add')")
-    public ResponseEntity<Object> create(@Validated @RequestBody DmDayPc resources){
+    public ResponseEntity<Object> create(@Validated @RequestBody DmDayPc resources) throws Exception {
         return new ResponseEntity<>(dmDayPcService.create(resources),HttpStatus.CREATED);
     }
 
@@ -84,4 +84,11 @@ public class DmDayPcController {
         dmDayPcService.deleteAll(ids);
         return new ResponseEntity<>(HttpStatus.OK);
     }
+
+    @GetMapping(value = "/foodRepository")
+    @Log("今日菜品")
+    @ApiOperation("今日菜品")
+    public ResponseEntity<Object> foodRepository(){
+        return new ResponseEntity<>(dmDayPcService.foodRepository(),HttpStatus.OK);
+    }
 }

+ 89 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/ReceiveMsg.java

@@ -0,0 +1,89 @@
+package me.zhengjie.modules.dm.daypc.rest;
+
+import com.rabbitmq.client.*;
+import lombok.SneakyThrows;
+import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
+import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
+import me.zhengjie.utils.ConnectionUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Component
+//@RabbitListener(queues = "schedule_produce")
+public class ReceiveMsg {
+//    private final static String SCHEDULE_PRODUCE = "schedule_produce";
+    @Autowired
+    private DmDayPcService dmDayPcService;
+    private static String isEable = "0";
+
+    //每天10点执行
+    @Scheduled(cron = "0 0 10 * * ?")
+    //异步执行,指定线程池(配置类里配置)
+    @Async("threadPoolTaskExecutor1")
+    public void timer(){
+        isEable = "1";
+    }
+
+    //每五分钟执行一次
+    @Scheduled(cron = "0 */5 * * * ?")
+    @Async("threadPoolTaskExecutor2")
+    public void timer2(){
+        if(isEable!=null&&isEable=="1"){
+            receive();
+            isEable = "0";
+        }
+    }
+
+    /**
+     * 消费者
+     */
+    public void receive(){
+        Connection connection = ConnectionUtil.getConnection();
+        try {
+            Channel channel = connection.createChannel();
+            Timestamp d = new Timestamp(System.currentTimeMillis());
+            //通过consumer来处理数据
+            Consumer consumer = new DefaultConsumer(channel){
+                @SneakyThrows
+                @Override
+                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
+                    //body就是从队列中获取的数据
+                    DmDayPc dmDayPc = (DmDayPc) getObjectFromBytes(body);
+                    dmDayPc.setPcdate(d);
+                    dmDayPcService.create(dmDayPc);
+                }
+            };
+            //参数1:接收哪个队列的数据
+            //参数2:消息确认 是否应答,收到消息是否回复
+            //参数3:
+            channel.basicConsume("schedule_produce",true,consumer);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public  Object getObjectFromBytes(byte[] objBytes) throws Exception {
+        if (objBytes == null || objBytes.length == 0) {
+            return null;
+        }
+        ByteArrayInputStream bi = new ByteArrayInputStream(objBytes);
+        ObjectInputStream oi = new ObjectInputStream(bi);
+        return oi.readObject();
+    }
+
+//    @RabbitHandler
+//    public void process(DmDayPc dmDayPc) {
+//        dmDayPcService.create(dmDayPc);
+//    }
+}

+ 89 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/rest/SendMsg.java

@@ -0,0 +1,89 @@
+package me.zhengjie.modules.dm.daypc.rest;
+
+import com.alibaba.fastjson.JSON;
+import com.rabbitmq.client.BuiltinExchangeType;
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
+import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
+import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcDto;
+import me.zhengjie.utils.ConnectionUtil;
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+@Component
+public class SendMsg {
+    @Autowired
+    private AmqpTemplate amqpTemplate;
+    @Autowired
+    private DmDayPcService dmDayPcService;
+    private static String isEable = "0";
+
+    //每天10点执行
+    @Scheduled(cron = "0 0 10 * * ?")
+    //异步执行,指定线程池(配置类里配置)
+    @Async("threadPoolTaskExecutor1")
+    public void timer(){
+        isEable = "1";
+    }
+
+    //每五分钟执行一次
+    @Scheduled(cron = "0 */5 * * * ?")
+    @Async("threadPoolTaskExecutor2")
+    public void timer2(){
+        if(isEable!=null&&isEable=="1"){
+            send();
+            isEable = "0";
+        }
+    }
+
+    public void send(){
+//        String msg = "Hello,rabbit";
+        //获取连接
+        Connection connection = ConnectionUtil.getConnection();
+        try {
+            List<DmDayPcDto> dmDayPc = dmDayPcService.queryAll(null);
+            String userString = JSON.toJSONString(dmDayPc);
+            Channel channel = connection.createChannel();
+            String exchangeName = "schedule_produce";//交换机
+            channel.exchangeDeclare(exchangeName, BuiltinExchangeType.DIRECT, true,false, null);
+            String queue1Name = "schedule_produce";//队列名称
+            channel.queueDeclare(queue1Name, true, false, false, null);
+            channel.queueBind(queue1Name, exchangeName, "schedule_produce");// 队列绑定hello路由
+            channel.basicPublish(exchangeName, "schedule_produce", null, userString.getBytes());
+//            Boy boy=new Boy(15,"tom");
+            //对象转化为字节码 把对象转化为字节码后,把字节码传输过去再转化为对象
+//            byte[] bytes=getBytesFromObject(dmDayPc);
+//            amqpTemplate.convertAndSend("exchange","topic.messages",bytes);
+
+//            List<DmDayPcDto> dmDayPc = dmDayPcService.queryAll(null);
+//            String userString = JSON.toJSONString(dmDayPc);
+//            amqpTemplate.convertAndSend(exchangeName,queue1Name,userString);
+            channel.close();
+            connection.close();
+        } catch (IOException | TimeoutException e) {
+            e.printStackTrace();
+        }
+    }
+
+    //对象转化为字节码
+    public  byte[] getBytesFromObject(Serializable obj) throws Exception {
+        if (obj == null) {
+            return null;
+        }
+        ByteArrayOutputStream bo = new ByteArrayOutputStream();
+        ObjectOutputStream oo = new ObjectOutputStream(bo);
+        oo.writeObject(obj);
+        return bo.toByteArray();
+    }
+}

+ 10 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/DmDayPcService.java

@@ -18,6 +18,7 @@ package me.zhengjie.modules.dm.daypc.service;
 import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
 import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcDto;
 import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcQueryCriteria;
+import me.zhengjie.modules.dm.food.domain.DmFood;
 import org.springframework.data.domain.Pageable;
 import java.util.Map;
 import java.util.List;
@@ -80,4 +81,13 @@ public interface DmDayPcService {
     * @throws IOException /
     */
     void download(List<DmDayPcDto> all, HttpServletResponse response) throws IOException;
+
+    /**
+     * 今日菜品
+     * @return
+     */
+    List<DmDayPc> foodRepository();
+
+//    void rabbitDayPcScz() throws IOException, Exception;
+//    void rabbitDayPcXfz() throws IOException, Exception;
 }

+ 6 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/dto/DmDayPcDto.java

@@ -21,6 +21,8 @@ import java.math.BigDecimal;
 import java.io.Serializable;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.ToStringSerializer;
+import me.zhengjie.modules.dm.food.domain.DmFood;
+import me.zhengjie.modules.dm.rfidTableware.domain.DmRfidTableware;
 
 /**
 * @website https://el-admin.vip
@@ -36,10 +38,12 @@ public class DmDayPcDto implements Serializable {
     private Long id;
 
     /** 菜品id */
-    private Integer pid;
+//    private Integer pid;
+    private DmFood food;
 
     /** 餐盘id */
-    private Integer cpid;
+//    private Integer cpid;
+    private DmRfidTableware rfidTableware;
 
     /** 菜品名称 */
     private String name;

+ 3 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/dto/DmDayPcQueryCriteria.java

@@ -29,7 +29,9 @@ import me.zhengjie.annotation.Query;
 public class DmDayPcQueryCriteria{
 
     /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
+//    @Query(type = Query.Type.INNER_LIKE)
+//    private Integer cpid;
+    @Query(propName = "cpid", type = Query.Type.INNER_LIKE, joinName = "rfidTableware")
     private Integer cpid;
 
     /** 模糊 */

+ 74 - 13
eladmin-system/src/main/java/me/zhengjie/modules/dm/daypc/service/impl/DmDayPcServiceImpl.java

@@ -15,9 +15,11 @@
 */
 package me.zhengjie.modules.dm.daypc.service.impl;
 
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+//import com.rabbitmq.client.QueueingConsumer;
 import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.modules.dm.daypc.repository.DmDayPcRepository;
 import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
@@ -30,14 +32,12 @@ import cn.hutool.core.lang.Snowflake;
 import cn.hutool.core.util.IdUtil;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
-import me.zhengjie.utils.PageUtil;
-import me.zhengjie.utils.QueryHelp;
-import java.util.List;
-import java.util.Map;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.*;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
 
 /**
 * @website https://el-admin.vip
@@ -48,12 +48,12 @@ import java.util.LinkedHashMap;
 @Service
 @RequiredArgsConstructor
 public class DmDayPcServiceImpl implements DmDayPcService {
-
+    private final static String SCHEDULE_PRODUCE = "schedule_produce";
     private final DmDayPcRepository dmDayPcRepository;
     private final DmDayPcMapper dmDayPcMapper;
 
     @Override
-    public Map<String,Object> queryAll(DmDayPcQueryCriteria criteria, Pageable pageable){
+    public Map<String,Object> queryAll(DmDayPcQueryCriteria criteria, Pageable pageable) {
         Page<DmDayPc> page = dmDayPcRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
         return PageUtil.toPage(page.map(dmDayPcMapper::toDto));
     }
@@ -75,10 +75,65 @@ public class DmDayPcServiceImpl implements DmDayPcService {
     @Transactional(rollbackFor = Exception.class)
     public DmDayPcDto create(DmDayPc resources) {
         Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-        resources.setId(snowflake.nextId()); 
+        resources.setId(snowflake.nextId());
         return dmDayPcMapper.toDto(dmDayPcRepository.save(resources));
     }
 
+    /**
+     * 生产者
+     * @throws Exception
+     */
+//    public void rabbitDayPcScz() throws Exception{
+//        // 获取到连接以及mq通道
+//        Connection connections = ConnectionUtil.getConnection();
+//        // 从连接中创建通道
+//        Channel channel = connections.createChannel();
+//        // 声明(创建)队列
+//        channel.queueDeclare(SCHEDULE_PRODUCE, false, false, false, null);
+//        // 消息内容
+//        List list = queryAll(null);
+//        byte[] bytes = new byte[list.size()];
+//        int i = 0;
+//        Iterator<Byte> iterator = list.iterator();
+//        while (iterator.hasNext()) {
+//            bytes[i] = iterator.next();
+//            i++;
+//        }
+//        System.out.println("生产者"+bytes);
+//        channel.basicPublish("", SCHEDULE_PRODUCE, null, bytes);
+//        //关闭通道和连接
+//        channel.close();
+//        connections.close();
+//    }
+
+    /**
+     * 消费者
+     * @throws Exception
+     */
+//    public void rabbitDayPcXfz() throws Exception {
+//        // 获取到连接以及mq通道
+//        Connection connection = ConnectionUtil.getConnection();
+//        // 从连接中创建通道
+//        Channel channel = connection.createChannel();
+//        // 声明队列
+//        channel.queueDeclare(SCHEDULE_PRODUCE, false, false, false, null);
+//        // 定义队列的消费者
+//        QueueingConsumer consumer = new QueueingConsumer(channel);
+//        // 监听队列
+//        channel.basicConsume(SCHEDULE_PRODUCE, true, consumer);
+//        // 获取消息
+//        List abyte = null;
+//        while (true) {
+//            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
+//            byte[] bytes = delivery.getBody();
+//            abyte = new ArrayList();
+//            for (byte b: bytes) {
+//                abyte.add(b);
+//            }
+//            System.out.println("消费者"+abyte);
+//        }
+//    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void update(DmDayPc resources) {
@@ -100,8 +155,8 @@ public class DmDayPcServiceImpl implements DmDayPcService {
         List<Map<String, Object>> list = new ArrayList<>();
         for (DmDayPcDto dmDayPc : all) {
             Map<String,Object> map = new LinkedHashMap<>();
-            map.put("菜品id", dmDayPc.getPid());
-            map.put("餐盘id", dmDayPc.getCpid());
+            map.put("菜品id", dmDayPc.getFood().getId());//.getPid()
+            map.put("餐盘id", dmDayPc.getRfidTableware().getId());//.getCpid()
             map.put("菜品名称", dmDayPc.getName());
             map.put("价格", dmDayPc.getPrice());
             map.put("餐别", dmDayPc.getTimes());
@@ -117,4 +172,10 @@ public class DmDayPcServiceImpl implements DmDayPcService {
         }
         FileUtil.downloadExcel(list, response);
     }
+
+    @Override
+    public List<DmDayPc> foodRepository() {
+        List<DmDayPc> dmFood = dmDayPcRepository.foodRepository();
+        return dmFood;
+    }
 }

+ 4 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/device/domain/DmDevice.java

@@ -64,6 +64,10 @@ public class DmDevice extends BaseEntity  implements Serializable {
     @ApiModelProperty(value = "安装时间")
     private Timestamp buildDate;
 
+    @Column(name = "state")
+    @ApiModelProperty(value = "设备状态")
+    private Integer state;
+
     public void copy(DmDevice source){
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/device/service/dto/DmDeviceDto.java

@@ -47,6 +47,8 @@ public class DmDeviceDto implements Serializable {
     /** 安装时间 */
     private Timestamp buildDate;
 
+    private Integer state;
+
     /** 创建者 */
     private String createBy;
 

+ 7 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/device/service/impl/DmDeviceServiceImpl.java

@@ -104,6 +104,13 @@ public class DmDeviceServiceImpl implements DmDeviceService {
             map.put("设备名称", dmDevice.getName());
             map.put("设备安装位置", dmDevice.getBuildAddress());
             map.put("安装时间", dmDevice.getBuildDate());
+            if (dmDevice.getState()==0){
+                map.put("设备状态", "启用");
+            }else if (dmDevice.getState()==1){
+                map.put("设备状态", "停用");
+            }else if (dmDevice.getState()==2){
+                map.put("设备状态", "待维修");
+            }
             map.put("创建者", dmDevice.getCreateBy());
             map.put("更新者", dmDevice.getUpdateBy());
             map.put("创建日期", dmDevice.getCreateTime());

+ 4 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/food/repository/DmFoodRepository.java

@@ -18,6 +18,10 @@ package me.zhengjie.modules.dm.food.repository;
 import me.zhengjie.modules.dm.food.domain.DmFood;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+import java.util.Map;
 
 /**
 * @website https://el-admin.vip

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/food/service/DmFoodService.java

@@ -80,4 +80,5 @@ public interface DmFoodService {
     * @throws IOException /
     */
     void download(List<DmFoodDto> all, HttpServletResponse response) throws IOException;
+
 }

+ 4 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/domain/DmFoodPj.java

@@ -40,6 +40,10 @@ public class DmFoodPj implements Serializable {
     @ApiModelProperty(value = "id")
     private Long id;
 
+    @Column(name = "oid")
+    @ApiModelProperty(value = "orderItem")
+    private Long oid;
+
     @Column(name = "food_name")
     @ApiModelProperty(value = "菜品名称")
     private String foodName;

+ 7 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/DmFoodPjService.java

@@ -61,6 +61,13 @@ public interface DmFoodPjService {
     */
     DmFoodPjDto create(DmFoodPj resources);
 
+    /**
+     * 创建
+     * @param resources /
+     * @return DmFoodPjDto
+     */
+    DmFoodPjDto createApp(DmFoodPj resources);
+
     /**
     * 编辑
     * @param resources /

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/dto/DmFoodPjDto.java

@@ -34,6 +34,8 @@ public class DmFoodPjDto implements Serializable {
     @JSONField(serializeUsing = ToStringSerializer.class)
     private Long id;
 
+    private Long oid;
+
     /** 菜品名称 */
     private String foodName;
 

+ 24 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodPj/service/impl/DmFoodPjServiceImpl.java

@@ -16,6 +16,11 @@
 package me.zhengjie.modules.dm.foodPj.service.impl;
 
 import me.zhengjie.modules.dm.foodPj.domain.DmFoodPj;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
+import me.zhengjie.modules.dm.order.domain.DmOrderRecord;
+import me.zhengjie.modules.dm.order.repository.DmOrderItemRepository;
+import me.zhengjie.modules.dm.order.repository.DmOrderRecordRepository;
+import me.zhengjie.modules.dm.order.service.DmOrderRecordService;
 import me.zhengjie.utils.ValidationUtil;
 import me.zhengjie.utils.FileUtil;
 import lombok.RequiredArgsConstructor;
@@ -32,6 +37,8 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
+
+import java.sql.Timestamp;
 import java.util.List;
 import java.util.Map;
 import java.io.IOException;
@@ -51,6 +58,7 @@ public class DmFoodPjServiceImpl implements DmFoodPjService {
 
     private final DmFoodPjRepository dmFoodPjRepository;
     private final DmFoodPjMapper dmFoodPjMapper;
+    private final DmOrderItemRepository dmOrderItemRepository;
 
     @Override
     public Map<String,Object> queryAll(DmFoodPjQueryCriteria criteria, Pageable pageable){
@@ -75,7 +83,22 @@ public class DmFoodPjServiceImpl implements DmFoodPjService {
     @Transactional(rollbackFor = Exception.class)
     public DmFoodPjDto create(DmFoodPj resources) {
         Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-        resources.setId(snowflake.nextId()); 
+        resources.setId(snowflake.nextId());
+        return dmFoodPjMapper.toDto(dmFoodPjRepository.save(resources));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public DmFoodPjDto createApp(DmFoodPj resources) {
+        Snowflake snowflake = IdUtil.createSnowflake(1, 1);
+        resources.setId(snowflake.nextId());
+
+        DmOrderItem dmOrderItem = dmOrderItemRepository.findById(resources.getOid()).orElseGet(DmOrderItem::new);
+        ValidationUtil.isNull( resources.getOid(),"DmOrderItem","id",resources.getOid());
+//        dmOrderItem.copy(resources);
+        dmOrderItem.setPjType("1");
+        dmOrderItemRepository.save(dmOrderItem);
+
         return dmFoodPjMapper.toDto(dmFoodPjRepository.save(resources));
     }
 

+ 32 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderItem.java

@@ -19,9 +19,12 @@ import lombok.Data;
 import cn.hutool.core.bean.BeanUtil;
 import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.modules.dm.food.domain.DmFood;
+
 import javax.persistence.*;
 import javax.validation.constraints.*;
 import java.io.Serializable;
+import java.util.List;
 
 /**
 * @website https://el-admin.vip
@@ -39,10 +42,31 @@ public class DmOrderItem implements Serializable {
     @ApiModelProperty(value = "id")
     private Long id;
 
+//    @OneToMany(mappedBy = "orderItem",cascade={CascadeType.PERSIST,CascadeType.REMOVE})
+//    private List<DmOrderItem> orderItems;
+
+//    @OneToOne
+//    @JoinColumn(name = "bh")
+//    @ApiModelProperty(value = "商品编号")
+//    private DmOrderItem orderItem;
+
     @Column(name = "bh")
     @ApiModelProperty(value = "编号")
     private String bh;
 
+    @Column(name = "pj_type")
+    @ApiModelProperty(value = "评价类型")
+    private String pjType;
+
+    @OneToOne
+    @JoinColumn(name = "pid")
+    @ApiModelProperty(value = "商品编号")
+    private DmFood food;
+
+//    @Column(name = "pid")
+//    @ApiModelProperty(value = "商品编号")
+//    private Long pid;
+
     @Column(name = "code")
     @ApiModelProperty(value = "商品编号")
     private String code;
@@ -63,6 +87,14 @@ public class DmOrderItem implements Serializable {
     @ApiModelProperty(value = "金额小计")
     private String money;
 
+    @Column(name = "seq")
+    @ApiModelProperty(value = "流水号")
+    private Long seq;
+
+    @Column(name = "amt")
+    @ApiModelProperty(value = "商品售价")
+    private Double amt;
+
     public void copy(DmOrderItem source){
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }

+ 72 - 8
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderRecord.java

@@ -42,23 +42,39 @@ public class DmOrderRecord implements Serializable {
     @ApiModelProperty(value = "id")
     private Long id;
 
-    @Column(name = "bh")
+//    @Column(name = "bh")
+//    @ApiModelProperty(value = "订单编号")
+//    private String bh;
+
+//    @JoinColumn(name = "id")
+//    @ManyToOne(fetch=FetchType.LAZY)
+//    @ApiModelProperty(value = "订单编号", hidden = true)
+    @OneToOne
+    @JoinColumn(name = "bh")
     @ApiModelProperty(value = "订单编号")
-    private String bh;
+    private DmOrderItem orderItem;
 
     @Column(name = "money")
     @ApiModelProperty(value = "实付金额")
     private String money;
 
-    @OneToOne
-    @JoinColumn(name = "dept_id")
-    @ApiModelProperty(value = "用户部门")
-    private Dept dept;
+    @Column(name = "mob")
+    @ApiModelProperty(value = "用户唯一识别号")
+    private String mob;
+
+    @Column(name = "user_code")
+    @ApiModelProperty(value = "用户工号")
+    private String userCode;
 
     @Column(name = "user_name")
     @ApiModelProperty(value = "用户姓名")
     private String userName;
 
+    @OneToOne
+    @JoinColumn(name = "dept_id")
+    @ApiModelProperty(value = "用户部门")
+    private Dept dept;
+
     @Column(name = "user_type")
     @ApiModelProperty(value = "人员种类")
     private String userType;
@@ -67,9 +83,9 @@ public class DmOrderRecord implements Serializable {
     @ApiModelProperty(value = "用户手机号")
     private String phone;
 
-    @Column(name = "order_time")
+    @Column(name = "create_date")
     @ApiModelProperty(value = "下单时间")
-    private Timestamp orderTime;
+    private Timestamp createDate;
 
     @Column(name = "total_money")
     @ApiModelProperty(value = "合计金额")
@@ -79,6 +95,54 @@ public class DmOrderRecord implements Serializable {
     @ApiModelProperty(value = "折扣")
     private String zkMoney;
 
+    @Column(name = "seq")
+    @ApiModelProperty(value = "流水号")
+    private Long seq;
+
+    @Column(name = "card")
+    @ApiModelProperty(value = "卡id")
+    private String card;
+
+    @Column(name = "card_no")
+    @ApiModelProperty(value = "卡no")
+    private String cardNo;
+
+    @Column(name = "part")
+    @ApiModelProperty(value = "餐别 1-早餐,2-午餐,3-晚餐,4-夜宵")
+    private Integer part;
+
+    @Column(name = "term")
+    @ApiModelProperty(value = "终端id")
+    private Integer term;
+
+    @Column(name = "shop")
+    @ApiModelProperty(value = "餐厅id")
+    private Integer shop;
+
+    @Column(name = "term_name")
+    @ApiModelProperty(value = "终端名称")
+    private String termName;
+
+    @Column(name = "shop_name")
+    @ApiModelProperty(value = "餐厅名称")
+    private String shopName;
+
+    @Column(name = "amt")
+    @ApiModelProperty(value = "金额")
+    private Double amt;
+
+    @Column(name = "balance")
+    @ApiModelProperty(value = "卡余额")
+    private Double balance;
+
+    @Column(name = "account")
+    @ApiModelProperty(value = "账户类型 0-主账户、1-补贴账户")
+    private Integer account;
+
+    @Column(name = "type")
+    @ApiModelProperty(value = "支付类型 11-主账户、21-补贴账户、 2-现金、 3-银联、30-扫码支付、31-微信、32-支付宝")
+    private Integer type;
+
     public void copy(DmOrderRecord source){
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }

+ 27 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/repository/DmOrderRecordRepository.java

@@ -16,8 +16,13 @@
 package me.zhengjie.modules.dm.order.repository;
 
 import me.zhengjie.modules.dm.order.domain.DmOrderRecord;
+import me.zhengjie.modules.dm.service.domain.DmServicePj;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 
 /**
 * @website https://el-admin.vip
@@ -25,4 +30,26 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 * @date 2021-09-15
 **/
 public interface DmOrderRecordRepository extends JpaRepository<DmOrderRecord, Long>, JpaSpecificationExecutor<DmOrderRecord> {
+    /**
+     * 昨日订单数量
+     * @return
+     */
+    @Query(value = "SELECT COUNT(1) FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 23:59:59') ",nativeQuery = true)
+    Integer countOrderQuantity();
+
+    /**
+     * 昨日收入
+     * @return
+     */
+    @Query(value = "SELECT SUM(amt) FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 23:59:59') ",nativeQuery = true)
+    Integer countIncome();
+
+    /**
+     * 昨日消费人数
+     * @return
+     */
+    @Query(value = "SELECT count(1) from ( " +
+            " SELECT DISTINCT mob FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 23:59:59') " +
+            " ) a ",nativeQuery = true)
+    Integer countConsumerNumber();
 }

+ 7 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/DmOrderItemController.java

@@ -59,6 +59,13 @@ public class DmOrderItemController {
         return new ResponseEntity<>(dmOrderItemService.queryAll(criteria,pageable),HttpStatus.OK);
     }
 
+    @GetMapping(value = "/queryDetails")
+    @Log("查询orderItem")
+    @ApiOperation("查询orderItem")
+    public ResponseEntity<Object> queryDetails(DmOrderItemQueryCriteria criteria, Pageable pageable){
+        return new ResponseEntity<>(dmOrderItemService.queryAll(criteria,pageable),HttpStatus.OK);
+    }
+
     @PostMapping
     @Log("新增orderItem")
     @ApiOperation("新增orderItem")

+ 14 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/DmOrderRecordController.java

@@ -59,6 +59,13 @@ public class DmOrderRecordController {
         return new ResponseEntity<>(dmOrderRecordService.queryAll(criteria,pageable),HttpStatus.OK);
     }
 
+    @GetMapping(value = "/queryDetails")
+    @Log("查询order")
+    @ApiOperation("查询order")
+    public ResponseEntity<Object> queryDetails(DmOrderRecordQueryCriteria criteria, Pageable pageable){
+        return new ResponseEntity<>(dmOrderRecordService.queryDetails(criteria,pageable),HttpStatus.OK);
+    }
+
     @PostMapping
     @Log("新增order")
     @ApiOperation("新增order")
@@ -84,4 +91,11 @@ public class DmOrderRecordController {
         dmOrderRecordService.deleteAll(ids);
         return new ResponseEntity<>(HttpStatus.OK);
     }
+
+    @GetMapping(value = "/panelGroup")
+    @Log("首页统计信息")
+    @ApiOperation("首页统计信息")
+    public ResponseEntity<Object> panelGroup(){
+        return new ResponseEntity<>(dmOrderRecordService.panelGroup(),HttpStatus.OK);
+    }
 }

+ 88 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/OrderReceiveMsg.java

@@ -0,0 +1,88 @@
+package me.zhengjie.modules.dm.order.rest;
+
+import com.rabbitmq.client.*;
+import lombok.SneakyThrows;
+import me.zhengjie.modules.dm.daypc.domain.DmDayPc;
+import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
+import me.zhengjie.modules.dm.order.domain.DmOrderRecord;
+import me.zhengjie.modules.dm.order.service.DmOrderItemService;
+import me.zhengjie.modules.dm.order.service.DmOrderRecordService;
+import me.zhengjie.utils.ConnectionUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+@Component
+public class OrderReceiveMsg {
+    @Autowired
+    private DmOrderRecordService dmOrderRecordService;
+    @Autowired
+    private DmOrderItemService dmOrderItemService;
+    private static String isEable = "0";
+
+    //每天10点执行
+    @Scheduled(cron = "0 0 10 * * ?")
+    //异步执行,指定线程池(配置类里配置)
+    @Async("threadPoolTaskExecutor1")
+    public void timer(){
+        isEable = "1";
+    }
+
+    //每五分钟执行一次
+    @Scheduled(cron = "0 */5 * * * ?")
+    @Async("threadPoolTaskExecutor2")
+    public void timer2(){
+        if(isEable!=null&&isEable=="1"){
+            receive();
+            isEable = "0";
+        }
+    }
+
+    /**
+     * 消费者
+     */
+    public void receive(){
+        Connection connection = ConnectionUtil.getConnection();
+        try {
+            Channel channel = connection.createChannel();
+            //通过consumer来处理数据
+            Consumer consumer = new DefaultConsumer(channel){
+                @SneakyThrows
+                @Override
+                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
+                    //body就是从队列中获取的数据
+                    DmOrderItem dmOrderItem = (DmOrderItem) getObjectFromBytes(body);
+                    DmOrderRecord dmOrderRecord = (DmOrderRecord) getObjectFromBytes(body);
+                    dmOrderItemService.create(dmOrderItem);
+                    dmOrderRecordService.create(dmOrderRecord);
+                }
+            };
+            //参数1:接收哪个队列的数据
+            //参数2:消息确认 是否应答,收到消息是否回复
+            //参数3:
+            channel.basicConsume("dish_trade_produce",true,consumer);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public  Object getObjectFromBytes(byte[] objBytes) throws Exception {
+        if (objBytes == null || objBytes.length == 0) {
+            return null;
+        }
+        ByteArrayInputStream bi = new ByteArrayInputStream(objBytes);
+        ObjectInputStream oi = new ObjectInputStream(bi);
+        return oi.readObject();
+    }
+
+//    @RabbitHandler
+//    public void process(DmDayPc dmDayPc) {
+//        dmDayPcService.create(dmDayPc);
+//    }
+}

+ 92 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/rest/OrderSendMsg.java

@@ -0,0 +1,92 @@
+package me.zhengjie.modules.dm.order.rest;
+
+import com.alibaba.fastjson.JSON;
+import com.rabbitmq.client.BuiltinExchangeType;
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
+import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcDto;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
+import me.zhengjie.modules.dm.order.domain.DmOrderRecord;
+import me.zhengjie.modules.dm.order.service.DmOrderItemService;
+import me.zhengjie.modules.dm.order.service.DmOrderRecordService;
+import me.zhengjie.modules.dm.order.service.dto.DmOrderItemDto;
+import me.zhengjie.modules.dm.order.service.dto.DmOrderRecordDto;
+import me.zhengjie.utils.ConnectionUtil;
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+@Component
+public class OrderSendMsg {
+    @Autowired
+    private DmOrderRecordService dmOrderRecordService;
+    @Autowired
+    private DmOrderItemService dmOrderItemService;
+    private static String isEable = "0";
+
+    //每天10点执行
+    @Scheduled(cron = "0 0 10 * * ?")
+    //异步执行,指定线程池(配置类里配置)
+    @Async("threadPoolTaskExecutor1")
+    public void timer(){
+        isEable = "1";
+    }
+
+    //每五分钟执行一次
+    @Scheduled(cron = "0 */5 * * * ?")
+    @Async("threadPoolTaskExecutor2")
+    public void timer2(){
+        if(isEable!=null&&isEable=="1"){
+            send();
+            isEable = "0";
+        }
+    }
+
+    public void send(){
+        //获取连接
+        Connection connection = ConnectionUtil.getConnection();
+        try {
+            String userString1 = JSON.toJSONString(dmOrderItemService.queryAll(null));
+            String userString2 = JSON.toJSONString(dmOrderRecordService.queryAll(null));
+
+            Channel channel = connection.createChannel();
+            String exchangeName = "dish_trade_produce";//交换机
+            channel.exchangeDeclare(exchangeName, BuiltinExchangeType.DIRECT, true,false, null);
+            String queue1Name = "dish_trade_produce";//队列名称
+            channel.queueDeclare(queue1Name, true, false, false, null);
+            channel.queueBind(queue1Name, exchangeName, "dish_trade_produce");// 队列绑定hello路由
+
+//            byte[] bytes = new byte[2];
+//            bytes = userString1.getBytes();
+//            bytes[1] = (Byte)
+            channel.basicPublish(exchangeName, "dish_trade_produce", null, userString1.getBytes());
+            channel.basicPublish(exchangeName, "dish_trade_produce", null, userString2.getBytes());
+
+            channel.close();
+            connection.close();
+        } catch (IOException | TimeoutException e) {
+            e.printStackTrace();
+        }
+    }
+
+    //对象转化为字节码
+    public  byte[] getBytesFromObject(Serializable obj) throws Exception {
+        if (obj == null) {
+            return null;
+        }
+        ByteArrayOutputStream bo = new ByteArrayOutputStream();
+        ObjectOutputStream oo = new ObjectOutputStream(bo);
+        oo.writeObject(obj);
+        return bo.toByteArray();
+    }
+}

+ 13 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/DmOrderRecordService.java

@@ -40,6 +40,14 @@ public interface DmOrderRecordService {
     */
     Map<String,Object> queryAll(DmOrderRecordQueryCriteria criteria, Pageable pageable);
 
+    /**
+     * 查询数据分页
+     * @param criteria 条件
+     * @param pageable 分页参数
+     * @return Map<String,Object>
+     */
+    Map<String,Object> queryDetails(DmOrderRecordQueryCriteria criteria, Pageable pageable);
+
     /**
     * 查询所有数据不分页
     * @param criteria 条件参数
@@ -80,4 +88,9 @@ public interface DmOrderRecordService {
     * @throws IOException /
     */
     void download(List<DmOrderRecordDto> all, HttpServletResponse response) throws IOException;
+
+    /**
+     * 首页统计信息
+     */
+    Map<String,Object> panelGroup();
 }

+ 19 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemDto.java

@@ -15,10 +15,17 @@
 */
 package me.zhengjie.modules.dm.order.service.dto;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.io.Serializable;
+import java.util.List;
+
 import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.ToStringSerializer;
+import me.zhengjie.modules.dm.food.domain.DmFood;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
+
+import javax.persistence.Column;
 
 /**
 * @website https://el-admin.vip
@@ -33,10 +40,16 @@ public class DmOrderItemDto implements Serializable {
     @JSONField(serializeUsing = ToStringSerializer.class)
     private Long id;
 
+    private String pjType;
+
     /** 编号 */
     private String bh;
+//    private List<DmOrderItem> orderItems;
 
     /** 商品编号 */
+    private DmFood food;
+//    private Long pid;
+
     private String code;
 
     /** 商品名称 */
@@ -50,4 +63,10 @@ public class DmOrderItemDto implements Serializable {
 
     /** 金额小计 */
     private String money;
+
+    //流水号
+    private Long seq;
+
+    //商品售价
+    private Double amt;
 }

+ 3 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemQueryCriteria.java

@@ -26,4 +26,7 @@ import me.zhengjie.annotation.Query;
 **/
 @Data
 public class DmOrderItemQueryCriteria{
+//    private String bh;
+    @Query
+    private Long seq;
 }

+ 22 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderItemSmallDto.java

@@ -0,0 +1,22 @@
+package me.zhengjie.modules.dm.order.service.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import java.io.Serializable;
+
+@Data
+public class DmOrderItemSmallDto implements Serializable {
+
+    private Long id;
+
+    //商品编号
+    private String code;
+
+   //商品名称")
+    private String name;
+
+    //单价")
+    private String price;
+}

+ 60 - 11
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderRecordDto.java

@@ -18,8 +18,11 @@ package me.zhengjie.modules.dm.order.service.dto;
 import lombok.Data;
 import java.sql.Timestamp;
 import java.io.Serializable;
+import java.util.List;
+
 import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.ToStringSerializer;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
 import me.zhengjie.modules.system.domain.Dept;
 
 /**
@@ -35,29 +38,75 @@ public class DmOrderRecordDto implements Serializable {
     @JSONField(serializeUsing = ToStringSerializer.class)
     private Long id;
 
-    /** 订单编号 */
-    private String bh;
+//    private String bh;
+    //订单编号
+//    private List<DmOrderItem> orderItem;
+//    private DmOrderItemSmallDto orderItem;
+    private DmOrderItem orderItem;
 
-    /** 实付金额 */
+    //实付金额
     private String money;
 
-    private Dept dept;
+    //用户唯一识别号
+    private String mob;
+
+    //用户工号
+    private String userCode;
 
-    /** 用户姓名 */
+    //用户姓名
     private String userName;
 
-    /** 人员种类 */
+    //用户部门
+    private Dept dept;
+
+    //人员种类
     private String userType;
 
-    /** 用户手机号 */
+    //用户手机号
     private String phone;
 
-    /** 下单时间 */
-    private Timestamp orderTime;
+    //下单时间
+    private Timestamp createDate;
 
-    /** 合计金额 */
+    //合计金额
     private String totalMoney;
 
-    /** 折扣 */
+    //折扣
     private String zkMoney;
+
+    //流水号
+    private Long seq;
+
+    //卡id
+    private String card;
+
+    //卡no
+    private String cardNo;
+
+    //餐别 1-早餐,2-午餐,3-晚餐,4-夜宵
+    private Integer part;
+
+    //终端id
+    private Integer term;
+
+    //餐厅id
+    private Integer shop;
+
+    //终端名称
+    private String termName;
+
+   //餐厅名称
+    private String shopName;
+
+    //金额
+    private Double amt;
+
+    //卡余额
+    private Double balance;
+
+    //账户类型 0-主账户、1-补贴账户
+    private Integer account;
+
+    //支付类型 11-主账户、21-补贴账户、 2-现金、 3-银联、30-扫码支付、31-微信、32-支付宝
+    private Integer type;
 }

+ 8 - 3
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderRecordQueryCriteria.java

@@ -19,6 +19,7 @@ import lombok.Data;
 import java.sql.Timestamp;
 import java.util.List;
 import me.zhengjie.annotation.Query;
+import me.zhengjie.modules.dm.order.domain.DmOrderItem;
 
 /**
 * @website https://el-admin.vip
@@ -29,13 +30,17 @@ import me.zhengjie.annotation.Query;
 public class DmOrderRecordQueryCriteria{
 
     /** 模糊 */
-    @Query(type = Query.Type.INNER_LIKE)
-    private String bh;
+//    @Query(type = Query.Type.INNER_LIKE)
+//    private String bh;
+    @Query
+    private Long id;
 
+    @Query(propName = "bh", type = Query.Type.INNER_LIKE, joinName = "orderItem")
+    private String bh;
     /** 模糊 */
     @Query(type = Query.Type.INNER_LIKE)
     private String userName;
     /** BETWEEN */
     @Query(type = Query.Type.BETWEEN)
-    private List<Timestamp> orderTime;
+    private List<Timestamp> createDate;
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderItemServiceImpl.java

@@ -75,7 +75,7 @@ public class DmOrderItemServiceImpl implements DmOrderItemService {
     @Transactional(rollbackFor = Exception.class)
     public DmOrderItemDto create(DmOrderItem resources) {
         Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-        resources.setId(snowflake.nextId()); 
+        resources.setId(snowflake.nextId());
         return dmOrderItemMapper.toDto(dmOrderItemRepository.save(resources));
     }
 

+ 27 - 6
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderRecordServiceImpl.java

@@ -15,6 +15,7 @@
 */
 package me.zhengjie.modules.dm.order.service.impl;
 
+import me.zhengjie.modules.dm.daypc.repository.DmDayPcRepository;
 import me.zhengjie.modules.dm.order.domain.DmOrderRecord;
 import me.zhengjie.utils.ValidationUtil;
 import me.zhengjie.utils.FileUtil;
@@ -32,12 +33,10 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
-import java.util.List;
-import java.util.Map;
+
+import java.util.*;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
 
 /**
 * @website https://el-admin.vip
@@ -51,6 +50,7 @@ public class DmOrderRecordServiceImpl implements DmOrderRecordService {
 
     private final DmOrderRecordRepository dmOrderRecordRepository;
     private final DmOrderRecordMapper dmOrderRecordMapper;
+    private final DmDayPcRepository dmDayPcRepository;
 
     @Override
     public Map<String,Object> queryAll(DmOrderRecordQueryCriteria criteria, Pageable pageable){
@@ -58,6 +58,13 @@ public class DmOrderRecordServiceImpl implements DmOrderRecordService {
         return PageUtil.toPage(page.map(dmOrderRecordMapper::toDto));
     }
 
+    @Override
+    public Map<String, Object> queryDetails(DmOrderRecordQueryCriteria criteria, Pageable pageable) {
+//        criteria.setId(criteria.getId());
+        Page<DmOrderRecord> page = dmOrderRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+        return PageUtil.toPage(page.map(dmOrderRecordMapper::toDto));
+    }
+
     @Override
     public List<DmOrderRecordDto> queryAll(DmOrderRecordQueryCriteria criteria){
         return dmOrderRecordMapper.toDto(dmOrderRecordRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
@@ -100,16 +107,30 @@ public class DmOrderRecordServiceImpl implements DmOrderRecordService {
         List<Map<String, Object>> list = new ArrayList<>();
         for (DmOrderRecordDto dmOrderRecord : all) {
             Map<String,Object> map = new LinkedHashMap<>();
-            map.put("订单编号", dmOrderRecord.getBh());
+            map.put("订单编号", dmOrderRecord.getOrderItem().getBh());//
             map.put("实付金额", dmOrderRecord.getMoney());
             map.put("用户姓名", dmOrderRecord.getUserName());
             map.put("人员种类", dmOrderRecord.getUserType());
             map.put("用户手机号", dmOrderRecord.getPhone());
-            map.put("下单时间", dmOrderRecord.getOrderTime());
+            map.put("下单时间", dmOrderRecord.getCreateDate());
             map.put("合计金额", dmOrderRecord.getTotalMoney());
             map.put("折扣", dmOrderRecord.getZkMoney());
             list.add(map);
         }
         FileUtil.downloadExcel(list, response);
     }
+
+    @Override
+    public Map<String, Object> panelGroup() {
+        Integer orderQuantity=dmOrderRecordRepository.countOrderQuantity();
+        Integer income=dmOrderRecordRepository.countIncome();
+        Integer consumerNumber=dmOrderRecordRepository.countConsumerNumber();
+        Integer dishesNumber=dmDayPcRepository.countDishesNumber();
+        Map<String,Object> map =new HashMap<>();
+        map.put("orderQuantity",orderQuantity);
+        map.put("income",income);
+        map.put("consumerNumber",consumerNumber);
+        map.put("dishesNumber",dishesNumber);
+        return map;
+    }
 }

+ 4 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/domain/DmServicePj.java

@@ -93,6 +93,10 @@ public class DmServicePj implements Serializable {
     @ApiModelProperty(value = "意见建议")
     private String remark;
 
+    @Column(name = "enabled")
+    @ApiModelProperty(value = "是否启用")
+    private String enabled;
+
     public void copy(DmServicePj source){
         BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
     }

+ 15 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/repository/DmServicePjRepository.java

@@ -15,9 +15,16 @@
 */
 package me.zhengjie.modules.dm.service.repository;
 
+import me.zhengjie.modules.dm.device.domain.DmDevice;
 import me.zhengjie.modules.dm.service.domain.DmServicePj;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
 * @website https://el-admin.vip
@@ -25,4 +32,12 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 * @date 2021-09-15
 **/
 public interface DmServicePjRepository extends JpaRepository<DmServicePj, Integer>, JpaSpecificationExecutor<DmServicePj> {
+    /**
+     * 状态修改
+     * @param enabled
+     */
+    @Transactional
+    @Modifying
+    @Query(value = " update dm_service_pj set enabled = ?1 ",nativeQuery = true)
+    void updatePj(String enabled);
 }

+ 9 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/rest/DmServicePjController.java

@@ -28,6 +28,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import io.swagger.annotations.*;
 import java.io.IOException;
+import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
 /**
@@ -76,6 +77,14 @@ public class DmServicePjController {
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @PutMapping(value = "/updatePj")
+    @Log("修改状态")
+    @ApiOperation("修改状态")
+    public ResponseEntity<Object> updatePj(@Validated @RequestBody String resources){
+        dmServicePjService.updatePj(resources);
+        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+    }
+
     @Log("删除servicePj")
     @ApiOperation("删除servicePj")
     @PreAuthorize("@el.check('dmServicePj:del')")

+ 13 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/DmServicePjService.java

@@ -61,12 +61,25 @@ public interface DmServicePjService {
     */
     DmServicePjDto create(DmServicePj resources);
 
+    /**
+     * 创建
+     * @param resources /
+     * @return DmServicePjDto
+     */
+    DmServicePjDto createApp(DmServicePj resources);
+
     /**
     * 编辑
     * @param resources /
     */
     void update(DmServicePj resources);
 
+    /**
+     * 修改整体评价的状态
+     * @param resources /
+     */
+    void updatePj(String resources);
+
     /**
     * 多选删除
     * @param ids /

+ 2 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/dto/DmServicePjDto.java

@@ -65,4 +65,6 @@ public class DmServicePjDto implements Serializable {
 
     /** 意见建议 */
     private String remark;
+
+    private String enabled;
 }

+ 15 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/service/service/impl/DmServicePjServiceImpl.java

@@ -75,6 +75,14 @@ public class DmServicePjServiceImpl implements DmServicePjService {
         return dmServicePjMapper.toDto(dmServicePjRepository.save(resources));
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public DmServicePjDto createApp(DmServicePj resources) {
+//        resources.setUserName(resources.getFoodName());
+//        resources.setUserCode(resources.getFoodName());
+        return dmServicePjMapper.toDto(dmServicePjRepository.save(resources));
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void update(DmServicePj resources) {
@@ -84,6 +92,13 @@ public class DmServicePjServiceImpl implements DmServicePjService {
         dmServicePjRepository.save(dmServicePj);
     }
 
+    @Override
+    public void updatePj(String resources) {
+//        for (DmServicePj dmServicePj: resources){
+            dmServicePjRepository.updatePj(resources);
+//        }
+    }
+
     @Override
     public void deleteAll(Integer[] ids) {
         for (Integer id : ids) {

+ 8 - 8
eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmEvaluateRepository.java

@@ -18,12 +18,12 @@ public interface DmEvaluateRepository extends JpaRepository<DmEvaluate,Integer>,
      * @param pageable
      * @return
      */
-    @Query(nativeQuery =true,value = "SELECT id,wd_point,pz_point,fl_point,fwtd_point,hjws_point,zhfw_point,cxgj_point,total_point, CONCAT( pj_time, '-01-01 00:00:00' ) pj_time from ( " +
-            "SELECT @id \\:= @id+1 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(total_point) total_point," +
+    @Query(nativeQuery =true,value = "SELECT id,format(wd_point,0) wd_point,format(pz_point,0) pz_point,format(fl_point,0) fl_point,format(fwtd_point,0) fwtd_point,format(hjws_point,0) hjws_point,format(zhfw_point,0) zhfw_point,format(cxgj_point,0) cxgj_point,format(total_point,0) total_point,CONCAT( pj_time, '-01-01 00:00:00' ) pj_time from ( " +
+            "SELECT @id \\:= @id+1 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(wd_point + pz_point + fl_point + fwtd_point + hjws_point + zhfw_point + cxgj_point)/7 total_point," +
             " DATE_FORMAT(pj_time,'%Y') pj_time FROM (SELECT @id \\:=0) r,dm_service_pj WHERE if(:stateDate != '' and :endDate !='',pj_time between :endDate and :stateDate,1=1) GROUP BY  DATE_FORMAT(pj_time,'%Y')  "+
             ") a ",
-            countQuery =  "SELECT count (*) from ( " +
-                    "SELECT 0 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(total_point) total_point," +
+            countQuery =  "SELECT count(*) from ( " +
+                    "SELECT 0 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(wd_point + pz_point + fl_point + fwtd_point + hjws_point + zhfw_point + cxgj_point)/7 total_point," +
                     " DATE_FORMAT(pj_time,'%Y') pj_time FROM dm_service_pj WHERE if(:stateDate != '' and :endDate !='',pj_time between :endDate and :stateDate,1=1) GROUP BY  DATE_FORMAT(pj_time,'%Y')  "+
                     ") a ")
     Page<DmEvaluate> selectYearServicePj (@Param("stateDate") String stateDate, @Param("endDate") String endDate, Pageable pageable);
@@ -34,12 +34,12 @@ public interface DmEvaluateRepository extends JpaRepository<DmEvaluate,Integer>,
      * @param pageable
      * @return
      */
-    @Query(nativeQuery =true,value = " SELECT id,wd_point,pz_point,fl_point,fwtd_point,hjws_point,zhfw_point,cxgj_point,total_point, CONCAT( pj_time, '-01 00:00:00' ) pj_time  from ( " +
-            " SELECT @id \\:= @id+1 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(total_point) total_point," +
+    @Query(nativeQuery =true,value = " SELECT id,format(wd_point,0) wd_point,format(pz_point,0) pz_point,format(fl_point,0) fl_point,format(fwtd_point,0) fwtd_point,format(hjws_point,0) hjws_point,format(zhfw_point,0) zhfw_point,format(cxgj_point,0) cxgj_point,format(total_point,0) total_point,CONCAT( pj_time, '-01 00:00:00' ) pj_time from ( " +
+            " SELECT @id \\:= @id+1 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(wd_point + pz_point + fl_point + fwtd_point + hjws_point + zhfw_point + cxgj_point)/7 total_point," +
             " DATE_FORMAT(pj_time,'%Y-%m') pj_time FROM (SELECT @id \\:=0) r,dm_service_pj WHERE if(:stateDate != '' and :endDate !='',pj_time between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(pj_time,'%Y-%m')  "+
             ") a ",
-            countQuery =  "SELECT count (*) from ( " +
-                    "SELECT 0 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(total_point) total_point," +
+            countQuery =  "SELECT count(*) from ( " +
+                    "SELECT 0 as id,AVG(wd_point) wd_point,AVG(pz_point) pz_point,AVG(fl_point) fl_point,AVG(fwtd_point) fwtd_point,AVG(hjws_point) hjws_point,AVG(zhfw_point) zhfw_point,AVG(cxgj_point) cxgj_point,AVG(wd_point + pz_point + fl_point + fwtd_point + hjws_point + zhfw_point + cxgj_point)/7 total_point," +
                     " DATE_FORMAT(pj_time,'%Y-%m') pj_time FROM dm_service_pj WHERE if(:stateDate != '' and :endDate !='',pj_time between :endDate and :stateDate,1=1) GROUP BY  DATE_FORMAT(pj_time,'%Y-%m')  "+
                     ") a ")
     Page<DmEvaluate> selectMonthServicePj (@Param("stateDate") String stateDate, @Param("endDate") String endDate, Pageable pageable);

+ 20 - 20
eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmHaveDinnerRepository.java

@@ -52,18 +52,18 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zgmonth as " +
-            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(order_time,'%Y-%m') time  FROM `dm_order_item` i " +
+            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%m') time  FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zg_name` " +
             "ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
     void addZgMonth(String stateDate,String endDate);
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zdmonth as " +
-            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(order_time,'%Y-%m') time FROM `dm_order_item` i " +
+            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%m') time FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zd_name` " +
             "ORDER BY time DESC,SUM(num) ASC ",nativeQuery = true)
     void addZdMonth(String stateDate,String endDate);
@@ -71,18 +71,18 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zgyear as " +
-            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(order_time,'%Y') time  FROM `dm_order_item` i " +
+            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y') time  FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zg_name` " +
             "ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
     void addZgYear(String stateDate,String endDate);
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zdyear as " +
-            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(order_time,'%Y') time FROM `dm_order_item` i " +
+            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y') time FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zd_name` " +
             "ORDER BY time DESC,SUM(num) ASC ",nativeQuery = true)
     void addZdYear(String stateDate,String endDate);
@@ -90,38 +90,38 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zgday as " +
-            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(order_time,'%Y-%m-%d') time  FROM `dm_order_item` i " +
+            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%m-%d') time  FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zg_name` " +
             "ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
     void addZgDay(String stateDate,String endDate);
 //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zdday as " +
-            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(order_time,'%Y-%m-%d') time FROM `dm_order_item` i " +
+            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%m-%d') time FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
             "GROUP BY time,`zd_name` " +
             "ORDER BY time DESC,SUM(num) ASC ",nativeQuery = true)
     void addZdDay(String stateDate,String endDate);
 
     @Modifying
     @Query(value = "CREATE VIEW  zgweek as " +
-            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(order_time,'%Y-%u') week_time  FROM `dm_order_item` i " +
+            "SELECT  i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%u') week_time  FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
-            "GROUP BY DATE_FORMAT(order_time,'%u'),`zg_name` " +
-            "ORDER BY DATE_FORMAT(order_time,'%u') DESC,SUM(num) DESC ",nativeQuery = true)
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
+            "GROUP BY DATE_FORMAT(create_date,'%u'),`zg_name` " +
+            "ORDER BY DATE_FORMAT(create_date,'%u') DESC,SUM(num) DESC ",nativeQuery = true)
     void addZgWeek(String stateDate,String endDate);
     //    @Transactional
     @Modifying
     @Query(value = "CREATE VIEW  zdweek as " +
-            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(order_time,'%Y-%u') week_time FROM `dm_order_item` i " +
+            "SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%u') week_time FROM `dm_order_item` i " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
-            "WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) " +
-            "GROUP BY DATE_FORMAT(order_time,'%u'),`zd_name` " +
-            "ORDER BY DATE_FORMAT(order_time,'%u') DESC,SUM(num) ASC ",nativeQuery = true)
+            "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
+            "GROUP BY DATE_FORMAT(create_date,'%u'),`zd_name` " +
+            "ORDER BY DATE_FORMAT(create_date,'%u') DESC,SUM(num) ASC ",nativeQuery = true)
     void addZdWeek(String stateDate,String endDate);
 
     /**

+ 10 - 10
eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmStatementRepository.java

@@ -18,12 +18,12 @@ public interface DmStatementRepository extends JpaRepository<DmStatement, Intege
      * @return
      */
     @Query(nativeQuery =true,value = " SELECT id,name,money,avg_money,CONCAT(order_time,'-01-01 00:00:00') order_time from ( " +
-            " SELECT @id \\:= @id+1 as id,b.name,SUM(money) money,AVG(money) avg_money, DATE_FORMAT( order_time, '%Y' ) order_time FROM (SELECT @id \\:=0) r,dm_order_record a  LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
-            " WHERE  if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(order_time,'%Y'),b.name" +
+            " SELECT @id \\:= @id+1 as id,b.name,SUM(money) money,AVG(money) avg_money, DATE_FORMAT( create_date, '%Y' ) order_time FROM (SELECT @id \\:=0) r,dm_order_record a  LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
+            " WHERE  if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(create_date,'%Y'),b.name" +
             ") a ",
-            countQuery =  "SELECT count (*) from ( " +
-                    "SELECT 0 as id,b.name,SUM(money),AVG(money) avg_money,DATE_FORMAT( order_time, '%Y' ) order_time FROM dm_order_record a LEFT JOIN sys_dept b ON a.dept_id = b.dept_id " +
-                    " WHERE if(:stateDate != '' and :endDate !='',DATE_FORMAT(order_time,'%Y') between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(order_time,'%Y'),b.name" +
+            countQuery =  "SELECT count(*) from ( " +
+                    "SELECT 0 as id,b.name,SUM(money),AVG(money) avg_money,DATE_FORMAT( create_date, '%Y' ) order_time FROM dm_order_record a LEFT JOIN sys_dept b ON a.dept_id = b.dept_id " +
+                    " WHERE if(:stateDate != '' and :endDate !='',DATE_FORMAT(create_date,'%Y') between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(create_date,'%Y'),b.name" +
                     ") a ")
     Page<DmStatement> selectYearStatement (@Param("stateDate") String stateDate, @Param("endDate") String endDate, Pageable pageable);
     /**
@@ -33,12 +33,12 @@ public interface DmStatementRepository extends JpaRepository<DmStatement, Intege
      * @return
      */
     @Query(nativeQuery =true,value = " SELECT id,name,money,avg_money,CONCAT(order_time,'-01 00:00:00') order_time from ( " +
-            " SELECT @id \\:= @id+1 as id,b.name,SUM(money) money,AVG(money) avg_money, DATE_FORMAT( order_time, '%Y-%m' ) order_time FROM (SELECT @id \\:=0) r,dm_order_record a  LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
-            " WHERE  if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(order_time,'%Y-%m'),b.name" +
+            " SELECT @id \\:= @id+1 as id,b.name,SUM(money) money,AVG(money) avg_money, DATE_FORMAT( create_date, '%Y-%m' ) order_time FROM (SELECT @id \\:=0) r,dm_order_record a  LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
+            " WHERE  if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(create_date,'%Y-%m'),b.name" +
             ") a ",
-            countQuery =  "SELECT count (*) from ( " +
-                    "SELECT 0 as id,b.name,SUM(money),AVG(money) avg_money,DATE_FORMAT( order_time, '%Y-%m' ) order_time FROM dm_order_record a LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
-                    " WHERE if(:stateDate != '' and :endDate !='',order_time between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(order_time,'%Y-%m'),b.name" +
+            countQuery =  "SELECT count(*) from ( " +
+                    "SELECT 0 as id,b.name,SUM(money),AVG(money) avg_money,DATE_FORMAT( create_date, '%Y-%m' ) order_time FROM dm_order_record a LEFT JOIN sys_dept b ON a.dept_id=b.dept_id " +
+                    " WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) GROUP BY DATE_FORMAT(create_date,'%Y-%m'),b.name" +
                     ") a ")
     Page<DmStatement> selectMonthStatement (@Param("stateDate") String stateDate, @Param("endDate") String endDate, Pageable pageable);
 }

+ 0 - 33
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/AppDaypcController.java

@@ -1,33 +0,0 @@
-package me.zhengjie.modules.dmApp;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import me.zhengjie.annotation.AnonymousAccess;
-import me.zhengjie.annotation.Log;
-import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
-import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcQueryCriteria;
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequiredArgsConstructor
-@Api(tags = "App 排菜接口")
-@RequestMapping("/app/daypc")
-public class AppDaypcController {
-
-    private final DmDayPcService dmDayPcService;
-
-    @AnonymousAccess
-    @GetMapping
-    @Log("查询daypc")
-    @ApiOperation("查询daypc")
-    public ResponseEntity<Object> query(DmDayPcQueryCriteria criteria, Pageable pageable){
-        return new ResponseEntity<>(dmDayPcService.queryAll(criteria,pageable), HttpStatus.OK);
-    }
-
-}

+ 59 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/domain/AppFoodPj.java

@@ -0,0 +1,59 @@
+package me.zhengjie.modules.dmApp.domain;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import me.zhengjie.modules.dm.statement.domain.DmEvaluate;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.Date;
+
+@Entity
+@Data
+@Table(name="app_food_pj")
+public class AppFoodPj implements Serializable {
+    @Id
+    @Column(name = "id")
+    @ApiModelProperty(value = "id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)//设置自增
+    private Integer id;
+
+    @Column(name = "name")
+    @ApiModelProperty(value = "菜品名称")
+    private String name;
+
+    @Column(name = "picture")
+    @ApiModelProperty(value = "菜品图片")
+    private String picture;
+
+    @Column(name = "user_code")
+    @ApiModelProperty(value = "用户id")
+    private String userCode;
+
+    @Column(name = "bh")
+    @ApiModelProperty(value = "订单编号")
+    private String bh;
+
+    @Column(name = "code")
+    @ApiModelProperty(value = "菜品编号")
+    private String code;
+
+    @Column(name = "type")
+    @ApiModelProperty(value = "菜品类型")
+    private String type;
+
+    @Column(name = "order_time")
+    @ApiModelProperty(value = "下单时间")
+    private Timestamp orderTime;
+
+    public void copy(AppFoodPj source){
+        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+    }
+    @PrePersist
+    public void prePersist() {
+        this.orderTime = new Timestamp(new Date().getTime());
+    }
+}

+ 21 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/repository/AppFoodPjRepository.java

@@ -0,0 +1,21 @@
+package me.zhengjie.modules.dmApp.repository;
+
+import me.zhengjie.modules.dmApp.domain.AppFoodPj;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+public interface AppFoodPjRepository extends JpaRepository<AppFoodPj,Integer>, JpaSpecificationExecutor<AppFoodPj> {
+    /**
+     * 菜品评价 app
+     * @param
+     * @return
+     */
+    @Query(nativeQuery =true,value = "SELECT a.id,b.`name`,b.`code`,b.type,c.create_date as order_time,c.bh,b.picture,user_code FROM dm_order_item a " +
+            "LEFT JOIN dm_food b ON a.`code` = b.`code` LEFT JOIN dm_order_record c ON a.bh=c.bh " +
+            "WHERE c.user_code=:userCode and a.pj_type='0' and date_format( create_date, '%Y-%m-%d' ) = date_format(now(),'%Y-%m-%d') ")
+    List<AppFoodPj> selectAppFoodPj (@Param("userCode") String userCode);
+}

+ 4 - 5
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/AppDmServicePjController.java → eladmin-system/src/main/java/me/zhengjie/modules/dmApp/rest/AppDmServicePjController.java

@@ -1,4 +1,4 @@
-package me.zhengjie.modules.dmApp;
+package me.zhengjie.modules.dmApp.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -24,12 +24,11 @@ public class AppDmServicePjController {
 
     private final DmServicePjService dmServicePjService;
 
-    @AnonymousAccess
-    @PostMapping
+    @PostMapping(value = "/createApp")
     @Log("新增服务评价")
     @ApiOperation("新增服务评价")
-    public ResponseEntity<Object> create(@Validated @RequestBody DmServicePj resources){
-        return new ResponseEntity<>(dmServicePjService.create(resources), HttpStatus.OK);
+    public ResponseEntity<Object> createApp(@Validated @RequestBody DmServicePj resources){
+        return new ResponseEntity<>(dmServicePjService.createApp(resources), HttpStatus.OK);
     }
 
 }

+ 49 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/rest/AppFoodPjController.java

@@ -0,0 +1,49 @@
+package me.zhengjie.modules.dmApp.rest;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.annotation.AnonymousAccess;
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.dm.daypc.service.DmDayPcService;
+import me.zhengjie.modules.dm.daypc.service.dto.DmDayPcQueryCriteria;
+import me.zhengjie.modules.dm.foodPj.domain.DmFoodPj;
+import me.zhengjie.modules.dm.foodPj.service.DmFoodPjService;
+import me.zhengjie.modules.dmApp.service.AppFoodPjService;
+import org.springframework.data.domain.Pageable;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "App 排菜接口")
+@RequestMapping("/app/daypc")
+public class AppFoodPjController {
+    private final AppFoodPjService appFoodPjService;
+    private final DmFoodPjService dmFoodPjService;
+
+    @GetMapping(value = "/appFoodPj")
+    @Log("App菜品评价")
+    @ApiOperation("App菜品评价")
+    public ResponseEntity<Object> appFoodPj(String userCode) {
+        return new ResponseEntity<>(appFoodPjService.selectAppFoodPj(userCode), HttpStatus.OK);
+    }
+
+    @PostMapping(value = "/createApp")
+    @Log("新增foodPj")
+    @ApiOperation("新增foodPj")
+    public ResponseEntity<Object> createApp(@Validated @RequestBody DmFoodPj resources){
+        return new ResponseEntity<>(dmFoodPjService.createApp(resources),HttpStatus.CREATED);
+    }
+
+//    @AnonymousAccess
+//    @GetMapping
+//    @Log("查询daypc")
+//    @ApiOperation("查询daypc")
+//    public ResponseEntity<Object> query(DmDayPcQueryCriteria criteria, Pageable pageable) {
+//        return new ResponseEntity<>(dmDayPcService.queryAll(criteria,pageable), HttpStatus.OK);
+//    }
+
+}

+ 14 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/AppFoodPjService.java

@@ -0,0 +1,14 @@
+package me.zhengjie.modules.dmApp.service;
+
+import me.zhengjie.modules.dmApp.domain.AppFoodPj;
+
+import java.util.List;
+
+public interface AppFoodPjService {
+    /**
+     * 菜品评价 APP
+     * @param userCode
+     * @return
+     */
+    List<AppFoodPj> selectAppFoodPj (String userCode);
+}

+ 32 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/dto/AppFoodPjDto.java

@@ -0,0 +1,32 @@
+package me.zhengjie.modules.dmApp.service.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@Data
+public class AppFoodPjDto implements Serializable {
+    private Integer id;
+
+    //菜品名称
+    private String name;
+
+    //菜品图片
+    private String picture;
+
+    private String userCode;
+
+    private String bh;
+
+    //菜品编号")
+    private String code;
+
+    //菜品类型")
+    private String type;
+
+    //下单时间")
+    private Timestamp orderTime;
+}

+ 10 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/dto/AppFoodPjQueryCriteria.java

@@ -0,0 +1,10 @@
+package me.zhengjie.modules.dmApp.service.dto;
+
+import lombok.Data;
+import me.zhengjie.annotation.Query;
+
+@Data
+public class AppFoodPjQueryCriteria {
+    @Query
+    private String userCode;
+}

+ 20 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/impl/AppFoodPjServiceImpl.java

@@ -0,0 +1,20 @@
+package me.zhengjie.modules.dmApp.service.impl;
+
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.dmApp.domain.AppFoodPj;
+import me.zhengjie.modules.dmApp.repository.AppFoodPjRepository;
+import me.zhengjie.modules.dmApp.service.AppFoodPjService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@RequiredArgsConstructor
+public class AppFoodPjServiceImpl implements AppFoodPjService {
+    private final AppFoodPjRepository appFoodPjRepository;
+
+    @Override
+    public List<AppFoodPj> selectAppFoodPj(String userCode) {
+        return appFoodPjRepository.selectAppFoodPj(userCode);
+    }
+}

+ 11 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dmApp/service/mapstruct/AppFoodPjMapper.java

@@ -0,0 +1,11 @@
+package me.zhengjie.modules.dmApp.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.dmApp.domain.AppFoodPj;
+import me.zhengjie.modules.dmApp.service.dto.AppFoodPjDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface AppFoodPjMapper extends BaseMapper<AppFoodPjDto, AppFoodPj> {
+}

+ 30 - 0
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java

@@ -21,6 +21,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.annotation.AnonymousAccess;
+import me.zhengjie.annotation.Log;
 import me.zhengjie.annotation.rest.AnonymousDeleteMapping;
 import me.zhengjie.annotation.rest.AnonymousGetMapping;
 import me.zhengjie.annotation.rest.AnonymousPostMapping;
@@ -106,6 +108,34 @@ public class AuthorizationController {
         return ResponseEntity.ok(authInfo);
     }
 
+    @GetMapping(value = "/login2")
+    @Log("登录")
+    @ApiOperation("登录")
+    @AnonymousAccess
+    public ResponseEntity<Object> login2(String username, HttpServletRequest request)throws Exception {
+        // 密码解密
+        String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, "xacy4R9bjxrtoFamboN7Hi083pqqkul3+11NGYxwx2v9ZxsJ5pvopViUtGeB3Rv05Seb7fsaAs3I7YBzIc/vag==");
+        UsernamePasswordAuthenticationToken authenticationToken =
+                new UsernamePasswordAuthenticationToken(username, password);
+        Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
+        SecurityContextHolder.getContext().setAuthentication(authentication);
+        // 生成令牌
+        String token = tokenProvider.createToken(authentication);
+        final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
+        // 保存在线信息
+        onlineUserService.save(jwtUserDto, token, request);
+        // 返回 token 与 用户信息
+        Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
+            put("token", properties.getTokenStartWith() + token);
+            put("user", jwtUserDto);
+        }};
+        if (loginProperties.isSingleLogin()) {
+            //踢掉之前已经登录的token
+            onlineUserService.checkLoginOnUser(username, token);
+        }
+        return ResponseEntity.ok(authInfo);
+    }
+
     @ApiOperation("获取用户信息")
     @GetMapping(value = "/info")
     public ResponseEntity<Object> getUserInfo() {