Commit b16632ea410dfa81c79219c005068563ac37b522

Authored by 芋道源码
Committed by Gitee
2 parents 6b1d996b 26f563df

!522 mall seckill

Merge pull request !522 from puhui999/feature/mall_product
Showing 110 changed files with 1903 additions and 1449 deletions

Too many changes.

To preserve performance only 100 of 110 files are displayed.

sql/dm/ruoyi-vue-pro-dm8.sql
... ... @@ -1797,27 +1797,112 @@ INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT"
1797 1797 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2046,'满减送活动关闭','promotion:reward-activity:close',3,5,2041,'','','',null,0,1,1,1,'1','2022-11-05 10:42:53','1','2022-11-05 10:42:53',0);
1798 1798 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2047,'限时折扣活动','',2,7,2030,'discount-activity','time','mall/promotion/discountActivity/index','PromotionDiscountActivity',0,1,1,1,'','2022-11-05 17:12:15','1','2023-04-08 11:45:44',0);
1799 1799 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2048,'限时折扣活动查询','promotion:discount-activity:query',3,1,2047,'','','',null,0,1,1,1,'','2022-11-05 17:12:15','','2022-11-05 17:12:15',0);
1800   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2049,'限时折扣活动创建','promotion:discount-activity:create',3,2,2047,'','','',null,0,1,1,1,'','2022-11-05 17:12:15','','2022-11-05 17:12:15',0);
1801   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2050,'限时折扣活动更新','promotion:discount-activity:update',3,3,2047,'','','',null,0,1,1,1,'','2022-11-05 17:12:16','','2022-11-05 17:12:16',0);
1802   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2051,'限时折扣活动删除','promotion:discount-activity:delete',3,4,2047,'','','',null,0,1,1,1,'','2022-11-05 17:12:16','','2022-11-05 17:12:16',0);
1803   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2052,'限时折扣活动关闭','promotion:discount-activity:close',3,5,2047,'','','',null,0,1,1,1,'','2022-11-05 17:12:16','','2022-11-05 17:12:16',0);
1804   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2059,'秒杀活动管理','',2,0,2030,'seckill-activity','time-range','mall/promotion/seckill/seckillActivity/index','PromotionSeckillActivity',0,1,1,1,'','2022-11-06 22:24:49','1','2023-04-08 11:46:02',0);
1805   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2060,'秒杀活动查询','promotion:seckill-activity:query',3,1,2059,'','','',null,0,1,1,1,'','2022-11-06 22:24:49','','2022-11-06 22:24:49',0);
1806   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2061,'秒杀活动创建','promotion:seckill-activity:create',3,2,2059,'','','',null,0,1,1,1,'','2022-11-06 22:24:49','','2022-11-06 22:24:49',0);
1807   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2062,'秒杀活动更新','promotion:seckill-activity:update',3,3,2059,'','','',null,0,1,1,1,'','2022-11-06 22:24:49','','2022-11-06 22:24:49',0);
1808   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2063,'秒杀活动删除','promotion:seckill-activity:delete',3,4,2059,'','','',null,0,1,1,1,'','2022-11-06 22:24:49','','2022-11-06 22:24:49',0);
1809   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2064,'秒杀活动导出','promotion:seckill-activity:export',3,5,2059,'','','',null,0,1,1,1,'','2022-11-06 22:24:49','','2022-11-06 22:24:49',0);
1810   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2066,'秒杀时段管理','',2,0,2030,'seckill-time','','mall/promotion/seckill/seckillTime/index','PromotionSeckillTime',0,0,1,1,'','2022-11-15 19:46:50','1','2023-04-08 11:46:17',0);
1811   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2067,'秒杀时段查询','promotion:seckill-time:query',3,1,2066,'','','',null,0,1,1,1,'','2022-11-15 19:46:51','','2022-11-15 19:46:51',0);
1812   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2068,'秒杀时段创建','promotion:seckill-time:create',3,2,2066,'','','',null,0,1,1,1,'','2022-11-15 19:46:51','','2022-11-15 19:46:51',0);
1813   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2069,'秒杀时段更新','promotion:seckill-time:update',3,3,2066,'','','',null,0,1,1,1,'','2022-11-15 19:46:51','','2022-11-15 19:46:51',0);
1814   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2070,'秒杀时段删除','promotion:seckill-time:delete',3,4,2066,'','','',null,0,1,1,1,'','2022-11-15 19:46:51','','2022-11-15 19:46:51',0);
1815   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2071,'秒杀时段导出','promotion:seckill-time:export',3,5,2066,'','','',null,0,1,1,1,'','2022-11-15 19:46:51','','2022-11-15 19:46:51',0);
1816   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2072,'订单中心','',1,65,0,'/trade','order',null,null,0,1,1,1,'1','2022-11-19 18:57:19','1','2022-12-10 16:32:57',0);
1817   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2073,'售后退款','',2,1,2072,'trade/after-sale','education','mall/trade/afterSale/index','TradeAfterSale',0,1,1,1,'','2022-11-19 20:15:32','1','2023-04-08 11:43:19',0);
1818   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2074,'售后查询','trade:after-sale:query',3,1,2073,'','','',null,0,1,1,1,'','2022-11-19 20:15:33','1','2022-12-10 21:04:29',0);
1819   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2075,'秒杀活动关闭','promotion:sekill-activity:close',3,6,2059,'','','',null,0,1,1,1,'1','2022-11-28 20:20:15','1','2022-11-28 20:20:15',0);
1820   -INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2076,'订单列表','',2,0,2072,'trade/order','list','mall/trade/order/index','TradeOrder',0,1,1,1,'1','2022-12-10 21:05:44','1','2023-04-08 11:42:23',0);
  1800 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1801 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1802 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1803 +VALUES (2049, '限时折扣活动创建', 'promotion:discount-activity:create', 3, 2, 2047, '', '', '', null, 0, 1, 1, 1, '',
  1804 + '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', 0);
  1805 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1806 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1807 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1808 +VALUES (2050, '限时折扣活动更新', 'promotion:discount-activity:update', 3, 3, 2047, '', '', '', null, 0, 1, 1, 1, '',
  1809 + '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', 0);
  1810 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1811 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1812 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1813 +VALUES (2051, '限时折扣活动删除', 'promotion:discount-activity:delete', 3, 4, 2047, '', '', '', null, 0, 1, 1, 1, '',
  1814 + '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', 0);
  1815 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1816 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1817 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1818 +VALUES (2052, '限时折扣活动关闭', 'promotion:discount-activity:close', 3, 5, 2047, '', '', '', null, 0, 1, 1, 1, '',
  1819 + '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', 0);
  1820 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1821 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1822 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1823 +VALUES (2059, '秒杀活动管理', '', 2, 0, 2030, 'seckill-activity', 'time-range',
  1824 + 'mall/promotion/seckill/seckillActivity/index', 'PromotionSeckillActivity', 0, 1, 1, 1, '',
  1825 + '2022-11-06 22:24:49', '1', '2023-04-08 11:46:02', 0);
  1826 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1827 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1828 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1829 +VALUES (2060, '秒杀活动查询', 'promotion:seckill-activity:query', 3, 1, 2059, '', '', '', null, 0, 1, 1, 1, '',
  1830 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', 0);
  1831 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1832 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1833 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1834 +VALUES (2061, '秒杀活动创建', 'promotion:seckill-activity:create', 3, 2, 2059, '', '', '', null, 0, 1, 1, 1, '',
  1835 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', 0);
  1836 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1837 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1838 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1839 +VALUES (2062, '秒杀活动更新', 'promotion:seckill-activity:update', 3, 3, 2059, '', '', '', null, 0, 1, 1, 1, '',
  1840 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', 0);
  1841 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1842 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1843 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1844 +VALUES (2063, '秒杀活动删除', 'promotion:seckill-activity:delete', 3, 4, 2059, '', '', '', null, 0, 1, 1, 1, '',
  1845 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', 0);
  1846 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1847 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1848 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1849 +VALUES (2064, '秒杀活动导出', 'promotion:seckill-activity:export', 3, 5, 2059, '', '', '', null, 0, 1, 1, 1, '',
  1850 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', 0);
  1851 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1852 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1853 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1854 +VALUES (2066, '秒杀时段管理', '', 2, 0, 2030, 'seckill-time', '', 'mall/promotion/seckill/SeckillConfig/index',
  1855 + 'PromotionSeckillConfig', 0, 0, 1, 1, '', '2022-11-15 19:46:50', '1', '2023-04-08 11:46:17', 0);
  1856 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1857 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1858 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1859 +VALUES (2067, '秒杀时段查询', 'promotion:seckill-time:query', 3, 1, 2066, '', '', '', null, 0, 1, 1, 1, '',
  1860 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', 0);
  1861 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1862 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1863 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1864 +VALUES (2068, '秒杀时段创建', 'promotion:seckill-time:create', 3, 2, 2066, '', '', '', null, 0, 1, 1, 1, '',
  1865 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', 0);
  1866 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1867 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1868 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1869 +VALUES (2069, '秒杀时段更新', 'promotion:seckill-time:update', 3, 3, 2066, '', '', '', null, 0, 1, 1, 1, '',
  1870 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', 0);
  1871 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1872 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1873 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1874 +VALUES (2070, '秒杀时段删除', 'promotion:seckill-time:delete', 3, 4, 2066, '', '', '', null, 0, 1, 1, 1, '',
  1875 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', 0);
  1876 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1877 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1878 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1879 +VALUES (2071, '秒杀时段导出', 'promotion:seckill-time:export', 3, 5, 2066, '', '', '', null, 0, 1, 1, 1, '',
  1880 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', 0);
  1881 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1882 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1883 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1884 +VALUES (2072, '订单中心', '', 1, 65, 0, '/trade', 'order', null, null, 0, 1, 1, 1, '1', '2022-11-19 18:57:19', '1',
  1885 + '2022-12-10 16:32:57', 0);
  1886 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1887 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1888 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1889 +VALUES (2073, '售后退款', '', 2, 1, 2072, 'trade/after-sale', 'education', 'mall/trade/afterSale/index',
  1890 + 'TradeAfterSale', 0, 1, 1, 1, '', '2022-11-19 20:15:32', '1', '2023-04-08 11:43:19', 0);
  1891 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1892 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1893 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1894 +VALUES (2074, '售后查询', 'trade:after-sale:query', 3, 1, 2073, '', '', '', null, 0, 1, 1, 1, '', '2022-11-19 20:15:33',
  1895 + '1', '2022-12-10 21:04:29', 0);
  1896 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1897 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1898 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1899 +VALUES (2075, '秒杀活动关闭', 'promotion:sekill-activity:close', 3, 6, 2059, '', '', '', null, 0, 1, 1, 1, '1',
  1900 + '2022-11-28 20:20:15', '1', '2022-11-28 20:20:15', 0);
  1901 +INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID", "NAME", "PERMISSION", "TYPE", "SORT", "PARENT_ID", "PATH", "ICON",
  1902 + "COMPONENT", "COMPONENT_NAME", "STATUS", "VISIBLE", "KEEP_ALIVE",
  1903 + "ALWAYS_SHOW", "CREATOR", "CREATE_TIME", "UPDATER", "UPDATE_TIME", "DELETED")
  1904 +VALUES (2076, '订单列表', '', 2, 0, 2072, 'trade/order', 'list', 'mall/trade/order/index', 'TradeOrder', 0, 1, 1, 1,
  1905 + '1', '2022-12-10 21:05:44', '1', '2023-04-08 11:42:23', 0);
1821 1906 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2077,'物流公司管理管理','',2,0,2072,'express-company','','mall/trade/expressCompany/index',null,0,1,1,1,'','2022-12-20 23:27:55','1','2022-12-20 23:36:20',0);
1822 1907 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2078,'物流公司管理查询','trade:express-company:query',3,1,2077,'','','',null,0,1,1,1,'','2022-12-20 23:27:55','','2022-12-20 23:27:55',0);
1823 1908 INSERT INTO "RUOYI_VUE_PRO"."SYSTEM_MENU"("ID","NAME","PERMISSION","TYPE","SORT","PARENT_ID","PATH","ICON","COMPONENT","COMPONENT_NAME","STATUS","VISIBLE","KEEP_ALIVE","ALWAYS_SHOW","CREATOR","CREATE_TIME","UPDATER","UPDATE_TIME","DELETED") VALUES(2079,'物流公司管理创建','trade:express-company:create',3,2,2077,'','','',null,0,1,1,1,'','2022-12-20 23:27:55','','2022-12-20 23:27:55',0);
... ...
sql/mysql/ruoyi-vue-pro.sql
... ... @@ -1980,27 +1980,112 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
1980 1980 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, '满减送活动关闭', 'promotion:reward-activity:close', 3, 5, 2041, '', '', '', NULL, 0, b'1', b'1', b'1', '1', '2022-11-05 10:42:53', '1', '2022-11-05 10:42:53', b'0');
1981 1981 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, '限时折扣活动', '', 2, 7, 2030, 'discount-activity', 'time', 'mall/promotion/discountActivity/index', 'PromotionDiscountActivity', 0, b'1', b'1', b'1', '', '2022-11-05 17:12:15', '1', '2023-04-08 11:45:44', b'0');
1982 1982 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, '限时折扣活动查询', 'promotion:discount-activity:query', 3, 1, 2047, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
1983   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, '限时折扣活动创建', 'promotion:discount-activity:create', 3, 2, 2047, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
1984   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, '限时折扣活动更新', 'promotion:discount-activity:update', 3, 3, 2047, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
1985   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, '限时折扣活动删除', 'promotion:discount-activity:delete', 3, 4, 2047, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
1986   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, '限时折扣活动关闭', 'promotion:discount-activity:close', 3, 5, 2047, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
1987   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2059, '秒杀活动管理', '', 2, 0, 2030, 'seckill-activity', 'time-range', 'mall/promotion/seckill/seckillActivity/index', 'PromotionSeckillActivity', 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '1', '2023-04-08 11:46:02', b'0');
1988   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2060, '秒杀活动查询', 'promotion:seckill-activity:query', 3, 1, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
1989   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, '秒杀活动创建', 'promotion:seckill-activity:create', 3, 2, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
1990   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, '秒杀活动更新', 'promotion:seckill-activity:update', 3, 3, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
1991   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, '秒杀活动删除', 'promotion:seckill-activity:delete', 3, 4, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
1992   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, '秒杀活动导出', 'promotion:seckill-activity:export', 3, 5, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
1993   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, '秒杀时段管理', '', 2, 0, 2030, 'seckill-time', '', 'mall/promotion/seckill/seckillTime/index', 'PromotionSeckillTime', 0, b'0', b'1', b'1', '', '2022-11-15 19:46:50', '1', '2023-04-08 11:46:17', b'0');
1994   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, '秒杀时段查询', 'promotion:seckill-time:query', 3, 1, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
1995   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, '秒杀时段创建', 'promotion:seckill-time:create', 3, 2, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
1996   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, '秒杀时段更新', 'promotion:seckill-time:update', 3, 3, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
1997   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, '秒杀时段删除', 'promotion:seckill-time:delete', 3, 4, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
1998   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, '秒杀时段导出', 'promotion:seckill-time:export', 3, 5, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
1999   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, '订单中心', '', 1, 65, 0, '/trade', 'order', NULL, NULL, 0, b'1', b'1', b'1', '1', '2022-11-19 18:57:19', '1', '2022-12-10 16:32:57', b'0');
2000   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, '售后退款', '', 2, 1, 2072, 'trade/after-sale', 'education', 'mall/trade/afterSale/index', 'TradeAfterSale', 0, b'1', b'1', b'1', '', '2022-11-19 20:15:32', '1', '2023-04-08 11:43:19', b'0');
2001   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, '售后查询', 'trade:after-sale:query', 3, 1, 2073, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-11-19 20:15:33', '1', '2022-12-10 21:04:29', b'0');
2002   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, '秒杀活动关闭', 'promotion:sekill-activity:close', 3, 6, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '1', '2022-11-28 20:20:15', '1', '2022-11-28 20:20:15', b'0');
2003   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, '订单列表', '', 2, 0, 2072, 'trade/order', 'list', 'mall/trade/order/index', 'TradeOrder', 0, b'1', b'1', b'1', '1', '2022-12-10 21:05:44', '1', '2023-04-08 11:42:23', b'0');
  1983 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  1984 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  1985 + `updater`, `update_time`, `deleted`)
  1986 +VALUES (2049, '限时折扣活动创建', 'promotion:discount-activity:create', 3, 2, 2047, '', '', '', NULL, 0, b'1', b'1',
  1987 + b'1', '', '2022-11-05 17:12:15', '', '2022-11-05 17:12:15', b'0');
  1988 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  1989 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  1990 + `updater`, `update_time`, `deleted`)
  1991 +VALUES (2050, '限时折扣活动更新', 'promotion:discount-activity:update', 3, 3, 2047, '', '', '', NULL, 0, b'1', b'1',
  1992 + b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
  1993 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  1994 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  1995 + `updater`, `update_time`, `deleted`)
  1996 +VALUES (2051, '限时折扣活动删除', 'promotion:discount-activity:delete', 3, 4, 2047, '', '', '', NULL, 0, b'1', b'1',
  1997 + b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
  1998 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  1999 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2000 + `updater`, `update_time`, `deleted`)
  2001 +VALUES (2052, '限时折扣活动关闭', 'promotion:discount-activity:close', 3, 5, 2047, '', '', '', NULL, 0, b'1', b'1',
  2002 + b'1', '', '2022-11-05 17:12:16', '', '2022-11-05 17:12:16', b'0');
  2003 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2004 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2005 + `updater`, `update_time`, `deleted`)
  2006 +VALUES (2059, '秒杀活动管理', '', 2, 0, 2030, 'seckill-activity', 'time-range',
  2007 + 'mall/promotion/seckill/seckillActivity/index', 'PromotionSeckillActivity', 0, b'1', b'1', b'1', '',
  2008 + '2022-11-06 22:24:49', '1', '2023-04-08 11:46:02', b'0');
  2009 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2010 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2011 + `updater`, `update_time`, `deleted`)
  2012 +VALUES (2060, '秒杀活动查询', 'promotion:seckill-activity:query', 3, 1, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2013 + '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
  2014 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2015 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2016 + `updater`, `update_time`, `deleted`)
  2017 +VALUES (2061, '秒杀活动创建', 'promotion:seckill-activity:create', 3, 2, 2059, '', '', '', NULL, 0, b'1', b'1', b'1',
  2018 + '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
  2019 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2020 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2021 + `updater`, `update_time`, `deleted`)
  2022 +VALUES (2062, '秒杀活动更新', 'promotion:seckill-activity:update', 3, 3, 2059, '', '', '', NULL, 0, b'1', b'1', b'1',
  2023 + '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
  2024 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2025 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2026 + `updater`, `update_time`, `deleted`)
  2027 +VALUES (2063, '秒杀活动删除', 'promotion:seckill-activity:delete', 3, 4, 2059, '', '', '', NULL, 0, b'1', b'1', b'1',
  2028 + '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
  2029 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2030 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2031 + `updater`, `update_time`, `deleted`)
  2032 +VALUES (2064, '秒杀活动导出', 'promotion:seckill-activity:export', 3, 5, 2059, '', '', '', NULL, 0, b'1', b'1', b'1',
  2033 + '', '2022-11-06 22:24:49', '', '2022-11-06 22:24:49', b'0');
  2034 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2035 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2036 + `updater`, `update_time`, `deleted`)
  2037 +VALUES (2066, '秒杀时段管理', '', 2, 0, 2030, 'seckill-time', '', 'mall/promotion/seckill/SeckillConfig/index',
  2038 + 'PromotionSeckillConfig', 0, b'0', b'1', b'1', '', '2022-11-15 19:46:50', '1', '2023-04-08 11:46:17', b'0');
  2039 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2040 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2041 + `updater`, `update_time`, `deleted`)
  2042 +VALUES (2067, '秒杀时段查询', 'promotion:seckill-time:query', 3, 1, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2043 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
  2044 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2045 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2046 + `updater`, `update_time`, `deleted`)
  2047 +VALUES (2068, '秒杀时段创建', 'promotion:seckill-time:create', 3, 2, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2048 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
  2049 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2050 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2051 + `updater`, `update_time`, `deleted`)
  2052 +VALUES (2069, '秒杀时段更新', 'promotion:seckill-time:update', 3, 3, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2053 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
  2054 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2055 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2056 + `updater`, `update_time`, `deleted`)
  2057 +VALUES (2070, '秒杀时段删除', 'promotion:seckill-time:delete', 3, 4, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2058 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
  2059 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2060 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2061 + `updater`, `update_time`, `deleted`)
  2062 +VALUES (2071, '秒杀时段导出', 'promotion:seckill-time:export', 3, 5, 2066, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2063 + '2022-11-15 19:46:51', '', '2022-11-15 19:46:51', b'0');
  2064 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2065 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2066 + `updater`, `update_time`, `deleted`)
  2067 +VALUES (2072, '订单中心', '', 1, 65, 0, '/trade', 'order', NULL, NULL, 0, b'1', b'1', b'1', '1', '2022-11-19 18:57:19',
  2068 + '1', '2022-12-10 16:32:57', b'0');
  2069 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2070 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2071 + `updater`, `update_time`, `deleted`)
  2072 +VALUES (2073, '售后退款', '', 2, 1, 2072, 'trade/after-sale', 'education', 'mall/trade/afterSale/index',
  2073 + 'TradeAfterSale', 0, b'1', b'1', b'1', '', '2022-11-19 20:15:32', '1', '2023-04-08 11:43:19', b'0');
  2074 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2075 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2076 + `updater`, `update_time`, `deleted`)
  2077 +VALUES (2074, '售后查询', 'trade:after-sale:query', 3, 1, 2073, '', '', '', NULL, 0, b'1', b'1', b'1', '',
  2078 + '2022-11-19 20:15:33', '1', '2022-12-10 21:04:29', b'0');
  2079 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2080 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2081 + `updater`, `update_time`, `deleted`)
  2082 +VALUES (2075, '秒杀活动关闭', 'promotion:sekill-activity:close', 3, 6, 2059, '', '', '', NULL, 0, b'1', b'1', b'1', '1',
  2083 + '2022-11-28 20:20:15', '1', '2022-11-28 20:20:15', b'0');
  2084 +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`,
  2085 + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`,
  2086 + `updater`, `update_time`, `deleted`)
  2087 +VALUES (2076, '订单列表', '', 2, 0, 2072, 'trade/order', 'list', 'mall/trade/order/index', 'TradeOrder', 0, b'1', b'1',
  2088 + b'1', '1', '2022-12-10 21:05:44', '1', '2023-04-08 11:42:23', b'0');
2004 2089 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, '物流公司管理管理', '', 2, 0, 2072, 'express-company', '', 'mall/trade/expressCompany/index', NULL, 0, b'1', b'1', b'1', '', '2022-12-20 23:27:55', '1', '2022-12-20 23:36:20', b'0');
2005 2090 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, '物流公司管理查询', 'trade:express-company:query', 3, 1, 2077, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
2006 2091 INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, '物流公司管理创建', 'trade:express-company:create', 3, 2, 2077, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-12-20 23:27:55', '', '2022-12-20 23:27:55', b'0');
... ...
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApi.java
... ... @@ -9,14 +9,12 @@ import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDT
9 9 */
10 10 public interface ProductCommentApi {
11 11  
12   - // TODO @puhui:Long orderId 放到 createReqDTO 里噶?
13 12 /**
14 13 * 创建评论
15 14 *
16 15 * @param createReqDTO 评论参数
17   - * @param orderId 订单 id
18 16 * @return 返回评论创建后的 id
19 17 */
20   - Long createComment(ProductCommentCreateReqDTO createReqDTO, Long orderId);
  18 + Long createComment(ProductCommentCreateReqDTO createReqDTO);
21 19  
22 20 }
... ...
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/comment/dto/ProductCommentCreateReqDTO.java
... ... @@ -17,19 +17,13 @@ public class ProductCommentCreateReqDTO {
17 17 */
18 18 private Long skuId;
19 19 /**
20   - * 交易订单项编号
21   - */
22   - private Long orderItemId;
23   -
24   - // TODO @huihui:spuId、spuName 去查询哇?通过 skuId
25   - /**
26   - * 商品 SPU 编号
  20 + * 订单编号
27 21 */
28   - private Long spuId;
  22 + private Long orderId;
29 23 /**
30   - * 商品 SPU 名称
  24 + * 交易订单项编号
31 25 */
32   - private String spuName;
  26 + private Long orderItemId;
33 27  
34 28 /**
35 29 * 评分星级 1-5 分
... ... @@ -60,14 +54,6 @@ public class ProductCommentCreateReqDTO {
60 54 * 评价人
61 55 */
62 56 private Long userId;
63   - // TODO @puhui999:是不是 userNickname、userAvatar 去掉?通过 userId 查询
64   - /**
65   - * 评价人名称
66   - */
67   - private String userNickname;
68   - /**
69   - * 评价人头像
70   - */
71   - private String userAvatar;
  57 +
72 58  
73 59 }
... ...
yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApi.java
1 1 package cn.iocoder.yudao.module.product.api.sku;
2 2  
3   -import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
4 3 import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
  4 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
5 5  
6 6 import java.util.Collection;
7 7 import java.util.List;
... ... @@ -31,6 +31,14 @@ public interface ProductSkuApi {
31 31 List<ProductSkuRespDTO> getSkuList(Collection<Long> ids);
32 32  
33 33 /**
  34 + * 批量查询 SKU 数组
  35 + *
  36 + * @param spuIds SPU 编号列表
  37 + * @return SKU 数组
  38 + */
  39 + List<ProductSkuRespDTO> getSkuListBySpuId(List<Long> spuIds);
  40 +
  41 + /**
34 42 * 更新 SKU 库存
35 43 *
36 44 * @param updateStockReqDTO 更新请求
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/comment/ProductCommentApiImpl.java
1 1 package cn.iocoder.yudao.module.product.api.comment;
2 2  
3 3 import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
4   -import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
5   -import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
6 4 import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
7 5 import org.springframework.stereotype.Service;
8 6 import org.springframework.validation.annotation.Validated;
... ... @@ -22,9 +20,8 @@ public class ProductCommentApiImpl implements ProductCommentApi {
22 20 private ProductCommentService productCommentService;
23 21  
24 22 @Override
25   - public Long createComment(ProductCommentCreateReqDTO createReqDTO, Long orderId) {
26   - ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqDTO, orderId);
27   - return productCommentService.createComment(commentDO);
  23 + public Long createComment(ProductCommentCreateReqDTO createReqDTO) {
  24 + return productCommentService.createComment(createReqDTO);
28 25 }
29 26  
30 27 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/sku/ProductSkuApiImpl.java
... ... @@ -43,6 +43,15 @@ public class ProductSkuApiImpl implements ProductSkuApi {
43 43 }
44 44  
45 45 @Override
  46 + public List<ProductSkuRespDTO> getSkuListBySpuId(List<Long> spuIds) {
  47 + if (CollUtil.isEmpty(spuIds)) {
  48 + return Collections.emptyList();
  49 + }
  50 + List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spuIds);
  51 + return ProductSkuConvert.INSTANCE.convertList04(skus);
  52 + }
  53 +
  54 + @Override
46 55 public void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO) {
47 56 productSkuService.updateSkuStock(updateStockReqDTO);
48 57 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/api/spu/ProductSpuApiImpl.java
1 1 package cn.iocoder.yudao.module.product.api.spu;
2 2  
3   -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  3 +import cn.hutool.core.collection.CollectionUtil;
4 4 import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
5 5 import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
6 6 import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
... ... @@ -14,7 +14,7 @@ import java.util.Collections;
14 14 import java.util.List;
15 15  
16 16 /**
17   - * TODO LeeYan9: 类注释;
  17 + * 商品 SPU API 接口实现类
18 18 *
19 19 * @author LeeYan9
20 20 * @since 2022-09-06
... ... @@ -28,11 +28,12 @@ public class ProductSpuApiImpl implements ProductSpuApi {
28 28  
29 29 @Override
30 30 public List<ProductSpuRespDTO> getSpuList(Collection<Long> spuIds) {
31   - // TODO TODO LeeYan9: AllEmpty?
32   - if (CollectionUtils.isAnyEmpty(spuIds)) {
  31 + // TODO 需不需要判断集合中是否有 null 值
  32 + if (CollectionUtil.isEmpty(spuIds)) {
33 33 return Collections.emptyList();
34 34 }
35 35 List<ProductSpuDO> productSpuDOList = productSpuMapper.selectBatchIds(spuIds);
36 36 return ProductSpuConvert.INSTANCE.convertList2(productSpuDOList);
37 37 }
  38 +
38 39 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/brand/vo/ProductBrandSimpleRespVO.java
... ... @@ -5,17 +5,16 @@ import lombok.AllArgsConstructor;
5 5 import lombok.Data;
6 6 import lombok.NoArgsConstructor;
7 7  
8   -// TODO @puhui999:class 类的开始和结束,都要有一个空行哈。
9 8 @Schema(description = "管理后台 - 品牌精简信息 Response VO")
10 9 @Data
11 10 @NoArgsConstructor
12 11 @AllArgsConstructor
13 12 public class ProductBrandSimpleRespVO {
14 13  
15   - @Schema(description = "品牌编号", required = true, example = "1024")
  14 + @Schema(description = "品牌编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
16 15 private Long id;
17 16  
18   - @Schema(description = "品牌名称", required = true, example = "苹果")
  17 + @Schema(description = "品牌名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "苹果")
19 18 private String name;
20 19  
21 20 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentBaseVO.java
... ... @@ -10,43 +10,51 @@ import java.util.List;
10 10 @Data
11 11 public class ProductCommentBaseVO {
12 12  
13   - @Schema(description = "评价人名称", required = true, example = "小姑凉")
  13 + @Schema(description = "评价人", requiredMode = Schema.RequiredMode.REQUIRED, example = "16868")
  14 + @NotNull(message = "评价人不能为空")
  15 + private Long userId;
  16 +
  17 + @Schema(description = "评价订单项", requiredMode = Schema.RequiredMode.REQUIRED, example = "19292")
  18 + @NotNull(message = "评价订单项不能为空")
  19 + private Long orderItemId;
  20 +
  21 + @Schema(description = "评价人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小姑凉")
14 22 @NotNull(message = "评价人名称不能为空")
15 23 private String userNickname;
16 24  
17   - @Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
  25 + @Schema(description = "评价人头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
18 26 @NotNull(message = "评价人头像不能为空")
19 27 private String userAvatar;
20 28  
21   - @Schema(description = "商品 SPU 编号", required = true, example = "清凉丝滑透气小短袖")
  29 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉丝滑透气小短袖")
22 30 @NotNull(message = "商品 SPU 编号不能为空")
23 31 private Long spuId;
24 32  
25   - @Schema(description = "商品 SPU 名称", required = true, example = "赵六")
  33 + @Schema(description = "商品 SPU 名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
26 34 @NotNull(message = "商品 SPU 名称不能为空")
27 35 private String spuName;
28 36  
29   - @Schema(description = "商品 SKU 编号", required = true, example = "1")
  37 + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
30 38 @NotNull(message = "商品 SKU 编号不能为空")
31 39 private Long skuId;
32 40  
33   - @Schema(description = "评分星级 1-5 分", required = true, example = "5")
  41 + @Schema(description = "评分星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
34 42 @NotNull(message = "评分星级不能为空")
35 43 private Integer scores;
36 44  
37   - @Schema(description = "描述星级 1-5 分", required = true, example = "5")
  45 + @Schema(description = "描述星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
38 46 @NotNull(message = "描述星级不能为空")
39 47 private Integer descriptionScores;
40 48  
41   - @Schema(description = "服务星级 1-5 分", required = true, example = "5")
  49 + @Schema(description = "服务星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
42 50 @NotNull(message = "服务星级分不能为空")
43 51 private Integer benefitScores;
44 52  
45   - @Schema(description = "评论内容", required = true, example = "穿起来非常丝滑凉快")
  53 + @Schema(description = "评论内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "穿起来非常丝滑凉快")
46 54 @NotNull(message = "评论内容不能为空")
47 55 private String content;
48 56  
49   - @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
  57 + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
50 58 @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张")
51 59 private List<String> picUrls;
52 60  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentCreateReqVO.java
... ... @@ -5,21 +5,10 @@ import lombok.Data;
5 5 import lombok.EqualsAndHashCode;
6 6 import lombok.ToString;
7 7  
8   -import javax.validation.constraints.NotNull;
9   -
10 8 @Schema(description = "管理后台 - 商品评价创建 Request VO")
11 9 @Data
12 10 @EqualsAndHashCode(callSuper = true)
13 11 @ToString(callSuper = true)
14 12 public class ProductCommentCreateReqVO extends ProductCommentBaseVO {
15 13  
16   - // TODO @puhui999:是不是也放到父类里?
17   - @Schema(description = "评价人", required = true, example = "16868")
18   - @NotNull(message = "评价人不能为空")
19   - private Long userId;
20   -
21   - @Schema(description = "评价订单项", required = true, example = "19292")
22   - @NotNull(message = "评价订单项不能为空")
23   - private Long orderItemId;
24   -
25 14 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentReplyReqVO.java
... ... @@ -12,11 +12,11 @@ import javax.validation.constraints.NotNull;
12 12 @ToString(callSuper = true)
13 13 public class ProductCommentReplyReqVO {
14 14  
15   - @Schema(description = "评价编号", required = true, example = "15721")
  15 + @Schema(description = "评价编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
16 16 @NotNull(message = "评价编号不能为空")
17 17 private Long id;
18 18  
19   - @Schema(description = "商家回复内容", required = true, example = "谢谢亲")
  19 + @Schema(description = "商家回复内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "谢谢亲")
20 20 @NotEmpty(message = "商家回复内容不能为空")
21 21 private String replyContent;
22 22  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentRespVO.java
... ... @@ -13,37 +13,31 @@ import java.time.LocalDateTime;
13 13 @ToString(callSuper = true)
14 14 public class ProductCommentRespVO extends ProductCommentBaseVO {
15 15  
16   - @Schema(description = "订单项编号", required = true, example = "24965")
  16 + @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24965")
17 17 private Long id;
18 18  
19   - @Schema(description = "是否匿名", required = true, example = "false")
  19 + @Schema(description = "是否匿名", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
20 20 private Boolean anonymous;
21 21  
22   - @Schema(description = "交易订单编号", required = true, example = "24428")
  22 + @Schema(description = "交易订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24428")
23 23 private Long orderId;
24 24  
25   - @Schema(description = "评价人 用户编号", required = true, example = "15721")
26   - private Long userId;
27   -
28   - @Schema(description = "交易订单项编号", required = true, example = "8233")
29   - private Long orderItemId;
30   -
31   - @Schema(description = "是否可见:[true:显示 false:隐藏]", required = true)
  25 + @Schema(description = "是否可见:[true:显示 false:隐藏]", requiredMode = Schema.RequiredMode.REQUIRED)
32 26 private Boolean visible;
33 27  
34   - @Schema(description = "商家是否回复:[1:回复 0:未回复]", required = true)
  28 + @Schema(description = "商家是否回复:[1:回复 0:未回复]", requiredMode = Schema.RequiredMode.REQUIRED)
35 29 private Boolean replyStatus;
36 30  
37   - @Schema(description = "回复管理员编号", example = "22212")
  31 + @Schema(description = "回复管理员编号", example = "9527")
38 32 private Long replyUserId;
39 33  
40   - @Schema(description = "商家回复内容")
  34 + @Schema(description = "商家回复内容", example = "感谢好评哦亲(づ ̄3 ̄)づ╭❤~")
41 35 private String replyContent;
42 36  
43   - @Schema(description = "商家回复时间")
  37 + @Schema(description = "商家回复时间", example = "2023-08-08 12:20:55")
44 38 private LocalDateTime replyTime;
45 39  
46   - @Schema(description = "创建时间", required = true)
  40 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
47 41 private LocalDateTime createTime;
48 42  
49 43 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/vo/ProductCommentUpdateVisibleReqVO.java
... ... @@ -11,11 +11,11 @@ import javax.validation.constraints.NotNull;
11 11 @ToString(callSuper = true)
12 12 public class ProductCommentUpdateVisibleReqVO {
13 13  
14   - @Schema(description = "评价编号", required = true, example = "15721")
  14 + @Schema(description = "评价编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
15 15 @NotNull(message = "评价编号不能为空")
16 16 private Long id;
17 17  
18   - @Schema(description = "是否可见", required = true, example = "false")
  18 + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
19 19 @NotNull(message = "是否可见不能为空")
20 20 private Boolean visible;
21 21  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
... ... @@ -20,16 +20,16 @@ import java.util.List;
20 20 @ToString(callSuper = true)
21 21 public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
22 22  
23   - @Schema(description = "商品 SPU 编号", required = true, example = "1212")
  23 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1212")
24 24 private Long id;
25 25  
26   - @Schema(description = "商品销量", required = true, example = "10000")
  26 + @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
27 27 private Integer salesCount;
28 28  
29   - @Schema(description = "浏览量", required = true, example = "20000")
  29 + @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20000")
30 30 private Integer browseCount;
31 31  
32   - @Schema(description = "商品状态", required = true, example = "1")
  32 + @Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
33 33 private Integer status;
34 34  
35 35 // ========== SKU 相关字段 =========
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java
1 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4   -import cn.iocoder.yudao.framework.common.validation.InEnum;
5 4 import io.swagger.v3.oas.annotations.media.Schema;
6 5 import lombok.Data;
7 6 import lombok.EqualsAndHashCode;
... ... @@ -51,7 +50,7 @@ public class ProductSpuPageReqVO extends PageParam {
51 50 @Schema(description = "商品名称", example = "清凉小短袖")
52 51 private String name;
53 52  
54   - @Schema(description = "前端请求的tab类型", required = true, example = "1")
  53 + @Schema(description = "前端请求的tab类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
55 54 private Integer tabType;
56 55  
57 56 @Schema(description = "商品分类编号", example = "1")
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuUpdateStatusReqVO.java
1 1 package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
2 2  
3 3 import cn.iocoder.yudao.framework.common.validation.InEnum;
4   -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
5 4 import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
6 5 import io.swagger.v3.oas.annotations.media.Schema;
7 6 import lombok.Data;
8   -import lombok.EqualsAndHashCode;
9   -import lombok.ToString;
10 7  
11   -import javax.validation.Valid;
12 8 import javax.validation.constraints.NotNull;
13   -import java.util.List;
14 9  
15 10 /**
16 11 * 商品 SPU Status 更新 Request VO
... ... @@ -21,11 +16,11 @@ import java.util.List;
21 16 @Data
22 17 public class ProductSpuUpdateStatusReqVO{
23 18  
24   - @Schema(description = "商品编号", required = true, example = "1")
  19 + @Schema(description = "商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
25 20 @NotNull(message = "商品编号不能为空")
26 21 private Long id;
27 22  
28   - @Schema(description = "商品状态", required = true, example = "1")
  23 + @Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
29 24 @NotNull(message = "商品状态不能为空")
30 25 @InEnum(ProductSpuStatusEnum.class)
31 26 private Integer status;
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppProductCommentController.java
1 1 package cn.iocoder.yudao.module.product.controller.app.comment;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.util.ObjectUtil;
3 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 7 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
6 8 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
7 9 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
8 10 import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
  11 +import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
  12 +import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
  13 +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
9 14 import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
  15 +import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
10 16 import io.swagger.v3.oas.annotations.Operation;
11 17 import io.swagger.v3.oas.annotations.Parameter;
12 18 import io.swagger.v3.oas.annotations.Parameters;
13 19 import io.swagger.v3.oas.annotations.tags.Tag;
  20 +import org.springframework.context.annotation.Lazy;
14 21 import org.springframework.validation.annotation.Validated;
15 22 import org.springframework.web.bind.annotation.GetMapping;
16 23 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -19,11 +26,11 @@ import org.springframework.web.bind.annotation.RestController;
19 26  
20 27 import javax.annotation.Resource;
21 28 import javax.validation.Valid;
22   -import java.time.LocalDateTime;
23   -import java.util.ArrayList;
24   -import java.util.Arrays;
  29 +import java.util.HashMap;
25 30 import java.util.List;
26   -import java.util.Random;
  31 +import java.util.Map;
  32 +import java.util.Set;
  33 +import java.util.stream.Collectors;
27 34  
28 35 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
29 36  
... ... @@ -36,7 +43,10 @@ public class AppProductCommentController {
36 43 @Resource
37 44 private ProductCommentService productCommentService;
38 45  
39   - // TODO @puhui999:可以实现下
  46 + @Resource
  47 + @Lazy
  48 + private ProductSkuService productSkuService;
  49 +
40 50 @GetMapping("/list")
41 51 @Operation(summary = "获得最近的 n 条商品评价")
42 52 @Parameters({
... ... @@ -45,67 +55,38 @@ public class AppProductCommentController {
45 55 })
46 56 public CommonResult<List<AppProductCommentRespVO>> getCommentList(@RequestParam("spuId") Long spuId,
47 57 @RequestParam(value = "count", defaultValue = "10") Integer count) {
48   - List<AppProductPropertyValueDetailRespVO> list = new ArrayList<>();
49   -
50   - AppProductPropertyValueDetailRespVO item1 = new AppProductPropertyValueDetailRespVO();
51   - item1.setPropertyId(1L);
52   - item1.setPropertyName("颜色");
53   - item1.setValueId(1024L);
54   - item1.setValueName("红色");
55   - list.add(item1);
56   -
57   - AppProductPropertyValueDetailRespVO item2 = new AppProductPropertyValueDetailRespVO();
58   - item2.setPropertyId(2L);
59   - item2.setPropertyName("尺寸");
60   - item2.setValueId(2048L);
61   - item2.setValueName("大号");
62   - list.add(item2);
63   -
64   - AppProductPropertyValueDetailRespVO item3 = new AppProductPropertyValueDetailRespVO();
65   - item3.setPropertyId(3L);
66   - item3.setPropertyName("重量");
67   - item3.setValueId(3072L);
68   - item3.setValueName("500克");
69   - list.add(item3);
70   -
71   - // TODO 生成 mock 的数据
72   - AppProductCommentRespVO appCommentRespVO = new AppProductCommentRespVO();
73   - appCommentRespVO.setUserId((long) (new Random().nextInt(100000) + 10000));
74   - appCommentRespVO.setUserNickname("用户" + new Random().nextInt(100));
75   - appCommentRespVO.setUserAvatar("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
76   - appCommentRespVO.setId((long) (new Random().nextInt(100000) + 10000));
77   - appCommentRespVO.setAnonymous(new Random().nextBoolean());
78   - appCommentRespVO.setOrderId((long) (new Random().nextInt(100000) + 10000));
79   - appCommentRespVO.setOrderItemId((long) (new Random().nextInt(100000) + 10000));
80   - appCommentRespVO.setReplyStatus(new Random().nextBoolean());
81   - appCommentRespVO.setReplyUserId((long) (new Random().nextInt(100000) + 10000));
82   - appCommentRespVO.setReplyContent("回复内容" + new Random().nextInt(100));
83   - appCommentRespVO.setReplyTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
84   - appCommentRespVO.setCreateTime(LocalDateTime.now().minusDays(new Random().nextInt(30)));
85   - appCommentRespVO.setSpuId((long) (new Random().nextInt(100000) + 10000));
86   - appCommentRespVO.setSpuName("商品" + new Random().nextInt(100));
87   - appCommentRespVO.setSkuId((long) (new Random().nextInt(100000) + 10000));
88   - appCommentRespVO.setSkuProperties(list);
89   - appCommentRespVO.setScores(new Random().nextInt(5) + 1);
90   - appCommentRespVO.setDescriptionScores(new Random().nextInt(5) + 1);
91   - appCommentRespVO.setBenefitScores(new Random().nextInt(5) + 1);
92   - appCommentRespVO.setContent("评论内容" + new Random().nextInt(100));
93   - appCommentRespVO.setPicUrls(Arrays.asList("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"));
  58 + return success(productCommentService.getCommentList(spuId, count));
94 59  
95   - return success(Arrays.asList(appCommentRespVO));
96 60 }
97 61  
98 62 @GetMapping("/page")
99 63 @Operation(summary = "获得商品评价分页")
100 64 public CommonResult<PageResult<AppProductCommentRespVO>> getCommentPage(@Valid AppCommentPageReqVO pageVO) {
101   - return success(productCommentService.getCommentPage(pageVO, Boolean.TRUE));
  65 + PageResult<AppProductCommentRespVO> page = productCommentService.getCommentPage(pageVO, Boolean.TRUE);
  66 + Set<Long> skuIds = page.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet());
  67 + List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds);
  68 + Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size());
  69 + if (CollUtil.isNotEmpty(skuList)) {
  70 + skuDOMap.putAll(skuList.stream().collect(Collectors.toMap(ProductSkuDO::getId, c -> c)));
  71 + }
  72 + page.getList().forEach(item -> {
  73 + // 判断用户是否选择匿名
  74 + if (ObjectUtil.equal(item.getAnonymous(), true)) {
  75 + item.setUserNickname(ProductCommentDO.NICKNAME_ANONYMOUS);
  76 + }
  77 + ProductSkuDO productSkuDO = skuDOMap.get(item.getSkuId());
  78 + if (productSkuDO != null) {
  79 + List<AppProductPropertyValueDetailRespVO> skuProperties = ProductCommentConvert.INSTANCE.convertList01(productSkuDO.getProperties());
  80 + item.setSkuProperties(skuProperties);
  81 + }
  82 + });
  83 + return success(page);
102 84 }
103 85  
104   - // TODO @puhui:get-statistics;方法改成 getCommentStatistics;getCommentPageTabsCount 也改掉哈
105 86 @GetMapping("/getCommentStatistics")
106 87 @Operation(summary = "获得商品的评价统计")
107   - public CommonResult<AppCommentStatisticsRespVO> getCommentPage(@Valid @RequestParam("spuId") Long spuId) {
108   - return success(productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE));
  88 + public CommonResult<AppCommentStatisticsRespVO> getCommentStatistics(@Valid @RequestParam("spuId") Long spuId) {
  89 + return success(productCommentService.getCommentStatistics(spuId, Boolean.TRUE));
109 90 }
110 91  
111 92 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentStatisticsRespVO.java
... ... @@ -9,16 +9,16 @@ import lombok.ToString;
9 9 @ToString(callSuper = true)
10 10 public class AppCommentStatisticsRespVO {
11 11  
12   - @Schema(description = "所有评论数量", required = true, example = "15721")
  12 + @Schema(description = "所有评论数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
13 13 private Long allCount;
14 14  
15   - @Schema(description = "好评数量", required = true, example = "15721")
  15 + @Schema(description = "好评数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
16 16 private Long goodCount;
17 17  
18   - @Schema(description = "中评数量", required = true, example = "15721")
  18 + @Schema(description = "中评数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
19 19 private Long mediocreCount;
20 20  
21   - @Schema(description = "差评数量", required = true, example = "15721")
  21 + @Schema(description = "差评数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
22 22 private Long negativeCount;
23 23  
24 24 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentCreateReqVO.java
... ... @@ -13,43 +13,43 @@ import java.util.List;
13 13 @ToString(callSuper = true)
14 14 public class AppProductCommentCreateReqVO {
15 15  
16   - @Schema(description = "是否匿名", required = true, example = "true")
  16 + @Schema(description = "是否匿名", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
17 17 @NotNull(message = "是否匿名不能为空")
18 18 private Boolean anonymous;
19 19  
20   - @Schema(description = "交易订单项编号", required = true, example = "2312312")
  20 + @Schema(description = "交易订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2312312")
21 21 @NotNull(message = "交易订单项编号不能为空")
22 22 private Long orderItemId;
23 23  
24   - @Schema(description = "商品 SPU 编号", required = true, example = "91192")
  24 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "91192")
25 25 @NotNull(message = "商品SPU编号不能为空")
26 26 private Long spuId;
27 27  
28   - @Schema(description = "商品 SPU 名称", required = true, example = "清凉丝滑小短袖")
  28 + @Schema(description = "商品 SPU 名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉丝滑小短袖")
29 29 @NotNull(message = "商品SPU名称不能为空")
30 30 private String spuName;
31 31  
32   - @Schema(description = "商品 SKU 编号", required = true, example = "81192")
  32 + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "81192")
33 33 @NotNull(message = "商品SKU编号不能为空")
34 34 private Long skuId;
35 35  
36   - @Schema(description = "评分星级 1-5 分", required = true, example = "5")
  36 + @Schema(description = "评分星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
37 37 @NotNull(message = "评分星级 1-5 分不能为空")
38 38 private Integer scores;
39 39  
40   - @Schema(description = "描述星级 1-5 分", required = true, example = "5")
  40 + @Schema(description = "描述星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
41 41 @NotNull(message = "描述星级 1-5 分不能为空")
42 42 private Integer descriptionScores;
43 43  
44   - @Schema(description = "服务星级 1-5 分", required = true, example = "5")
  44 + @Schema(description = "服务星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
45 45 @NotNull(message = "服务星级 1-5 分不能为空")
46 46 private Integer benefitScores;
47 47  
48   - @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评")
  48 + @Schema(description = "评论内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "哇,真的很丝滑凉快诶,好评")
49 49 @NotNull(message = "评论内容不能为空")
50 50 private String content;
51 51  
52   - @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
  52 + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
53 53 @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张")
54 54 private List<String> picUrls;
55 55  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppProductCommentRespVO.java
... ... @@ -23,28 +23,28 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
23 23 @ToString(callSuper = true)
24 24 public class AppProductCommentRespVO {
25 25  
26   - @Schema(description = "评价人的用户编号", required = true, example = "15721")
  26 + @Schema(description = "评价人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721")
27 27 private Long userId;
28 28  
29   - @Schema(description = "评价人名称", required = true, example = "张三")
  29 + @Schema(description = "评价人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
30 30 private String userNickname;
31 31  
32   - @Schema(description = "评价人头像", required = true, example = "https://www.iocoder.cn/xx.png")
  32 + @Schema(description = "评价人头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
33 33 private String userAvatar;
34 34  
35   - @Schema(description = "订单项编号", required = true, example = "24965")
  35 + @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24965")
36 36 private Long id;
37 37  
38   - @Schema(description = "是否匿名", required = true, example = "false")
  38 + @Schema(description = "是否匿名", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
39 39 private Boolean anonymous;
40 40  
41   - @Schema(description = "交易订单编号", required = true, example = "24428")
  41 + @Schema(description = "交易订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24428")
42 42 private Long orderId;
43 43  
44   - @Schema(description = "交易订单项编号", required = true, example = "8233")
  44 + @Schema(description = "交易订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8233")
45 45 private Long orderItemId;
46 46  
47   - @Schema(description = "商家是否回复", required = true, example = "true")
  47 + @Schema(description = "商家是否回复", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
48 48 private Boolean replyStatus;
49 49  
50 50 @Schema(description = "回复管理员编号", example = "22212")
... ... @@ -71,38 +71,38 @@ public class AppProductCommentRespVO {
71 71 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
72 72 private LocalDateTime createTime;
73 73  
74   - @Schema(description = "商品SPU编号", required = true, example = "91192")
  74 + @Schema(description = "商品SPU编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "91192")
75 75 @NotNull(message = "商品SPU编号不能为空")
76 76 private Long spuId;
77 77  
78   - @Schema(description = "商品SPU名称", required = true, example = "清凉丝滑小短袖")
  78 + @Schema(description = "商品SPU名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉丝滑小短袖")
79 79 @NotNull(message = "商品SPU名称不能为空")
80 80 private String spuName;
81 81  
82   - @Schema(description = "商品SKU编号", required = true, example = "81192")
  82 + @Schema(description = "商品SKU编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "81192")
83 83 @NotNull(message = "商品SKU编号不能为空")
84 84 private Long skuId;
85 85  
86   - @Schema(description = "商品 SKU 属性", required = true)
  86 + @Schema(description = "商品 SKU 属性", requiredMode = Schema.RequiredMode.REQUIRED)
87 87 private List<AppProductPropertyValueDetailRespVO> skuProperties;
88 88  
89   - @Schema(description = "评分星级 1-5 分", required = true, example = "5")
  89 + @Schema(description = "评分星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
90 90 @NotNull(message = "评分星级 1-5 分不能为空")
91 91 private Integer scores;
92 92  
93   - @Schema(description = "描述星级 1-5 分", required = true, example = "5")
  93 + @Schema(description = "描述星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
94 94 @NotNull(message = "描述星级 1-5 分不能为空")
95 95 private Integer descriptionScores;
96 96  
97   - @Schema(description = "服务星级 1-5 分", required = true, example = "5")
  97 + @Schema(description = "服务星级 1-5 分", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
98 98 @NotNull(message = "服务星级 1-5 分不能为空")
99 99 private Integer benefitScores;
100 100  
101   - @Schema(description = "评论内容", required = true, example = "哇,真的很丝滑凉快诶,好评")
  101 + @Schema(description = "评论内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "哇,真的很丝滑凉快诶,好评")
102 102 @NotNull(message = "评论内容不能为空")
103 103 private String content;
104 104  
105   - @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", required = true, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
  105 + @Schema(description = "评论图片地址数组,以逗号分隔最多上传 9 张", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]")
106 106 @Size(max = 9, message = "评论图片地址数组长度不能超过 9 张")
107 107 private List<String> picUrls;
108 108  
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java
... ... @@ -9,40 +9,40 @@ import java.util.List;
9 9 @Data
10 10 public class AppProductSpuPageRespVO {
11 11  
12   - @Schema(description = "商品 SPU 编号", required = true, example = "1")
  12 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
13 13 private Long id;
14 14  
15   - @Schema(description = "商品名称", required = true, example = "芋道")
  15 + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
16 16 private String name;
17 17  
18   - @Schema(description = "分类编号", required = true)
  18 + @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED)
19 19 private Long categoryId;
20 20  
21   - @Schema(description = "商品封面图", required = true)
  21 + @Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED)
22 22 private String picUrl;
23 23  
24   - @Schema(description = "商品轮播图", required = true)
  24 + @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED)
25 25 private List<String> sliderPicUrls;
26 26  
27 27 // ========== SKU 相关字段 =========
28 28  
29   - @Schema(description = "规格类型", required = true, example = "true")
  29 + @Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
30 30 private Boolean specType;
31 31  
32   - @Schema(description = "商品价格,单位使用:分", required = true, example = "1024")
  32 + @Schema(description = "商品价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
33 33 private Integer price;
34 34  
35   - @Schema(description = "库存", required = true, example = "666")
  35 + @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
36 36 private Integer stock;
37 37  
38 38 // ========== 营销相关字段 =========
39 39  
40   - @Schema(description = "活动排序数组", required = true, example = "1024")
  40 + @Schema(description = "活动排序数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
41 41 private List<Integer> activityOrders;
42 42  
43 43 // ========== 统计相关字段 =========
44 44  
45   - @Schema(description = "商品销量", required = true, example = "1024")
  45 + @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
46 46 private Integer salesCount;
47 47  
48 48 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java
1 1 package cn.iocoder.yudao.module.product.convert.comment;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
4 5 import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
5 6 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
6 7 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO;
... ... @@ -9,6 +10,7 @@ import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductComme
9 10 import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
10 11 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
11 12 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
  13 +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
12 14 import org.mapstruct.Mapper;
13 15 import org.mapstruct.Mapping;
14 16 import org.mapstruct.Named;
... ... @@ -59,9 +61,18 @@ public interface ProductCommentConvert {
59 61 return divide.intValue();
60 62 }
61 63  
62   - @Mapping(target = "orderId", source = "orderId")
  64 + ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO);
  65 +
63 66 @Mapping(target = "scores", expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))")
64   - ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO, Long orderId);
  67 + default ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO, ProductSpuDO spuDO, MemberUserRespDTO user) {
  68 + ProductCommentDO commentDO = convert(createReqDTO);
  69 + commentDO.setUserId(user.getId());
  70 + commentDO.setUserNickname(user.getNickname());
  71 + commentDO.setUserAvatar(user.getAvatar());
  72 + commentDO.setSpuId(spuDO.getId());
  73 + commentDO.setSpuName(spuDO.getName());
  74 + return commentDO;
  75 + }
65 76  
66 77 @Mapping(target = "userId", constant = "0L")
67 78 @Mapping(target = "orderId", constant = "0L")
... ... @@ -70,4 +81,6 @@ public interface ProductCommentConvert {
70 81 @Mapping(target = "scores", expression = "java(convertScores(createReq.getDescriptionScores(), createReq.getBenefitScores()))")
71 82 ProductCommentDO convert(ProductCommentCreateReqVO createReq);
72 83  
  84 + List<AppProductCommentRespVO> convertList02(List<ProductCommentDO> list);
  85 +
73 86 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/comment/ProductCommentMapper.java
... ... @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.dal.mysql.comment;
2 2  
3 3  
4 4 import cn.hutool.core.util.ObjectUtil;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
5 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 7 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
7 8 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
... ... @@ -25,19 +26,18 @@ public interface ProductCommentMapper extends BaseMapperX&lt;ProductCommentDO&gt; {
25 26 }
26 27  
27 28 // TODO 芋艿:在看看这块
28   - // TODO @puhui999:直接使用 scores 来算好评、中评、差评
29 29 static void appendTabQuery(LambdaQueryWrapperX<ProductCommentDO> queryWrapper, Integer type) {
30   - // 构建好评查询语句:好评计算 (商品评分星级+服务评分星级) >= 8
  30 + // 构建好评查询语句:好评计算 总评 >= 4
31 31 if (ObjectUtil.equal(type, AppCommentPageReqVO.GOOD_COMMENT)) {
32   - queryWrapper.apply("(scores + benefit_scores) >= 8");
  32 + queryWrapper.apply("scores >= 4");
33 33 }
34   - // 构建中评查询语句:中评计算 (商品评分星级+服务评分星级) > 4 且 (商品评分星级+服务评分星级) < 8
  34 + // 构建中评查询语句:中评计算 总评 >= 3 且 总评 < 4
35 35 if (ObjectUtil.equal(type, AppCommentPageReqVO.MEDIOCRE_COMMENT)) {
36   - queryWrapper.apply("(scores + benefit_scores) > 4 and (scores + benefit_scores) < 8");
  36 + queryWrapper.apply("scores >=3 and scores < 4");
37 37 }
38   - // 构建差评查询语句:差评计算 (商品评分星级+服务评分星级) <= 4
  38 + // 构建差评查询语句:差评计算 总评 < 3
39 39 if (ObjectUtil.equal(type, AppCommentPageReqVO.NEGATIVE_COMMENT)) {
40   - queryWrapper.apply("(scores + benefit_scores) <= 4");
  40 + queryWrapper.apply("scores < 3");
41 41 }
42 42 }
43 43  
... ... @@ -52,10 +52,10 @@ public interface ProductCommentMapper extends BaseMapperX&lt;ProductCommentDO&gt; {
52 52 return selectPage(reqVO, queryWrapper);
53 53 }
54 54  
55   - default ProductCommentDO selectByUserIdAndOrderIdAndSpuId(Long userId, Long orderId, Long spuId) {
  55 + default ProductCommentDO selectByUserIdAndOrderItemIdAndSpuId(Long userId, Long orderItemId, Long spuId) {
56 56 return selectOne(new LambdaQueryWrapperX<ProductCommentDO>()
57 57 .eq(ProductCommentDO::getUserId, userId)
58   - .eq(ProductCommentDO::getOrderId, orderId)
  58 + .eq(ProductCommentDO::getOrderItemId, orderItemId)
59 59 .eq(ProductCommentDO::getSpuId, spuId));
60 60 }
61 61  
... ... @@ -68,4 +68,12 @@ public interface ProductCommentMapper extends BaseMapperX&lt;ProductCommentDO&gt; {
68 68 return selectCount(queryWrapper);
69 69 }
70 70  
  71 + default PageResult<ProductCommentDO> selectCommentList(Long spuId, Integer count) {
  72 + // 构建分页查询条件
  73 + return selectPage(new PageParam().setPageSize(count), new LambdaQueryWrapperX<ProductCommentDO>()
  74 + .eqIfPresent(ProductCommentDO::getSpuId, spuId)
  75 + .orderByDesc(ProductCommentDO::getCreateTime)
  76 + );
  77 + }
  78 +
71 79 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentService.java
1 1 package cn.iocoder.yudao.module.product.service.comment;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
4 5 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
5 6 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
6 7 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
... ... @@ -12,6 +13,8 @@ import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
12 13 import org.springframework.stereotype.Service;
13 14 import org.springframework.validation.annotation.Validated;
14 15  
  16 +import java.util.List;
  17 +
15 18 /**
16 19 * 商品评论 Service 接口
17 20 *
... ... @@ -65,10 +68,10 @@ public interface ProductCommentService {
65 68 * 创建评论
66 69 * 创建商品评论 APP 端创建商品评论使用
67 70 *
68   - * @param commentDO 评论对象
  71 + * @param createReqDTO 创建请求 dto
69 72 * @return 返回评论 id
70 73 */
71   - Long createComment(ProductCommentDO commentDO);
  74 + Long createComment(ProductCommentCreateReqDTO createReqDTO);
72 75  
73 76 /**
74 77 * 获得商品的评价统计
... ... @@ -77,6 +80,15 @@ public interface ProductCommentService {
77 80 * @param visible 是否可见
78 81 * @return 评价统计
79 82 */
80   - AppCommentStatisticsRespVO getCommentPageTabsCount(Long spuId, Boolean visible);
  83 + AppCommentStatisticsRespVO getCommentStatistics(Long spuId, Boolean visible);
  84 +
  85 + /**
  86 + * 得到评论列表
  87 + *
  88 + * @param spuId 商品 id
  89 + * @param count 数量
  90 + * @return {@link Object}
  91 + */
  92 + List<AppProductCommentRespVO> getCommentList(Long spuId, Integer count);
81 93  
82 94 }
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
1 1 package cn.iocoder.yudao.module.product.service.comment;
2 2  
3   -import cn.hutool.core.collection.CollUtil;
4   -import cn.hutool.core.util.ObjectUtil;
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
  5 +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
  6 +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
6 7 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentCreateReqVO;
7 8 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO;
8 9 import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO;
... ... @@ -10,7 +11,6 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommen
10 11 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO;
11 12 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO;
12 13 import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppProductCommentRespVO;
13   -import cn.iocoder.yudao.module.product.controller.app.property.vo.value.AppProductPropertyValueDetailRespVO;
14 14 import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert;
15 15 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
16 16 import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
... ... @@ -18,7 +18,6 @@ import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
18 18 import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper;
19 19 import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
20 20 import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
21   -import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
22 21 import org.springframework.context.annotation.Lazy;
23 22 import org.springframework.stereotype.Service;
24 23 import org.springframework.transaction.annotation.Transactional;
... ... @@ -26,11 +25,7 @@ import org.springframework.validation.annotation.Validated;
26 25  
27 26 import javax.annotation.Resource;
28 27 import java.time.LocalDateTime;
29   -import java.util.HashMap;
30 28 import java.util.List;
31   -import java.util.Map;
32   -import java.util.Set;
33   -import java.util.stream.Collectors;
34 29  
35 30 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
36 31 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
... ... @@ -48,15 +43,15 @@ public class ProductCommentServiceImpl implements ProductCommentService {
48 43 private ProductCommentMapper productCommentMapper;
49 44  
50 45 @Resource
51   - private TradeOrderApi tradeOrderApi;
52   -
53   - @Resource
54 46 private ProductSpuService productSpuService;
55 47  
56 48 @Resource
57 49 @Lazy
58 50 private ProductSkuService productSkuService;
59 51  
  52 + @Resource
  53 + private MemberUserApi memberUserApi;
  54 +
60 55 @Override
61 56 @Transactional(rollbackFor = Exception.class)
62 57 public void updateCommentVisible(ProductCommentUpdateVisibleReqVO updateReqVO) {
... ... @@ -85,11 +80,8 @@ public class ProductCommentServiceImpl implements ProductCommentService {
85 80 @Override
86 81 @Transactional(rollbackFor = Exception.class)
87 82 public void createComment(ProductCommentCreateReqVO createReqVO) {
88   - // 校验订单
89   - // TODO @puhui999:不校验哈;尽可能解耦
90   - Long orderId = tradeOrderApi.validateOrder(createReqVO.getUserId(), createReqVO.getOrderItemId());
91 83 // 校验评论
92   - validateComment(createReqVO.getSpuId(), createReqVO.getUserId(), orderId);
  84 + validateComment(createReqVO.getSpuId(), createReqVO.getUserId(), createReqVO.getOrderItemId());
93 85  
94 86 ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqVO);
95 87 productCommentMapper.insert(commentDO);
... ... @@ -97,26 +89,41 @@ public class ProductCommentServiceImpl implements ProductCommentService {
97 89  
98 90 @Override
99 91 @Transactional(rollbackFor = Exception.class)
100   - public Long createComment(ProductCommentDO commentDO) {
  92 + public Long createComment(ProductCommentCreateReqDTO createReqDTO) {
  93 + // 通过 sku ID 拿到 spu 相关信息
  94 + ProductSkuDO sku = productSkuService.getSku(createReqDTO.getSkuId());
  95 + if (sku == null) {
  96 + throw exception(SKU_NOT_EXISTS);
  97 + }
  98 + // 校验 spu 如果存在返回详情
  99 + ProductSpuDO spuDO = validateSpu(sku.getSpuId());
101 100 // 校验评论
102   - validateComment(commentDO.getSpuId(), commentDO.getUserId(), commentDO.getOrderId());
  101 + validateComment(spuDO.getId(), createReqDTO.getUserId(), createReqDTO.getOrderId());
  102 + // 获取用户详细信息
  103 + MemberUserRespDTO user = memberUserApi.getUser(createReqDTO.getUserId());
103 104  
  105 + // 创建评论
  106 + ProductCommentDO commentDO = ProductCommentConvert.INSTANCE.convert(createReqDTO, spuDO, user);
104 107 productCommentMapper.insert(commentDO);
105 108 return commentDO.getId();
106 109 }
107 110  
108   - private void validateComment(Long spuId, Long userId, Long orderId) {
109   - ProductSpuDO spu = productSpuService.getSpu(spuId);
110   - if (null == spu) {
111   - throw exception(SPU_NOT_EXISTS);
112   - }
  111 + private void validateComment(Long spuId, Long userId, Long orderItemId) {
113 112 // 判断当前订单的当前商品用户是否评价过
114   - ProductCommentDO exist = productCommentMapper.selectByUserIdAndOrderIdAndSpuId(userId, orderId, spuId);
  113 + ProductCommentDO exist = productCommentMapper.selectByUserIdAndOrderItemIdAndSpuId(userId, orderItemId, spuId);
115 114 if (null != exist) {
116 115 throw exception(ORDER_SPU_COMMENT_EXISTS);
117 116 }
118 117 }
119 118  
  119 + private ProductSpuDO validateSpu(Long spuId) {
  120 + ProductSpuDO spu = productSpuService.getSpu(spuId);
  121 + if (null == spu) {
  122 + throw exception(SPU_NOT_EXISTS);
  123 + }
  124 + return spu;
  125 + }
  126 +
120 127 private ProductCommentDO validateCommentExists(Long id) {
121 128 ProductCommentDO productComment = productCommentMapper.selectById(id);
122 129 if (productComment == null) {
... ... @@ -126,7 +133,7 @@ public class ProductCommentServiceImpl implements ProductCommentService {
126 133 }
127 134  
128 135 @Override
129   - public AppCommentStatisticsRespVO getCommentPageTabsCount(Long spuId, Boolean visible) {
  136 + public AppCommentStatisticsRespVO getCommentStatistics(Long spuId, Boolean visible) {
130 137 return ProductCommentConvert.INSTANCE.convert(
131 138 // 查询商品 id = spuId 的所有评论数量
132 139 productCommentMapper.selectCountBySpuId(spuId, visible, null),
... ... @@ -140,28 +147,17 @@ public class ProductCommentServiceImpl implements ProductCommentService {
140 147 }
141 148  
142 149 @Override
  150 + public List<AppProductCommentRespVO> getCommentList(Long spuId, Integer count) {
  151 + // 校验商品 spu 是否存在
  152 + ProductSpuDO spuDO = validateSpu(spuId);
  153 +
  154 + return ProductCommentConvert.INSTANCE.convertList02(productCommentMapper.selectCommentList(spuDO.getId(), count).getList());
  155 + }
  156 +
  157 + @Override
143 158 public PageResult<AppProductCommentRespVO> getCommentPage(AppCommentPageReqVO pageVO, Boolean visible) {
144   - PageResult<AppProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage02(
  159 + return ProductCommentConvert.INSTANCE.convertPage02(
145 160 productCommentMapper.selectPage(pageVO, visible));
146   - // TODO @puhui999:要不这块放到 controller 里拼接?
147   - Set<Long> skuIds = result.getList().stream().map(AppProductCommentRespVO::getSkuId).collect(Collectors.toSet());
148   - List<ProductSkuDO> skuList = productSkuService.getSkuList(skuIds);
149   - Map<Long, ProductSkuDO> skuDOMap = new HashMap<>(skuIds.size());
150   - if (CollUtil.isNotEmpty(skuList)) {
151   - skuDOMap.putAll(skuList.stream().collect(Collectors.toMap(ProductSkuDO::getId, c -> c)));
152   - }
153   - result.getList().forEach(item -> {
154   - // 判断用户是否选择匿名
155   - if (ObjectUtil.equal(item.getAnonymous(), true)) {
156   - item.setUserNickname(ProductCommentDO.NICKNAME_ANONYMOUS);
157   - }
158   - ProductSkuDO productSkuDO = skuDOMap.get(item.getSkuId());
159   - if (productSkuDO != null) {
160   - List<AppProductPropertyValueDetailRespVO> skuProperties = ProductCommentConvert.INSTANCE.convertList01(productSkuDO.getProperties());
161   - item.setSkuProperties(skuProperties);
162   - }
163   - });
164   - return result;
165 161 }
166 162  
167 163 @Override
... ...
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java
... ... @@ -55,7 +55,7 @@ public interface ProductSkuService {
55 55 * 批量创建 SKU
56 56 *
57 57 * @param spuId 商品 SPU 编号
58   - * @param list SKU 对象集合
  58 + * @param list SKU 对象集合
59 59 */
60 60 void createSkuList(Long spuId, List<ProductSkuCreateOrUpdateReqVO> list);
61 61  
... ... @@ -63,13 +63,13 @@ public interface ProductSkuService {
63 63 * 根据 SPU 编号,批量更新它的 SKU 信息
64 64 *
65 65 * @param spuId SPU 编码
66   - * @param skus SKU 的集合
  66 + * @param skus SKU 的集合
67 67 */
68 68 void updateSkuList(Long spuId, List<ProductSkuCreateOrUpdateReqVO> skus);
69 69  
70 70 /**
71 71 * 更新 SKU 库存(增量)
72   - *
  72 + * <p>
73 73 * 如果更新的库存不足,会抛出异常
74 74 *
75 75 * @param updateStockReqDTO 更行请求
... ... @@ -88,7 +88,7 @@ public interface ProductSkuService {
88 88 * 获得 spu 对应的 SKU 集合
89 89 *
90 90 * @param spuIds spu 编码集合
91   - * @return 商品 sku 集合
  91 + * @return 商品 sku 集合
92 92 */
93 93 List<ProductSkuDO> getSkuListBySpuId(List<Long> spuIds);
94 94  
... ... @@ -123,4 +123,5 @@ public interface ProductSkuService {
123 123 * @return int 影响的行数
124 124 */
125 125 int updateSkuPropertyValue(Long propertyValueId, String propertyValueName);
  126 +
126 127 }
... ...
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
... ... @@ -150,7 +150,7 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
150 150 assertEquals(2, result3.getTotal());
151 151  
152 152 // 测试分页 tab count
153   - AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentPageTabsCount(spuId, Boolean.TRUE);
  153 + AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentStatistics(spuId, Boolean.TRUE);
154 154 assertEquals(6, tabsCount.getAllCount());
155 155 assertEquals(4, tabsCount.getGoodCount());
156 156 assertEquals(2, tabsCount.getMediocreCount());
... ...
yudao-module-mall/yudao-module-product-biz/src/test/resources/sql/create_tables.sql
... ... @@ -126,82 +126,32 @@ CREATE TABLE IF NOT EXISTS `product_property_value` (
126 126 PRIMARY KEY("id")
127 127 ) COMMENT '规格值';
128 128  
129   --- TODO @puhui999:格式不太对哈
130   -CREATE TABLE IF NOT EXISTS `product_comment`
131   -(
132   - `id`
133   - bigint
134   - NOT
135   - NULL
136   - AUTO_INCREMENT
137   - COMMENT
138   - '评论编号,主键自增',
139   - `user_id`
140   - bigint
141   - DEFAULT
142   - NULL
143   - COMMENT
144   - '评价人的用户编号关联 MemberUserDO 的 id 编号',
145   - `user_nickname`
146   - varchar
147   -(
148   - 255
149   -) DEFAULT NULL COMMENT '评价人名称',
150   - `user_avatar` varchar
151   -(
152   - 1024
153   -) DEFAULT NULL COMMENT '评价人头像',
154   - `anonymous` bit
155   -(
156   - 1
157   -) DEFAULT NULL COMMENT '是否匿名',
  129 +DROP TABLE IF EXISTS `product_comment` (
  130 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论编号,主键自增',
  131 + `user_id` bigint DEFAULT NULL COMMENT '评价人的用户编号关联 MemberUserDO 的 id 编号',
  132 + `user_nickname` varchar(255) DEFAULT NULL COMMENT '评价人名称',
  133 + `user_avatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '评价人头像',
  134 + `anonymous` bit(1) DEFAULT NULL COMMENT '是否匿名',
158 135 `order_id` bigint DEFAULT NULL COMMENT '交易订单编号关联 TradeOrderDO 的 id 编号',
159 136 `order_item_id` bigint DEFAULT NULL COMMENT '交易订单项编号关联 TradeOrderItemDO 的 id 编号',
160 137 `spu_id` bigint DEFAULT NULL COMMENT '商品 SPU 编号关联 ProductSpuDO 的 id',
161   - `spu_name` varchar
162   -(
163   - 255
164   -) DEFAULT NULL COMMENT '商品 SPU 名称',
  138 + `spu_name` varchar(255) DEFAULT NULL COMMENT '商品 SPU 名称',
165 139 `sku_id` bigint DEFAULT NULL COMMENT '商品 SKU 编号关联 ProductSkuDO 的 id 编号',
166   - `visible` bit
167   -(
168   - 1
169   -) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏',
170   - `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5 分',
  140 + `visible` bit(1) DEFAULT NULL COMMENT '是否可见true:显示false:隐藏',
  141 + `scores` tinyint DEFAULT NULL COMMENT '评分星级1-5分',
171 142 `description_scores` tinyint DEFAULT NULL COMMENT '描述星级1-5 星',
172 143 `benefit_scores` tinyint DEFAULT NULL COMMENT '服务星级1-5 星',
173   - `content` varchar
174   -(
175   - 1024
176   -) DEFAULT NULL COMMENT '评论内容',
177   - `pic_urls` varchar
178   -(
179   - 4096
180   -) DEFAULT NULL COMMENT '评论图片地址数组',
181   - `reply_status` bit
182   -(
183   - 1
184   -) DEFAULT NULL COMMENT '商家是否回复',
  144 + `content` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '评论内容',
  145 + `pic_urls` varchar(4096) DEFAULT NULL COMMENT '评论图片地址数组',
  146 + `reply_status` bit(1) DEFAULT NULL COMMENT '商家是否回复',
185 147 `reply_user_id` bigint DEFAULT NULL COMMENT '回复管理员编号关联 AdminUserDO 的 id 编号',
186   - `reply_content` varchar
187   -(
188   - 1024
189   -) DEFAULT NULL COMMENT '商家回复内容',
  148 + `reply_content` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商家回复内容',
190 149 `reply_time` datetime DEFAULT NULL COMMENT '商家回复时间',
191   - `creator` varchar
192   -(
193   - 64
194   -) DEFAULT '' COMMENT '创建者',
  150 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
195 151 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
196   - `updater` varchar
197   -(
198   - 64
199   -) DEFAULT '' COMMENT '更新者',
  152 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
200 153 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
201   - "deleted" bit NOT NULL DEFAULT FALSE,
202   - "tenant_id" bigint not null default '0',
203   - PRIMARY KEY
204   -(
205   - `id`
206   -)
207   - ) COMMENT '产品评论表';
  154 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  155 + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
  156 + PRIMARY KEY (`id`) USING BTREE
  157 +) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '商品评论';
208 158 \ No newline at end of file
... ...
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
... ... @@ -56,5 +56,7 @@ public interface ErrorCodeConstants {
56 56 // ========== 秒杀时段 1013009000 ==========
57 57 ErrorCode SECKILL_TIME_NOT_EXISTS = new ErrorCode(1013009000, "秒杀时段不存在");
58 58 ErrorCode SECKILL_TIME_CONFLICTS = new ErrorCode(1013009001, "秒杀时段冲突");
  59 + ErrorCode SECKILL_TIME_EQUAL = new ErrorCode(1013009002, "秒杀时段开始时间和结束时间不能相等");
  60 + ErrorCode SECKILL_START_TIME_BEFORE_END_TIME = new ErrorCode(1013009003, "秒杀时段开始时间不能在结束时间之后");
59 61  
60 62 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillConfigController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.*;
  6 +import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert;
  7 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
  8 +import cn.iocoder.yudao.module.promotion.service.seckill.seckillconfig.SeckillConfigService;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +import io.swagger.v3.oas.annotations.Parameter;
  11 +import io.swagger.v3.oas.annotations.tags.Tag;
  12 +import org.springframework.security.access.prepost.PreAuthorize;
  13 +import org.springframework.validation.annotation.Validated;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import javax.annotation.Resource;
  17 +import javax.validation.Valid;
  18 +import java.util.List;
  19 +
  20 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  21 +
  22 +/**
  23 + * 管理后台 - 秒杀时段相关接口
  24 + *
  25 + * @author HUIHUI
  26 + */
  27 +@Tag(name = "管理后台 - 秒杀时段")
  28 +@RestController
  29 +@RequestMapping("/promotion/seckill-config")
  30 +@Validated
  31 +public class SeckillConfigController {
  32 +
  33 + @Resource
  34 + private SeckillConfigService seckillConfigService;
  35 +
  36 + @PostMapping("/create")
  37 + @Operation(summary = "创建秒杀时段")
  38 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:create')")
  39 + public CommonResult<Long> createSeckillConfig(@Valid @RequestBody SeckillConfigCreateReqVO createReqVO) {
  40 + return success(seckillConfigService.createSeckillConfig(createReqVO));
  41 + }
  42 +
  43 + @PutMapping("/update")
  44 + @Operation(summary = "更新秒杀时段")
  45 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:update')")
  46 + public CommonResult<Boolean> updateSeckillConfig(@Valid @RequestBody SeckillConfigUpdateReqVO updateReqVO) {
  47 + seckillConfigService.updateSeckillConfig(updateReqVO);
  48 + return success(true);
  49 + }
  50 +
  51 + @PutMapping("/update-status")
  52 + @Operation(summary = "修改时段配置状态")
  53 + @PreAuthorize("@ss.hasPermission('system:seckill-config:update')")
  54 + public CommonResult<Boolean> updateSeckillConfigStatus(@Valid @RequestBody SeckillConfigUpdateStatusReqVo reqVO) {
  55 + seckillConfigService.updateSeckillConfigStatus(reqVO.getId(), reqVO.getStatus());
  56 + return success(true);
  57 + }
  58 +
  59 + @DeleteMapping("/delete")
  60 + @Operation(summary = "删除秒杀时段")
  61 + @Parameter(name = "id", description = "编号", required = true)
  62 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:delete')")
  63 + public CommonResult<Boolean> deleteSeckillConfig(@RequestParam("id") Long id) {
  64 + seckillConfigService.deleteSeckillConfig(id);
  65 + return success(true);
  66 + }
  67 +
  68 + @GetMapping("/get")
  69 + @Operation(summary = "获得秒杀时段")
  70 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  71 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:query')")
  72 + public CommonResult<SeckillConfigRespVO> getSeckillConfig(@RequestParam("id") Long id) {
  73 + SeckillConfigDO seckillConfig = seckillConfigService.getSeckillConfig(id);
  74 + return success(SeckillConfigConvert.INSTANCE.convert(seckillConfig));
  75 + }
  76 +
  77 + @GetMapping("/list")
  78 + @Operation(summary = "获得所有秒杀时段列表")
  79 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:query')")
  80 + public CommonResult<List<SeckillConfigRespVO>> getSeckillConfigList() {
  81 + List<SeckillConfigDO> list = seckillConfigService.getSeckillConfigList();
  82 + return success(SeckillConfigConvert.INSTANCE.convertList(list));
  83 + }
  84 +
  85 + @GetMapping("/list-all-simple")
  86 + @Operation(summary = "获得所有开启状态的秒杀时段精简列表", description = "主要用于前端的下拉选项")
  87 + public CommonResult<List<SeckillConfigSimpleRespVO>> getListAllSimple() {
  88 + List<SeckillConfigDO> list = seckillConfigService.getListAllSimple();
  89 + return success(SeckillConfigConvert.INSTANCE.convertList1(list));
  90 + }
  91 +
  92 + @GetMapping("/page")
  93 + @Operation(summary = "获得秒杀活动分页")
  94 + @PreAuthorize("@ss.hasPermission('promotion:seckill-config:query')")
  95 + public CommonResult<PageResult<SeckillConfigRespVO>> getSeckillActivityPage(@Valid SeckillConfigPageReqVO pageVO) {
  96 + PageResult<SeckillConfigDO> pageResult = seckillConfigService.getSeckillConfigPage(pageVO);
  97 + return success(SeckillConfigConvert.INSTANCE.convertPage(pageResult));
  98 + }
  99 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillTimeController.java deleted
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill;
2   -
3   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeCreateReqVO;
5   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeRespVO;
6   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeUpdateReqVO;
7   -import cn.iocoder.yudao.module.promotion.convert.seckill.seckilltime.SeckillTimeConvert;
8   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
9   -import cn.iocoder.yudao.module.promotion.service.seckill.seckilltime.SeckillTimeService;
10   -import io.swagger.v3.oas.annotations.Operation;
11   -import io.swagger.v3.oas.annotations.Parameter;
12   -import io.swagger.v3.oas.annotations.tags.Tag;
13   -import org.springframework.security.access.prepost.PreAuthorize;
14   -import org.springframework.validation.annotation.Validated;
15   -import org.springframework.web.bind.annotation.*;
16   -
17   -import javax.annotation.Resource;
18   -import javax.validation.Valid;
19   -import java.util.List;
20   -
21   -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
22   -
23   -@Tag(name = "管理后台 - 秒杀时段")
24   -@RestController
25   -@RequestMapping("/promotion/seckill-time")
26   -@Validated
27   -public class SeckillTimeController {
28   -
29   - @Resource
30   - private SeckillTimeService seckillTimeService;
31   -
32   - @PostMapping("/create")
33   - @Operation(summary = "创建秒杀时段")
34   - @PreAuthorize("@ss.hasPermission('promotion:seckill-time:create')")
35   - public CommonResult<Long> createSeckillTime(@Valid @RequestBody SeckillTimeCreateReqVO createReqVO) {
36   - return success(seckillTimeService.createSeckillTime(createReqVO));
37   - }
38   -
39   - @PutMapping("/update")
40   - @Operation(summary = "更新秒杀时段")
41   - @PreAuthorize("@ss.hasPermission('promotion:seckill-time:update')")
42   - public CommonResult<Boolean> updateSeckillTime(@Valid @RequestBody SeckillTimeUpdateReqVO updateReqVO) {
43   - seckillTimeService.updateSeckillTime(updateReqVO);
44   - return success(true);
45   - }
46   -
47   - @DeleteMapping("/delete")
48   - @Operation(summary = "删除秒杀时段")
49   - @Parameter(name = "id", description = "编号", required = true)
50   - @PreAuthorize("@ss.hasPermission('promotion:seckill-time:delete')")
51   - public CommonResult<Boolean> deleteSeckillTime(@RequestParam("id") Long id) {
52   - seckillTimeService.deleteSeckillTime(id);
53   - return success(true);
54   - }
55   -
56   - @GetMapping("/get")
57   - @Operation(summary = "获得秒杀时段")
58   - @Parameter(name = "id", description = "编号", required = true, example = "1024")
59   - @PreAuthorize("@ss.hasPermission('promotion:seckill-time:query')")
60   - public CommonResult<SeckillTimeRespVO> getSeckillTime(@RequestParam("id") Long id) {
61   - SeckillTimeDO seckillTime = seckillTimeService.getSeckillTime(id);
62   - return success(SeckillTimeConvert.INSTANCE.convert(seckillTime));
63   - }
64   -
65   - @GetMapping("/list")
66   - @Operation(summary = "获得所有秒杀时段列表")
67   - @PreAuthorize("@ss.hasPermission('promotion:seckill-time:query')")
68   - public CommonResult<List<SeckillTimeRespVO>> getSeckillTimeList() {
69   - List<SeckillTimeDO> list = seckillTimeService.getSeckillTimeList();
70   - return success(SeckillTimeConvert.INSTANCE.convertList(list));
71   - }
72   -}
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityBaseVO.java
1 1 package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
2 2  
3   -import com.fasterxml.jackson.annotation.JsonFormat;
4 3 import io.swagger.v3.oas.annotations.media.Schema;
5 4 import lombok.Data;
6 5 import org.springframework.format.annotation.DateTimeFormat;
7 6  
8   -import javax.validation.constraints.Min;
9 7 import javax.validation.constraints.NotNull;
10 8 import java.time.LocalDateTime;
  9 +import java.util.List;
11 10  
12 11 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
13   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
14 12  
15 13 /**
  14 + * 秒杀活动基地签证官
16 15 * 秒杀活动 Base VO,提供给添加、修改、详细的子 VO 使用
17 16 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  17 + *
  18 + * @author HUIHUI
18 19 */
19 20 @Data
20 21 public class SeckillActivityBaseVO {
21 22  
22   - @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晚九点限时秒杀")
  23 + @Schema(description = "秒杀活动商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "[121,1212]")
  24 + @NotNull(message = "秒杀活动商品不能为空")
  25 + private List<Long> spuIds;
  26 +
  27 + @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促")
23 28 @NotNull(message = "秒杀活动名称不能为空")
24 29 private String name;
25 30  
  31 + @Schema(description = "备注", example = "清仓大甩卖割韭菜")
  32 + private String remark;
  33 +
26 34 @Schema(description = "活动开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
27 35 @NotNull(message = "活动开始时间不能为空")
28 36 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
29   - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
30 37 private LocalDateTime startTime;
31 38  
32 39 @Schema(description = "活动结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
33 40 @NotNull(message = "活动结束时间不能为空")
34 41 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
35   - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
36 42 private LocalDateTime endTime;
37 43  
  44 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
  45 + @NotNull(message = "排序不能为空")
  46 + private Integer sort;
38 47  
39   - @Schema(description = "商品")
40   - @Data
41   - public static class Product {
42   -
43   - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
44   - @NotNull(message = "商品 SPU 编号不能为空")
45   - private Long spuId;
46   -
47   - @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
48   - @NotNull(message = "商品 SKU 编号不能为空")
49   - private Long skuId;
50   -
51   - @Schema(description = "秒杀金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "12.00")
52   - @NotNull(message = "秒杀金额不能为空")
53   - private Integer seckillPrice;
  48 + @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2,3]")
  49 + @NotNull(message = "秒杀时段不能为空")
  50 + private List<Long> configIds;
54 51  
55   - @Schema(description = "秒杀库存", example = "80")
56   - @Min(value = 0, message = "秒杀库存需要大于等于 0")
57   - private Integer stock;
  52 + @Schema(description = "总限购数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "12877")
  53 + private Integer totalLimitCount;
58 54  
59   - @Schema(description = "每人限购", example = "10") // 如果为 0 则不限购
60   - @Min(value = 0, message = "每人限购需要大于等于 0")
61   - private Integer limitCount;
  55 + @Schema(description = "单次限够数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "31683")
  56 + private Integer singleLimitCount;
62 57  
63   - }
  58 + @Schema(description = "秒杀总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  59 + private Integer totalStock;
64 60  
65 61 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityCreateReqVO.java
1 1 package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
2 2  
  3 +
  4 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductCreateReqVO;
3 5 import io.swagger.v3.oas.annotations.media.Schema;
4 6 import lombok.Data;
5 7 import lombok.EqualsAndHashCode;
6 8 import lombok.ToString;
7 9  
8   -import javax.validation.Valid;
9   -import javax.validation.constraints.NotEmpty;
10   -import javax.validation.constraints.NotNull;
11 10 import java.util.List;
12 11  
  12 +/**
  13 + * 管理后台 - 秒杀活动创建 Request VO
  14 + *
  15 + * @author HUIHUI
  16 + */
13 17 @Schema(description = "管理后台 - 秒杀活动创建 Request VO")
14 18 @Data
15 19 @EqualsAndHashCode(callSuper = true)
16 20 @ToString(callSuper = true)
17 21 public class SeckillActivityCreateReqVO extends SeckillActivityBaseVO {
18 22  
19   - @Schema(description = "备注", example = "限时秒杀活动")
20   - private String remark;
21   -
22   - @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
23   - @NotNull(message = "排序不能为空")
24   - private Integer sort;
25   -
26   - @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3")
27   - @NotEmpty(message = "参与场次不能为空")
28   - private List<Long> timeIds;
29   -
30   - /**
31   - * 商品列表
32   - */
33   - @NotEmpty(message = "商品列表不能为空")
34   - @Valid
35   - private List<Product> products;
  23 + @Schema(description = "秒杀商品", requiredMode = Schema.RequiredMode.REQUIRED)
  24 + private List<SeckillProductCreateReqVO> products;
36 25  
37 26 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityDetailRespVO.java
1 1 package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
2 2  
  3 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductRespVO;
3 4 import io.swagger.v3.oas.annotations.media.Schema;
4 5 import lombok.Data;
5   -import lombok.EqualsAndHashCode;
6 6 import lombok.ToString;
7 7  
8 8 import java.util.List;
9 9  
  10 +/**
  11 + * 管理后台 - 秒杀活动的详细 Response VO
  12 + *
  13 + * @author HUIHUI
  14 + */
10 15 @Schema(description = "管理后台 - 秒杀活动的详细 Response VO")
11 16 @Data
12   -@EqualsAndHashCode(callSuper = true)
13 17 @ToString(callSuper = true)
14   -public class SeckillActivityDetailRespVO extends SeckillActivityRespVO {
  18 +public class SeckillActivityDetailRespVO extends SeckillActivityBaseVO{
15 19  
16   - /**
17   - * 商品列表
18   - */
19   - private List<Product> products;
  20 + @Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  21 + private Long id;
  22 +
  23 + @Schema(description = "秒杀商品", requiredMode = Schema.RequiredMode.REQUIRED)
  24 + private List<SeckillProductRespVO> products;
20 25  
21 26 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityPageReqVO.java
... ... @@ -26,7 +26,7 @@ public class SeckillActivityPageReqVO extends PageParam {
26 26 private Integer status;
27 27  
28 28 @Schema(description = "秒杀时段id", example = "1")
29   - private Long timeId;
  29 + private Long configId;
30 30  
31 31 @Schema(description = "创建时间")
32 32 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityRespVO.java
1 1 package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
2 2  
  3 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductRespVO;
3 4 import io.swagger.v3.oas.annotations.media.Schema;
4 5 import lombok.Data;
5 6 import lombok.EqualsAndHashCode;
6 7 import lombok.ToString;
7 8  
8   -import java.time.LocalDateTime;
9 9 import java.util.List;
10 10  
  11 +/**
  12 + * 管理后台 - 秒杀活动 Response VO
  13 + *
  14 + * @author HUIHUI
  15 + */
11 16 @Schema(description = "管理后台 - 秒杀活动 Response VO")
12 17 @Data
13 18 @EqualsAndHashCode(callSuper = true)
... ... @@ -17,25 +22,11 @@ public class SeckillActivityRespVO extends SeckillActivityBaseVO {
17 22 @Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
18 23 private Long id;
19 24  
20   - @Schema(description = "付款订单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
21   - private Integer orderCount;
  25 + @Schema(description = "秒杀商品", requiredMode = Schema.RequiredMode.REQUIRED)
  26 + private List<SeckillProductRespVO> products; // TODO puhui: 考虑是否去除
22 27  
23   - @Schema(description = "付款人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
24   - private Integer userCount;
25   -
26   - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
27   - private LocalDateTime createTime;
28   -
29   - @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3")
30   - private List<Long> timeIds;
31   -
32   - @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
33   - private Integer sort;
34   -
35   - @Schema(description = "备注", example = "限时秒杀活动")
36   - private String remark;
37   -
38   - @Schema(description = "活动状态", example = "进行中")
  28 + @Schema(description = "活动状态 开启:0 禁用:1", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
39 29 private Integer status;
40 30  
  31 +
41 32 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/activity/SeckillActivityUpdateReqVO.java
1 1 package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity;
2 2  
  3 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductRespVO;
  4 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductUpdateReqVO;
3 5 import io.swagger.v3.oas.annotations.media.Schema;
4 6 import lombok.Data;
5 7 import lombok.EqualsAndHashCode;
... ... @@ -10,32 +12,22 @@ import javax.validation.constraints.NotEmpty;
10 12 import javax.validation.constraints.NotNull;
11 13 import java.util.List;
12 14  
  15 +/**
  16 + * 管理后台 - 秒杀活动更新 Request VO
  17 + *
  18 + * @author HUIHUI
  19 + */
13 20 @Schema(description = "管理后台 - 秒杀活动更新 Request VO")
14 21 @Data
15 22 @EqualsAndHashCode(callSuper = true)
16 23 @ToString(callSuper = true)
17 24 public class SeckillActivityUpdateReqVO extends SeckillActivityBaseVO {
18 25  
19   - @Schema(description = "秒杀活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "224")
20   - @NotNull(message = "秒杀活动编号不能为空")
  26 + @Schema(description = "秒杀活动id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
21 27 private Long id;
22 28  
23   - @Schema(description = "备注", example = "限时秒杀活动")
24   - private String remark;
  29 + @Schema(description = "秒杀商品", requiredMode = Schema.RequiredMode.REQUIRED)
  30 + private List<SeckillProductUpdateReqVO> products;
25 31  
26   - @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
27   - @NotNull(message = "排序不能为空")
28   - private Integer sort;
29   -
30   - @Schema(description = "秒杀时段id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,3")
31   - @NotEmpty(message = "秒杀时段id不能为空")
32   - private List<Long> timeIds;
33   -
34   - /**
35   - * 商品列表
36   - */
37   - @NotEmpty(message = "商品列表不能为空")
38   - @Valid
39   - private List<Product> products;
40 32  
41 33 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/time/SeckillTimeBaseVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigBaseVO.java
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time;
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
5 5  
6 6 import javax.validation.constraints.NotNull;
7   -import java.time.LocalTime;
8 7  
9 8 /**
10 9 * 秒杀时段 Base VO,提供给添加、修改、详细的子 VO 使用
11 10 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  11 + *
  12 + * @author HUIHUI
12 13 */
13 14 @Data
14   -public class SeckillTimeBaseVO {
  15 +public class SeckillConfigBaseVO {
15 16  
16   - @Schema(description = "秒杀时段名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "上午场")
  17 + @Schema(description = "秒杀时段名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "早上场")
17 18 @NotNull(message = "秒杀时段名称不能为空")
18 19 private String name;
19 20  
20   - @Schema(description = "开始时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16:30:40")
  21 + @Schema(description = "开始时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:00:00")
21 22 @NotNull(message = "开始时间点不能为空")
22   - private LocalTime startTime;
  23 + private String startTime;
23 24  
24   - @Schema(description = "结束时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16:30:40")
  25 + @Schema(description = "结束时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16:00:00")
25 26 @NotNull(message = "结束时间点不能为空")
26   - private LocalTime endTime;
  27 + private String endTime;
  28 +
  29 + @Schema(description = "秒杀主图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
  30 + @NotNull(message = "秒杀主图不能为空")
  31 + private String picUrl;
  32 +
  33 + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  34 + @NotNull(message = "状态不能为空")
  35 + private Integer status;
27 36  
28 37 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/time/SeckillTimeCreateReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigCreateReqVO.java
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time;
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
5 5 import lombok.EqualsAndHashCode;
6 6 import lombok.ToString;
7 7  
  8 +/**
  9 + * 管理后台 秒杀时段创建 Request VO
  10 + *
  11 + * @author HUIHUI
  12 + */
8 13 @Schema(description = "管理后台 - 秒杀时段创建 Request VO")
9 14 @Data
10 15 @EqualsAndHashCode(callSuper = true)
11 16 @ToString(callSuper = true)
12   -public class SeckillTimeCreateReqVO extends SeckillTimeBaseVO {
  17 +public class SeckillConfigCreateReqVO extends SeckillConfigBaseVO {
13 18  
14 19 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/time/SeckillTimePageReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigPageReqVO.java
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time;
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 4 import io.swagger.v3.oas.annotations.media.Schema;
5 5 import lombok.Data;
6 6 import lombok.EqualsAndHashCode;
7 7 import lombok.ToString;
8   -import org.springframework.format.annotation.DateTimeFormat;
9   -
10   -import java.time.LocalTime;
11 8  
  9 +/**
  10 + * 管理后台 - 秒杀时段分页 Request VO
  11 + *
  12 + * @author HUIHUI
  13 + */
12 14 @Schema(description = "管理后台 - 秒杀时段分页 Request VO")
13 15 @Data
14 16 @EqualsAndHashCode(callSuper = true)
15 17 @ToString(callSuper = true)
16   -public class SeckillTimePageReqVO extends PageParam {
  18 +public class SeckillConfigPageReqVO extends PageParam {
17 19  
18 20 @Schema(description = "秒杀时段名称", example = "上午场")
19 21 private String name;
20 22  
21   - @Schema(description = "开始时间点", example = "16:30:40")
22   - @DateTimeFormat(pattern = "HH:mm:ss")
23   - private LocalTime startTime;
24   -
25   - @Schema(description = "结束时间点", example = "16:30:40")
26   - @DateTimeFormat(pattern = "HH:mm:ss")
27   - private LocalTime endTime;
  23 + @Schema(description = "状态", example = "0")
  24 + private Integer status;
28 25  
29 26 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/time/SeckillTimeRespVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigRespVO.java
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time;
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
5 5 import lombok.EqualsAndHashCode;
6 6 import lombok.ToString;
  7 +import org.springframework.format.annotation.DateTimeFormat;
7 8  
8 9 import java.time.LocalDateTime;
9 10  
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
  13 +/**
  14 + * 管理后台 - 秒杀时段 Response VO
  15 + *
  16 + * @author HUIHUI
  17 + */
10 18 @Schema(description = "管理后台 - 秒杀时段 Response VO")
11 19 @Data
12 20 @EqualsAndHashCode(callSuper = true)
13 21 @ToString(callSuper = true)
14   -public class SeckillTimeRespVO extends SeckillTimeBaseVO {
  22 +public class SeckillConfigRespVO extends SeckillConfigBaseVO {
15 23  
16 24 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
17 25 private Long id;
18 26  
19   - @Schema(description = "秒杀活动数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  27 + @Schema(description = "秒杀活动数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
20 28 private Integer seckillActivityCount;
21 29  
22 30 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  31 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
23 32 private LocalDateTime createTime;
24 33  
25 34 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigSimpleRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Data;
  6 +import lombok.NoArgsConstructor;
  7 +
  8 +import javax.validation.constraints.NotNull;
  9 +
  10 +/**
  11 + * 管理后台 - 秒杀时段配置精简信息 Response VO
  12 + *
  13 + * @author HUIHUI
  14 + */
  15 +@Schema(description = "管理后台 - 秒杀时段配置精简信息 Response VO")
  16 +@Data
  17 +@NoArgsConstructor
  18 +@AllArgsConstructor
  19 +public class SeckillConfigSimpleRespVO {
  20 +
  21 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  22 + @NotNull(message = "编号不能为空")
  23 + private Long id;
  24 +
  25 + @Schema(description = "秒杀时段名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "早上场")
  26 + @NotNull(message = "秒杀时段名称不能为空")
  27 + private String name;
  28 +
  29 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/time/SeckillTimeUpdateReqVO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigUpdateReqVO.java
1   -package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time;
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ... @@ -7,11 +7,16 @@ import lombok.ToString;
7 7  
8 8 import javax.validation.constraints.NotNull;
9 9  
  10 +/**
  11 + * 管理后台 - 秒杀时段更新 Request VO
  12 + *
  13 + * @author HUIHUI
  14 + */
10 15 @Schema(description = "管理后台 - 秒杀时段更新 Request VO")
11 16 @Data
12 17 @EqualsAndHashCode(callSuper = true)
13 18 @ToString(callSuper = true)
14   -public class SeckillTimeUpdateReqVO extends SeckillTimeBaseVO {
  19 +public class SeckillConfigUpdateReqVO extends SeckillConfigBaseVO {
15 20  
16 21 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
17 22 @NotNull(message = "编号不能为空")
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/config/SeckillConfigUpdateStatusReqVo.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config;
  2 +
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.yudao.framework.common.validation.InEnum;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import lombok.Data;
  7 +
  8 +import javax.validation.constraints.NotNull;
  9 +
  10 +/**
  11 + * 管理后台 - 修改时段配置状态 Request VO
  12 + *
  13 + * @author HUIHUI
  14 + */
  15 +@Schema(description = "管理后台 - 修改时段配置状态 Request VO")
  16 +@Data
  17 +public class SeckillConfigUpdateStatusReqVo {
  18 +
  19 + @Schema(description = "时段配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  20 + @NotNull(message = "时段配置编号不能为空")
  21 + private Long id;
  22 +
  23 + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  24 + @NotNull(message = "状态不能为空")
  25 + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
  26 + private Integer status;
  27 +
  28 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/product/SeckillProductBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +import javax.validation.constraints.NotNull;
  7 +
  8 +/**
  9 + * 秒杀参与商品 Base VO,提供给添加、修改、详细的子 VO 使用
  10 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  11 + *
  12 + * @author HUIHUI
  13 + */
  14 +@Data
  15 +public class SeckillProductBaseVO {
  16 +
  17 + @Schema(description = "商品spu_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30563")
  18 + @NotNull(message = "商品spu_id不能为空")
  19 + private Long spuId;
  20 +
  21 + @Schema(description = "商品sku_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30563")
  22 + @NotNull(message = "商品sku_id不能为空")
  23 + private Long skuId;
  24 +
  25 + @Schema(description = "秒杀金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "6689")
  26 + @NotNull(message = "秒杀金额,单位:分不能为空")
  27 + private Integer seckillPrice;
  28 +
  29 + @Schema(description = "秒杀库存", requiredMode = Schema.RequiredMode.REQUIRED)
  30 + @NotNull(message = "秒杀库存不能为空")
  31 + private Integer stock;
  32 +
  33 +
  34 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/product/SeckillProductCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product;
  2 +
  3 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductBaseVO;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import io.swagger.v3.oas.annotations.media.Schema;
  7 +import javax.validation.constraints.*;
  8 +
  9 +/**
  10 + * 管理后台 - 秒杀参与商品创建 Request VO
  11 + *
  12 + * @author HUIHUI
  13 + */
  14 +@Schema(description = "管理后台 - 秒杀参与商品创建 Request VO")
  15 +@Data
  16 +@EqualsAndHashCode(callSuper = true)
  17 +@ToString(callSuper = true)
  18 +public class SeckillProductCreateReqVO extends SeckillProductBaseVO {
  19 +
  20 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/product/SeckillProductRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.time.LocalDateTime;
  6 +
  7 +/**
  8 + * 管理后台 - 秒杀参与商品 Response VO
  9 + *
  10 + * @author HUIHUI
  11 + */
  12 +@Schema(description = "管理后台 - 秒杀参与商品 Response VO")
  13 +@Data
  14 +@EqualsAndHashCode(callSuper = true)
  15 +@ToString(callSuper = true)
  16 +public class SeckillProductRespVO extends SeckillProductBaseVO {
  17 +
  18 + @Schema(description = "秒杀参与商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "256")
  19 + private Long id;
  20 +
  21 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  22 + private LocalDateTime createTime;
  23 +
  24 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/vo/product/SeckillProductUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import javax.validation.constraints.*;
  6 +
  7 +/**
  8 + * 管理后台 - 秒杀参与商品更新 Request VO
  9 + *
  10 + * @author HUIHUI
  11 + */
  12 +@Schema(description = "管理后台 - 秒杀参与商品更新 Request VO")
  13 +@Data
  14 +@EqualsAndHashCode(callSuper = true)
  15 +@ToString(callSuper = true)
  16 +public class SeckillProductUpdateReqVO extends SeckillProductBaseVO {
  17 +
  18 + @Schema(description = "秒杀参与商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "256")
  19 + @NotNull(message = "秒杀参与商品编号不能为空")
  20 + private Long id;
  21 +
  22 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/activity/vo/AppActivityRespVO.java
... ... @@ -9,19 +9,20 @@ import java.time.LocalDateTime;
9 9 @Data
10 10 public class AppActivityRespVO {
11 11  
12   - @Schema(description = "活动编号", required = true, example = "1024")
  12 + @Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
13 13 private Long id;
14 14  
15   - @Schema(description = "活动类型", required = true, example = "1") // 对应 PromotionTypeEnum 枚举
  15 + @Schema(description = "活动类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  16 + // 对应 PromotionTypeEnum 枚举
16 17 private Integer type;
17 18  
18   - @Schema(description = "活动名称", required = true, example = "618 大促")
  19 + @Schema(description = "活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618 大促")
19 20 private String name;
20 21  
21   - @Schema(description = "活动开始时间", required = true)
  22 + @Schema(description = "活动开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
22 23 private LocalDateTime startTime;
23 24  
24   - @Schema(description = "活动结束时间", required = true)
  25 + @Schema(description = "活动结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
25 26 private LocalDateTime endTime;
26 27  
27 28 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityDetailRespVO.java
... ... @@ -10,28 +10,28 @@ import java.util.List;
10 10 @Data
11 11 public class AppCombinationActivityDetailRespVO {
12 12  
13   - @Schema(description = "拼团活动编号", required = true, example = "1024")
  13 + @Schema(description = "拼团活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
14 14 private Long id;
15 15  
16   - @Schema(description = "拼团活动名称", required = true, example = "618 大拼团")
  16 + @Schema(description = "拼团活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618 大拼团")
17 17 private String name;
18 18  
19   - @Schema(description = "活动状态", required = true, example = "1")
  19 + @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
20 20 private Integer status;
21 21  
22   - @Schema(description = "活动开始时间", required = true)
  22 + @Schema(description = "活动开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
23 23 private LocalDateTime startTime;
24 24  
25   - @Schema(description = "活动结束时间", required = true)
  25 + @Schema(description = "活动结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
26 26 private LocalDateTime endTime;
27 27  
28   - @Schema(description = "拼团人数", required = true, example = "3")
  28 + @Schema(description = "拼团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
29 29 private Integer userSize;
30 30  
31   - @Schema(description = "成功的拼团数量", required = true, example = "100")
  31 + @Schema(description = "成功的拼团数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
32 32 private Integer successCount;
33 33  
34   - @Schema(description = "商品 SPU 编号", required = true, example = "2048")
  34 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
35 35 private Long spuId;
36 36  
37 37 @Schema(description = "总共限购数量", example = "10")
... ... @@ -40,17 +40,17 @@ public class AppCombinationActivityDetailRespVO {
40 40 @Schema(description = "单次限购数量", example = "5")
41 41 private Integer singleLimitCount;
42 42  
43   - @Schema(description = "商品信息数组", required = true)
  43 + @Schema(description = "商品信息数组", requiredMode = Schema.RequiredMode.REQUIRED)
44 44 private List<Product> products;
45 45  
46 46 @Schema(description = "商品信息")
47 47 @Data
48 48 public static class Product {
49 49  
50   - @Schema(description = "商品 SKU 编号", required = true, example = "4096")
  50 + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096")
51 51 private Long skuId;
52 52  
53   - @Schema(description = "拼团金额,单位:分", required = true, example = "100")
  53 + @Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
54 54 private Integer combinationPrice;
55 55  
56 56 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java
... ... @@ -7,25 +7,28 @@ import lombok.Data;
7 7 @Data
8 8 public class AppCombinationActivityRespVO {
9 9  
10   - @Schema(description = "拼团活动编号", required = true, example = "1024")
  10 + @Schema(description = "拼团活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
11 11 private Long id;
12 12  
13   - @Schema(description = "拼团活动名称", required = true, example = "618 大拼团")
  13 + @Schema(description = "拼团活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618 大拼团")
14 14 private String name;
15 15  
16   - @Schema(description = "拼团人数", required = true, example = "3")
  16 + @Schema(description = "拼团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
17 17 private Integer userSize;
18 18  
19   - @Schema(description = "商品 SPU 编号", required = true, example = "2048")
  19 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
20 20 private Long spuId;
21 21  
22   - @Schema(description = "商品图片", required = true, example = "4096") // 从 SPU 的 picUrl 读取
  22 + @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096")
  23 + // 从 SPU 的 picUrl 读取
23 24 private String picUrl;
24 25  
25   - @Schema(description = "商品市场价,单位:分", required = true, example = "50") // 从 SPU 的 marketPrice 读取
  26 + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
  27 + // 从 SPU 的 marketPrice 读取
26 28 private Integer marketPrice;
27 29  
28   - @Schema(description = "拼团金额,单位:分", required = true, example = "100") // 从拼团商品里取最低价
  30 + @Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  31 + // 从拼团商品里取最低价
29 32 private Integer combinationPrice;
30 33  
31 34 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/record/AppCombinationRecordDetailRespVO.java
... ... @@ -9,13 +9,14 @@ import java.util.List;
9 9 @Data
10 10 public class AppCombinationRecordDetailRespVO {
11 11  
12   - @Schema(description = "团长的拼团记录", required = true)
  12 + @Schema(description = "团长的拼团记录", requiredMode = Schema.RequiredMode.REQUIRED)
13 13 private AppCombinationRecordRespVO headRecord;
14 14  
15   - @Schema(description = "成员的拼团记录", required = true)
  15 + @Schema(description = "成员的拼团记录", requiredMode = Schema.RequiredMode.REQUIRED)
16 16 private List<AppCombinationRecordRespVO> memberRecords;
17 17  
18   - @Schema(description = "当前用户参团记录对应的订单编号", required = true, example = "1024") // 如果没参团,返回 null
  18 + @Schema(description = "当前用户参团记录对应的订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + // 如果没参团,返回 null
19 20 private Long orderId;
20 21  
21 22 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/record/AppCombinationRecordRespVO.java
... ... @@ -9,37 +9,37 @@ import java.util.Date;
9 9 @Data
10 10 public class AppCombinationRecordRespVO {
11 11  
12   - @Schema(description = "拼团记录编号", required = true, example = "1024")
  12 + @Schema(description = "拼团记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
13 13 private Long id;
14 14  
15   - @Schema(description = "拼团活动编号", required = true, example = "1024")
  15 + @Schema(description = "拼团活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
16 16 private Long activityId;
17 17  
18   - @Schema(description = "用户昵称", required = true, example = "1024")
  18 + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
19 19 private String nickname;
20 20  
21   - @Schema(description = "用户头像", required = true, example = "1024")
  21 + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
22 22 private String avatar;
23 23  
24   - @Schema(description = "过期时间", required = true)
  24 + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
25 25 private Date expireTime;
26 26  
27   - @Schema(description = "可参团人数", required = true, example = "10")
  27 + @Schema(description = "可参团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
28 28 private Integer userSize;
29 29  
30   - @Schema(description = "已参团人数", required = true, example = "5")
  30 + @Schema(description = "已参团人数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
31 31 private Integer userCount;
32 32  
33   - @Schema(description = "拼团状态", required = true, example = "1")
  33 + @Schema(description = "拼团状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
34 34 private Integer status;
35 35  
36   - @Schema(description = "商品名字", required = true, example = "我是大黄豆")
  36 + @Schema(description = "商品名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是大黄豆")
37 37 private String spuName;
38 38  
39   - @Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
  39 + @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
40 40 private String picUrl;
41 41  
42   - @Schema(description = "拼团金额,单位:分", required = true, example = "100")
  42 + @Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
43 43 private Integer combinationPrice;
44 44  
45 45 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/record/AppCombinationRecordSummaryRespVO.java
... ... @@ -9,10 +9,10 @@ import java.util.List;
9 9 @Data
10 10 public class AppCombinationRecordSummaryRespVO {
11 11  
12   - @Schema(description = "拼团用户数量", required = true, example = "1024")
  12 + @Schema(description = "拼团用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
13 13 private Integer userCount;
14 14  
15   - @Schema(description = "拼团用户头像列表", required = true) // 只返回最近的 7 个
  15 + @Schema(description = "拼团用户头像列表", requiredMode = Schema.RequiredMode.REQUIRED) // 只返回最近的 7 个
16 16 private List<String> avatars;
17 17  
18 18 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/vo/template/AppCouponTemplateRespVO.java
... ... @@ -10,27 +10,28 @@ import java.time.LocalDateTime;
10 10 @Data
11 11 public class AppCouponTemplateRespVO {
12 12  
13   - @Schema(description = "优惠劵模板编号", required = true, example = "1")
  13 + @Schema(description = "优惠劵模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
14 14 private Long id;
15 15  
16   - @Schema(description = "优惠劵名", required = true, example = "春节送送送")
  16 + @Schema(description = "优惠劵名", requiredMode = Schema.RequiredMode.REQUIRED, example = "春节送送送")
17 17 private String name;
18 18  
19   - @Schema(description = "每人限领个数", required = true, example = "66") // -1 - 则表示不限制
  19 + @Schema(description = "每人限领个数", requiredMode = Schema.RequiredMode.REQUIRED, example = "66") // -1 - 则表示不限制
20 20 private Integer takeLimitCount;
21 21  
22   - @Schema(description = "是否设置满多少金额可用", required = true, example = "100") // 单位:分;0 - 不限制
  22 + @Schema(description = "是否设置满多少金额可用", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  23 + // 单位:分;0 - 不限制
23 24 private Integer usePrice;
24 25  
25 26 // TODO 芋艿:这两要改的
26   -// @Schema(description = "商品范围", required = true, example = "1")
  27 +// @Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
27 28 // @InEnum(PromotionProductScopeEnum.class)
28 29 // private Integer productScope;
29 30 //
30 31 // @Schema(description = "商品 SPU 编号的数组", example = "1,3")
31 32 // private List<Long> productSpuIds;
32 33  
33   - @Schema(description = "生效日期类型", required = true, example = "1")
  34 + @Schema(description = "生效日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
34 35 private Integer validityType;
35 36  
36 37 @Schema(description = "固定日期 - 生效开始时间")
... ... @@ -47,7 +48,7 @@ public class AppCouponTemplateRespVO {
47 48 @Min(value = 1L, message = "开始天数必须大于 1")
48 49 private Integer fixedEndTerm;
49 50  
50   - @Schema(description = "优惠类型", required = true, example = "1")
  51 + @Schema(description = "优惠类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
51 52 private Integer discountType;
52 53  
53 54 @Schema(description = "折扣百分比", example = "80") // 例如说,80% 为 80
... ... @@ -62,7 +63,7 @@ public class AppCouponTemplateRespVO {
62 63  
63 64 // ========== 用户相关字段 ==========
64 65  
65   - @Schema(description = "是否已领取", required = true, example = "true")
  66 + @Schema(description = "是否已领取", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
66 67 private Boolean takeStatus;
67 68  
68 69 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityDetailRespVO.java
... ... @@ -10,24 +10,24 @@ import java.util.List;
10 10 @Data
11 11 public class AppSeckillActivityDetailRespVO {
12 12  
13   - @Schema(description = "秒杀活动编号", required = true, example = "1024")
  13 + @Schema(description = "秒杀活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
14 14 private Long id;
15 15  
16   - @Schema(description = "秒杀活动名称", required = true, example = "晚九点限时秒杀")
  16 + @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晚九点限时秒杀")
17 17 private String name;
18 18  
19   - @Schema(description = "活动状态", required = true, example = "1")
  19 + @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
20 20 private Integer status;
21 21  
22 22 // TODO @芋艿:开始时间、结束时间,要和场次结合起来;就是要算到当前场次,是几点哈;
23 23  
24   - @Schema(description = "活动开始时间", required = true)
  24 + @Schema(description = "活动开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
25 25 private LocalDateTime startTime;
26 26  
27   - @Schema(description = "活动结束时间", required = true)
  27 + @Schema(description = "活动结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
28 28 private LocalDateTime endTime;
29 29  
30   - @Schema(description = "商品 SPU 编号", required = true, example = "2048")
  30 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
31 31 private Long spuId;
32 32  
33 33 @Schema(description = "总共限购数量", example = "10")
... ... @@ -36,26 +36,26 @@ public class AppSeckillActivityDetailRespVO {
36 36 @Schema(description = "单次限购数量", example = "5")
37 37 private Integer singleLimitCount;
38 38  
39   - @Schema(description = "秒杀库存(剩余)", required = true, example = "50")
  39 + @Schema(description = "秒杀库存(剩余)", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
40 40 private Integer stock;
41 41  
42   - @Schema(description = "秒杀库存(总计)", required = true, example = "100")
  42 + @Schema(description = "秒杀库存(总计)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
43 43 private Integer totalStock;
44 44  
45   - @Schema(description = "商品信息数组", required = true)
  45 + @Schema(description = "商品信息数组", requiredMode = Schema.RequiredMode.REQUIRED)
46 46 private List<Product> products;
47 47  
48 48 @Schema(description = "商品信息")
49 49 @Data
50 50 public static class Product {
51 51  
52   - @Schema(description = "商品 SKU 编号", required = true, example = "4096")
  52 + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096")
53 53 private Long skuId;
54 54  
55   - @Schema(description = "秒杀金额,单位:分", required = true, example = "100")
  55 + @Schema(description = "秒杀金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
56 56 private Integer seckillPrice;
57 57  
58   - @Schema(description = "秒杀限量库存", required = true, example = "50")
  58 + @Schema(description = "秒杀限量库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
59 59 private Integer stock;
60 60  
61 61 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityNowRespVO.java
... ... @@ -10,10 +10,10 @@ import java.util.List;
10 10 @Data
11 11 public class AppSeckillActivityNowRespVO {
12 12  
13   - @Schema(description = "秒杀时间段", required = true)
  13 + @Schema(description = "秒杀时间段", requiredMode = Schema.RequiredMode.REQUIRED)
14 14 private AppSeckillConfigRespVO config;
15 15  
16   - @Schema(description = "秒杀活动数组", required = true)
  16 + @Schema(description = "秒杀活动数组", requiredMode = Schema.RequiredMode.REQUIRED)
17 17 private List<AppSeckillActivityRespVO> activities;
18 18  
19 19 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java
... ... @@ -7,28 +7,31 @@ import lombok.Data;
7 7 @Data
8 8 public class AppSeckillActivityRespVO {
9 9  
10   - @Schema(description = "秒杀活动编号", required = true, example = "1024")
  10 + @Schema(description = "秒杀活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
11 11 private Long id;
12 12  
13   - @Schema(description = "秒杀活动名称", required = true, example = "晚九点限时秒杀")
  13 + @Schema(description = "秒杀活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晚九点限时秒杀")
14 14 private String name;
15 15  
16   - @Schema(description = "商品 SPU 编号", required = true, example = "2048")
  16 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
17 17 private Long spuId;
18 18  
19   - @Schema(description = "商品图片", required = true, example = "4096") // 从 SPU 的 picUrl 读取
  19 + @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "4096")
  20 + // 从 SPU 的 picUrl 读取
20 21 private String picUrl;
21 22 @Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个")
22 23 private String unitName;
23   - @Schema(description = "商品市场价,单位:分", required = true, example = "50") // 从 SPU 的 marketPrice 读取
  24 + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50")
  25 + // 从 SPU 的 marketPrice 读取
24 26 private Integer marketPrice;
25 27  
26   - @Schema(description = "秒杀库存(剩余)", required = true, example = "100")
  28 + @Schema(description = "秒杀库存(剩余)", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
27 29 private Integer stock;
28   - @Schema(description = "秒杀库存(总共)", required = true, example = "200")
  30 + @Schema(description = "秒杀库存(总共)", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
29 31 private Integer totalStock;
30 32  
31   - @Schema(description = "秒杀金额,单位:分", required = true, example = "100") // 从秒杀商品里取最低价
  33 + @Schema(description = "秒杀金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  34 + // 从秒杀商品里取最低价
32 35 private Integer seckillPrice;
33 36  
34 37 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/config/AppSeckillConfigRespVO.java
... ... @@ -9,15 +9,15 @@ import java.util.List;
9 9 @Data
10 10 public class AppSeckillConfigRespVO {
11 11  
12   - @Schema(description = "秒杀时间段编号", required = true, example = "1024")
  12 + @Schema(description = "秒杀时间段编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
13 13 private Long id;
14 14  
15   - @Schema(description = "开始时间点", required = true, example = "09:00")
  15 + @Schema(description = "开始时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:00")
16 16 private String startTime;
17   - @Schema(description = "结束时间点", required = true, example = "09:59")
  17 + @Schema(description = "结束时间点", requiredMode = Schema.RequiredMode.REQUIRED, example = "09:59")
18 18 private String endTime;
19 19  
20   - @Schema(description = "轮播图", required = true)
  20 + @Schema(description = "轮播图", requiredMode = Schema.RequiredMode.REQUIRED)
21 21 private List<String> sliderPicUrls;
22 22  
23 23 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java
1 1 package cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity;
2 2  
3 3 import cn.hutool.core.util.ObjectUtil;
  4 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5   -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
6   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.*;
  6 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO;
  7 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityDetailRespVO;
  8 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityRespVO;
  9 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO;
  10 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductCreateReqVO;
7 11 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
8 12 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillProductDO;
9 13 import org.mapstruct.Mapper;
10   -import org.mapstruct.Mapping;
11   -import org.mapstruct.Mappings;
12 14 import org.mapstruct.factory.Mappers;
13 15  
  16 +import java.util.ArrayList;
14 17 import java.util.List;
15 18  
16 19 /**
... ... @@ -23,15 +26,10 @@ public interface SeckillActivityConvert {
23 26  
24 27 SeckillActivityConvert INSTANCE = Mappers.getMapper(SeckillActivityConvert.class);
25 28  
26   - SeckillProductDO convert(SeckillActivityBaseVO.Product product);
27   -
  29 + SeckillProductDO convert(SeckillProductCreateReqVO product);
28 30  
29 31 SeckillActivityDO convert(SeckillActivityCreateReqVO bean);
30 32  
31   - default String map(Long[] value) {
32   - return value.toString();
33   - }
34   -
35 33 SeckillActivityDO convert(SeckillActivityUpdateReqVO bean);
36 34  
37 35 SeckillActivityRespVO convert(SeckillActivityDO bean);
... ... @@ -40,7 +38,6 @@ public interface SeckillActivityConvert {
40 38  
41 39 PageResult<SeckillActivityRespVO> convertPage(PageResult<SeckillActivityDO> page);
42 40  
43   - @Mappings({@Mapping(target = "products", source = "seckillProducts")})
44 41 SeckillActivityDetailRespVO convert(SeckillActivityDO seckillActivity, List<SeckillProductDO> seckillProducts);
45 42  
46 43  
... ... @@ -51,12 +48,12 @@ public interface SeckillActivityConvert {
51 48 * @param productVO 前端传入的商品
52 49 * @return 是否匹配
53 50 */
54   - default boolean isEquals(SeckillProductDO productDO, SeckillActivityBaseVO.Product productVO) {
55   - return ObjectUtil.equals(productDO.getSpuId(), productVO.getSpuId())
  51 + default boolean isEquals(SeckillProductDO productDO, SeckillProductCreateReqVO productVO) {
  52 + return ObjectUtil.equals(productDO.getSpuId(), 1) // TODO puhui:再看看
56 53 && ObjectUtil.equals(productDO.getSkuId(), productVO.getSkuId())
57   - && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice())
58   - && ObjectUtil.equals(productDO.getStock(), productVO.getStock())
59   - && ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount());
  54 + && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice());
  55 + //&& ObjectUtil.equals(productDO.getQuota(), productVO.getQuota())
  56 + //&& ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount());
60 57 }
61 58  
62 59 /**
... ... @@ -69,15 +66,26 @@ public interface SeckillActivityConvert {
69 66 default boolean isEquals(SeckillProductDO productDO, SeckillProductDO productVO) {
70 67 return ObjectUtil.equals(productDO.getSpuId(), productVO.getSpuId())
71 68 && ObjectUtil.equals(productDO.getSkuId(), productVO.getSkuId())
72   - && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice())
73   - && ObjectUtil.equals(productDO.getStock(), productVO.getStock())
74   - && ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount());
  69 + && ObjectUtil.equals(productDO.getSeckillPrice(), productVO.getSeckillPrice());
  70 + //&& ObjectUtil.equals(productDO.getQuota(), productVO.getQuota())
  71 + //&& ObjectUtil.equals(productDO.getLimitCount(), productVO.getLimitCount());
75 72  
76 73 }
77 74  
78   - default List<SeckillProductDO> convertList(List<SeckillActivityBaseVO.Product> products, SeckillActivityDO seckillActivity) {
79   - return CollectionUtils.convertList(products, product -> convert(product)
80   - .setActivityId(seckillActivity.getId()).setTimeIds(seckillActivity.getTimeIds()));
  75 + default List<SeckillProductDO> convertList(SeckillActivityDO seckillActivity, List<SeckillProductCreateReqVO> products) {
  76 + List<SeckillProductDO> list = new ArrayList<>();
  77 + products.forEach(sku -> {
  78 + SeckillProductDO productDO = new SeckillProductDO();
  79 + productDO.setActivityId(seckillActivity.getId());
  80 + productDO.setConfigIds(seckillActivity.getConfigIds());
  81 + productDO.setSpuId(sku.getSpuId());
  82 + productDO.setSkuId(sku.getSkuId());
  83 + productDO.setSeckillPrice(sku.getSeckillPrice());
  84 + productDO.setStock(sku.getStock());
  85 + productDO.setActivityStatus(CommonStatusEnum.ENABLE.getStatus());
  86 + productDO.setActivityStartTime(seckillActivity.getStartTime());
  87 + productDO.setActivityEndTime(seckillActivity.getEndTime());
  88 + });
  89 + return list;
81 90 }
82   -
83 91 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillconfig/SeckillConfigConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO;
  5 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigRespVO;
  6 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigSimpleRespVO;
  7 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO;
  8 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
  9 +import org.mapstruct.Mapper;
  10 +import org.mapstruct.factory.Mappers;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 秒杀时段 Convert
  16 + *
  17 + * @author 芋道源码
  18 + */
  19 +@Mapper
  20 +public interface SeckillConfigConvert {
  21 +
  22 + SeckillConfigConvert INSTANCE = Mappers.getMapper(SeckillConfigConvert.class);
  23 +
  24 + SeckillConfigDO convert(SeckillConfigCreateReqVO bean);
  25 +
  26 + SeckillConfigDO convert(SeckillConfigUpdateReqVO bean);
  27 +
  28 + SeckillConfigRespVO convert(SeckillConfigDO bean);
  29 +
  30 + List<SeckillConfigRespVO> convertList(List<SeckillConfigDO> list);
  31 +
  32 + List<SeckillConfigSimpleRespVO> convertList1(List<SeckillConfigDO> list);
  33 +
  34 + PageResult<SeckillConfigRespVO> convertPage(PageResult<SeckillConfigDO> page);
  35 +
  36 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckilltime/SeckillTimeConvert.java deleted
1   -package cn.iocoder.yudao.module.promotion.convert.seckill.seckilltime;
2   -
3   -import java.util.*;
4   -
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -
7   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeCreateReqVO;
8   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeRespVO;
9   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeUpdateReqVO;
10   -import org.mapstruct.Mapper;
11   -import org.mapstruct.factory.Mappers;
12   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
13   -
14   -/**
15   - * 秒杀时段 Convert
16   - *
17   - * @author 芋道源码
18   - */
19   -@Mapper
20   -public interface SeckillTimeConvert {
21   -
22   - SeckillTimeConvert INSTANCE = Mappers.getMapper(SeckillTimeConvert.class);
23   -
24   - SeckillTimeDO convert(SeckillTimeCreateReqVO bean);
25   -
26   - SeckillTimeDO convert(SeckillTimeUpdateReqVO bean);
27   -
28   - SeckillTimeRespVO convert(SeckillTimeDO bean);
29   -
30   - List<SeckillTimeRespVO> convertList(List<SeckillTimeDO> list);
31   -
32   - PageResult<SeckillTimeRespVO> convertPage(PageResult<SeckillTimeDO> page);
33   -
34   -}
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java
1 1 package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity;
2 2  
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 5 import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
5   -import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
6 6 import com.baomidou.mybatisplus.annotation.KeySequence;
7 7 import com.baomidou.mybatisplus.annotation.TableField;
8 8 import com.baomidou.mybatisplus.annotation.TableId;
... ... @@ -32,13 +32,18 @@ public class SeckillActivityDO extends BaseDO {
32 32 @TableId
33 33 private Long id;
34 34 /**
  35 + * 秒杀活动商品
  36 + */
  37 + @TableField(typeHandler = LongListTypeHandler.class)
  38 + private List<Long> spuIds;
  39 + /**
35 40 * 秒杀活动名称
36 41 */
37 42 private String name;
38 43 /**
39 44 * 活动状态
40 45 *
41   - * 枚举 {@link PromotionActivityStatusEnum 对应的类}
  46 + * 枚举 {@link CommonStatusEnum 对应的类}
42 47 */
43 48 private Integer status;
44 49 /**
... ... @@ -61,9 +66,9 @@ public class SeckillActivityDO extends BaseDO {
61 66 * 秒杀时段 id
62 67 */
63 68 @TableField(typeHandler = LongListTypeHandler.class)
64   - private List<Long> timeIds;
  69 + private List<Long> configIds;
65 70 /**
66   - * 付款订单数
  71 + * 新增订单数
67 72 */
68 73 private Integer orderCount;
69 74 /**
... ... @@ -74,5 +79,21 @@ public class SeckillActivityDO extends BaseDO {
74 79 * 订单实付金额,单位:分
75 80 */
76 81 private Long totalPrice;
  82 + /**
  83 + * 总限购数量
  84 + */
  85 + private Integer totalLimitCount;
  86 + /**
  87 + * 单次限够数量
  88 + */
  89 + private Integer singleLimitCount;
  90 + /**
  91 + * 秒杀库存
  92 + */
  93 + private Integer stock;
  94 + /**
  95 + * 秒杀总库存
  96 + */
  97 + private Integer totalStock;
77 98  
78 99 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java
1 1 package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity;
2 2  
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 5 import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
5   -import com.baomidou.mybatisplus.annotation.*;
6   -import lombok.Data;
7   -import lombok.EqualsAndHashCode;
8   -import lombok.ToString;
  6 +import com.baomidou.mybatisplus.annotation.KeySequence;
  7 +import com.baomidou.mybatisplus.annotation.TableField;
  8 +import com.baomidou.mybatisplus.annotation.TableId;
  9 +import com.baomidou.mybatisplus.annotation.TableName;
  10 +import lombok.*;
9 11  
  12 +import java.time.LocalDateTime;
10 13 import java.util.List;
11 14  
12 15 /**
13   - * 秒杀参与商品
  16 + * 秒杀参与商品 DO
14 17 *
15   - * @author halfninety
16   - * @TableName promotion_seckill_product
  18 + * @author HUIHUI
17 19 */
18   -@TableName(value = "promotion_seckill_product", autoResultMap = true)
  20 +@TableName("promotion_seckill_product")
19 21 @KeySequence("promotion_seckill_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
20 22 @Data
21 23 @EqualsAndHashCode(callSuper = true)
22 24 @ToString(callSuper = true)
  25 +@Builder
  26 +@NoArgsConstructor
  27 +@AllArgsConstructor
23 28 public class SeckillProductDO extends BaseDO {
  29 +
24 30 /**
25 31 * 秒杀参与商品编号
26 32 */
27   - @TableId(type = IdType.AUTO)
  33 + @TableId
28 34 private Long id;
29   -
30 35 /**
31   - * 秒杀活动id
  36 + * 秒杀活动 id
32 37 */
33 38 private Long activityId;
34   -
35 39 /**
36   - * 秒杀时段id
  40 + * 秒杀时段 id
37 41 */
38 42 @TableField(typeHandler = LongListTypeHandler.class)
39   - private List<Long> timeIds;
40   -
  43 + private List<Long> configIds;
41 44 /**
42   - * 商品id
  45 + * 商品 spu_id
43 46 */
44 47 private Long spuId;
45   -
46 48 /**
47   - * 商品sku_id
  49 + * 商品 sku_id
48 50 */
49 51 private Long skuId;
50   -
51 52 /**
52   - * 秒杀金额
  53 + * 秒杀金额,单位:分
53 54 */
54 55 private Integer seckillPrice;
55   -
56   - // TODO @芋艿:改成 quota 限量库存;每次购买时,需要减小;
57 56 /**
58 57 * 秒杀库存
59 58 */
60 59 private Integer stock;
61   -
62 60 /**
63   - * 每人限购
  61 + * 秒杀商品状态
  62 + * 枚举 {@link CommonStatusEnum 对应的类}
  63 + */
  64 + private Integer activityStatus;
  65 + /**
  66 + * 活动开始时间点
  67 + */
  68 + private LocalDateTime activityStartTime;
  69 + /**
  70 + * 活动结束时间点
64 71 */
65   - private Integer limitCount;
  72 + private LocalDateTime activityEndTime;
66 73  
67 74 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckilltime/SeckillTimeDO.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillconfig/SeckillConfigDO.java
1   -package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime;
  1 +package cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig;
2 2  
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 5 import com.baomidou.mybatisplus.annotation.KeySequence;
5 6 import com.baomidou.mybatisplus.annotation.TableId;
... ... @@ -8,19 +9,17 @@ import lombok.Data;
8 9 import lombok.EqualsAndHashCode;
9 10 import lombok.ToString;
10 11  
11   -import java.time.LocalTime;
12   -
13 12 /**
14 13 * 秒杀时段 DO
15 14 *
16 15 * @author 芋道源码
17 16 */
18   -@TableName("promotion_seckill_time")
19   -@KeySequence("promotion_seckill_time_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  17 +@TableName("promotion_seckill_config")
  18 +@KeySequence("promotion_seckill_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
20 19 @Data
21 20 @EqualsAndHashCode(callSuper = true)
22 21 @ToString(callSuper = true)
23   -public class SeckillTimeDO extends BaseDO {
  22 +public class SeckillConfigDO extends BaseDO {
24 23  
25 24 /**
26 25 * 编号
... ... @@ -34,14 +33,20 @@ public class SeckillTimeDO extends BaseDO {
34 33 /**
35 34 * 开始时间点
36 35 */
37   - private LocalTime startTime;
  36 + private String startTime;
38 37 /**
39 38 * 结束时间点
40 39 */
41   - private LocalTime endTime;
  40 + private String endTime;
  41 + /**
  42 + * 秒杀主图
  43 + */
  44 + private String picUrl;
42 45 /**
43   - * 秒杀活动数量
  46 + * 状态 开启:0 禁用:1
  47 + * <p>
  48 + * 枚举 {@link CommonStatusEnum 对应的类}
44 49 */
45   - private Integer seckillActivityCount;
  50 + private Integer status;
46 51  
47 52 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java
... ... @@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.Se
8 8 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
9 9 import org.apache.ibatis.annotations.Mapper;
10 10  
  11 +import java.util.List;
  12 +
11 13 /**
12 14 * 秒杀活动 Mapper
13 15 *
... ... @@ -20,7 +22,12 @@ public interface SeckillActivityMapper extends BaseMapperX&lt;SeckillActivityDO&gt; {
20 22 .likeIfPresent(SeckillActivityDO::getName, reqVO.getName())
21 23 .eqIfPresent(SeckillActivityDO::getStatus, reqVO.getStatus())
22 24 .betweenIfPresent(SeckillActivityDO::getCreateTime, reqVO.getCreateTime())
23   - .apply(ObjectUtil.isNotNull(reqVO.getTimeId()),"FIND_IN_SET(" + reqVO.getTimeId() + ",time_ids) > 0")
  25 + .apply(ObjectUtil.isNotNull(reqVO.getConfigId()), "FIND_IN_SET(" + reqVO.getConfigId() + ",time_ids) > 0")
24 26 .orderByDesc(SeckillActivityDO::getId));
25 27 }
  28 +
  29 + default List<SeckillActivityDO> selectListByStatus(Integer status) {
  30 + return selectList(new LambdaQueryWrapperX<SeckillActivityDO>()
  31 + .eqIfPresent(SeckillActivityDO::getStatus, status));
  32 + }
26 33 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillProductMapper.java
... ... @@ -27,7 +27,7 @@ public interface SeckillProductMapper extends BaseMapperX&lt;SeckillProductDO&gt; {
27 27  
28 28 default void updateTimeIdsByActivityId(Long id, List<Long> timeIds) {
29 29 new LambdaUpdateChainWrapper<>(this)
30   - .set(SeckillProductDO::getTimeIds, CollUtil.join(timeIds, ","))
  30 + .set(SeckillProductDO::getConfigIds, CollUtil.join(timeIds, ","))
31 31 .eq(SeckillProductDO::getActivityId, id)
32 32 .update();
33 33 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillconfig/SeckillConfigMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillconfig;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigPageReqVO;
  7 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +@Mapper
  11 +public interface SeckillConfigMapper extends BaseMapperX<SeckillConfigDO> {
  12 +
  13 + default PageResult<SeckillConfigDO> selectPage(SeckillConfigPageReqVO reqVO) {
  14 + return selectPage(reqVO, new LambdaQueryWrapperX<SeckillConfigDO>()
  15 + .likeIfPresent(SeckillConfigDO::getName, reqVO.getName())
  16 + .eqIfPresent(SeckillConfigDO::getStatus, reqVO.getStatus())
  17 + .orderByDesc(SeckillConfigDO::getId));
  18 + }
  19 +
  20 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckilltime/SeckillTimeMapper.java deleted
1   -package cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckilltime;
2   -
3   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
4   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
5   -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
6   -import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
7   -import org.apache.ibatis.annotations.Mapper;
8   -
9   -import java.time.LocalTime;
10   -import java.util.Collection;
11   -import java.util.List;
12   -
13   -@Mapper
14   -public interface SeckillTimeMapper extends BaseMapperX<SeckillTimeDO> {
15   -
16   - default List<SeckillTimeDO> selectListByTime(LocalTime time) {
17   - return selectList(SeckillTimeDO::getStartTime, SeckillTimeDO::getEndTime, time);
18   - }
19   -
20   - default List<SeckillTimeDO> selectListByTime(LocalTime startTime, LocalTime endTime) {
21   - return selectList(new LambdaQueryWrapper<SeckillTimeDO>()
22   - .ge(SeckillTimeDO::getStartTime, startTime)
23   - .le(SeckillTimeDO::getEndTime, endTime));
24   - }
25   -
26   - default void updateActivityCount(Collection<Long> ids, String type, Integer count) {
27   - new LambdaUpdateChainWrapper<>(this)
28   - .in(SeckillTimeDO::getId, ids)
29   - .setSql("`seckill_activity_count` = `seckill_activity_count` " + type + count)
30   - .update();
31   - }
32   -}
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityServiceImpl.java
... ... @@ -52,7 +52,7 @@ public class DiscountActivityServiceImpl implements DiscountActivityService {
52 52  
53 53 // 插入活动
54 54 DiscountActivityDO discountActivity = DiscountActivityConvert.INSTANCE.convert(createReqVO)
55   - .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getStartTime(), createReqVO.getEndTime()));
  55 + .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime()));
56 56 discountActivityMapper.insert(discountActivity);
57 57 // 插入商品
58 58 List<DiscountProductDO> discountProducts = convertList(createReqVO.getProducts(),
... ... @@ -74,7 +74,7 @@ public class DiscountActivityServiceImpl implements DiscountActivityService {
74 74  
75 75 // 更新活动
76 76 DiscountActivityDO updateObj = DiscountActivityConvert.INSTANCE.convert(updateReqVO)
77   - .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getStartTime(), updateReqVO.getEndTime()));
  77 + .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getEndTime()));
78 78 discountActivityMapper.updateById(updateObj);
79 79 // 更新商品
80 80 updateDiscountProduct(updateReqVO);
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java
... ... @@ -41,7 +41,7 @@ public class RewardActivityServiceImpl implements RewardActivityService {
41 41  
42 42 // 插入
43 43 RewardActivityDO rewardActivity = RewardActivityConvert.INSTANCE.convert(createReqVO)
44   - .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getStartTime(), createReqVO.getEndTime()));
  44 + .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime()));
45 45 rewardActivityMapper.insert(rewardActivity);
46 46 // 返回
47 47 return rewardActivity.getId();
... ... @@ -59,7 +59,7 @@ public class RewardActivityServiceImpl implements RewardActivityService {
59 59  
60 60 // 更新
61 61 RewardActivityDO updateObj = RewardActivityConvert.INSTANCE.convert(updateReqVO)
62   - .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getStartTime(), updateReqVO.getEndTime()));
  62 + .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getEndTime()));
63 63 rewardActivityMapper.updateById(updateObj);
64 64 }
65 65  
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityService.java
1 1 package cn.iocoder.yudao.module.promotion.service.seckill.seckillactivity;
2 2  
3   -import java.util.*;
4   -import javax.validation.*;
5   -
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 4 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO;
7 5 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityPageReqVO;
8 6 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO;
9 7 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
10   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
11 8 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillProductDO;
12 9  
  10 +import javax.validation.Valid;
  11 +import java.util.Collection;
  12 +import java.util.List;
  13 +
13 14 /**
14 15 * 秒杀活动 Service 接口
15 16 *
... ... @@ -77,4 +78,5 @@ public interface SeckillActivityService {
77 78 * @return 活动商品列表
78 79 */
79 80 List<SeckillProductDO> getSeckillProductListByActivityId(Long id);
  81 +
80 82 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java
1 1 package cn.iocoder.yudao.module.promotion.service.seckill.seckillactivity;
2 2  
3 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.util.ArrayUtil;
  5 +import cn.hutool.core.util.ObjectUtil;
  6 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 8 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
6   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityBaseVO;
  9 +import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
  10 +import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
  11 +import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
  12 +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
7 13 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO;
8 14 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityPageReqVO;
9 15 import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityUpdateReqVO;
  16 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.product.SeckillProductBaseVO;
10 17 import cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity.SeckillActivityConvert;
11 18 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillActivityDO;
12 19 import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillactivity.SeckillProductDO;
13 20 import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillactivity.SeckillActivityMapper;
14 21 import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillactivity.SeckillProductMapper;
15 22 import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
16   -import cn.iocoder.yudao.module.promotion.service.seckill.seckilltime.SeckillTimeService;
  23 +import cn.iocoder.yudao.module.promotion.service.seckill.seckillconfig.SeckillConfigService;
17 24 import cn.iocoder.yudao.module.promotion.util.PromotionUtils;
18 25 import org.springframework.stereotype.Service;
19 26 import org.springframework.validation.annotation.Validated;
... ... @@ -21,8 +28,12 @@ import org.springframework.validation.annotation.Validated;
21 28 import javax.annotation.Resource;
22 29 import java.util.Collection;
23 30 import java.util.List;
  31 +import java.util.Set;
  32 +import java.util.stream.Collectors;
24 33  
25 34 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  35 +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SKU_NOT_EXISTS;
  36 +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS;
26 37 import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
27 38 import static java.util.Arrays.asList;
28 39  
... ... @@ -34,76 +45,105 @@ import static java.util.Arrays.asList;
34 45 @Service
35 46 @Validated
36 47 public class SeckillActivityServiceImpl implements SeckillActivityService {
  48 +
37 49 @Resource
38 50 private SeckillActivityMapper seckillActivityMapper;
39 51 @Resource
40 52 private SeckillProductMapper seckillProductMapper;
41 53 @Resource
42   - private SeckillTimeService seckillTimeService;
  54 + private SeckillConfigService seckillConfigService;
  55 + @Resource
  56 + private ProductSpuApi productSpuApi;
  57 + @Resource
  58 + private ProductSkuApi productSkuApi;
43 59  
44 60 @Override
45 61 public Long createSeckillActivity(SeckillActivityCreateReqVO createReqVO) {
46   - // 校验商品是否冲突
47   - validateSeckillActivityProductConflicts(null, createReqVO.getProducts());
48   - // 校验秒杀时段是否存在
49   - seckillTimeService.validateSeckillTimeExists(createReqVO.getTimeIds());
  62 + // 校验商品秒秒杀时段是否冲突
  63 + validateProductSpuSeckillConflict(createReqVO.getConfigIds(), createReqVO.getSpuIds());
  64 + // 校验商品 sku 是否存在
  65 + validateProductSkuExistence(createReqVO.getSpuIds(), createReqVO.getProducts());
50 66  
51 67 // 插入秒杀活动
52 68 SeckillActivityDO seckillActivity = SeckillActivityConvert.INSTANCE.convert(createReqVO)
53   - .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getStartTime(), createReqVO.getEndTime()));
  69 + .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime()));
54 70 seckillActivityMapper.insert(seckillActivity);
55 71 // 插入商品
56   - List<SeckillProductDO> productDOS = SeckillActivityConvert.INSTANCE.convertList(createReqVO.getProducts(), seckillActivity);
57   - seckillProductMapper.insertBatch(productDOS);
58   - // 更新秒杀时段的秒杀活动数量
59   - seckillTimeService.sekillActivityCountIncr(createReqVO.getTimeIds());
  72 + List<SeckillProductDO> productDOs = SeckillActivityConvert.INSTANCE.convertList(seckillActivity, createReqVO.getProducts());
  73 + seckillProductMapper.insertBatch(productDOs);
60 74 return seckillActivity.getId();
61 75 }
62 76  
  77 + private <T extends SeckillProductBaseVO> void validateProductSkuExistence(List<Long> spuIds, List<T> products) {
  78 + Set<Long> convertedSpuIds = CollectionUtils.convertSet(products, T::getSpuId);
  79 + // 校验 spu 个数是否相等
  80 + if (ObjectUtil.notEqual(spuIds.size(), convertedSpuIds.size())) {
  81 + throw exception(SKU_NOT_EXISTS);
  82 + }
  83 + // 获取所选 spu下的所有 sku
  84 + List<ProductSkuRespDTO> skuRespDTOs = productSkuApi.getSkuListBySpuId(spuIds);
  85 + // 校验 sku 个数是否一致
  86 + Set<Long> skuIdsSet = CollectionUtils.convertSet(products, T::getSkuId);
  87 + Set<Long> skuIdsSet1 = CollectionUtils.convertSet(skuRespDTOs, ProductSkuRespDTO::getId);
  88 + if (ObjectUtil.notEqual(skuIdsSet.size(), skuIdsSet1.size())) {
  89 + throw exception(SKU_NOT_EXISTS);
  90 + }
  91 + // 校验 skuId 是否存在
  92 + if (!skuIdsSet1.containsAll(skuIdsSet) || !skuIdsSet.containsAll(skuIdsSet1)) {
  93 + throw exception(SKU_NOT_EXISTS);
  94 + }
  95 + }
  96 +
  97 + private void validateProductSpuSeckillConflict(List<Long> configIds, List<Long> spuIds) {
  98 + // 校验秒杀时段是否存在
  99 + seckillConfigService.validateSeckillConfigExists(configIds);
  100 + // 校验商品 spu 是否存在
  101 + List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(spuIds);
  102 + if (ObjectUtil.notEqual(spuIds.size(), spuList.size())) {
  103 + throw exception(SPU_NOT_EXISTS);
  104 + }
  105 + // 查询所有开启的秒杀活动
  106 + List<SeckillActivityDO> activityDOs = seckillActivityMapper.selectListByStatus(CommonStatusEnum.ENABLE.getStatus());
  107 + // 过滤出所有 spuIds 有交集的活动
  108 + List<SeckillActivityDO> doList = activityDOs.stream().filter(s -> {
  109 + // 判断 spu 是否有交集
  110 + List<Long> spuIdsClone = ArrayUtil.clone(s.getSpuIds());
  111 + spuIdsClone.retainAll(spuIds);
  112 + if (CollUtil.isEmpty(spuIdsClone)) {
  113 + return false;
  114 + }
  115 + // 判断秒杀时段是否有交集
  116 + List<Long> configIdsClone = ArrayUtil.clone(s.getConfigIds());
  117 + configIdsClone.retainAll(configIds);
  118 + return CollUtil.isNotEmpty(configIdsClone);
  119 + }).collect(Collectors.toList());
  120 + if (CollUtil.isNotEmpty(doList)) {
  121 + throw exception(SECKILL_ACTIVITY_SPU_CONFLICTS);
  122 + }
  123 + }
  124 +
63 125 @Override
64 126 public void updateSeckillActivity(SeckillActivityUpdateReqVO updateReqVO) {
65 127 // 校验存在
66 128 SeckillActivityDO seckillActivity = validateSeckillActivityExists(updateReqVO.getId());
67   - if (PromotionActivityStatusEnum.CLOSE.getStatus().equals(seckillActivity.getStatus())) {
  129 + if (CommonStatusEnum.ENABLE.getStatus().equals(seckillActivity.getStatus())) {
68 130 throw exception(SECKILL_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED);
69 131 }
70 132 // 校验商品是否冲突
71   - validateSeckillActivityProductConflicts(updateReqVO.getId(), updateReqVO.getProducts());
  133 + validateProductSpuSeckillConflict(updateReqVO.getConfigIds(), updateReqVO.getSpuIds());
  134 + // 校验商品 sku 是否存在
  135 + validateProductSkuExistence(updateReqVO.getSpuIds(), updateReqVO.getProducts());
72 136  
73 137 // 更新活动
74 138 SeckillActivityDO updateObj = SeckillActivityConvert.INSTANCE.convert(updateReqVO)
75   - .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getStartTime(), updateReqVO.getEndTime()));
  139 + .setStatus(PromotionUtils.calculateActivityStatus(updateReqVO.getEndTime()));
76 140 seckillActivityMapper.updateById(updateObj);
77 141 // 更新商品
78   - updateSeckillProduct(updateReqVO);
79   - // 更新秒杀时段的秒杀活动数量
80   - updateSeckillTimeActivityCount(seckillActivity, updateReqVO.getTimeIds());
  142 + //updateSeckillProduct(updateReqVO);
81 143 }
82 144  
83 145  
84 146 /**
85   - * 更新秒杀时段的秒杀活动数量
86   - *
87   - * @param seckillActivity 查询出的秒杀活动
88   - * @param updateTimeIds 更新后的秒杀时段id列表
89   - */
90   - private void updateSeckillTimeActivityCount(SeckillActivityDO seckillActivity, List<Long> updateTimeIds) {
91   - // 查询出 timeIds
92   - List<Long> existsTimeIds = seckillActivity.getTimeIds();
93   - // 需要减少的时间段
94   - Collection<Long> reduceIds = CollUtil.filterNew(existsTimeIds, existsTimeId -> !updateTimeIds.contains(existsTimeId));
95   - // 需要添加的时间段
96   - updateTimeIds.removeIf(existsTimeIds::contains);
97   - // 更新减少时间段和增加时间段
98   - if (CollUtil.isNotEmpty(updateTimeIds)) {
99   - seckillTimeService.sekillActivityCountIncr(updateTimeIds);
100   - }
101   - if (CollUtil.isNotEmpty(reduceIds)) {
102   - seckillTimeService.sekillActivityCountDecr(reduceIds);
103   - }
104   - }
105   -
106   - /**
107 147 * 更新秒杀商品
108 148 * 后台查出的数据和前台查出的数据进行遍历,
109 149 * 1. 对前台数据进行遍历:如果不存在于后台的 sku 中需要新增
... ... @@ -113,57 +153,29 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
113 153 * @param updateReqVO 更新的请求VO
114 154 */
115 155 private void updateSeckillProduct(SeckillActivityUpdateReqVO updateReqVO) {
116   - List<SeckillProductDO> seckillProductDOS = seckillProductMapper.selectListByActivityId(updateReqVO.getId());
117   - List<SeckillActivityBaseVO.Product> products = updateReqVO.getProducts();
118   -
119   - // 计算需要删除的数据
120   - List<Long> deleteIds = CollectionUtils.convertList(seckillProductDOS, SeckillProductDO::getId,
121   - seckillProductDO -> products.stream()
122   - .noneMatch(product -> SeckillActivityConvert.INSTANCE.isEquals(seckillProductDO, product)));
123   - if (CollUtil.isNotEmpty(deleteIds)) {
124   - seckillProductMapper.deleteBatchIds(deleteIds);
125   - }
126   -
127   - // 计算需要新增的数据
128   - List<SeckillProductDO> newSeckillProductDOs = CollectionUtils.convertList(products,
129   - product -> SeckillActivityConvert.INSTANCE.convert(product).setActivityId(updateReqVO.getId()));
130   - newSeckillProductDOs.removeIf(product -> seckillProductDOS.stream()
131   - .anyMatch(seckillProduct -> SeckillActivityConvert.INSTANCE.isEquals(seckillProduct, product)));
132   - if (CollUtil.isNotEmpty(newSeckillProductDOs)) {
133   - seckillProductMapper.insertBatch(newSeckillProductDOs);
134   - }
  156 + // TODO puhui999:后续完善
  157 + //List<SeckillProductDO> seckillProductDOs = seckillProductMapper.selectListByActivityId(updateReqVO.getId());
  158 + //List<SeckillProductUpdateReqVO> products = updateReqVO.getProducts();
  159 +
  160 + ////计算需要删除的数据
  161 + //List<Long> deleteIds = CollectionUtils.convertList(seckillProductDOs, SeckillProductDO::getId,
  162 + // seckillProductDO -> products.stream()
  163 + // .noneMatch(product -> SeckillActivityConvert.INSTANCE.isEquals(seckillProductDO, product)));
  164 + //if (CollUtil.isNotEmpty(deleteIds)) {
  165 + // seckillProductMapper.deleteBatchIds(deleteIds);
  166 + //}
  167 + //
  168 + //// 计算需要新增的数据
  169 + //List<SeckillProductDO> newSeckillProductDOs = CollectionUtils.convertList(products,
  170 + // product -> SeckillActivityConvert.INSTANCE.convert(product).setActivityId(updateReqVO.getId()));
  171 + //newSeckillProductDOs.removeIf(product -> seckillProductDOs.stream()
  172 + // .anyMatch(seckillProduct -> SeckillActivityConvert.INSTANCE.isEquals(seckillProduct, product)));
  173 + //if (CollUtil.isNotEmpty(newSeckillProductDOs)) {
  174 + // seckillProductMapper.insertBatch(newSeckillProductDOs);
  175 + //}
135 176  
136 177 //全量更新当前活动商品的秒杀时段id列表(timeIds)
137   - seckillProductMapper.updateTimeIdsByActivityId(updateReqVO.getId(), updateReqVO.getTimeIds());
138   - }
139   -
140   - /**
141   - * 校验商品是否冲突
142   - *
143   - * @param id 秒杀活动编号
144   - * @param products 商品列表
145   - */
146   - private void validateSeckillActivityProductConflicts(Long id, List<SeckillActivityBaseVO.Product> products) {
147   - if (CollUtil.isEmpty(products)) {
148   - return;
149   - }
150   - List<SeckillProductDO> seckillProductDOS = seckillProductMapper
151   - .selectListBySkuIds(CollectionUtils.convertSet(products, SeckillActivityBaseVO.Product::getSkuId));
152   - if (CollUtil.isEmpty(seckillProductDOS)) {
153   - return;
154   - }
155   - List<SeckillActivityDO> seckillActivityDOS = seckillActivityMapper
156   - .selectBatchIds(CollectionUtils.convertSet(seckillProductDOS, SeckillProductDO::getActivityId));
157   - if (id != null) { // 排除自己这个活动
158   - seckillActivityDOS.removeIf(item -> id.equals(item.getId()));
159   - }
160   - // 排除不满足 status 的活动
161   - List<Integer> statuses = asList(PromotionActivityStatusEnum.WAIT.getStatus(), PromotionActivityStatusEnum.RUN.getStatus());
162   - seckillActivityDOS.removeIf(item -> !statuses.contains(item.getStatus()));
163   - // 如果非空,则说明冲突
164   - if (CollUtil.isNotEmpty(seckillActivityDOS)) {
165   - throw exception(SECKILL_ACTIVITY_SPU_CONFLICTS);
166   - }
  178 + seckillProductMapper.updateTimeIdsByActivityId(updateReqVO.getId(), updateReqVO.getConfigIds());
167 179 }
168 180  
169 181 @Override
... ... @@ -189,8 +201,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
189 201 if (!statuses.contains(seckillActivity.getStatus())) {
190 202 throw exception(SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END);
191 203 }
192   - // 更新秒杀时段的秒杀活动数量
193   - seckillTimeService.sekillActivityCountDecr(seckillActivity.getTimeIds());
  204 +
194 205 // 删除
195 206 seckillActivityMapper.deleteById(id);
196 207 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckilltime/SeckillTimeService.java renamed to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigService.java
1   -package cn.iocoder.yudao.module.promotion.service.seckill.seckilltime;
  1 +package cn.iocoder.yudao.module.promotion.service.seckill.seckillconfig;
2 2  
3   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeCreateReqVO;
4   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeUpdateReqVO;
5   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO;
  5 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigPageReqVO;
  6 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO;
  7 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
6 8  
7 9 import javax.validation.Valid;
8 10 import java.util.Collection;
... ... @@ -13,7 +15,7 @@ import java.util.List;
13 15 *
14 16 * @author halfninety
15 17 */
16   -public interface SeckillTimeService {
  18 +public interface SeckillConfigService {
17 19  
18 20 /**
19 21 * 创建秒杀时段
... ... @@ -21,21 +23,21 @@ public interface SeckillTimeService {
21 23 * @param createReqVO 创建信息
22 24 * @return 编号
23 25 */
24   - Long createSeckillTime(@Valid SeckillTimeCreateReqVO createReqVO);
  26 + Long createSeckillConfig(@Valid SeckillConfigCreateReqVO createReqVO);
25 27  
26 28 /**
27 29 * 更新秒杀时段
28 30 *
29 31 * @param updateReqVO 更新信息
30 32 */
31   - void updateSeckillTime(@Valid SeckillTimeUpdateReqVO updateReqVO);
  33 + void updateSeckillConfig(@Valid SeckillConfigUpdateReqVO updateReqVO);
32 34  
33 35 /**
34 36 * 删除秒杀时段
35 37 *
36 38 * @param id 编号
37 39 */
38   - void deleteSeckillTime(Long id);
  40 + void deleteSeckillConfig(Long id);
39 41  
40 42 /**
41 43 * 获得秒杀时段
... ... @@ -43,34 +45,43 @@ public interface SeckillTimeService {
43 45 * @param id 编号
44 46 * @return 秒杀时段
45 47 */
46   - SeckillTimeDO getSeckillTime(Long id);
  48 + SeckillConfigDO getSeckillConfig(Long id);
47 49  
48 50 /**
49 51 * 获得所有秒杀时段列表
50 52 *
51 53 * @return 所有秒杀时段列表
52 54 */
53   - List<SeckillTimeDO> getSeckillTimeList();
  55 + List<SeckillConfigDO> getSeckillConfigList();
54 56  
55 57 /**
56 58 * 校验秒杀时段是否存在
57 59 *
58 60 * @param timeIds 秒杀时段id集合
59 61 */
60   - void validateSeckillTimeExists(Collection<Long> timeIds);
  62 + void validateSeckillConfigExists(Collection<Long> timeIds);
  63 +
61 64  
62 65 /**
63   - * 秒杀时段列表的秒杀活动数量加 1
  66 + * 获得秒杀时间段配置分页数据
64 67 *
65   - * @param ids 秒杀时段id列表
  68 + * @param pageVO 分页请求参数
  69 + * @return 秒杀时段分页列表
66 70 */
67   - void sekillActivityCountIncr(Collection<Long> ids);
  71 + PageResult<SeckillConfigDO> getSeckillConfigPage(SeckillConfigPageReqVO pageVO);
68 72  
  73 + /**
  74 + * 获得所有正常状态的时段配置列表
  75 + *
  76 + * @return 秒杀时段列表
  77 + */
  78 + List<SeckillConfigDO> getListAllSimple();
69 79  
70 80 /**
71   - * 秒杀时段列表的秒杀活动数量减 1
  81 + * 更新秒杀时段配置状态
72 82 *
73   - * @param ids 秒杀时段id列表
  83 + * @param id id
  84 + * @param status 状态
74 85 */
75   - void sekillActivityCountDecr(Collection<Long> ids);
  86 + void updateSeckillConfigStatus(Long id, Integer status);
76 87 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillconfig/SeckillConfigServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.service.seckill.seckillconfig;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO;
  7 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigPageReqVO;
  8 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO;
  9 +import cn.iocoder.yudao.module.promotion.convert.seckill.seckillconfig.SeckillConfigConvert;
  10 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
  11 +import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillconfig.SeckillConfigMapper;
  12 +import org.springframework.stereotype.Service;
  13 +import org.springframework.validation.annotation.Validated;
  14 +
  15 +import javax.annotation.Resource;
  16 +import java.time.LocalTime;
  17 +import java.util.Collection;
  18 +import java.util.List;
  19 +import java.util.Set;
  20 +import java.util.stream.Collectors;
  21 +
  22 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  23 +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
  24 +
  25 +/**
  26 + * 秒杀时段 Service 实现类
  27 + *
  28 + * @author halfninety
  29 + */
  30 +@Service
  31 +@Validated
  32 +public class SeckillConfigServiceImpl implements SeckillConfigService {
  33 +
  34 + @Resource
  35 + private SeckillConfigMapper seckillConfigMapper;
  36 +
  37 + @Override
  38 + public Long createSeckillConfig(SeckillConfigCreateReqVO createReqVO) {
  39 + // 校验时间段是否冲突
  40 + validateSeckillConfigConflict(createReqVO.getStartTime(), createReqVO.getEndTime());
  41 +
  42 + // 插入
  43 + SeckillConfigDO seckillConfig = SeckillConfigConvert.INSTANCE.convert(createReqVO);
  44 + seckillConfigMapper.insert(seckillConfig);
  45 + // 返回
  46 + return seckillConfig.getId();
  47 + }
  48 +
  49 + @Override
  50 + public void updateSeckillConfig(SeckillConfigUpdateReqVO updateReqVO) {
  51 + // 校验存在
  52 + validateSeckillConfigExists(updateReqVO.getId());
  53 + // 校验时间段是否冲突
  54 + validateSeckillConfigConflict(updateReqVO.getStartTime(), updateReqVO.getEndTime());
  55 +
  56 + // 更新
  57 + SeckillConfigDO updateObj = SeckillConfigConvert.INSTANCE.convert(updateReqVO);
  58 + seckillConfigMapper.updateById(updateObj);
  59 + }
  60 +
  61 + @Override
  62 + public void deleteSeckillConfig(Long id) {
  63 + // 校验存在
  64 + validateSeckillConfigExists(id);
  65 +
  66 + // 删除
  67 + seckillConfigMapper.deleteById(id);
  68 + }
  69 +
  70 + private void validateSeckillConfigExists(Long id) {
  71 + if (seckillConfigMapper.selectById(id) == null) {
  72 + throw exception(SECKILL_TIME_NOT_EXISTS);
  73 + }
  74 + }
  75 +
  76 + /**
  77 + * 校验时间是否存在冲突
  78 + *
  79 + * @param startTime 开始时间
  80 + * @param endTime 结束时间
  81 + */
  82 + private void validateSeckillConfigConflict(String startTime, String endTime) {
  83 + LocalTime startTime1 = LocalTime.parse(startTime);
  84 + LocalTime endTime1 = LocalTime.parse(endTime);
  85 + // 检查选择的时间是否相等
  86 + if (startTime1.equals(endTime1)) {
  87 + throw exception(SECKILL_TIME_EQUAL);
  88 + }
  89 + // 检查开始时间是否在结束时间之前
  90 + if (startTime1.isAfter(endTime1)) {
  91 + throw exception(SECKILL_START_TIME_BEFORE_END_TIME);
  92 + }
  93 + // 查询出所有的时段配置
  94 + List<SeckillConfigDO> configDOs = seckillConfigMapper.selectList();
  95 + // 过滤出重叠的时段 ids
  96 + Set<Long> ids = configDOs.stream().filter((config) -> {
  97 + LocalTime startTime2 = LocalTime.parse(config.getStartTime());
  98 + LocalTime endTime2 = LocalTime.parse(config.getEndTime());
  99 + // 判断时间是否重叠
  100 + // 开始时间在已配置时段的结束时间之前 且 结束时间在已配置时段的开始时间之后 []
  101 + return startTime1.isBefore(endTime2) && endTime1.isAfter(startTime2)
  102 + // 开始时间在已配置时段的开始时间之前 且 结束时间在已配置时段的开始时间之后 (] 或 ()
  103 + || startTime1.isBefore(startTime2) && endTime1.isAfter(startTime2)
  104 + // 开始时间在已配置时段的结束时间之前 且 结束时间在已配值时段的结束时间之后 [) 或 ()
  105 + || startTime1.isBefore(endTime2) && endTime1.isAfter(endTime2);
  106 + }).map(SeckillConfigDO::getId).collect(Collectors.toSet());
  107 + if (CollUtil.isNotEmpty(ids)) {
  108 + throw exception(SECKILL_TIME_CONFLICTS);
  109 + }
  110 + }
  111 +
  112 + @Override
  113 + public SeckillConfigDO getSeckillConfig(Long id) {
  114 + return seckillConfigMapper.selectById(id);
  115 + }
  116 +
  117 + @Override
  118 + public List<SeckillConfigDO> getSeckillConfigList() {
  119 + return seckillConfigMapper.selectList();
  120 + }
  121 +
  122 + @Override
  123 + public void validateSeckillConfigExists(Collection<Long> configIds) {
  124 + if (CollUtil.isEmpty(configIds)) {
  125 + throw exception(SECKILL_TIME_NOT_EXISTS);
  126 + }
  127 + if (seckillConfigMapper.selectBatchIds(configIds).size() != configIds.size()) {
  128 + throw exception(SECKILL_TIME_NOT_EXISTS);
  129 + }
  130 + }
  131 +
  132 + @Override
  133 + public PageResult<SeckillConfigDO> getSeckillConfigPage(SeckillConfigPageReqVO pageVO) {
  134 + return seckillConfigMapper.selectPage(pageVO);
  135 + }
  136 +
  137 + @Override
  138 + public List<SeckillConfigDO> getListAllSimple() {
  139 + return seckillConfigMapper.selectList(SeckillConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
  140 + }
  141 +
  142 + @Override
  143 + public void updateSeckillConfigStatus(Long id, Integer status) {
  144 + // 校验秒杀时段是否存在
  145 + validateSeckillConfigExists(id);
  146 +
  147 + SeckillConfigDO seckillConfigDO = new SeckillConfigDO();
  148 + seckillConfigDO.setId(id);
  149 + seckillConfigDO.setStatus(status);
  150 + // 更新状态
  151 + seckillConfigMapper.updateById(seckillConfigDO);
  152 + }
  153 +
  154 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckilltime/SeckillTimeServiceImpl.java deleted
1   -package cn.iocoder.yudao.module.promotion.service.seckill.seckilltime;
2   -
3   -import cn.hutool.core.collection.CollUtil;
4   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeCreateReqVO;
5   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeUpdateReqVO;
6   -import cn.iocoder.yudao.module.promotion.convert.seckill.seckilltime.SeckillTimeConvert;
7   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
8   -import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckilltime.SeckillTimeMapper;
9   -import org.springframework.stereotype.Service;
10   -import org.springframework.validation.annotation.Validated;
11   -
12   -import javax.annotation.Resource;
13   -import java.time.LocalTime;
14   -import java.util.Collection;
15   -import java.util.List;
16   -import java.util.Objects;
17   -
18   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
19   -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_TIME_CONFLICTS;
20   -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_TIME_NOT_EXISTS;
21   -
22   -/**
23   - * 秒杀时段 Service 实现类
24   - *
25   - * @author halfninety
26   - */
27   -@Service
28   -@Validated
29   -public class SeckillTimeServiceImpl implements SeckillTimeService {
30   -
31   - @Resource
32   - private SeckillTimeMapper seckillTimeMapper;
33   -
34   - @Override
35   - public Long createSeckillTime(SeckillTimeCreateReqVO createReqVO) {
36   - // 校验时间段是否冲突
37   - validateSeckillTimeConflict(null, createReqVO.getStartTime(), createReqVO.getEndTime());
38   - // 插入
39   - SeckillTimeDO seckillTime = SeckillTimeConvert.INSTANCE.convert(createReqVO);
40   - seckillTimeMapper.insert(seckillTime);
41   - // 返回
42   - return seckillTime.getId();
43   - }
44   -
45   - @Override
46   - public void updateSeckillTime(SeckillTimeUpdateReqVO updateReqVO) {
47   - // 校验存在
48   - this.validateSeckillTimeExists(updateReqVO.getId());
49   - // 校验时间段是否冲突
50   - validateSeckillTimeConflict(updateReqVO.getId(), updateReqVO.getStartTime(), updateReqVO.getEndTime());
51   - // 更新
52   - SeckillTimeDO updateObj = SeckillTimeConvert.INSTANCE.convert(updateReqVO);
53   - seckillTimeMapper.updateById(updateObj);
54   - }
55   -
56   - @Override
57   - public void deleteSeckillTime(Long id) {
58   - // 校验存在
59   - this.validateSeckillTimeExists(id);
60   - // 删除
61   - seckillTimeMapper.deleteById(id);
62   - }
63   -
64   - private void validateSeckillTimeExists(Long id) {
65   - if (seckillTimeMapper.selectById(id) == null) {
66   - throw exception(SECKILL_TIME_NOT_EXISTS);
67   - }
68   - }
69   -
70   - /**
71   - * 校验时间是否存在冲突
72   - *
73   - * @param startTime 开始时间
74   - * @param endTime 结束时间
75   - */
76   - private void validateSeckillTimeConflict(Long id, LocalTime startTime, LocalTime endTime) {
77   - //查询开始时间,结束时间,是否在别人的时间段内
78   - List<SeckillTimeDO> startTimeList = seckillTimeMapper.selectListByTime(startTime);
79   - List<SeckillTimeDO> endTimeList = seckillTimeMapper.selectListByTime(endTime);
80   - //查询自己时间段内是否有时间段
81   - List<SeckillTimeDO> startEndTimeList = seckillTimeMapper.selectListByTime(startTime, endTime);
82   - if (id != null) {
83   - //移除自己
84   - startTimeList.removeIf(seckillTime -> Objects.equals(seckillTime.getId(), id));
85   - endTimeList.removeIf(seckillTime -> Objects.equals(seckillTime.getId(), id));
86   - startEndTimeList.removeIf(seckillTime -> Objects.equals(seckillTime.getId(), id));
87   - }
88   - if (CollUtil.isNotEmpty(startTimeList) || CollUtil.isNotEmpty(endTimeList)
89   - || CollUtil.isNotEmpty(startEndTimeList)) {
90   - throw exception(SECKILL_TIME_CONFLICTS);
91   - }
92   - }
93   -
94   - @Override
95   - public SeckillTimeDO getSeckillTime(Long id) {
96   - return seckillTimeMapper.selectById(id);
97   - }
98   -
99   - @Override
100   - public List<SeckillTimeDO> getSeckillTimeList() {
101   - return seckillTimeMapper.selectList();
102   - }
103   -
104   - @Override
105   - public void validateSeckillTimeExists(Collection<Long> timeIds) {
106   - if (CollUtil.isEmpty(timeIds)) {
107   - throw exception(SECKILL_TIME_NOT_EXISTS);
108   - }
109   - if (seckillTimeMapper.selectBatchIds(timeIds).size() != timeIds.size()) {
110   - throw exception(SECKILL_TIME_NOT_EXISTS);
111   - }
112   - }
113   -
114   - @Override
115   - public void sekillActivityCountIncr(Collection<Long> ids) {
116   - seckillTimeMapper.updateActivityCount(ids, "+", 1);
117   - }
118   -
119   - @Override
120   - public void sekillActivityCountDecr(Collection<Long> ids) {
121   - seckillTimeMapper.updateActivityCount(ids, "-", 1);
122   - }
123   -
124   -}
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/util/PromotionUtils.java
1 1 package cn.iocoder.yudao.module.promotion.util;
2 2  
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 4 import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
4   -import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
5 5  
6 6 import java.time.LocalDateTime;
7 7  
... ... @@ -15,18 +15,11 @@ public class PromotionUtils {
15 15 /**
16 16 * 根据时间,计算活动状态
17 17 *
18   - * @param startTime 开始时间
19 18 * @param endTime 结束时间
20 19 * @return 活动状态
21 20 */
22   - public static Integer calculateActivityStatus(LocalDateTime startTime, LocalDateTime endTime) {
23   - if (LocalDateTimeUtils.beforeNow(endTime)) {
24   - return PromotionActivityStatusEnum.END.getStatus();
25   - }
26   - if (LocalDateTimeUtils.afterNow(startTime)) {
27   - return PromotionActivityStatusEnum.WAIT.getStatus();
28   - }
29   - return PromotionActivityStatusEnum.RUN.getStatus();
  21 + public static Integer calculateActivityStatus(LocalDateTime endTime) {
  22 + return LocalDateTimeUtils.beforeNow(endTime) ? CommonStatusEnum.DISABLE.getStatus() : CommonStatusEnum.ENABLE.getStatus();
30 23 }
31 24  
32 25 }
... ...
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillactivity/SeckillActivityServiceImplTest.java
... ... @@ -108,31 +108,31 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest {
108 108 SeckillActivityDO dbSeckillActivity = randomPojo(SeckillActivityDO.class, o -> { // 等会查询到
109 109 o.setName(null);
110 110 o.setStatus(null);
111   - o.setTimeIds(null);
  111 + o.setConfigIds(null);
112 112 o.setCreateTime(null);
113 113 });
114 114 seckillActivityMapper.insert(dbSeckillActivity);
115 115 // 测试 name 不匹配
116   - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setName(null)));
117   - // 测试 status 不匹配
118   - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setStatus(null)));
119   - // 测试 timeId 不匹配
120   - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setTimeIds(null)));
121   - // 测试 createTime 不匹配
122   - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setCreateTime(null)));
123   - // 准备参数
124   - SeckillActivityPageReqVO reqVO = new SeckillActivityPageReqVO();
125   - reqVO.setName(null);
126   - reqVO.setStatus(null);
127   - reqVO.setTimeId(null);
128   - reqVO.setCreateTime((new LocalDateTime[]{}));
129   -
130   - // 调用
131   - PageResult<SeckillActivityDO> pageResult = seckillActivityService.getSeckillActivityPage(reqVO);
132   - // 断言
133   - assertEquals(1, pageResult.getTotal());
134   - assertEquals(1, pageResult.getList().size());
135   - assertPojoEquals(dbSeckillActivity, pageResult.getList().get(0));
  116 + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setName(null)));
  117 + // 测试 status 不匹配
  118 + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setStatus(null)));
  119 + // 测试 timeId 不匹配
  120 + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setConfigIds(null)));
  121 + // 测试 createTime 不匹配
  122 + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setCreateTime(null)));
  123 + // 准备参数
  124 + SeckillActivityPageReqVO reqVO = new SeckillActivityPageReqVO();
  125 + reqVO.setName(null);
  126 + reqVO.setStatus(null);
  127 + reqVO.setConfigId(null);
  128 + reqVO.setCreateTime((new LocalDateTime[]{}));
  129 +
  130 + // 调用
  131 + PageResult<SeckillActivityDO> pageResult = seckillActivityService.getSeckillActivityPage(reqVO);
  132 + // 断言
  133 + assertEquals(1, pageResult.getTotal());
  134 + assertEquals(1, pageResult.getList().size());
  135 + assertPojoEquals(dbSeckillActivity, pageResult.getList().get(0));
136 136 }
137 137  
138 138 @Test
... ... @@ -142,7 +142,7 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest {
142 142 SeckillActivityDO dbSeckillActivity = randomPojo(SeckillActivityDO.class, o -> { // 等会查询到
143 143 o.setName(null);
144 144 o.setStatus(null);
145   - o.setTimeIds(null);
  145 + o.setConfigIds(null);
146 146 o.setCreateTime(null);
147 147 });
148 148 seckillActivityMapper.insert(dbSeckillActivity);
... ... @@ -151,7 +151,7 @@ public class SeckillActivityServiceImplTest extends BaseDbUnitTest {
151 151 // 测试 status 不匹配
152 152 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setStatus(null)));
153 153 // 测试 timeId 不匹配
154   - seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setTimeIds(null)));
  154 + seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setConfigIds(null)));
155 155 // 测试 createTime 不匹配
156 156 seckillActivityMapper.insert(cloneIgnoreId(dbSeckillActivity, o -> o.setCreateTime(null)));
157 157 // 准备参数
... ...
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckillconfig/SeckillConfigServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.service.seckillconfig;
  2 +
  3 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  4 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigCreateReqVO;
  5 +import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.config.SeckillConfigUpdateReqVO;
  6 +import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckillconfig.SeckillConfigDO;
  7 +import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckillconfig.SeckillConfigMapper;
  8 +import cn.iocoder.yudao.module.promotion.service.seckill.seckillconfig.SeckillConfigServiceImpl;
  9 +import com.fasterxml.jackson.core.JsonProcessingException;
  10 +import com.fasterxml.jackson.databind.ObjectMapper;
  11 +import org.junit.jupiter.api.Disabled;
  12 +import org.junit.jupiter.api.Test;
  13 +import org.springframework.context.annotation.Import;
  14 +
  15 +import javax.annotation.Resource;
  16 +
  17 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
  18 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
  19 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
  20 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
  21 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
  22 +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_TIME_NOT_EXISTS;
  23 +import static org.junit.jupiter.api.Assertions.assertNotNull;
  24 +import static org.junit.jupiter.api.Assertions.assertNull;
  25 +
  26 +/**
  27 + * {@link SeckillConfigServiceImpl} 的单元测试类
  28 + *
  29 + * @author 芋道源码
  30 + */
  31 +@Import(SeckillConfigServiceImpl.class)
  32 +@Disabled // TODO 芋艿:未来开启
  33 +public class SeckillConfigServiceImplTest extends BaseDbUnitTest {
  34 +
  35 + @Resource
  36 + private SeckillConfigServiceImpl SeckillConfigService;
  37 +
  38 + @Resource
  39 + private SeckillConfigMapper seckillConfigMapper;
  40 +
  41 + @Resource
  42 + private ObjectMapper objectMapper;
  43 +
  44 + @Test
  45 + public void testJacksonSerializ() {
  46 +
  47 + // 准备参数
  48 + SeckillConfigCreateReqVO reqVO = randomPojo(SeckillConfigCreateReqVO.class);
  49 +// ObjectMapper objectMapper = new ObjectMapper();
  50 + try {
  51 + String string = objectMapper.writeValueAsString(reqVO);
  52 + System.out.println(string);
  53 + } catch (JsonProcessingException e) {
  54 + e.printStackTrace();
  55 + }
  56 +
  57 +
  58 + }
  59 +
  60 + @Test
  61 + public void testCreateSeckillConfig_success() {
  62 + // 准备参数
  63 + SeckillConfigCreateReqVO reqVO = randomPojo(SeckillConfigCreateReqVO.class);
  64 +
  65 + // 调用
  66 + Long SeckillConfigId = SeckillConfigService.createSeckillConfig(reqVO);
  67 + // 断言
  68 + assertNotNull(SeckillConfigId);
  69 + // 校验记录的属性是否正确
  70 + SeckillConfigDO SeckillConfig = seckillConfigMapper.selectById(SeckillConfigId);
  71 + assertPojoEquals(reqVO, SeckillConfig);
  72 + }
  73 +
  74 + @Test
  75 + public void testUpdateSeckillConfig_success() {
  76 + // mock 数据
  77 + SeckillConfigDO dbSeckillConfig = randomPojo(SeckillConfigDO.class);
  78 + seckillConfigMapper.insert(dbSeckillConfig);// @Sql: 先插入出一条存在的数据
  79 + // 准备参数
  80 + SeckillConfigUpdateReqVO reqVO = randomPojo(SeckillConfigUpdateReqVO.class, o -> {
  81 + o.setId(dbSeckillConfig.getId()); // 设置更新的 ID
  82 + });
  83 +
  84 + // 调用
  85 + SeckillConfigService.updateSeckillConfig(reqVO);
  86 + // 校验是否更新正确
  87 + SeckillConfigDO SeckillConfig = seckillConfigMapper.selectById(reqVO.getId()); // 获取最新的
  88 + assertPojoEquals(reqVO, SeckillConfig);
  89 + }
  90 +
  91 + @Test
  92 + public void testUpdateSeckillConfig_notExists() {
  93 + // 准备参数
  94 + SeckillConfigUpdateReqVO reqVO = randomPojo(SeckillConfigUpdateReqVO.class);
  95 +
  96 + // 调用, 并断言异常
  97 + assertServiceException(() -> SeckillConfigService.updateSeckillConfig(reqVO), SECKILL_TIME_NOT_EXISTS);
  98 + }
  99 +
  100 + @Test
  101 + public void testDeleteSeckillConfig_success() {
  102 + // mock 数据
  103 + SeckillConfigDO dbSeckillConfig = randomPojo(SeckillConfigDO.class);
  104 + seckillConfigMapper.insert(dbSeckillConfig);// @Sql: 先插入出一条存在的数据
  105 + // 准备参数
  106 + Long id = dbSeckillConfig.getId();
  107 +
  108 + // 调用
  109 + SeckillConfigService.deleteSeckillConfig(id);
  110 + // 校验数据不存在了
  111 + assertNull(seckillConfigMapper.selectById(id));
  112 + }
  113 +
  114 + @Test
  115 + public void testDeleteSeckillConfig_notExists() {
  116 + // 准备参数
  117 + Long id = randomLongId();
  118 +
  119 + // 调用, 并断言异常
  120 + assertServiceException(() -> SeckillConfigService.deleteSeckillConfig(id), SECKILL_TIME_NOT_EXISTS);
  121 + }
  122 +
  123 + @Test
  124 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  125 + public void testGetSeckillConfigPage() {
  126 + // mock 数据
  127 +// SeckillConfigDO dbSeckillConfig = randomPojo(SeckillConfigDO.class, o -> { // 等会查询到
  128 +// o.setName(null);
  129 +// o.setStartTime(null);
  130 +// o.setEndTime(null);
  131 +// o.setCreateTime(null);
  132 +// });
  133 +// seckillConfigMapper.insert(dbSeckillConfig);
  134 +// // 测试 name 不匹配
  135 +// seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setName(null)));
  136 +// // 测试 startTime 不匹配
  137 +// seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setStartTime(null)));
  138 +// // 测试 endTime 不匹配
  139 +// seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setEndTime(null)));
  140 +// // 测试 createTime 不匹配
  141 +// seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setCreateTime(null)));
  142 +// // 准备参数
  143 +// SeckillConfigPageReqVO reqVO = new SeckillConfigPageReqVO();
  144 +// reqVO.setName(null);
  145 +//// reqVO.setStartTime((new LocalTime()));
  146 +//// reqVO.setEndTime((new LocalTime[]{}));
  147 +//// reqVO.setCreateTime((new Date[]{}));
  148 +//
  149 +// // 调用
  150 +// PageResult<SeckillConfigDO> pageResult = SeckillConfigService.getSeckillConfigPage(reqVO);
  151 +// // 断言
  152 +// assertEquals(1, pageResult.getTotal());
  153 +// assertEquals(1, pageResult.getList().size());
  154 +// assertPojoEquals(dbSeckillConfig, pageResult.getList().get(0));
  155 + }
  156 +
  157 + @Test
  158 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  159 + public void testGetSeckillConfigList() {
  160 + // mock 数据
  161 + SeckillConfigDO dbSeckillConfig = randomPojo(SeckillConfigDO.class, o -> { // 等会查询到
  162 + o.setName(null);
  163 + o.setStartTime(null);
  164 + o.setEndTime(null);
  165 + o.setCreateTime(null);
  166 + });
  167 + seckillConfigMapper.insert(dbSeckillConfig);
  168 + // 测试 name 不匹配
  169 + seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setName(null)));
  170 + // 测试 startTime 不匹配
  171 + seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setStartTime(null)));
  172 + // 测试 endTime 不匹配
  173 + seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setEndTime(null)));
  174 + // 测试 createTime 不匹配
  175 + seckillConfigMapper.insert(cloneIgnoreId(dbSeckillConfig, o -> o.setCreateTime(null)));
  176 + // 准备参数
  177 +// SeckillConfigExportReqVO reqVO = new SeckillConfigExportReqVO();
  178 +// reqVO.setName(null);
  179 +// reqVO.setStartTime((new LocalTime[]{}));
  180 +// reqVO.setEndTime((new LocalTime[]{}));
  181 +// reqVO.setCreateTime((new Date[]{}));
  182 +//
  183 +// // 调用
  184 +// List<SeckillConfigDO> list = SeckillConfigService.getSeckillConfigList(reqVO);
  185 +// // 断言
  186 +// assertEquals(1, list.size());
  187 +// assertPojoEquals(dbSeckillConfig, list.get(0));
  188 + }
  189 +
  190 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/seckilltime/SeckillTimeServiceImplTest.java deleted
1   -package cn.iocoder.yudao.module.promotion.service.seckilltime;
2   -
3   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeCreateReqVO;
4   -import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.time.SeckillTimeUpdateReqVO;
5   -import cn.iocoder.yudao.module.promotion.service.seckill.seckilltime.SeckillTimeServiceImpl;
6   -import com.fasterxml.jackson.core.JsonProcessingException;
7   -import com.fasterxml.jackson.databind.ObjectMapper;
8   -import org.junit.jupiter.api.Disabled;
9   -import org.junit.jupiter.api.Test;
10   -
11   -import javax.annotation.Resource;
12   -
13   -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
14   -
15   -import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.seckilltime.SeckillTimeDO;
16   -import cn.iocoder.yudao.module.promotion.dal.mysql.seckill.seckilltime.SeckillTimeMapper;
17   -
18   -import org.springframework.context.annotation.Import;
19   -
20   -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
21   -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
22   -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
23   -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
24   -import static org.junit.jupiter.api.Assertions.*;
25   -
26   -/**
27   -* {@link SeckillTimeServiceImpl} 的单元测试类
28   -*
29   -* @author 芋道源码
30   -*/
31   -@Import(SeckillTimeServiceImpl.class)
32   -@Disabled // TODO 芋艿:未来开启
33   -public class SeckillTimeServiceImplTest extends BaseDbUnitTest {
34   -
35   - @Resource
36   - private SeckillTimeServiceImpl seckillTimeService;
37   -
38   - @Resource
39   - private SeckillTimeMapper seckillTimeMapper;
40   -
41   - @Resource
42   - private ObjectMapper objectMapper;
43   -
44   - @Test
45   - public void testJacksonSerializ(){
46   -
47   - // 准备参数
48   - SeckillTimeCreateReqVO reqVO = randomPojo(SeckillTimeCreateReqVO.class);
49   -// ObjectMapper objectMapper = new ObjectMapper();
50   - try {
51   - String string = objectMapper.writeValueAsString(reqVO);
52   - System.out.println(string);
53   - } catch (JsonProcessingException e) {
54   - e.printStackTrace();
55   - }
56   -
57   -
58   - }
59   -
60   - @Test
61   - public void testCreateSeckillTime_success() {
62   - // 准备参数
63   - SeckillTimeCreateReqVO reqVO = randomPojo(SeckillTimeCreateReqVO.class);
64   -
65   - // 调用
66   - Long seckillTimeId = seckillTimeService.createSeckillTime(reqVO);
67   - // 断言
68   - assertNotNull(seckillTimeId);
69   - // 校验记录的属性是否正确
70   - SeckillTimeDO seckillTime = seckillTimeMapper.selectById(seckillTimeId);
71   - assertPojoEquals(reqVO, seckillTime);
72   - }
73   -
74   - @Test
75   - public void testUpdateSeckillTime_success() {
76   - // mock 数据
77   - SeckillTimeDO dbSeckillTime = randomPojo(SeckillTimeDO.class);
78   - seckillTimeMapper.insert(dbSeckillTime);// @Sql: 先插入出一条存在的数据
79   - // 准备参数
80   - SeckillTimeUpdateReqVO reqVO = randomPojo(SeckillTimeUpdateReqVO.class, o -> {
81   - o.setId(dbSeckillTime.getId()); // 设置更新的 ID
82   - });
83   -
84   - // 调用
85   - seckillTimeService.updateSeckillTime(reqVO);
86   - // 校验是否更新正确
87   - SeckillTimeDO seckillTime = seckillTimeMapper.selectById(reqVO.getId()); // 获取最新的
88   - assertPojoEquals(reqVO, seckillTime);
89   - }
90   -
91   - @Test
92   - public void testUpdateSeckillTime_notExists() {
93   - // 准备参数
94   - SeckillTimeUpdateReqVO reqVO = randomPojo(SeckillTimeUpdateReqVO.class);
95   -
96   - // 调用, 并断言异常
97   - assertServiceException(() -> seckillTimeService.updateSeckillTime(reqVO), SECKILL_TIME_NOT_EXISTS);
98   - }
99   -
100   - @Test
101   - public void testDeleteSeckillTime_success() {
102   - // mock 数据
103   - SeckillTimeDO dbSeckillTime = randomPojo(SeckillTimeDO.class);
104   - seckillTimeMapper.insert(dbSeckillTime);// @Sql: 先插入出一条存在的数据
105   - // 准备参数
106   - Long id = dbSeckillTime.getId();
107   -
108   - // 调用
109   - seckillTimeService.deleteSeckillTime(id);
110   - // 校验数据不存在了
111   - assertNull(seckillTimeMapper.selectById(id));
112   - }
113   -
114   - @Test
115   - public void testDeleteSeckillTime_notExists() {
116   - // 准备参数
117   - Long id = randomLongId();
118   -
119   - // 调用, 并断言异常
120   - assertServiceException(() -> seckillTimeService.deleteSeckillTime(id), SECKILL_TIME_NOT_EXISTS);
121   - }
122   -
123   - @Test
124   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
125   - public void testGetSeckillTimePage() {
126   - // mock 数据
127   -// SeckillTimeDO dbSeckillTime = randomPojo(SeckillTimeDO.class, o -> { // 等会查询到
128   -// o.setName(null);
129   -// o.setStartTime(null);
130   -// o.setEndTime(null);
131   -// o.setCreateTime(null);
132   -// });
133   -// seckillTimeMapper.insert(dbSeckillTime);
134   -// // 测试 name 不匹配
135   -// seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setName(null)));
136   -// // 测试 startTime 不匹配
137   -// seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setStartTime(null)));
138   -// // 测试 endTime 不匹配
139   -// seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setEndTime(null)));
140   -// // 测试 createTime 不匹配
141   -// seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setCreateTime(null)));
142   -// // 准备参数
143   -// SeckillTimePageReqVO reqVO = new SeckillTimePageReqVO();
144   -// reqVO.setName(null);
145   -//// reqVO.setStartTime((new LocalTime()));
146   -//// reqVO.setEndTime((new LocalTime[]{}));
147   -//// reqVO.setCreateTime((new Date[]{}));
148   -//
149   -// // 调用
150   -// PageResult<SeckillTimeDO> pageResult = seckillTimeService.getSeckillTimePage(reqVO);
151   -// // 断言
152   -// assertEquals(1, pageResult.getTotal());
153   -// assertEquals(1, pageResult.getList().size());
154   -// assertPojoEquals(dbSeckillTime, pageResult.getList().get(0));
155   - }
156   -
157   - @Test
158   - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
159   - public void testGetSeckillTimeList() {
160   - // mock 数据
161   - SeckillTimeDO dbSeckillTime = randomPojo(SeckillTimeDO.class, o -> { // 等会查询到
162   - o.setName(null);
163   - o.setStartTime(null);
164   - o.setEndTime(null);
165   - o.setCreateTime(null);
166   - });
167   - seckillTimeMapper.insert(dbSeckillTime);
168   - // 测试 name 不匹配
169   - seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setName(null)));
170   - // 测试 startTime 不匹配
171   - seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setStartTime(null)));
172   - // 测试 endTime 不匹配
173   - seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setEndTime(null)));
174   - // 测试 createTime 不匹配
175   - seckillTimeMapper.insert(cloneIgnoreId(dbSeckillTime, o -> o.setCreateTime(null)));
176   - // 准备参数
177   -// SeckillTimeExportReqVO reqVO = new SeckillTimeExportReqVO();
178   -// reqVO.setName(null);
179   -// reqVO.setStartTime((new LocalTime[]{}));
180   -// reqVO.setEndTime((new LocalTime[]{}));
181   -// reqVO.setCreateTime((new Date[]{}));
182   -//
183   -// // 调用
184   -// List<SeckillTimeDO> list = seckillTimeService.getSeckillTimeList(reqVO);
185   -// // 断言
186   -// assertEquals(1, list.size());
187   -// assertPojoEquals(dbSeckillTime, list.get(0));
188   - }
189   -
190   -}
yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql
... ... @@ -4,3 +4,4 @@ DELETE FROM &quot;promotion_coupon&quot;;
4 4 DELETE FROM "promotion_reward_activity";
5 5 DELETE FROM "promotion_discount_activity";
6 6 DELETE FROM "promotion_discount_product";
  7 +DELETE FROM "promotion_seckill_config";
... ...
yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql
... ... @@ -107,18 +107,45 @@ CREATE TABLE IF NOT EXISTS &quot;promotion_discount_activity&quot; (
107 107 PRIMARY KEY ("id")
108 108 ) COMMENT '限时折扣活动';
109 109  
110   -CREATE TABLE IF NOT EXISTS "promotion_discount_product" (
111   - "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
112   - "activity_id" bigint NOT NULL,
113   - "spu_id" bigint NOT NULL,
114   - "sku_id" bigint NOT NULL,
115   - "discount_type" int NOT NULL,
116   - "discount_percent" int,
117   - "discount_price" int,
118   - "creator" varchar DEFAULT '',
119   - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
120   - "updater" varchar DEFAULT '',
121   - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
122   - "deleted" bit NOT NULL DEFAULT FALSE,
123   - PRIMARY KEY ("id")
124   -) COMMENT '限时折扣活动';
  110 +-- 将该建表 SQL 语句,添加到 yudao-module-promotion-biz 模块的 test/resources/sql/create_tables.sql 文件里
  111 +CREATE TABLE IF NOT EXISTS "promotion_seckill_activity" (
  112 + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  113 + "spu_id" bigint NOT NULL,
  114 + "name" varchar NOT NULL,
  115 + "status" int NOT NULL,
  116 + "remark" varchar,
  117 + "start_time" varchar NOT NULL,
  118 + "end_time" varchar NOT NULL,
  119 + "sort" int NOT NULL,
  120 + "config_ids" varchar NOT NULL,
  121 + "order_count" int NOT NULL,
  122 + "user_count" int NOT NULL,
  123 + "total_price" int NOT NULL,
  124 + "total_limit_count" int,
  125 + "single_limit_count" int,
  126 + "stock" int,
  127 + "total_stock" int,
  128 + "creator" varchar DEFAULT '',
  129 + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  130 + "updater" varchar DEFAULT '',
  131 + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  132 + "deleted" bit NOT NULL DEFAULT FALSE,
  133 + "tenant_id" bigint NOT NULL,
  134 + PRIMARY KEY ("id")
  135 +) COMMENT '秒杀活动';
  136 +
  137 +CREATE TABLE IF NOT EXISTS "promotion_seckill_config" (
  138 + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  139 + "name" varchar NOT NULL,
  140 + "start_time" varchar NOT NULL,
  141 + "end_time" varchar NOT NULL,
  142 + "pic_url" varchar NOT NULL,
  143 + "status" int NOT NULL,
  144 + "creator" varchar DEFAULT '',
  145 + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  146 + "updater" varchar DEFAULT '',
  147 + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  148 + "deleted" bit NOT NULL DEFAULT FALSE,
  149 + "tenant_id" bigint NOT NULL,
  150 + PRIMARY KEY ("id")
  151 +) COMMENT '秒杀时段配置';
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressBaseVO.java
... ... @@ -12,22 +12,22 @@ import javax.validation.constraints.NotNull;
12 12 @Data
13 13 public class DeliveryExpressBaseVO {
14 14  
15   - @Schema(description = "快递公司编码", required = true)
  15 + @Schema(description = "快递公司编码", requiredMode = Schema.RequiredMode.REQUIRED)
16 16 @NotNull(message = "快递公司编码不能为空")
17 17 private String code;
18 18  
19   - @Schema(description = "快递公司名称", required = true, example = "李四")
  19 + @Schema(description = "快递公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
20 20 @NotNull(message = "快递公司名称不能为空")
21 21 private String name;
22 22  
23 23 @Schema(description = "快递公司logo")
24 24 private String logo;
25 25  
26   - @Schema(description = "排序", required = true)
  26 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
27 27 @NotNull(message = "排序不能为空")
28 28 private Integer sort;
29 29  
30   - @Schema(description = "状态", required = true, example = "1")
  30 + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
31 31 @NotNull(message = "状态不能为空")
32 32 private Integer status;
33 33  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressRespVO.java
1 1 package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.*;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
  7 +
5 8 import java.time.LocalDateTime;
6 9  
7 10 @Schema(description = "管理后台 - 快递公司 Response VO")
... ... @@ -10,10 +13,10 @@ import java.time.LocalDateTime;
10 13 @ToString(callSuper = true)
11 14 public class DeliveryExpressRespVO extends DeliveryExpressBaseVO {
12 15  
13   - @Schema(description = "编号", required = true, example = "6592")
  16 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6592")
14 17 private Long id;
15 18  
16   - @Schema(description = "创建时间", required = true)
  19 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 20 private LocalDateTime createTime;
18 21  
19 22 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressUpdateReqVO.java
... ... @@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
13 13 @ToString(callSuper = true)
14 14 public class DeliveryExpressUpdateReqVO extends DeliveryExpressBaseVO {
15 15  
16   - @Schema(description = "编号", required = true, example = "6592")
  16 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6592")
17 17 @NotNull(message = "编号不能为空")
18 18 private Long id;
19 19  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateBaseVO.java
... ... @@ -12,15 +12,15 @@ import javax.validation.constraints.NotNull;
12 12 @Data
13 13 public class DeliveryExpressTemplateBaseVO {
14 14  
15   - @Schema(description = "模板名称", required = true, example = "王五")
  15 + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
16 16 @NotNull(message = "模板名称不能为空")
17 17 private String name;
18 18  
19   - @Schema(description = "配送计费方式 1:按件 2:按重量 3:按体积", required = true)
  19 + @Schema(description = "配送计费方式 1:按件 2:按重量 3:按体积", requiredMode = Schema.RequiredMode.REQUIRED)
20 20 @NotNull(message = "配送计费方式 1:按件 2:按重量 3:按体积不能为空")
21 21 private Integer chargeMode;
22 22  
23   - @Schema(description = "排序", required = true)
  23 + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
24 24 @NotNull(message = "排序不能为空")
25 25 private Integer sort;
26 26  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateRespVO.java
1 1 package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.*;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
  7 +
5 8 import java.time.LocalDateTime;
6 9  
7 10 @Schema(description = "管理后台 - 快递运费模板 Response VO")
... ... @@ -10,10 +13,10 @@ import java.time.LocalDateTime;
10 13 @ToString(callSuper = true)
11 14 public class DeliveryExpressTemplateRespVO extends DeliveryExpressTemplateBaseVO {
12 15  
13   - @Schema(description = "编号,自增", required = true, example = "371")
  16 + @Schema(description = "编号,自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
14 17 private Long id;
15 18  
16   - @Schema(description = "创建时间", required = true)
  19 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 20 private LocalDateTime createTime;
18 21  
19 22 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java
... ... @@ -12,10 +12,10 @@ import lombok.NoArgsConstructor;
12 12 @AllArgsConstructor
13 13 public class DeliveryExpressTemplateSimpleRespVO {
14 14  
15   - @Schema(description = "模版编号", required = true, example = "1024")
  15 + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
16 16 private Long id;
17 17  
18   - @Schema(description = "模板名称", required = true, example = "测试模版")
  18 + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试模版")
19 19 private String name;
20 20  
21 21 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateUpdateReqVO.java
... ... @@ -15,7 +15,7 @@ import java.util.List;
15 15 @ToString(callSuper = true)
16 16 public class DeliveryExpressTemplateUpdateReqVO extends DeliveryExpressTemplateBaseVO {
17 17  
18   - @Schema(description = "编号", required = true, example = "371")
  18 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
19 19 @NotNull(message = "编号不能为空")
20 20 private Long id;
21 21  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreBaseVO.java
... ... @@ -18,49 +18,49 @@ import java.time.LocalTime;
18 18 @Data
19 19 public class DeliveryPickUpStoreBaseVO {
20 20  
21   - @Schema(description = "门店名称", required = true, example = "李四")
  21 + @Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
22 22 @NotBlank(message = "门店名称不能为空")
23 23 private String name;
24 24  
25 25 @Schema(description = "门店简介", example = "我是门店简介")
26 26 private String introduction;
27 27  
28   - @Schema(description = "门店手机", required = true, example = "15601892312")
  28 + @Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312")
29 29 @NotBlank(message = "门店手机不能为空")
30 30 @Mobile
31 31 private String phone;
32 32  
33   - @Schema(description = "区域编号", required = true, example = "18733")
  33 + @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
34 34 @NotNull(message = "区域编号不能为空")
35 35 private Integer areaId;
36 36  
37   - @Schema(description = "门店详细地址", required = true, example = "复旦大学路 188 号")
  37 + @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
38 38 @NotBlank(message = "门店详细地址不能为空")
39 39 private String detailAddress;
40 40  
41   - @Schema(description = "门店 logo", required = true, example = "https://www.iocoder.cn/1.png")
  41 + @Schema(description = "门店 logo", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
42 42 @NotBlank(message = "门店 logo 不能为空")
43 43 private String logo;
44 44  
45   - @Schema(description = "营业开始时间", required = true)
  45 + @Schema(description = "营业开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
46 46 @NotNull(message = "营业开始时间不能为空")
47 47 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
48 48 private LocalTime openingTime;
49 49  
50   - @Schema(description = "营业结束时间", required = true)
  50 + @Schema(description = "营业结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
51 51 @NotNull(message = "营业结束时间不能为空")
52 52 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
53 53 private LocalTime closingTime;
54 54  
55   - @Schema(description = "纬度", required = true, example = "5.88")
  55 + @Schema(description = "纬度", requiredMode = Schema.RequiredMode.REQUIRED, example = "5.88")
56 56 @NotNull(message = "纬度不能为空")
57 57 private Double latitude;
58 58  
59   - @Schema(description = "经度", required = true, example = "6.99")
  59 + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED, example = "6.99")
60 60 @NotNull(message = "经度不能为空")
61 61 private Double longitude;
62 62  
63   - @Schema(description = "门店状态", required = true, example = "1")
  63 + @Schema(description = "门店状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
64 64 @NotNull(message = "门店状态不能为空")
65 65 @InEnum(CommonStatusEnum.class)
66 66 private Integer status;
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreRespVO.java
1 1 package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.*;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
  7 +
5 8 import java.time.LocalDateTime;
6 9  
7 10 @Schema(description = "管理后台 - 自提门店 Response VO")
... ... @@ -10,10 +13,10 @@ import java.time.LocalDateTime;
10 13 @ToString(callSuper = true)
11 14 public class DeliveryPickUpStoreRespVO extends DeliveryPickUpStoreBaseVO {
12 15  
13   - @Schema(description = "编号", required = true, example = "23128")
  16 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
14 17 private Long id;
15 18  
16   - @Schema(description = "创建时间", required = true)
  19 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
17 20 private LocalDateTime createTime;
18 21  
19 22 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreUpdateReqVO.java
1 1 package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.*;
5   -import java.util.*;
6   -import javax.validation.constraints.*;
  4 +import lombok.Data;
  5 +import lombok.EqualsAndHashCode;
  6 +import lombok.ToString;
  7 +
  8 +import javax.validation.constraints.NotNull;
7 9  
8 10 @Schema(description = "管理后台 - 自提门店更新 Request VO")
9 11 @Data
... ... @@ -11,7 +13,7 @@ import javax.validation.constraints.*;
11 13 @ToString(callSuper = true)
12 14 public class DeliveryPickUpStoreUpdateReqVO extends DeliveryPickUpStoreBaseVO {
13 15  
14   - @Schema(description = "编号", required = true, example = "23128")
  16 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
15 17 @NotNull(message = "编号不能为空")
16 18 private Long id;
17 19  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleCreateReqVO.java
... ... @@ -36,7 +36,7 @@ public class AppTradeAfterSaleCreateReqVO {
36 36 /**
37 37 * @see AfterSaleStatusEnum
38 38 */
39   - @Schema(description = "操作类型", required = true, example = "1")
  39 + @Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
40 40 @NotNull(message = "操作类型不能为空")
41 41 private String operateType;
42 42  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSalePageItemRespVO.java
... ... @@ -11,48 +11,48 @@ import java.util.List;
11 11 @Data
12 12 public class AppTradeAfterSalePageItemRespVO {
13 13  
14   - @Schema(description = "售后编号", required = true, example = "1024")
  14 + @Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
15 15 private Long id;
16 16  
17   - @Schema(description = "售后流水号", required = true, example = "1146347329394184195")
  17 + @Schema(description = "售后流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1146347329394184195")
18 18 private String no;
19 19  
20   - @Schema(description = "售后状态", required = true, example = "1")
  20 + @Schema(description = "售后状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
21 21 private Integer status;
22 22  
23   - @Schema(description = "售后方式", required = true, example = "1")
  23 + @Schema(description = "售后方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
24 24 private Integer way;
25 25  
26   - @Schema(description = "售后类型", required = true, example = "1")
  26 + @Schema(description = "售后类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
27 27 private Integer type;
28 28  
29   - @Schema(description = "申请原因", required = true, example = "1")
  29 + @Schema(description = "申请原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
30 30 private String applyReason;
31 31  
32   - @Schema(description = "补充描述", required = true, example = "1")
  32 + @Schema(description = "补充描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
33 33 private String applyDescription;
34 34  
35   - @Schema(description = "补充凭证图片", required = true, example = "1")
  35 + @Schema(description = "补充凭证图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
36 36 private List<String> applyPicUrls;
37 37  
38 38 // ========== 交易订单相关 ==========
39 39  
40   - @Schema(description = "交易订单编号", required = true, example = "1")
  40 + @Schema(description = "交易订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
41 41 private Long orderId;
42 42  
43   - @Schema(description = "交易订单流水号", required = true, example = "1")
  43 + @Schema(description = "交易订单流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
44 44 private String orderNo;
45 45  
46   - @Schema(description = "交易订单项编号", required = true, example = "1")
  46 + @Schema(description = "交易订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
47 47 private Long orderItemId;
48 48  
49   - @Schema(description = "商品 SPU 编号", required = true, example = "1")
  49 + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
50 50 private Long spuId;
51 51  
52   - @Schema(description = "商品 SPU 名称", required = true, example = "1")
  52 + @Schema(description = "商品 SPU 名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
53 53 private String spuName;
54 54  
55   - @Schema(description = "商品 SKU 编号", required = true, example = "1")
  55 + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
56 56 private Long skuId;
57 57  
58 58 /**
... ... @@ -60,10 +60,10 @@ public class AppTradeAfterSalePageItemRespVO {
60 60 */
61 61 private List<AppProductPropertyValueDetailRespVO> properties;
62 62  
63   - @Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/01.jpg")
  63 + @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/01.jpg")
64 64 private String picUrl;
65 65  
66   - @Schema(description = "退货商品数量", required = true, example = "1")
  66 + @Schema(description = "退货商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
67 67 private Integer count;
68 68  
69 69 // ========== 审批相关 ==========
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/AppTradeCartAddReqVO.java
... ... @@ -17,7 +17,7 @@ public class AppTradeCartAddReqVO {
17 17 @NotNull(message = "数量不能为空")
18 18 private Integer count;
19 19  
20   - @Schema(description = "是否添加到购物车", required = true, example = "true")
  20 + @Schema(description = "是否添加到购物车", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
21 21 @NotNull(message = "是否添加购物车不能为空")
22 22 private Boolean addStatus;
23 23  
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/AppTradeCartListRespVO.java
... ... @@ -25,10 +25,10 @@ public class AppTradeCartListRespVO {
25 25 @Data
26 26 public static class Cart {
27 27  
28   - @Schema(description = "购物项的编号", required = true, example = "1024")
  28 + @Schema(description = "购物项的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
29 29 private Long id;
30 30  
31   - @Schema(description = "商品数量", required = true, example = "1")
  31 + @Schema(description = "商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
32 32 private Integer count;
33 33  
34 34 /**
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/cart/vo/AppTradeCartUpdateReqVO.java
... ... @@ -10,11 +10,11 @@ import javax.validation.constraints.NotNull;
10 10 @Data
11 11 public class AppTradeCartUpdateReqVO {
12 12  
13   - @Schema(description = "编号", required = true, example = "1024")
  13 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
14 14 @NotNull(message = "编号不能为空")
15 15 private Long id;
16 16  
17   - @Schema(description = "商品数量", required = true, example = "1")
  17 + @Schema(description = "商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
18 18 @NotNull(message = "数量不能为空")
19 19 @Min(message = "数量必须大于 0", value = 1L)
20 20 private Integer count;
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
... ... @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 5 import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
6 6 import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
7 7 import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
  8 +import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
8 9 import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;
9 10 import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
10 11 import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
... ... @@ -35,6 +36,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
35 36 import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
36 37 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
37 38 import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_ITEM_NOT_FOUND;
  39 +import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
38 40  
39 41 @Tag(name = "用户 App - 交易订单")
40 42 @RestController
... ... @@ -138,16 +140,20 @@ public class AppTradeOrderController {
138 140 @PostMapping("/item/create-comment")
139 141 @Operation(summary = "创建交易订单项的评价")
140 142 public CommonResult<Long> createOrderItemComment(@RequestBody AppTradeOrderItemCommentCreateReqVO createReqVO) {
141   - // 校验订单项,订单项存在订单就存在
142   - // TODO @puhui999:要去查询订单是不是自己的;不然别人模拟请求哈;
143   - TradeOrderItemDO item = tradeOrderService.getOrderItem(createReqVO.getUserId(), createReqVO.getOrderItemId());
144   - if (item == null) {
  143 + Long loginUserId = getLoginUserId();
  144 + // 先通过订单项 ID 查询订单项是否存在
  145 + TradeOrderItemDO orderItemDO = tradeOrderService.getOrderItemByIdAndUserId(createReqVO.getOrderItemId(), loginUserId);
  146 + if (orderItemDO == null) {
145 147 throw exception(ORDER_ITEM_NOT_FOUND);
146 148 }
  149 + // 校验订单
  150 + TradeOrderDO orderDO = tradeOrderService.getOrderByIdAndUserId(orderItemDO.getOrderId(), loginUserId);
  151 + if (orderDO == null) {
  152 + throw exception(ORDER_NOT_FOUND);
  153 + }
147 154  
148   - return success(productCommentApi.createComment(TradeOrderConvert.INSTANCE.convert04(createReqVO), item.getOrderId()));
  155 + ProductCommentCreateReqDTO productCommentCreateReqDTO = TradeOrderConvert.INSTANCE.convert04(createReqVO, orderItemDO);
  156 + return success(productCommentApi.createComment(productCommentCreateReqDTO));
149 157 }
150 158  
151   - // TODO 合并代码后发现只有商家回复功能 用户追评不要了吗?不要了哈;
152   -
153 159 }
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java
... ... @@ -21,7 +21,7 @@ public class AppTradeOrderSettlementReqVO {
21 21 @Deprecated // TODO 芋艿:后续干掉这个字段,对于前端不需要关注这个
22 22 private Integer type;
23 23  
24   - @Schema(description = "商品项数组", required = true)
  24 + @Schema(description = "商品项数组", requiredMode = Schema.RequiredMode.REQUIRED)
25 25 @NotNull(message = "商品不能为空")
26 26 private List<Item> items;
27 27  
... ...