Explorar o código

根据分类显示今日排菜,报表的金额类型

he.dujuan %!s(int64=3) %!d(string=hai) anos
pai
achega
86dae51e8e

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/config/rabbitmq/test/ListenerTemplate.java

@@ -58,6 +58,7 @@ public class ListenerTemplate {
                 DmDayPc dmDayPc = new DmDayPc();
 
                 dmDayPc.setId(snowflake.nextId());
+                dmDayPc.setCpid(attendance.getLong("id"));
                 dmDayPc.setTimes(attendance.getString("times"));
                 dmDayPc.setPrice(attendance.getBigDecimal("price"));
                 dmDayPc.setQtyBook(attendance.getString("qty_book"));

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

@@ -54,11 +54,11 @@ public class DmDayPc implements Serializable {
 //    private DmFood food;
     private Long pid;
 
-    @OneToOne
-    @JoinColumn(name = "id",referencedColumnName = "id")
+//    @OneToOne
+    @Column(name = "id")//,referencedColumnName = "id"
     @ApiModelProperty(value = "餐盘id")
-    private DmRfidTableware rfidTableware;
-//    private Integer cpid;
+//    private DmRfidTableware rfidTableware;
+    private Long cpid;
 
     @Column(name = "name")
     @ApiModelProperty(value = "菜品名称")

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

@@ -39,15 +39,20 @@ public interface DmDayPcRepository extends JpaRepository<DmDayPc, Long>, JpaSpec
 //            "WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') ",nativeQuery = true)
 //    List<DmDayPc> foodRepository();
 
-    @Query(value = "SELECT DISTINCT a.`pcid`, a.`pid`, a.`id`, a.`name`, a.`price`, `times`,a.`cate`, a.`cate_name`, a.`state`," +
-            " `window`,`window_name`, a.`pstate`, a.`barcode`, a.`no`, a.`goods`, a.`pinyin`, a.`qty_book`, `seq`, `date`," +
-            " `shopname`,0 as cate_id,0 as pid,NULL as cate_name,null as picture,null as create_by,null as update_by," +
-            "null as create_time,null as update_time,NULL AS `storage_id`, NULL AS `real_name`, NULL AS `name`, NULL AS `suffix`," +
-            " NULL AS `path`, NULL AS `url`, NULL AS `type`, NULL AS `size`, NULL AS `create_by`, NULL AS `update_by`," +
-            " NULL AS `create_time`, NULL AS `update_time` FROM dm_day_pc a LEFT JOIN dm_food_cate c ON a.cate = c.cate_id " +
-            "LEFT JOIN tool_local_storage s ON c.url = s.storage_id " +
-            "WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')",nativeQuery = true)
-    List<DmDayPc> foodRepository();
+//    @Query(value = "SELECT DISTINCT a.`pcid`, a.`pid`, a.`id`, a.`name`, a.`price`, `times`,a.`cate`, a.`cate_name`, a.`state`," +
+//            " `window`,`window_name`, a.`pstate`, a.`barcode`, a.`no`, a.`goods`, a.`pinyin`, a.`qty_book`, `seq`, `date`," +
+//            " `shopname`,0 as cate_id,0 as pid,NULL as cate_name,null as picture,null as create_by,null as update_by," +
+//            "null as create_time,null as update_time,NULL AS `storage_id`, NULL AS `real_name`, NULL AS `name`, NULL AS `suffix`," +
+//            " NULL AS `path`, NULL AS `url`, NULL AS `type`, NULL AS `size`, NULL AS `create_by`, NULL AS `update_by`," +
+//            " NULL AS `create_time`, NULL AS `update_time` FROM dm_day_pc a LEFT JOIN dm_food_cate c ON a.cate = c.cate_id " +
+//            "LEFT JOIN tool_local_storage s ON c.url = s.storage_id " +
+//            "WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')",nativeQuery = true)
+//    List<DmDayPc> foodRepository();
+
+    @Query(value = "SELECT p.pcid,p.`name`,cate_id,c.cate_name,t.url,p.price,COUNT(p.`name`) AS `no` FROM dm_day_pc p " +
+            "LEFT JOIN dm_food_cate c ON c.cate_id = p.cate LEFT JOIN tool_local_storage t ON " +
+            "c.url = t.storage_id WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') GROUP BY p.`name`",nativeQuery = true)
+    List<Map<String,Object>> foodRepository();
 
     /**
      * 今日菜品数量

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

@@ -86,5 +86,5 @@ public interface DmDayPcService {
      * 今日菜品
      * @return
      */
-    List<DmDayPc> foodRepository();
+    List<Map<String,Object>> foodRepository();
 }

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

@@ -46,8 +46,8 @@ public class DmDayPcDto implements Serializable {
 //    private DmFood food;
 
     /** 餐盘id */
-//    private Integer cpid;
-    private DmRfidTableware rfidTableware;
+    private Long cpid;
+//    private DmRfidTableware rfidTableware;
 
     /** 菜品名称 */
     private String name;

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

@@ -30,9 +30,9 @@ public class DmDayPcQueryCriteria{
 
     /** 模糊 */
 //    @Query(type = Query.Type.INNER_LIKE)
-//    private Integer cpid;
-    @Query(propName = "name",  joinName = "rfidTableware")//type = Query.Type.INNER_LIKE,
-    private String rfName;
+//    private Long cpid;
+//    @Query(propName = "name",  joinName = "rfidTableware")//type = Query.Type.INNER_LIKE,
+//    private String rfName;
 
     /** 模糊 */
     @Query(type = Query.Type.INNER_LIKE)

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

@@ -118,7 +118,7 @@ public class DmDayPcServiceImpl implements DmDayPcService {
     }
 
     @Override
-    public List<DmDayPc> foodRepository() {
+    public List<Map<String,Object>> foodRepository() {
         return dmDayPcRepository.foodRepository();
     }
 }

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/foodCate/repository/DmFoodCateRepository.java

@@ -34,9 +34,9 @@ import java.util.Map;
 **/
 public interface DmFoodCateRepository extends JpaRepository<DmFoodCate, Integer>, JpaSpecificationExecutor<DmFoodCate> {
 
-    @Query(value = "SELECT p.pcid,p.`name`,cate_id,c.cate_name,t.url,p.price FROM dm_day_pc p " +
+    @Query(value = "SELECT p.pcid,p.`name`,cate_id,c.cate_name,t.url,p.price,COUNT(p.`name`) AS `no` FROM dm_day_pc p " +
             "LEFT JOIN dm_food_cate c ON c.cate_id = p.cate LEFT JOIN tool_local_storage t ON " +
-            "c.url = t.storage_id WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')",nativeQuery = true)
+            "c.url = t.storage_id WHERE date_format(date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') GROUP BY p.`name`",nativeQuery = true)
     List<Map<String,Object>> foodApp();
 
     /**

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

@@ -133,7 +133,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgmonth b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgMonth(Pageable pageable);
-    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, '-01 00:00:00' ) time,money,zd_name,zd_num,week_time FROM("+
+    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, '-01 00:00:00' ) time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+
             "SELECT @id \\:= @id+1 as id,null as zg_name,0 as zg_num,time,money,zd_name,zd_num,null as week_time from zdmonth a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdmonth b WHERE a.time = b.time and a.zd_num > b.zd_num))a ",
             countQuery="select count(*) from(" +
@@ -150,7 +150,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgyear b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgYear(Pageable pageable);
-    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, '-01-01 00:00:00' ) time,money,zd_name,zd_num,week_time FROM("+
+    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, '-01-01 00:00:00' ) time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+
             "SELECT @id \\:= @id+1 as id,zd_name,zd_num,time,money,null as zg_name,0 as zg_num,null as week_time from zdyear a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdyear b WHERE a.time = b.time and a.zd_num > b.zd_num))a ",
             countQuery="select count(*) from(" +
@@ -167,7 +167,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgday b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgDay(Pageable pageable);
-    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, ' 00:00:00' ) time,money,zd_name,zd_num,week_time FROM("+
+    @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, ' 00:00:00' ) time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+
             "SELECT @id \\:= @id+1 as id,zd_name,zd_num,time,money,null as zg_name,0 as zg_num,null as week_time from zdday a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdday b WHERE a.time = b.time and a.zd_num > b.zd_num))a ",
             countQuery="select count(*) from(" +
@@ -184,7 +184,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgweek b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgWeek(Pageable pageable);
-    @Query(value = "SELECT id,zg_name,zg_num, time,money,zd_name,zd_num,week_time FROM("+//CONCAT( time, '-00 00:00:00' )
+    @Query(value = "SELECT id,zg_name,zg_num, time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+//CONCAT( time, '-00 00:00:00' )
             "SELECT @id \\:= @id+1 as id,zd_name,zd_num,null as time,money,null as zg_name,0 as zg_num,week_time from zdweek a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdweek b WHERE a.week_time = b.week_time and a.zd_num > b.zd_num))a ",
             countQuery="select count(*) from(" +

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

@@ -18,7 +18,7 @@ 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( 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 " +
+            " SELECT @id \\:= @id+1 as id,b.name,CAST(SUM(money) AS DECIMAL(15,2)) money,CAST(AVG(money) AS DECIMAL(15,2)) 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 ( " +
@@ -33,7 +33,7 @@ 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( 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 " +
+            " SELECT @id \\:= @id+1 as id,b.name,CAST(SUM(money) AS DECIMAL(15,2)) money,CAST(AVG(money) AS DECIMAL(15,2)) 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 ( " +