diff --git a/1 b/1 index 579bf2448e5853c68304b007110e3b2a24f0394f..773dffc8493fa51c88bd9549c1cc4ebec05c6244 100644 --- a/1 +++ b/1 @@ -61,20 +61,41 @@ send_timeout 45; } +server { + listen 80; + server_name www.yjlive.cn; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + location / { + alias /root/jm/h5/; + index index.html; + } + + location /h5 { + alias /root/jm/mall/; + try_files $uri $uri/ @router; + index index.html; + } + location /api { + rewrite ^/api/(.*)$ /$1 break; + include uwsgi_params; + proxy_pass http://39.106.212.32:8081 ; + } + location @router { + rewrite ^.*$ /index.html last; + } + } server { listen 8082; server_name _; root /root/jm/h5; index index.html; } -server { - listen 8083; - server_name _; - root /root/jm/mall; - index index.html; -try_files $uri $uri/ /index.html; -} + server { listen 8084; server_name _; @@ -83,13 +104,7 @@ server { try_files $uri $uri/ /index.html; } -server { - listen 8087; - server_name _; - root /root/jm/jsshop; - index index.html; -try_files $uri $uri/ /index.html; -} + server { listen 8088; server_name _; diff --git a/3 b/3 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..da921e40e28b795286a12d3d9ad3a9b5617fed26 100644 --- a/3 +++ b/3 @@ -0,0 +1,10 @@ + location /mall { + alias /root/jm/mall/; + try_files $uri $uri/ @router; + index index.html; + } + location /jsshop { + alias /root/jm/jsshop/; + try_files $uri $uri/ @router; + index index.html; + } diff --git a/h b/h index d2fa5299e5565f0590d5772cda4a84d858532956..9745ce93dea809b504065bef223a1ffe871e6179 100644 --- a/h +++ b/h @@ -1,124 +1,126 @@ -CREATE TABLE `sms_bargain_config` ( - `id` bigint(11) unsigned NOT NULL COMMENT 'id', - `plug_ins_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '插件id', - `can_num` int(11) DEFAULT NULL COMMENT '能砍的次数', - `help_num` int(11) DEFAULT NULL COMMENT '每天最多帮别人砍的次数', - `parameter` char(11) DEFAULT NULL COMMENT '每次砍价的参数', - `invalid_time` int(11) DEFAULT NULL COMMENT '逾期失效时间', - `add_time` datetime NULL DEFAULT NULL COMMENT '修改时间' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='砍价免单设置表'; - -CREATE TABLE `sms_bargain_record` ( - `id` bigint(11) unsigned NOT NULL COMMENT 'id', - `s_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '属性id', - `user_id` bigint(15) NOT NULL COMMENT '用户ID', - `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额', - `add_time` datetime NULL DEFAULT NULL COMMENT '添加时间', - `event` varchar(200) DEFAULT NULL COMMENT '事件', - `name` varchar(15) NOT NULL COMMENT '收货人', - `tel` char(15) NOT NULL COMMENT '联系方式', - `sheng` int(11) NOT NULL DEFAULT '0' COMMENT '省', - `city` int(11) NOT NULL DEFAULT '0' COMMENT '市', - `quyu` int(11) NOT NULL DEFAULT '0' COMMENT '县', - `address` varchar(255) NOT NULL COMMENT '收货地址(不加省市区)', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:砍价中 1:砍价成功 2:逾期失效 3:生成订单', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='砍价免单记录表'; - -CREATE TABLE `sms_draw_user` ( - `id` bigint(11) NOT NULL COMMENT 'ID', - `draw_id` bigint(11) DEFAULT NULL COMMENT '拼团ID', - `user_id` bigint(30) DEFAULT NULL COMMENT '用户ID', - `time` datetime NULL DEFAULT NULL COMMENT '用户参团时间', - `role` varchar(30) DEFAULT '0' COMMENT '用户角色(默认 0:团长 userid:该用户分享进来的用户)', - `lottery_status` int(11) DEFAULT '0' COMMENT '抽奖状态(0.参团中 1.待抽奖 2.参团失败 3.抽奖失败 4.抽奖成功)' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='抽奖与用户关联表'; - -CREATE TABLE `sms_experience` ( - `id` bigint(11) unsigned NOT NULL COMMENT 'id', - `user_id` bigint(15) NOT NULL DEFAULT '' COMMENT '用户id', - `seller_id` bigint(15) NOT NULL DEFAULT '' COMMENT '商家id', - `name` varchar(20) NOT NULL DEFAULT '' COMMENT '姓名', - `mobile` varchar(20) DEFAULT NULL COMMENT '手机', - `address` varchar(300) DEFAULT NULL COMMENT '地址', - `num` int(11) NOT NULL DEFAULT '0' COMMENT '数量', - `content` text NOT NULL COMMENT '内容', - `add_date` timestamp NULL DEFAULT NULL COMMENT '添加时间', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型 0:申请预约 1:已预约 2:取消预约 3:完成' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='预约表'; - - -CREATE TABLE `sms_detailed_commission` ( - `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `userid` bigint(50) DEFAULT NULL, - `sNo` varchar(255) DEFAULT NULL COMMENT '订单号', - `money` float(10,2) DEFAULT '0.00' COMMENT '应发佣金', - `s_money` float(10,2) DEFAULT '0.00' COMMENT '实发佣金', - `status` int(2) DEFAULT '1' COMMENT '1.未发放,2.已发放', - `addtime` datetime DEFAULT NULL COMMENT '添加时间', - `type` int(2) DEFAULT NULL COMMENT '类型', - `Referee` varchar(50) DEFAULT NULL COMMENT '上级', - `recycle` int(2) DEFAULT '0' COMMENT '0 不回收 1.回收', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='分销佣金明细表'; - - -CREATE TABLE `sms_sign_activity` ( - `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `image` char(30) NOT NULL DEFAULT '' COMMENT '图片', - `starttime` char(20) NOT NULL DEFAULT '' COMMENT '签到活动开始时间', - `endtime` char(20) NOT NULL DEFAULT '' COMMENT '签到活动结束时间', - `detail` text COMMENT '签到活动详情', - `add_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:未启用 1:启用 2:已结束', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='签到活动'; - -CREATE TABLE `sms_share` ( - `id` bigint(11) unsigned NOT NULL COMMENT 'id', - `user_id` char(15) DEFAULT NULL COMMENT '用户id', - `wx_id` varchar(50) DEFAULT NULL COMMENT '微信id', - `wx_name` varchar(150) DEFAULT NULL COMMENT '微信昵称', - `sex` int(11) DEFAULT NULL COMMENT '性别 0:未知 1:男 2:女', - `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类别 0:新闻 1:文章', - `Article_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '新闻id', - `share_add` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '分享时间', - `coupon` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '礼券', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分享列表'; - -CREATE TABLE `sms_sign_config` ( - `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `plug_ins_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '插件id', - `imgurl` varchar(200) NOT NULL COMMENT '图片', - `min_score` int(11) NOT NULL DEFAULT '0' COMMENT '领取的最少积分', - `max_score` int(11) NOT NULL DEFAULT '0' COMMENT '领取的最大积分', - `continuity_three` int(11) NOT NULL DEFAULT '0' COMMENT '连续签到7天', - `continuity_twenty` int(11) NOT NULL DEFAULT '0' COMMENT '连续签到20天', - `continuity_thirty` int(11) NOT NULL DEFAULT '0' COMMENT '连续签到30天', - `activity_overdue` int(11) NOT NULL DEFAULT '0' COMMENT '活动过期删除时间', - `modify_date` timestamp NULL DEFAULT NULL COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='签到配置表'; - -CREATE TABLE `sms_sign_record` ( - `bigint` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `user_id` bigint(15) NOT NULL COMMENT '用户ID', - `sign_score` int(11) NOT NULL DEFAULT '0' COMMENT '签到积分', - `record` char(20) DEFAULT NULL COMMENT '事件', - `sign_time` timestamp NULL DEFAULT NULL COMMENT '签到时间', - `type` int(4) NOT NULL DEFAULT '0' COMMENT '类型: 0:签到 1:消费 2:首次关注得积分 3:转积分给好友 4:好友转积分 5:系统扣除 6:系统充值 7:抽奖', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='签到记录'; - -CREATE TABLE `sms_system_message` ( - `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', - `senderid` bigint(30) NOT NULL COMMENT '发送人ID', - `recipientid` bigint(30) NOT NULL COMMENT '接收人ID', - `title` text COMMENT '标题', - `content` text COMMENT '内容', - `time` datetime DEFAULT NULL COMMENT '时间', - `type` int(2) NOT NULL DEFAULT '1' COMMENT '1未读 2 已读', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='系统消息表'; +#user nobody; +worker_processes 1; + +#error_log logs/error.log; +#error_log logs/error.log notice; +#error_log logs/error.log info; + +#pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 165; +client_header_timeout 45; + +client_body_timeout 45; + +send_timeout 45; + + #gzip on; + + server { + listen 8090; + server_name 39.106.212.32; + client_max_body_size 10M; + #charset koi8-r; + + #access_log logs/host.access.log main; + location / { + root /root/jm/dist; + index index.html; +} + + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + + } +server { + listen 80; + server_name www.yjlive.cn; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + location / { + alias /root/jm/h5/; + index index.html; + } + + location /h5 { + alias /root/jm/mall/; + try_files $uri $uri/ @router; + index index.html; + } + location /cms { + alias /root/jm/cms/; + try_files $uri $uri/ @router; + index index.html; + } + location /pc { + alias /root/jm/pc/; + try_files $uri $uri/ @router; + index index.html; + } + location /pcbak { + alias /root/jm/pcbak/; + try_files $uri $uri/ @router; + index index.html; + } + location /h5bak { + alias /root/jm/h5bak/; + try_files $uri $uri/ @router; + index index.html; + } + + location /mei { + alias /root/jm/mei/; + try_files $uri $uri/ @router; + index index.html; + } + location /mei1 { + alias /root/jm/mei1/; + try_files $uri $uri/ @router; + index index.html; + } + location /api { + rewrite ^/api/(.*)$ /$1 break; + include uwsgi_params; + proxy_pass http://39.106.212.32:8081 ; + } + location @router { + rewrite ^.*$ /index.html last; + } + } + + + + } diff --git a/mallplus-admin/pom.xml b/mallplus-admin/pom.xml index 0e57bd5627410bd27ea25e987b7a0e80375afd33..37a48bd8fcd82011e5dc2ce769a70b6ab20d78c0 100644 --- a/mallplus-admin/pom.xml +++ b/mallplus-admin/pom.xml @@ -77,6 +77,11 @@ mallplus-mbg 1.0-SNAPSHOT + + com.zscat.mallplus + mallplus-wechat + 1.0-SNAPSHOT + org.springframework.boot spring-boot-starter-web diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ApiContext.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ApiContext.java deleted file mode 100644 index f8af47296e3b9fe21e885192c7d7d2554bcd01e0..0000000000000000000000000000000000000000 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ApiContext.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.zscat.mallplus; - -import org.springframework.stereotype.Component; - -@Component -public class ApiContext { - - - -} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/CommandLineRunnerImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/CommandLineRunnerImpl.java index fefff8bbd16a504e1d393d76fb8c4ee51bbd013d..86e445dc15f0a3327e4f33c04e8861ab933ac640 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/CommandLineRunnerImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/CommandLineRunnerImpl.java @@ -14,6 +14,9 @@ public class CommandLineRunnerImpl implements CommandLineRunner { @Autowired GeneratorMapper generatorMapper; + public static void main(String[] args) { + System.out.println("http://localhost:8080/cms/CmsSubjectCategory/list".replace("//", "a").indexOf("/") + 1); + } @Override public void run(String... args) throws Exception { @@ -30,8 +33,4 @@ public class CommandLineRunnerImpl implements CommandLineRunner { }*/ } - - public static void main(String[] args) { - System.out.println( "http://localhost:8080/cms/CmsSubjectCategory/list".replace("//","a").indexOf("/") + 1); - } -} \ No newline at end of file +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ExportSubject.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ExportSubject.java index 716799cce15a277b3a8fd84b7735ee7ddf416802..05059184f8116ecf7f91cda7949cc17ef3fc7800 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ExportSubject.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ExportSubject.java @@ -17,8 +17,5 @@ public class ExportSubject { private String content; - - - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ExportUser.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ExportUser.java index a68861a8217b958f4264904535c2a5c3ce4ca150..81d73a6de3cb23dfc931635013b09f95fea8e2fa 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ExportUser.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ExportUser.java @@ -1,12 +1,10 @@ package com.zscat.mallplus; import cn.afterturn.easypoi.excel.annotation.Excel; -import com.aliyun.oss.common.utils.DateUtil; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import java.text.SimpleDateFormat; import java.util.Date; @Data @@ -20,6 +18,5 @@ public class ExportUser { private Date createTime; - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/bill/controller/BillAftersalesController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/bill/controller/BillAftersalesController.java index e1db08a6c58514bd9360c2668df2705b7ce0fee0..b4bafe088f9f939d1c38ac024dfc5b08ad26bba1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/bill/controller/BillAftersalesController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/bill/controller/BillAftersalesController.java @@ -48,6 +48,5 @@ public class BillAftersalesController { } - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/ColumnInfo.java b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/ColumnInfo.java index 9e4ab2a8aec4d9b5032835f4dc76e8f6a39428b5..186d25e170839621a8165e00d1251d0170c17b41 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/ColumnInfo.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/ColumnInfo.java @@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; /** * 列的数据信息 + * * @author mallplus * @date 2019-01-02 */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/SysLogAspect.java b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/SysLogAspect.java index b1289642f527d2ed7b42079109f40979d6dac6a5..61bb1b75210a8f3164d04cb12d23019f977218a4 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/SysLogAspect.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/SysLogAspect.java @@ -145,7 +145,7 @@ public class SysLogAspect { logger.info(getString(sysLog)); //保存系统日志 - // fopSystemOperationLogService.save(sysLog); + // fopSystemOperationLogService.save(sysLog); } catch (Exception ex) { logger.error("保存系统日志失败"); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/TableInfo.java b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/TableInfo.java index 610d69120441e563eeb521d29522be6e0b162e99..2f19cd2784969531907746002251f2c2210dc784 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/bo/TableInfo.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/bo/TableInfo.java @@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; /** * 表的数据信息 + * * @author mallplus * @date 2019-01-02 */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildApplyRoomController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildApplyRoomController.java index 964486a758aa165a9b3047b592cedb3bc785ae14..cd4892df06e007dc47f2de3415be47f05cb281a0 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildApplyRoomController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildApplyRoomController.java @@ -1,13 +1,12 @@ package com.zscat.mallplus.build.controller; -import org.springframework.web.bind.annotation.RequestMapping; - import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupController.java index a7ca7cd5868ef4ff733ab16c860a13613a3c0a13..5f198fcc82d849f88243835643c704d45e92723f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupController.java @@ -21,7 +21,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -40,8 +40,8 @@ public class BuildGroupController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:group:read')") public Object getBuildGroupByPage(BuildGroup entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildGroupService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -133,6 +133,7 @@ public class BuildGroupController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildGroup entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupMemberController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupMemberController.java index 8971f1f1d66f293ef01783f01c805ad3963c5ef3..f144c4cab8ffed0f88b7a133250d41d5aa4ffb00 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupMemberController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildGroupMemberController.java @@ -21,7 +21,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -41,8 +41,8 @@ public class BuildGroupMemberController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:groupMember:read')") public Object getBuildGroupMemberByPage(BuildGroupMember entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildGroupMemberService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -134,6 +134,7 @@ public class BuildGroupMemberController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildGroupMember entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildNoticeController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildNoticeController.java index 724df82713da20c07af3e2389d32fee77e038813..ac8089634cf31c6b67112a53be56a7cd50b4e1af 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildNoticeController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildNoticeController.java @@ -42,8 +42,8 @@ public class BuildNoticeController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:notice:read')") public Object getBuildNoticeByPage(BuildNotice entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildNoticeService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -135,6 +135,7 @@ public class BuildNoticeController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildNotice entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildRepairController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildRepairController.java index 13300b6a246aa1e46d2d624feec808efa7bbb89f..ad6c091410716ee90c043a02033687c5a2096f25 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildRepairController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildRepairController.java @@ -21,7 +21,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -132,6 +132,7 @@ public class BuildRepairController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildRepair entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildTypePriceController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildTypePriceController.java index 093c43bdc25307d76ce81f7b922950b80b42e7d0..b9c6a4fe26edb17e39da757ec38a5cc38ccea92a 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildTypePriceController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildTypePriceController.java @@ -22,7 +22,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -41,8 +41,8 @@ public class BuildTypePriceController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:typePrice:read')") public Object getBuildTypePriceByPage(BuildTypePrice entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildTypePriceService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -134,6 +134,7 @@ public class BuildTypePriceController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildTypePrice entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyeCompanyController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyeCompanyController.java index 239ac74564102fa866d319d4eb2d0abb70e1ad7e..46898c10fc7c15e039c53c4fbb3f7c1648993d9b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyeCompanyController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyeCompanyController.java @@ -21,7 +21,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -40,8 +40,8 @@ public class BuildWuyeCompanyController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:wuyeCompany:read')") public Object getBuildWuyeCompanyByPage(BuildWuyeCompany entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildWuyeCompanyService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -133,6 +133,7 @@ public class BuildWuyeCompanyController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildWuyeCompany entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyePriceController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyePriceController.java index c06fdbefb82200d44710eedd61b7006c79c2e396..ab8405b594d0e5db3a153db1ef8a4eded2734442 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyePriceController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildWuyePriceController.java @@ -23,7 +23,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -44,8 +44,8 @@ public class BuildWuyePriceController { @GetMapping(value = "/list") @PreAuthorize("hasAuthority('build:wuyePrice:read')") public Object getBuildWuyePriceByPage(BuildWuyePrice entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(IBuildWuyePriceService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -61,11 +61,11 @@ public class BuildWuyePriceController { @PreAuthorize("hasAuthority('build:wuyePrice:create')") public Object saveBuildWuyePrice(@RequestBody BuildWuyePrice entity) { try { - if (ValidatorUtils.empty(entity.getAmount())||ValidatorUtils.empty(entity.getPrice())){ + if (ValidatorUtils.empty(entity.getAmount()) || ValidatorUtils.empty(entity.getPrice())) { return new CommonResult().failed("请输入价格"); } - BuildingRoom room =IBuildingRoomService.getById(entity.getRoomId()); - if (room!=null && room.getRoomDesc()!=null){ + BuildingRoom room = IBuildingRoomService.getById(entity.getRoomId()); + if (room != null && room.getRoomDesc() != null) { entity.setRoomDesc(room.getRoomDesc()); } entity.setCreateDate(new Date()); @@ -145,6 +145,7 @@ public class BuildWuyePriceController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildWuyePrice entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingCommunityController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingCommunityController.java index de26224f9640dcfaf6f64e98b051144401699ea0..4b4a3246f004e989a299819da272219fd735dad5 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingCommunityController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingCommunityController.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zscat.mallplus.annotation.SysLog; import com.zscat.mallplus.build.entity.BuildingCommunity; import com.zscat.mallplus.util.EasyPoiUtils; -import com.zscat.mallplus.util.UserUtils; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; import io.swagger.annotations.ApiOperation; @@ -61,10 +60,10 @@ public class BuildingCommunityController { try { entity.setCreateTime(new Date()); entity.setStatus(3); - if (ValidatorUtils.empty(entity.getCompanyId())){ - entity.setCompanyId(UserUtils.getCurrentMember().getStoreId()); + if (ValidatorUtils.empty(entity.getCompanyId())) { + // entity.setCompanyId(UserUtils.getCurrentMember().getStoreId()); } - if (ValidatorUtils.empty(entity.getCompanyId())){ + if (ValidatorUtils.empty(entity.getCompanyId())) { return new CommonResult().failed("请选择物业攻啊"); } if (IBuildingCommunityService.saveCommunity(entity)) { @@ -142,8 +141,9 @@ public class BuildingCommunityController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") - public void export(HttpServletResponse response,BuildingCommunity entity) { + public void export(HttpServletResponse response, BuildingCommunity entity) { // 模拟从数据库获取需要导出的数据 List personList = IBuildingCommunityService.list(new QueryWrapper<>(entity)); // 导出操作 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingFloorController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingFloorController.java index 684afebc7823ba0abe95fe23db82263f29889c1e..7709a2d15f7197e7ab5a552fad8dadc2b9bd21f5 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingFloorController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingFloorController.java @@ -23,7 +23,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -59,7 +59,7 @@ public class BuildingFloorController { public Object saveBuildingFloor(@RequestBody BuildingFloor entity) { try { - if (ValidatorUtils.empty(entity.getCommunityId())){ + if (ValidatorUtils.empty(entity.getCommunityId())) { return new CommonResult().failed("请选择小区"); } entity.setCreateTime(new Date()); @@ -138,6 +138,7 @@ public class BuildingFloorController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildingFloor entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingOwnerController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingOwnerController.java index dfa0129577e9dfb3d03e123081173ee315f378da..734e3f1a1203f3ad94e560c8112e00c5471359ee 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingOwnerController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingOwnerController.java @@ -59,15 +59,15 @@ public class BuildingOwnerController { public Object saveBuildingOwner(@RequestBody BuildingOwner entity) { try { - if (ValidatorUtils.empty(entity.getRoomId())){ + if (ValidatorUtils.empty(entity.getRoomId())) { return new CommonResult().failed("请选择房屋"); } entity.setCreateTime(new Date()); - if (entity.getType()==2 || entity.getType()==3){ - List list = IBuildingOwnerService.list(new QueryWrapper().eq("room_id",entity.getRoomId()).eq("type",1).orderByAsc("id")); - if (list!=null && list.size()>0){ + if (entity.getType() == 2 || entity.getType() == 3) { + List list = IBuildingOwnerService.list(new QueryWrapper().eq("room_id", entity.getRoomId()).eq("type", 1).orderByAsc("id")); + if (list != null && list.size() > 0) { entity.setOwnerId(list.get(0).getId()); - }else { + } else { return new CommonResult().failed("请先添加一个业主"); } } @@ -146,6 +146,7 @@ public class BuildingOwnerController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildingOwner entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingRoomController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingRoomController.java index a739dc7c3aab846ee8e8507cb3d29f05e6c32273..930b35e09109be759a5cdde0920030c4baa12597 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingRoomController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingRoomController.java @@ -49,6 +49,7 @@ public class BuildingRoomController { private IBuildingFloorService floorService; @Resource private IBuildingCommunityService communityService; + @SysLog(MODULE = "build", REMARK = "根据条件查询所有房间表列表") @ApiOperation("根据条件查询所有房间表列表") @GetMapping(value = "/list") @@ -71,8 +72,8 @@ public class BuildingRoomController { public Object withChilds(BuildingFloor entity) { try { List floors = floorService.list(new QueryWrapper<>(entity)); - for (BuildingFloor floor : floors){ - List list = IBuildingRoomService.list(new QueryWrapper().eq("floor_id",floor.getId())); + for (BuildingFloor floor : floors) { + List list = IBuildingRoomService.list(new QueryWrapper().eq("floor_id", floor.getId())); floor.setChildren(list); } return new CommonResult().success(floors); @@ -81,21 +82,23 @@ public class BuildingRoomController { } return new CommonResult().failed(); } + @SysLog(MODULE = "build", REMARK = "保存房间表") @ApiOperation("保存房间表") @PostMapping(value = "/create") public Object saveBuildingRoom(@RequestBody BuildingRoom entity) { try { - if (ValidatorUtils.empty(entity.getUnitId())){ + if (ValidatorUtils.empty(entity.getUnitId())) { return new CommonResult().failed("请选择单元"); } entity.setCreateTime(new Date()); BuildingUnit unit = unitService.getById(entity.getUnitId()); BuildingFloor floor = floorService.getById(unit.getFloorId()); - entity.setFloorId(floor.getId());entity.setCommunityId(floor.getCommunityId()); + entity.setFloorId(floor.getId()); + entity.setCommunityId(floor.getCommunityId()); BuildingCommunity community = communityService.getById(floor.getCommunityId()); - entity.setRoomDesc(community.getName()+"-"+floor.getName()+"-"+unit.getUnitNum()+"-"+entity.getRoomNum()); + entity.setRoomDesc(community.getName() + "-" + floor.getName() + "-" + unit.getUnitNum() + "-" + entity.getRoomNum()); entity.setLayer(floor.getLayerCount()); entity.setId(IdWorker.getId()); if (IBuildingRoomService.save(entity)) { @@ -173,6 +176,7 @@ public class BuildingRoomController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildingRoom entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingUnitController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingUnitController.java index ace829faad88cab139e56c08a368d4ab82a028f4..1a65c3432e3b7adba785cd63a1479111070729eb 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingUnitController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/controller/BuildingUnitController.java @@ -23,7 +23,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -59,7 +59,7 @@ public class BuildingUnitController { public Object saveBuildingUnit(@RequestBody BuildingUnit entity) { try { - if (ValidatorUtils.empty(entity.getFloorId())){ + if (ValidatorUtils.empty(entity.getFloorId())) { return new CommonResult().failed("请选择楼"); } entity.setCreateTime(new Date()); @@ -138,6 +138,7 @@ public class BuildingUnitController { return new CommonResult().failed(); } } + @GetMapping("/exportExcel") public void export(HttpServletResponse response, BuildingUnit entity) { // 模拟从数据库获取需要导出的数据 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildAdvService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildAdvService.java index 2f6f2a50490f444b575f47fd1518c7fa504d4c75..167910e23f045e9f75cbf1b5aef99a6bbfd105b1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildAdvService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildAdvService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildAdv; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildAdv; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildApplyRoomService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildApplyRoomService.java index cd00b22db3fce87d26630fc7cd31456b4c74c670..a55ed632b25b0029c2614dd6638938d5129246c2 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildApplyRoomService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildApplyRoomService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildApplyRoom; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildApplyRoom; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupMemberService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupMemberService.java index 675391493d11750fa36984303993860407ddfaf6..69eb6f1a5242e26ec539c15a69ec21a0ca970a00 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupMemberService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupMemberService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildGroupMember; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildGroupMember; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupService.java index 5ec0a1ad8e195a975914489432498d0ca3c7f0a8..c4cef379cd7121b0beb31b7135cb1ebbe3417032 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildGroupService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildGroup; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildGroup; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildNoticeService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildNoticeService.java index 937e7deaa19f4ab1cef15a855cc2fd7b313a06bd..67a11f5f0aba583fbd104b03a3a476c9116a9ca1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildNoticeService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildNoticeService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildNotice; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildNotice; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildRepairService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildRepairService.java index 767d86e9ed42e95073ee52c09c56bbe747d8b563..51a390af2e77ae2790085eb267428db87840588f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildRepairService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildRepairService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildRepair; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildRepair; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildTypePriceService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildTypePriceService.java index 2185d26ffd965a69753f2e70a75488240f83850b..630b03ae9f973106d6f30c3d192b41a7e6ed9b4d 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildTypePriceService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildTypePriceService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildTypePrice; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildTypePrice; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyeCompanyService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyeCompanyService.java index d2cd3e5c22b9223c4f3c3c26a07288a0c3172f1c..2ca750ffec390acbf93a6e212f364e0f2c60eb88 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyeCompanyService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyeCompanyService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildWuyeCompany; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildWuyeCompany; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyePriceService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyePriceService.java index dd2532bda708e9cc5b4958de18a1f99d8b56a525..dfc979d129dc1eed2660aebaf67e9811cba80c90 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyePriceService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildWuyePriceService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildWuyePrice; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildWuyePrice; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingCommunityService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingCommunityService.java index 74ddb20057935ef73ac68714f9e7bd50662bda9d..c7ef9058778324793d514d29c65d2e7fbee3c856 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingCommunityService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingCommunityService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildingCommunity; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildingCommunity; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingFloorService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingFloorService.java index eb896f7e012357bb02679917212d40a53038fe64..338f1a382b960b99b8e7891b6cd55537fed8b0c7 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingFloorService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingFloorService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildingFloor; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildingFloor; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingOwnerService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingOwnerService.java index 025ce26c7ba6c61c2b54142074d845fc60a220ff..e135411246191535212be1ddca14c2249c68bdf3 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingOwnerService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingOwnerService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildingOwner; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildingOwner; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingRoomService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingRoomService.java index 370a45e1f3a9c87a5c2c69d74665c269129a2e03..e4e15dd841eb31bdcb541334aebb8aa0fc25ef4c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingRoomService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingRoomService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildingRoom; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildingRoom; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingUnitService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingUnitService.java index a24b9c4d7f8c80a61f0591c7de630a325984fdfc..25386c8dcbdecf078a4f722135e54c76b2aa0dcd 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingUnitService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/IBuildingUnitService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.build.service; -import com.zscat.mallplus.build.entity.BuildingUnit; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.build.entity.BuildingUnit; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildAdvServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildAdvServiceImpl.java index b4f11fd7eb2425f87a606ea4344ad13892c64df9..e683338db475e63ba3a1416f59359309ec7cadd0 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildAdvServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildAdvServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildAdv; import com.zscat.mallplus.build.mapper.BuildAdvMapper; import com.zscat.mallplus.build.service.IBuildAdvService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildApplyRoomServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildApplyRoomServiceImpl.java index 6471df4ff7404c8b6013d3a9ecd7427fe716c539..4d40fa8bb6573150e7d5b6c009908fc8e9c7382e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildApplyRoomServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildApplyRoomServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildApplyRoom; import com.zscat.mallplus.build.mapper.BuildApplyRoomMapper; import com.zscat.mallplus.build.service.IBuildApplyRoomService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupMemberServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupMemberServiceImpl.java index 5dd5f882da08b56a553875341189acd1fe8bc95a..593aae53085f443ca4988b9873f6d5b1b6a28c51 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupMemberServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupMemberServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildGroupMember; import com.zscat.mallplus.build.mapper.BuildGroupMemberMapper; import com.zscat.mallplus.build.service.IBuildGroupMemberService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupServiceImpl.java index f83b98431ac430c96d4beb133cb634dcabc990af..44a95869aba584402ba2062bc569a828215275ce 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildGroupServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildGroup; import com.zscat.mallplus.build.mapper.BuildGroupMapper; import com.zscat.mallplus.build.service.IBuildGroupService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildNoticeServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildNoticeServiceImpl.java index 185ff6aed7b1513f7c1d77dc8a1f3839397de35c..3ae3720b625534f267def05c809944e332c8cde9 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildNoticeServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildNoticeServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildNotice; import com.zscat.mallplus.build.mapper.BuildNoticeMapper; import com.zscat.mallplus.build.service.IBuildNoticeService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildRepairServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildRepairServiceImpl.java index ac5b825f4b5462bb2a2e2356bf91327fe640ad12..c6808e6884098d69ee8996381513ad4e93b23677 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildRepairServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildRepairServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildRepair; import com.zscat.mallplus.build.mapper.BuildRepairMapper; import com.zscat.mallplus.build.service.IBuildRepairService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildTypePriceServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildTypePriceServiceImpl.java index cbc46e8be444ae6a378ecbf2cdbbc802f6c17fce..52dd1a35d0baf08c05fd9d647d1af6019d2a0536 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildTypePriceServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildTypePriceServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildTypePrice; import com.zscat.mallplus.build.mapper.BuildTypePriceMapper; import com.zscat.mallplus.build.service.IBuildTypePriceService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildWuyeCompanyServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildWuyeCompanyServiceImpl.java index b039bd6fcbd66a8a2e2ce36798f5ebf0db34ab30..25a5a956391a42d2d28631d3a47031e42617ff7c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildWuyeCompanyServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildWuyeCompanyServiceImpl.java @@ -18,7 +18,7 @@ import java.util.Date; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -35,33 +35,35 @@ public class BuildWuyeCompanyServiceImpl extends ServiceImpl - * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingCommunityServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingCommunityServiceImpl.java index 9548b3b61e387558241945b7dce0bd4689f9854d..c420b793619e422b7f81f208d2b1925864b4ef20 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingCommunityServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingCommunityServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildingCommunity; import com.zscat.mallplus.build.mapper.BuildingCommunityMapper; import com.zscat.mallplus.build.service.IBuildingCommunityService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.exception.ApiMallPlusException; import com.zscat.mallplus.sys.entity.SysUser; import com.zscat.mallplus.sys.entity.SysUserRole; @@ -44,21 +44,22 @@ public class BuildingCommunityServiceImpl extends ServiceImpl - * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingOwnerServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingOwnerServiceImpl.java index c94c1c36ccb1b38b5b2dea901ec76b6eade182db..c3cef35171897a71937db704a273f505c282dd59 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingOwnerServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingOwnerServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildingOwner; import com.zscat.mallplus.build.mapper.BuildingOwnerMapper; import com.zscat.mallplus.build.service.IBuildingOwnerService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingRoomServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingRoomServiceImpl.java index f8d1af2cd35ef98afefbefd6ade21cf826f4bb5c..a675348209d19d7920d93e56c2781f67ae4cf7c1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingRoomServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingRoomServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildingRoom; import com.zscat.mallplus.build.mapper.BuildingRoomMapper; import com.zscat.mallplus.build.service.IBuildingRoomService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingUnitServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingUnitServiceImpl.java index 38ee8edfe21a83a1ceb85fd7ed8a4a7c7d53663d..df6c1e10051c5726e0bb25c18e4f49a3d961100c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingUnitServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/build/service/impl/BuildingUnitServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.build.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.build.entity.BuildingUnit; import com.zscat.mallplus.build.mapper.BuildingUnitMapper; import com.zscat.mallplus.build.service.IBuildingUnitService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/component/JwtAuthenticationTokenFilter.java b/mallplus-admin/src/main/java/com/zscat/mallplus/component/JwtAuthenticationTokenFilter.java index cbc24cb5710205da870598a4d735da2828595e22..2cf9779e7a25857ac3fdeef9c1f89beaaa5ca395 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/component/JwtAuthenticationTokenFilter.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/component/JwtAuthenticationTokenFilter.java @@ -1,6 +1,7 @@ package com.zscat.mallplus.component; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.sys.entity.SysAdminLog; import com.zscat.mallplus.sys.service.ISysAdminLogService; import com.zscat.mallplus.util.IpAddressUtil; @@ -36,6 +37,8 @@ import java.util.Map; */ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { private static final Logger LOGGER = LoggerFactory.getLogger(JwtAuthenticationTokenFilter.class); + @Resource + public ISysAdminLogService fopSystemOperationLogService; @Autowired private UserDetailsService userDetailsService; @Autowired @@ -44,9 +47,8 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { private String tokenHeader; @Value("${jwt.tokenHead}") private String tokenHead; - - @Resource - public ISysAdminLogService fopSystemOperationLogService; + @Autowired + private ApiContext apiContext; @Override protected void doFilterInternal(HttpServletRequest request, @@ -83,15 +85,15 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { String authToken = authHeader.substring(this.tokenHead.length()); username = jwtTokenUtil.getUserNameFromToken(authToken); LOGGER.info("checking username:{}", username); - if (fullUrl.contains("logout") || fullUrl.contains("login")){ + if (fullUrl.contains("logout") || fullUrl.contains("login")) { - }else{ + } else { if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); if (jwtTokenUtil.validateToken(authToken, userDetails)) { UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); - LOGGER.info("authenticated user:{}", username); + LOGGER.info("checking username:{},storeId:{}", username,apiContext.getCurrentProviderId()); SecurityContextHolder.getContext().setAuthentication(authentication); } } @@ -107,7 +109,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { IpAddressUtil.getIpAddr((HttpServletRequest) request), sbParams.toString(), authHeader) + ",\"cost\":\"" + (endTime - startTime) + "ms\""); int startIntercept = fullUrl.replace("//", "a").indexOf("/") + 1; - String interfaceName = fullUrl.substring(startIntercept,fullUrl.length()); + String interfaceName = fullUrl.substring(startIntercept, fullUrl.length()); sysLog.setCreateTime(new Date()); sysLog.setIp(IpAddressUtil.getIpAddr(request)); sysLog.setMethod(interfaceName); @@ -118,7 +120,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { sysLog.setTimeMin((endTime - startTime)); if (!"OPTIONS".equals(requestType) && !interfaceName.contains("webjars") && !interfaceName.contains("api-docs")) { - // fopSystemOperationLogService.save(sysLog); + fopSystemOperationLogService.save(sysLog); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunConfig.java b/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunConfig.java index 9784b97a2af76170e7464deda6cee7825caa3c02..35288c1b0ae162234c037e8c50eaa679d1747ba4 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunConfig.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunConfig.java @@ -7,19 +7,20 @@ import org.springframework.context.annotation.Configuration; /** * 阿里云配置类 + * * @author: Peter * @date: 2018-4-11 */ @Configuration public class OssAliyunConfig { - @Bean(value="defaultOssAliyunField") + @Bean(value = "defaultOssAliyunField") @ConfigurationProperties("oss.aliyun.defalut") public OssAliyunField defaultOssAliyunField() { return new OssAliyunField(); } - @Bean(value="firstOssAliyuField") + @Bean(value = "firstOssAliyuField") @ConfigurationProperties("oss.aliyun.first") public OssAliyunField firstOssAliyuField() { return new OssAliyunField(); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunUtil.java index 20f42d1864e8b3ff918bec466196ef5d4232ef36..53eb05c3641980706868449150fc5b8ec6c29633 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/component/OssAliyunUtil.java @@ -27,8 +27,9 @@ import java.util.UUID; @Component public class OssAliyunUtil { - @Resource(name="defaultOssAliyunField") + @Resource(name = "defaultOssAliyunField") private OssAliyunField defaultOssAliyunField; + /** * 上传文件(选择默认的OSS配置) * @@ -48,6 +49,7 @@ public class OssAliyunUtil { /** * 上传文件 + * * @param suffix * @param inputStream * @return @@ -55,6 +57,7 @@ public class OssAliyunUtil { public String upload(String suffix, InputStream inputStream) { return upload(defaultOssAliyunField, getKey(defaultOssAliyunField.getPrefix(), suffix), inputStream); } + /** * 上传文件 * @@ -142,7 +145,7 @@ public class OssAliyunUtil { * @param key 文件名 */ public void delete(final String accessKeyId, final String accessKeySecret, final String bucketName, - final String endpoint, final String key) { + final String endpoint, final String key) { // 创建OSSClient实例 OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); // 删除Object @@ -172,7 +175,7 @@ public class OssAliyunUtil { * @param keys 多个文件名的集合 */ public void delete(final String accessKeyId, final String accessKeySecret, final String bucketName, - final String endpoint, final List keys) { + final String endpoint, final List keys) { // 创建OSSClient实例 OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); // 删除Objects diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/config/MybatisPlusConfig.java b/mallplus-admin/src/main/java/com/zscat/mallplus/config/MybatisPlusConfig.java index 173045915590b856f9dc7c044eba2486808197fe..dbf1a0e466c2f8e59c18ae16edbd9053c37ed368 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/config/MybatisPlusConfig.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/config/MybatisPlusConfig.java @@ -1,16 +1,26 @@ package com.zscat.mallplus.config; +import com.baomidou.mybatisplus.core.parser.ISqlParser; +import com.baomidou.mybatisplus.core.parser.ISqlParserFilter; +import com.baomidou.mybatisplus.core.parser.SqlParserHelper; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor; +import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler; +import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser; import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.enums.ConstansValue; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.LongValue; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.reflection.MetaObject; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.EnableTransactionManagement; +import java.util.ArrayList; import java.util.List; //Spring boot方式 @@ -31,7 +41,54 @@ public class MybatisPlusConfig { PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); paginationInterceptor.setDialectType("mysql"); + /* + * 【测试多租户】 SQL 解析处理拦截器
+ * 这里固定写成住户 1 实际情况你可以从cookie读取,因此数据看不到 【 麻花藤 】 这条记录( 注意观察 SQL )
+ */ + List sqlParserList = new ArrayList<>(); + TenantSqlParser tenantSqlParser = new TenantSqlParser(); + tenantSqlParser.setTenantHandler(new TenantHandler() { + @Override + public Expression getTenantId() { + // 从当前系统上下文中取出当前请求的服务商ID,通过解析器注入到SQL中。 + Long currentProviderId = apiContext.getCurrentProviderId(); + if (null == currentProviderId) { + currentProviderId = 1l; + System.out.println("#1129 getCurrentProviderId error."); + // throw new RuntimeException("#1129 getCurrentProviderId error."); + } + return new LongValue(currentProviderId); + } + + @Override + public String getTenantIdColumn() { + return "store_id"; + } + + @Override + public boolean doTableFilter(String tableName) { + if (tableName.startsWith("admin_") || tableName.startsWith("QRTZ_")) { + return true; + } + return IGNORE_TENANT_TABLES.stream().anyMatch((e) -> e.equalsIgnoreCase(tableName)); + + } + }); + + sqlParserList.add(tenantSqlParser); + paginationInterceptor.setSqlParserList(sqlParserList); + paginationInterceptor.setSqlParserFilter(new ISqlParserFilter() { + @Override + public boolean doFilter(MetaObject metaObject) { + MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject); + // 过滤自定义查询此时无租户信息约束【 麻花藤 】出现 + if ("com.zscat.mallplus.sys.mapper.SysUserMapper.selectByUserName".equals(ms.getId())) { + return true; + } + return false; + } + }); return paginationInterceptor; } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/config/SecurityConfig.java b/mallplus-admin/src/main/java/com/zscat/mallplus/config/SecurityConfig.java index 25b23f9532c15e5b507d497ab711f4e7b470b50f..ad8dc4a3db38cca5ba39eef83f3d7a31197e3d85 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/config/SecurityConfig.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/config/SecurityConfig.java @@ -1,5 +1,6 @@ package com.zscat.mallplus.config; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.bo.AdminUserDetails; import com.zscat.mallplus.component.JwtAuthenticationTokenFilter; import com.zscat.mallplus.component.RestAuthenticationEntryPoint; @@ -8,7 +9,6 @@ import com.zscat.mallplus.sys.entity.SysPermission; import com.zscat.mallplus.sys.entity.SysUserVo; import com.zscat.mallplus.sys.mapper.SysUserMapper; import com.zscat.mallplus.sys.service.ISysUserService; -import com.zscat.mallplus.ApiContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; @@ -52,6 +52,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private ApiContext apiContext; + @Override protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity.csrf()// 由于使用的是JWT,我们这里不需要csrf @@ -106,9 +107,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { //获取登录用户信息 return username -> { SysUserVo admin = userMapper.selectByUserName(username); - // apiContext.setCurrentProviderId(admin.getStoreId()); + // apiContext.setCurrentProviderId(admin.getStoreId()); if (admin != null) { - if (admin.getSupplyId()!=null && admin.getSupplyId() == 1L) { + if (admin.getSupplyId() != null && admin.getSupplyId() == 1L) { List permissionList = sysUserService.listPerms(); return new AdminUserDetails(admin, permissionList); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCartItemController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCartItemController.java index 0d5c67c3e50f507bbdf6d488d797b3b7cca229a8..d15104d1b6199bc73a2096021a895d74521987a8 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCartItemController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCartItemController.java @@ -27,7 +27,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsCartItemController", description = "购物车表管理") +@Api(tags = "oms", description = "购物车表管理") @RequestMapping("/oms/OmsCartItem") public class OmsCartItemController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCompanyAddressController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCompanyAddressController.java index 9c6afbb3518ec1e591f5c18c42e4f329743e9cd7..9f0b49ba39c7b156e527845b6adccb1e8eef73b2 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCompanyAddressController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCompanyAddressController.java @@ -1,10 +1,12 @@ package com.zscat.mallplus.oms.controller; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zscat.mallplus.annotation.SysLog; import com.zscat.mallplus.oms.entity.OmsCompanyAddress; import com.zscat.mallplus.oms.service.IOmsCompanyAddressService; +import com.zscat.mallplus.util.EasyPoiUtils; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; import io.swagger.annotations.Api; @@ -13,114 +15,118 @@ import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** - *

- * 公司收发货地址表 - *

- * - * @author zscat - * @since 2019-04-19 + * @author mallplus + * @date 2019-12-07 + * 发货地址 */ @Slf4j +@Api(tags = "oms", description = "发货地址列表") @RestController -@Api(tags = "OmsCompanyAddressController", description = "公司收发货地址表管理") -@RequestMapping("/oms/OmsCompanyAddress") +@RequestMapping("/oms/omsCompanyAddress") public class OmsCompanyAddressController { + @Resource private IOmsCompanyAddressService IOmsCompanyAddressService; - @SysLog(MODULE = "oms", REMARK = "根据条件查询所有公司收发货地址表列表") - @ApiOperation("根据条件查询所有公司收发货地址表列表") + @SysLog(MODULE = "oms", REMARK = "根据条件查询所有发货地址列表") + @ApiOperation("根据条件查询所有发货地址列表") @GetMapping(value = "/list") public Object getOmsCompanyAddressByPage(OmsCompanyAddress entity, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { + if (ValidatorUtils.notEmpty(entity.getName())){ + return new CommonResult().success(IOmsCompanyAddressService.page(new Page(pageNum, pageSize), new QueryWrapper(new OmsCompanyAddress()).like("name",entity.getName()))); + } return new CommonResult().success(IOmsCompanyAddressService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); } catch (Exception e) { - log.error("根据条件查询所有公司收发货地址表列表:%s", e.getMessage(), e); + log.error("根据条件查询所有发货地址列表:%s", e.getMessage(), e); } return new CommonResult().failed(); } - @SysLog(MODULE = "oms", REMARK = "保存公司收发货地址表") - @ApiOperation("保存公司收发货地址表") + @SysLog(MODULE = "oms", REMARK = "保存发货地址") + @ApiOperation("保存发货地址") @PostMapping(value = "/create") + @PreAuthorize("hasAuthority('oms:omsCompanyAddress:create')") public Object saveOmsCompanyAddress(@RequestBody OmsCompanyAddress entity) { try { + if (IOmsCompanyAddressService.save(entity)) { return new CommonResult().success(); } } catch (Exception e) { - log.error("保存公司收发货地址表:%s", e.getMessage(), e); - return new CommonResult().failed(); + log.error("保存发货地址:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); } return new CommonResult().failed(); } - @SysLog(MODULE = "oms", REMARK = "更新公司收发货地址表") - @ApiOperation("更新公司收发货地址表") + @SysLog(MODULE = "oms", REMARK = "更新发货地址") + @ApiOperation("更新发货地址") @PostMapping(value = "/update/{id}") - @PreAuthorize("hasAuthority('oms:OmsCompanyAddress:update')") + @PreAuthorize("hasAuthority('oms:omsCompanyAddress:update')") public Object updateOmsCompanyAddress(@RequestBody OmsCompanyAddress entity) { try { if (IOmsCompanyAddressService.updateById(entity)) { return new CommonResult().success(); } } catch (Exception e) { - log.error("更新公司收发货地址表:%s", e.getMessage(), e); - return new CommonResult().failed(); + log.error("更新发货地址:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); } return new CommonResult().failed(); } - @SysLog(MODULE = "oms", REMARK = "删除公司收发货地址表") - @ApiOperation("删除公司收发货地址表") + @SysLog(MODULE = "oms", REMARK = "删除发货地址") + @ApiOperation("删除发货地址") @GetMapping(value = "/delete/{id}") - @PreAuthorize("hasAuthority('oms:OmsCompanyAddress:delete')") - public Object deleteOmsCompanyAddress(@ApiParam("公司收发货地址表id") @PathVariable Long id) { + @PreAuthorize("hasAuthority('oms:omsCompanyAddress:delete')") + public Object deleteOmsCompanyAddress(@ApiParam("发货地址id") @PathVariable Long id) { try { if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("公司收发货地址表id"); + return new CommonResult().paramFailed("发货地址id"); } if (IOmsCompanyAddressService.removeById(id)) { return new CommonResult().success(); } } catch (Exception e) { - log.error("删除公司收发货地址表:%s", e.getMessage(), e); - return new CommonResult().failed(); + log.error("删除发货地址:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); } return new CommonResult().failed(); } - @SysLog(MODULE = "oms", REMARK = "给公司收发货地址表分配公司收发货地址表") - @ApiOperation("查询公司收发货地址表明细") + @SysLog(MODULE = "oms", REMARK = "给发货地址分配发货地址") + @ApiOperation("查询发货地址明细") @GetMapping(value = "/{id}") - @PreAuthorize("hasAuthority('oms:OmsCompanyAddress:read')") - public Object getOmsCompanyAddressById(@ApiParam("公司收发货地址表id") @PathVariable Long id) { + @PreAuthorize("hasAuthority('oms:omsCompanyAddress:read')") + public Object getOmsCompanyAddressById(@ApiParam("发货地址id") @PathVariable Long id) { try { if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("公司收发货地址表id"); + return new CommonResult().paramFailed("发货地址id"); } OmsCompanyAddress coupon = IOmsCompanyAddressService.getById(id); return new CommonResult().success(coupon); } catch (Exception e) { - log.error("查询公司收发货地址表明细:%s", e.getMessage(), e); + log.error("查询发货地址明细:%s", e.getMessage(), e); return new CommonResult().failed(); } } - @ApiOperation(value = "批量删除公司收发货地址表") + @ApiOperation(value = "批量删除发货地址") @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) - @ResponseBody - @SysLog(MODULE = "pms", REMARK = "批量删除公司收发货地址表") - @PreAuthorize("hasAuthority('oms:OmsCompanyAddress:delete')") + @SysLog(MODULE = "oms", REMARK = "批量删除发货地址") + @PreAuthorize("hasAuthority('oms:omsCompanyAddress:delete')") public Object deleteBatch(@RequestParam("ids") List ids) { boolean count = IOmsCompanyAddressService.removeByIds(ids); if (count) { @@ -130,4 +136,23 @@ public class OmsCompanyAddressController { } } + + @SysLog(MODULE = "oms", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, OmsCompanyAddress entity) { + // 模拟从数据库获取需要导出的数据 + List personList = IOmsCompanyAddressService.list(new QueryWrapper<>(entity)); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", OmsCompanyAddress.class, "导出社区数据.xls", response); + + } + + @SysLog(MODULE = "oms", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List personList = EasyPoiUtils.importExcel(file, OmsCompanyAddress.class); + IOmsCompanyAddressService.saveBatch(personList); + } } + + diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderController.java index 7190ac3274c16e8172b2bd658365849a484bfb22..ac73ba103b04764c0ac6e35738a7c1876dafb53b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderController.java @@ -37,7 +37,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderController", description = "订单表管理") +@Api(tags = "oms", description = "订单表管理") @RequestMapping("/oms/OmsOrder") public class OmsOrderController { @Resource @@ -46,7 +46,8 @@ public class OmsOrderController { private IOmsOrderItemService orderItemService; @Resource - private OmsOrderOperateHistoryMapper omsOrderOperateHistoryMapper; + private OmsOrderOperateHistoryMapper omsOrderOperateHistoryMapper; + @SysLog(MODULE = "oms", REMARK = "根据条件查询所有订单表列表") @ApiOperation("根据条件查询所有订单表列表") @GetMapping(value = "/list") @@ -64,7 +65,6 @@ public class OmsOrderController { } - @SysLog(MODULE = "oms", REMARK = "删除订单表") @ApiOperation("删除订单表") @GetMapping(value = "/delete/{id}") @@ -93,8 +93,8 @@ public class OmsOrderController { return new CommonResult().paramFailed("订单表id"); } OmsOrder coupon = IOmsOrderService.getById(id); - coupon.setOrderItemList(orderItemService.list(new QueryWrapper().eq("order_id",coupon.getId()))); - coupon.setHistoryList(omsOrderOperateHistoryMapper.selectList(new QueryWrapper().eq("order_id",coupon.getId()))); + coupon.setOrderItemList(orderItemService.list(new QueryWrapper().eq("order_id", coupon.getId()))); + coupon.setHistoryList(omsOrderOperateHistoryMapper.selectList(new QueryWrapper().eq("order_id", coupon.getId()))); return new CommonResult().success(coupon); } catch (Exception e) { log.error("查询订单表明细:%s", e.getMessage(), e); @@ -128,6 +128,7 @@ public class OmsOrderController { } return new CommonResult().failed(); } + @SysLog(MODULE = "oms", REMARK = "批量发货") @ApiOperation("批量发货") @RequestMapping(value = "/delivery", method = RequestMethod.POST) @@ -197,14 +198,14 @@ public class OmsOrderController { @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) { IPage page = null; - if (order.getStatus()!=null && order.getStatus()==0){ - page = IOmsOrderService.page(new Page(pageNum, pageSize), new QueryWrapper().orderByDesc("create_time").select(ConstansValue.sampleOrderList)) ; - }else { - page = IOmsOrderService.page(new Page(pageNum, pageSize), new QueryWrapper<>(order).orderByDesc("create_time").select(ConstansValue.sampleOrderList)) ; + if (order.getStatus() != null && order.getStatus() == 0) { + page = IOmsOrderService.page(new Page(pageNum, pageSize), new QueryWrapper().orderByDesc("create_time").select(ConstansValue.sampleOrderList)); + } else { + page = IOmsOrderService.page(new Page(pageNum, pageSize), new QueryWrapper<>(order).orderByDesc("create_time").select(ConstansValue.sampleOrderList)); } - for (OmsOrder omsOrder : page.getRecords()){ - List itemList = orderItemService.list(new QueryWrapper().eq("order_id",omsOrder.getId()).eq("type", AllEnum.OrderItemType.GOODS.code())); + for (OmsOrder omsOrder : page.getRecords()) { + List itemList = orderItemService.list(new QueryWrapper().eq("order_id", omsOrder.getId()).eq("type", AllEnum.OrderItemType.GOODS.code())); omsOrder.setOrderItemList(itemList); } return new CommonResult().success(page); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderItemController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderItemController.java index 54e90e066b1255445c329687d172b8c65d9cd3c7..120259b03df26edb13cad002a6b61ce78d538998 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderItemController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderItemController.java @@ -27,7 +27,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderItemController", description = "订单中所包含的商品管理") +@Api(tags = "oms", description = "订单中所包含的商品管理") @RequestMapping("/oms/OmsOrderItem") public class OmsOrderItemController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderOperateHistoryController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderOperateHistoryController.java index c0e99e6532bc48cb06075317a5449cc5b0749072..a4d18ade476f2d0d8c4c8e870528abe51ee661ee 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderOperateHistoryController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderOperateHistoryController.java @@ -27,7 +27,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderOperateHistoryController", description = "订单操作历史记录管理") +@Api(tags = "oms", description = "订单操作历史记录管理") @RequestMapping("/oms/OmsOrderOperateHistory") public class OmsOrderOperateHistoryController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnApplyController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnApplyController.java index b18ed477ab45c193a7146d6416aeea7e096a8f1b..0b87a085a685df2725a34565fd24c4e1dda893f1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnApplyController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnApplyController.java @@ -28,7 +28,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderReturnApplyController", description = "订单退货申请管理") +@Api(tags = "oms", description = "订单退货申请管理") @RequestMapping("/oms/OmsOrderReturnApply") public class OmsOrderReturnApplyController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnReasonController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnReasonController.java index 1843116ed3d0d71a7a19ea9514a2fb9479941fac..e64cf2bccf95626efd7c1e7067c4bf5914fe3d85 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnReasonController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderReturnReasonController.java @@ -27,7 +27,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderReturnReasonController", description = "退货原因表管理") +@Api(tags = "oms", description = "退货原因表管理") @RequestMapping("/oms/OmsOrderReturnReason") public class OmsOrderReturnReasonController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderSettingController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderSettingController.java index 7774d2c1f79187afaacc3ea2550dff3da875d0d7..a6a43c3494709e54a65365bf65051ed3dcb97c7d 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderSettingController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsOrderSettingController.java @@ -27,7 +27,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "OmsOrderSettingController", description = "订单设置表管理") +@Api(tags = "oms", description = "订单设置表管理") @RequestMapping("/oms/OmsOrderSetting") public class OmsOrderSettingController { @Resource diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsPaymentsController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsPaymentsController.java new file mode 100644 index 0000000000000000000000000000000000000000..54f0147ef47743c6eea919cd9ed56d7624b9efd4 --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsPaymentsController.java @@ -0,0 +1,156 @@ +package com.zscat.mallplus.oms.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zscat.mallplus.annotation.SysLog; +import com.zscat.mallplus.oms.entity.OmsPayments; +import com.zscat.mallplus.oms.service.IOmsPaymentsService; +import com.zscat.mallplus.util.EasyPoiUtils; +import com.zscat.mallplus.utils.CommonResult; +import com.zscat.mallplus.utils.ValidatorUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author mallplus + * @date 2019-12-07 + * 支付配置 + */ +@Slf4j +@Api(tags = "oms", description = "支付配置") +@RestController +@RequestMapping("/oms/omsPayments") +public class OmsPaymentsController { + + @Resource + private IOmsPaymentsService IOmsPaymentsService; + + @SysLog(MODULE = "oms", REMARK = "根据条件查询所有支付配置列表") + @ApiOperation("根据条件查询所有支付配置列表") + @GetMapping(value = "/list") + @PreAuthorize("hasAuthority('oms:omsPayments:read')") + public Object getOmsPaymentsByPage(OmsPayments entity, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + ) { + try { + return new CommonResult().success(IOmsPaymentsService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); + } catch (Exception e) { + log.error("根据条件查询所有支付配置列表:%s", e.getMessage(), e); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "oms", REMARK = "保存支付配置") + @ApiOperation("保存支付配置") + @PostMapping(value = "/create") + @PreAuthorize("hasAuthority('oms:omsPayments:create')") + public Object saveOmsPayments(@RequestBody OmsPayments entity) { + try { + + if (IOmsPaymentsService.save(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("保存支付配置:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "oms", REMARK = "更新支付配置") + @ApiOperation("更新支付配置") + @PostMapping(value = "/update/{id}") + @PreAuthorize("hasAuthority('oms:omsPayments:update')") + public Object updateOmsPayments(@RequestBody OmsPayments entity) { + try { + if (IOmsPaymentsService.updateById(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("更新支付配置:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "oms", REMARK = "删除支付配置") + @ApiOperation("删除支付配置") + @GetMapping(value = "/delete/{id}") + @PreAuthorize("hasAuthority('oms:omsPayments:delete')") + public Object deleteOmsPayments(@ApiParam("支付配置id") @PathVariable Long id) { + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("支付配置id"); + } + if (IOmsPaymentsService.removeById(id)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("删除支付配置:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "oms", REMARK = "给支付配置分配支付配置") + @ApiOperation("查询支付配置明细") + @GetMapping(value = "/{id}") + @PreAuthorize("hasAuthority('oms:omsPayments:read')") + public Object getOmsPaymentsById(@ApiParam("支付配置id") @PathVariable Long id) { + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("支付配置id"); + } + OmsPayments coupon = IOmsPaymentsService.getById(id); + return new CommonResult().success(coupon); + } catch (Exception e) { + log.error("查询支付配置明细:%s", e.getMessage(), e); + return new CommonResult().failed(); + } + + } + + @ApiOperation(value = "批量删除支付配置") + @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) + @SysLog(MODULE = "oms", REMARK = "批量删除支付配置") + @PreAuthorize("hasAuthority('oms:omsPayments:delete')") + public Object deleteBatch(@RequestParam("ids") List ids) { + boolean count = IOmsPaymentsService.removeByIds(ids); + if (count) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + + @SysLog(MODULE = "oms", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, OmsPayments entity) { + // 模拟从数据库获取需要导出的数据 + List personList = IOmsPaymentsService.list(new QueryWrapper<>(entity)); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", OmsPayments.class, "导出社区数据.xls", response); + + } + + @SysLog(MODULE = "oms", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List personList = EasyPoiUtils.importExcel(file, OmsPayments.class); + IOmsPaymentsService.saveBatch(personList); + } +} + + diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsCompanyAddressService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsCompanyAddressService.java index 788f3ff31f1dc5706c1ddd21107f59c1c236626a..fad957714d12138d19d345e6b03d37f755675fe3 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsCompanyAddressService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsCompanyAddressService.java @@ -4,13 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.zscat.mallplus.oms.entity.OmsCompanyAddress; /** - *

- * 公司收发货地址表 服务类 - *

- * - * @author zscat - * @since 2019-04-17 + * @author mallplus + * @date 2019-12-07 */ + public interface IOmsCompanyAddressService extends IService { } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsOrderService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsOrderService.java index 6bc82a24b5161c490225157d9647565b4a4d5995..5b91185946812c3a88122d533d4f3338b506c552 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsOrderService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsOrderService.java @@ -49,21 +49,25 @@ public interface IOmsOrderService extends IService { */ @Transactional int close(List ids, String note); + @Transactional int singleDelivery(OmsOrderDeliveryParam deliveryParamList); /** * 订单日统计 + * * @param date * @return */ Map orderDayStatic(String date); + /** * 订单月统计 + * * @param date * @return */ Map orderMonthStatic(String date); - Object dayStatic(String date,Integer type); + Object dayStatic(String date, Integer type); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsPaymentsService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsPaymentsService.java new file mode 100644 index 0000000000000000000000000000000000000000..1a76e934c1ef9fd326238e3df6d0459711d38b7d --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/IOmsPaymentsService.java @@ -0,0 +1,13 @@ +package com.zscat.mallplus.oms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.oms.entity.OmsPayments; + +/** + * @author mallplus + * @date 2019-12-07 + */ + +public interface IOmsPaymentsService extends IService { + +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsCompanyAddressServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsCompanyAddressServiceImpl.java index 62b4dcbdf6249dd5fd372dbba17e3ec7afcc9be8..554017e2dfde5f3f4f316b4a79e42d4d914f8f1f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsCompanyAddressServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsCompanyAddressServiceImpl.java @@ -6,15 +6,17 @@ import com.zscat.mallplus.oms.mapper.OmsCompanyAddressMapper; import com.zscat.mallplus.oms.service.IOmsCompanyAddressService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + /** - *

- * 公司收发货地址表 服务实现类 - *

- * - * @author zscat - * @since 2019-04-17 + * @author mallplus + * @date 2019-12-07 */ @Service public class OmsCompanyAddressServiceImpl extends ServiceImpl implements IOmsCompanyAddressService { + @Resource + private OmsCompanyAddressMapper omsCompanyAddressMapper; + + } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java index 67ce6c281b1d7bc63c011bd95cc744840c01da25..239b2c0ab6600b2cd86e207c678ed1a5aefebb1f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsOrderServiceImpl.java @@ -109,10 +109,10 @@ public class OmsOrderServiceImpl extends ServiceImpl i } @Override - public Object dayStatic(String date,Integer type) { - List orders = orderMapper.listByDate(date,type); - List members = memberMapper.listByDate(date,type); - List products = productMapper.listByDate(date,type); + public Object dayStatic(String date, Integer type) { + List orders = orderMapper.listByDate(date, type); + List members = memberMapper.listByDate(date, type); + List products = productMapper.listByDate(date, type); int nowOrderCount = 0; // 今日订单 BigDecimal nowOrderPay = new BigDecimal(0); //今日销售总额 for (OmsOrder order : orders) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsPaymentsServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsPaymentsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..aad195ad309265e1619e1782331095ba1c472f83 --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/service/impl/OmsPaymentsServiceImpl.java @@ -0,0 +1,22 @@ +package com.zscat.mallplus.oms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zscat.mallplus.oms.entity.OmsPayments; +import com.zscat.mallplus.oms.mapper.OmsPaymentsMapper; +import com.zscat.mallplus.oms.service.IOmsPaymentsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * @author mallplus + * @date 2019-12-07 + */ +@Service +public class OmsPaymentsServiceImpl extends ServiceImpl implements IOmsPaymentsService { + + @Resource + private OmsPaymentsMapper omsPaymentsMapper; + + +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsBrandController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsBrandController.java index 737a80fe9eadb1143dd23bc85a19d8535d785a87..ec536d68538f90ebe831d9fdbc61460d5c726b5c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsBrandController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsBrandController.java @@ -36,11 +36,14 @@ public class PmsBrandController { @SysLog(MODULE = "pms", REMARK = "根据条件查询所有品牌表列表") @ApiOperation("根据条件查询所有品牌表列表") @GetMapping(value = "/list") - public Object getPmsBrandByPage(PmsBrand entity, + public Object getPmsBrandByPage( PmsBrand entity, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { + if (ValidatorUtils.notEmpty(entity.getName())){ + return new CommonResult().success(IPmsBrandService.page(new Page(pageNum, pageSize), new QueryWrapper(new PmsBrand()).like("name",entity.getName()))); + } return new CommonResult().success(IPmsBrandService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); } catch (Exception e) { log.error("根据条件查询所有品牌表列表:%s", e.getMessage(), e); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsGiftsController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsGiftsController.java index e0c0a4362f6be96462bbc14eb35b3bc9558914ab..fd58cfe500f512334093bdc852d0ffc8f00de918 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsGiftsController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsGiftsController.java @@ -42,7 +42,11 @@ public class PmsGiftsController { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { + if (ValidatorUtils.notEmpty(entity.getTitle())){ + return new CommonResult().success(IPmsGiftsService.page(new Page(pageNum, pageSize), new QueryWrapper(new PmsGifts()).like("title",entity.getTitle()))); + } return new CommonResult().success(IPmsGiftsService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); + } catch (Exception e) { log.error("根据条件查询所有帮助表列表:%s", e.getMessage(), e); } @@ -131,5 +135,20 @@ public class PmsGiftsController { return new CommonResult().failed(); } } + @ApiOperation(value = "批量更新显示状态") + @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) + @ResponseBody + @SysLog(MODULE = "pms", REMARK = "批量更新显示状态") + public Object updateShowStatus(@RequestParam("ids") Long ids, + @RequestParam("showStatus") Integer showStatus) { + PmsGifts g = new PmsGifts(); + g.setId(ids); + g.setShowStatus(showStatus); + if (IPmsGiftsService.updateById(g)) { + return new CommonResult().success(); + } else { + return new CommonResult().failed(); + } + } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductAttributeController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductAttributeController.java index 7586daae5a95a32a859fae5c0c0e8509a6fcc0e3..777702c709a1f49feaf0da2b77d37a8c712ef8e1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductAttributeController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductAttributeController.java @@ -73,7 +73,7 @@ public class PmsProductAttributeController { @PreAuthorize("hasAuthority('pms:PmsProductAttribute:create')") public Object savePmsProductAttribute(@RequestBody PmsProductAttribute entity) { try { - if (entity.getType().equals(null)){ + if (entity.getType().equals(null)) { entity.setType(0); } if (IPmsProductAttributeService.saveAndUpdate(entity)) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductConsultController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductConsultController.java index 814515117a9100338a340f2b475d144d545df2a1..38e424679ef9069863acab48b781ad20ffe1a423 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductConsultController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductConsultController.java @@ -50,7 +50,6 @@ public class PmsProductConsultController { } - @SysLog(MODULE = "pms", REMARK = "删除产品咨询表") @ApiOperation("删除产品咨询表") @GetMapping(value = "/delete/{id}") diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductController.java index ecce6b4b2eec1f3534718a8813844efac9dfe54c..5b4ad6fb9db428d6e983eeef3a473202921b5c36 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductController.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zscat.mallplus.annotation.SysLog; import com.zscat.mallplus.enums.ConstansValue; -import com.zscat.mallplus.oms.entity.OmsOrder; import com.zscat.mallplus.pms.entity.PmsProduct; import com.zscat.mallplus.pms.entity.PmsProductVertifyRecord; import com.zscat.mallplus.pms.service.IPmsProductService; @@ -51,10 +50,10 @@ public class PmsProductController { ) { try { IPage page = null; - if (ValidatorUtils.notEmpty(entity.getKeyword())){ - page = IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("name",entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList)) ; - }else { - page = IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("create_time").select(ConstansValue.sampleGoodsList)) ; + if (ValidatorUtils.notEmpty(entity.getKeyword())) { + page = IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList)); + } else { + page = IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("create_time").select(ConstansValue.sampleGoodsList)); } return new CommonResult().success(page); @@ -63,6 +62,7 @@ public class PmsProductController { } return new CommonResult().failed(); } + @ApiOperation("根据商品名称或货号模糊查询") @RequestMapping(value = "/simpleList", method = RequestMethod.GET) @ResponseBody @@ -70,6 +70,7 @@ public class PmsProductController { List productList = IPmsProductService.list(keyword); return new CommonResult().success(productList); } + @SysLog(MODULE = "pms", REMARK = "保存商品信息") @ApiOperation("保存商品信息") @PostMapping(value = "/create") @@ -215,14 +216,16 @@ public class PmsProductController { @SysLog(MODULE = "pms", REMARK = "批量上下架") public Object updatePublishStatu(@RequestBody IdStatus ids, BindingResult result) { PmsProduct product = new PmsProduct(); - product.setId(ids.getId());product.setPublishStatus(ids.getStatus()); + product.setId(ids.getId()); + product.setPublishStatus(ids.getStatus()); Boolean count = IPmsProductService.updateById(product); - if (count ) { + if (count) { return new CommonResult().success(count); } else { return new CommonResult().failed(); } } + @ApiOperation("批量推荐商品") @RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST) @ResponseBody @@ -270,16 +273,18 @@ public class PmsProductController { @GetMapping(value = "/goods/list") public Object getPmsProductListByPage(PmsProduct entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { - if(entity.getType()==1){ - return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("publish_status",1).gt("stock",0).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); - }if(entity.getType()==2){ - return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("publish_status",0).gt("stock",0).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); - }if(entity.getType()==3){ - return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().lt("stock",1).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); + if (entity.getType() == 1) { + return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("publish_status", 1).gt("stock", 0).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); + } + if (entity.getType() == 2) { + return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().eq("publish_status", 0).gt("stock", 0).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); + } + if (entity.getType() == 3) { + return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().lt("stock", 1).select(ConstansValue.sampleGoodsList).orderByDesc("create_time"))); } return new CommonResult().success(IPmsProductService.page(new Page(pageNum, pageSize), new QueryWrapper().select(ConstansValue.sampleGoodsList))); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsSkuStockController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsSkuStockController.java index 8d9897b3b85ff88666f0ef64b60e75459823ba6f..62345ae340b14c92acc6827059fadce4620e768d 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsSkuStockController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsSkuStockController.java @@ -104,13 +104,12 @@ public class PmsSkuStockController { @ApiOperation("查询sku的库存明细") @GetMapping(value = "select/{id}") @PreAuthorize("hasAuthority('pms:PmsSkuStock:read')") - public Object getPmsSkuStockById(@ApiParam("sku的库存id") @PathVariable Long id) { + public Object getPmsSkuStockById(@ApiParam("sku的库存id") @PathVariable Long id, @RequestParam(value = "keyword", required = false) String keyword) { try { if (ValidatorUtils.empty(id)) { return new CommonResult().paramFailed("sku的库存id"); } - PmsSkuStock coupon = IPmsSkuStockService.getById(id); - return new CommonResult().success(coupon); + return new CommonResult().success(IPmsSkuStockService.getList(id, keyword)); } catch (Exception e) { log.error("查询sku的库存明细:%s", e.getMessage(), e); return new CommonResult().failed(); @@ -143,7 +142,7 @@ public class PmsSkuStockController { @SysLog(MODULE = "pms", REMARK = "批量更新库存信息") @ApiOperation("批量更新库存信息") - @RequestMapping(value = "/update/{pid}", method = RequestMethod.POST) + @RequestMapping(value = "/updatePid/{pid}", method = RequestMethod.POST) @ResponseBody public Object update(@PathVariable Long pid, @RequestBody List skuStockList) { int count = IPmsSkuStockService.update(pid, skuStockList); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductAttributeServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductAttributeServiceImpl.java index 99636a86911f17c3fecb752cc097a52b362cb4d5..69870028b2999b5f09e611d2ad0838ea0b4cbc63 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductAttributeServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductAttributeServiceImpl.java @@ -39,8 +39,8 @@ public class PmsProductAttributeServiceImpl extends ServiceImpl().eq("product_attribute_category_id",entity.getProductAttributeCategoryId()).eq("type",entity.getType())); - if (count>=3){ + int count = productAttributeMapper.selectCount(new QueryWrapper().eq("product_attribute_category_id", entity.getProductAttributeCategoryId()).eq("type", entity.getType())); + if (count >= 3) { throw new BusinessMallException("规格或者属性数量不能超过3个"); } productAttributeMapper.insert(entity); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductServiceImpl.java index 7eeb0184683014e225392053d0514443d4086dbb..90566de7bd496035f4947b1ffe06fe1386b509b4 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/service/impl/PmsProductServiceImpl.java @@ -2,6 +2,7 @@ package com.zscat.mallplus.pms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.cms.service.ICmsPrefrenceAreaProductRelationService; import com.zscat.mallplus.cms.service.ICmsSubjectProductRelationService; import com.zscat.mallplus.pms.entity.*; @@ -15,7 +16,6 @@ import com.zscat.mallplus.util.JsonUtil; import com.zscat.mallplus.util.UserUtils; import com.zscat.mallplus.utils.IdWorker; import com.zscat.mallplus.utils.ValidatorUtils; -import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.vo.Rediskey; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -90,20 +90,22 @@ public class PmsProductServiceImpl extends ServiceImpl skuStockList, PmsProduct product) { - if (CollectionUtils.isEmpty(skuStockList)) return ; - int stock = 0 ; + private void handleSkuStockCode(List skuStockList, PmsProduct product) { + if (CollectionUtils.isEmpty(skuStockList)) return; + int stock = 0; for (int i = 0; i < skuStockList.size(); i++) { PmsSkuStock skuStock = skuStockList.get(i); skuStock.setProductName(product.getName()); @@ -139,7 +141,7 @@ public class PmsProductServiceImpl extends ServiceImpl(new PmsMemberPrice()).eq("product_id", id)); - // relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), id); + // memberPriceMapper.delete(new QueryWrapper<>(new PmsMemberPrice()).eq("product_id", id)); + // relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), id); //阶梯价格 productLadderMapper.delete(new QueryWrapper<>(new PmsProductLadder()).eq("product_id", id)); @@ -221,11 +223,13 @@ public class PmsProductServiceImpl extends ServiceImpl().in("id", ids)); } + public void clerGoodsRedis(List ids) { - for (Long id : ids){ + for (Long id : ids) { redisService.remove(String.format(Rediskey.GOODSDETAIL, id)); } } + @Override public int updateRecommendStatus(List ids, Integer recommendStatus) { PmsProduct record = new PmsProduct(); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsBasicMarkingController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsBasicMarkingController.java index c7e6c7a5a9de9ce007468edb7a6b89a18bfdbcf0..7df5cb4eafc0fb71e9b44cd5f08190bc61e3b1b1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsBasicMarkingController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsBasicMarkingController.java @@ -75,39 +75,39 @@ public class SmsBasicMarkingController { private void validateParam(@RequestBody SmsBasicMarking entity) { // 活动商品 1 按类别 2 部分商品 - if (ValidatorUtils.empty(entity.getActiviGoods())){ + if (ValidatorUtils.empty(entity.getActiviGoods())) { entity.setActiviGoods(3); } - if (ValidatorUtils.empty(entity.getActiviUser())){ + if (ValidatorUtils.empty(entity.getActiviUser())) { entity.setActiviUser(1); } - if (ValidatorUtils.empty(entity.getSmallType())){ + if (ValidatorUtils.empty(entity.getSmallType())) { entity.setSmallType(1); } - if (entity.getActiviGoods()==1){ - if (ValidatorUtils.notEmpty(entity.getProductCategoryRelationList())){ + if (entity.getActiviGoods() == 1) { + if (ValidatorUtils.notEmpty(entity.getProductCategoryRelationList())) { entity.setGoodsDs(JsonUtil.objectToJson(entity.getProductCategoryRelationList())); } - }else if (entity.getActiviGoods()==2){ - if (ValidatorUtils.notEmpty(entity.getProductRelationList())){ + } else if (entity.getActiviGoods() == 2) { + if (ValidatorUtils.notEmpty(entity.getProductRelationList())) { entity.setGoodsDs(JsonUtil.objectToJson(entity.getProductRelationList())); } - }else { + } else { entity.setGoodsDs(null); } - if (entity.getActiviUser()==2){ - if (ValidatorUtils.notEmpty(entity.getMemberLevelList())){ + if (entity.getActiviUser() == 2) { + if (ValidatorUtils.notEmpty(entity.getMemberLevelList())) { entity.setUserLevel(JsonUtil.objectToJson(entity.getMemberLevelList())); } - }else { + } else { entity.setUserLevel(null); } - if (entity.getSmallType()==1) { + if (entity.getSmallType() == 1) { if (ValidatorUtils.notEmpty(entity.getActrule())) { entity.setRules(JsonUtil.objectToJson(entity.getActrule())); } - }else { + } else { if (ValidatorUtils.notEmpty(entity.getActrule1())) { entity.setRules(JsonUtil.objectToJson(entity.getActrule1())); } @@ -161,30 +161,30 @@ public class SmsBasicMarkingController { } SmsBasicMarking entity = ISmsBasicMarkingService.getById(id); // 活动商品 1 按类别 2 部分商品 - if (entity.getActiviGoods()==1){ - if (ValidatorUtils.notEmpty(entity.getGoodsDs())){ + if (entity.getActiviGoods() == 1) { + if (ValidatorUtils.notEmpty(entity.getGoodsDs())) { entity.setProductCategoryRelationList(JsonUtil.jsonToList(entity.getGoodsDs(), BeanKv.class)); } } - if (entity.getActiviGoods()==2){ - if (ValidatorUtils.notEmpty(entity.getGoodsDs())){ + if (entity.getActiviGoods() == 2) { + if (ValidatorUtils.notEmpty(entity.getGoodsDs())) { entity.setProductRelationList(JsonUtil.jsonToList(entity.getGoodsDs(), BeanKv.class)); } } - if (entity.getActiviUser()==2){ - if (ValidatorUtils.notEmpty(entity.getUserLevel())){ + if (entity.getActiviUser() == 2) { + if (ValidatorUtils.notEmpty(entity.getUserLevel())) { entity.setMemberLevelList(JsonUtil.jsonToList(entity.getUserLevel(), BeanKv.class)); } } - if (entity.getSmallType()==1) { + if (entity.getSmallType() == 1) { if (ValidatorUtils.notEmpty(entity.getRules())) { - entity.setActrule(JsonUtil.jsonToList(entity.getRules(),BasicRuls.class)); + entity.setActrule(JsonUtil.jsonToList(entity.getRules(), BasicRuls.class)); } } - if (entity.getSmallType()==2) { + if (entity.getSmallType() == 2) { if (ValidatorUtils.notEmpty(entity.getRules())) { - entity.setActrule1(JsonUtil.jsonToList(entity.getRules(),BasicRuls.class)); + entity.setActrule1(JsonUtil.jsonToList(entity.getRules(), BasicRuls.class)); } } return new CommonResult().success(entity); @@ -208,14 +208,15 @@ public class SmsBasicMarkingController { return new CommonResult().failed(); } } + @ApiOperation("批量上下架") @RequestMapping(value = "/publishStatus", method = RequestMethod.POST) @ResponseBody @SysLog(MODULE = "pms", REMARK = "批量上下架") - public Object updatePublishStatus(@RequestParam("id") Long id, + public Object updatePublishStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status, @RequestParam("bigType") Integer bigType) { - int count = ISmsBasicMarkingService.updateStatus(id, status,bigType); + int count = ISmsBasicMarkingService.updateStatus(id, status, bigType); return new CommonResult().success(count); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsContentController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsContentController.java new file mode 100644 index 0000000000000000000000000000000000000000..48e1dbbf12bd35b8ef18912f0fef79d7471bcb91 --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsContentController.java @@ -0,0 +1,155 @@ +package com.zscat.mallplus.sms.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zscat.mallplus.annotation.SysLog; +import com.zscat.mallplus.sms.entity.SmsContent; +import com.zscat.mallplus.sms.service.ISmsContentService; +import com.zscat.mallplus.util.EasyPoiUtils; +import com.zscat.mallplus.utils.CommonResult; +import com.zscat.mallplus.utils.ValidatorUtils; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; + +/** + * @author mallplus + * @date 2019-12-07 + * 短信模版 + */ +@Slf4j +@RestController +@RequestMapping("/sms/smsContent") +public class SmsContentController { + + @Resource + private ISmsContentService ISmsContentService; + + @SysLog(MODULE = "ms", REMARK = "根据条件查询所有短信模版列表") + @ApiOperation("根据条件查询所有短信模版列表") + @GetMapping(value = "/list") + @PreAuthorize("hasAuthority('sms:smsContent:read')") + public Object getSmsContentByPage(SmsContent entity, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + ) { + try { + return new CommonResult().success(ISmsContentService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); + } catch (Exception e) { + log.error("根据条件查询所有短信模版列表:%s", e.getMessage(), e); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "ms", REMARK = "保存短信模版") + @ApiOperation("保存短信模版") + @PostMapping(value = "/create") + @PreAuthorize("hasAuthority('sms:smsContent:create')") + public Object saveSmsContent(@RequestBody SmsContent entity) { + try { + entity.setCreateTime(new Date()); + if (ISmsContentService.save(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("保存短信模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "ms", REMARK = "更新短信模版") + @ApiOperation("更新短信模版") + @PostMapping(value = "/update/{id}") + @PreAuthorize("hasAuthority('sms:smsContent:update')") + public Object updateSmsContent(@RequestBody SmsContent entity) { + try { + if (ISmsContentService.updateById(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("更新短信模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "ms", REMARK = "删除短信模版") + @ApiOperation("删除短信模版") + @GetMapping(value = "/delete/{id}") + @PreAuthorize("hasAuthority('sms:smsContent:delete')") + public Object deleteSmsContent(@ApiParam("短信模版id") @PathVariable Long id) { + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("短信模版id"); + } + if (ISmsContentService.removeById(id)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("删除短信模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); + } + + @SysLog(MODULE = "ms", REMARK = "给短信模版分配短信模版") + @ApiOperation("查询短信模版明细") + @GetMapping(value = "/{id}") + @PreAuthorize("hasAuthority('sms:smsContent:read')") + public Object getSmsContentById(@ApiParam("短信模版id") @PathVariable Long id) { + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("短信模版id"); + } + SmsContent coupon = ISmsContentService.getById(id); + return new CommonResult().success(coupon); + } catch (Exception e) { + log.error("查询短信模版明细:%s", e.getMessage(), e); + return new CommonResult().failed(); + } + + } + + @ApiOperation(value = "批量删除短信模版") + @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) + @SysLog(MODULE = "ms", REMARK = "批量删除短信模版") + @PreAuthorize("hasAuthority('sms:smsContent:delete')") + public Object deleteBatch(@RequestParam("ids") List ids) { + boolean count = ISmsContentService.removeByIds(ids); + if (count) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + + @SysLog(MODULE = "ms", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, SmsContent entity) { + // 模拟从数据库获取需要导出的数据 + List personList = ISmsContentService.list(new QueryWrapper<>(entity)); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", SmsContent.class, "导出社区数据.xls", response); + + } + + @SysLog(MODULE = "ms", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List personList = EasyPoiUtils.importExcel(file, SmsContent.class); + ISmsContentService.saveBatch(personList); + } +} + + diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiyPageController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiyPageController.java index 57f16c09182b3bc40ab54031297c307fdf152713..c6f9fe230a0747742e8845ff7d76e39bbdf0051b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiyPageController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiyPageController.java @@ -48,8 +48,8 @@ public class SmsDiyPageController { @ApiOperation("根据条件查询所有页面配置列表") @GetMapping(value = "/list") public Object getSmsDiyPageByPage(SmsDiyPage entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(ISmsDiyPageService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -58,6 +58,7 @@ public class SmsDiyPageController { } return new CommonResult().failed(); } + @SysLog(MODULE = "自定义页面配置", REMARK = "添加自定义页面配置") @ApiOperation("添加自定义页面配置") @PostMapping(value = "/create") @@ -77,7 +78,7 @@ public class SmsDiyPageController { entity.setCreateTime(sdf.parse(da)); ISmsDiyPageService.save(entity); if (entity.getType() == 2 && entity.getStatus() == 1) { - redisRepository.set(String.format(Rediskey.EsShopDiypage, 12), JsonUtil.objectToJson(entity)); + redisRepository.set(String.format(Rediskey.EsShopDiypage, 12), JsonUtil.objectToJson(entity)); } return new CommonResult().success("success"); } catch (Exception e) { @@ -121,6 +122,7 @@ public class SmsDiyPageController { return new CommonResult().failed(); } } + @SysLog(MODULE = "sms", REMARK = "给优惠卷表分配优惠卷表") @ApiOperation("查询优惠卷表明细") @GetMapping(value = "/{id}") @@ -137,6 +139,7 @@ public class SmsDiyPageController { } } + @SysLog(MODULE = "自定义页面配置", REMARK = "更改自定义页面配置信息") @ApiOperation("更改自定义页面配置信息") @PostMapping(value = "/update") @@ -174,8 +177,8 @@ public class SmsDiyPageController { @ApiOperation("查询页面") @GetMapping("/selDiyPage") public Object selDiyPage(SmsDiyPage entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(ISmsDiyPageService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -192,7 +195,7 @@ public class SmsDiyPageController { @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { try { - return new CommonResult().success(ISmsDiyPageService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).like("name",entity.getName()))); + return new CommonResult().success(ISmsDiyPageService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).like("name", entity.getName()))); } catch (Exception e) { return new CommonResult().failed(); } @@ -272,6 +275,7 @@ public class SmsDiyPageController { } } + @ApiOperation("修改展示状态") @RequestMapping(value = "/update/updateShowStatus") @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiypageTemplateCategoryController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiypageTemplateCategoryController.java index a454e6119afef4846edeb4b2607811b2efec8a8d..65b2ec58c8cf48d24145ac11ac364e760105b376 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiypageTemplateCategoryController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsDiypageTemplateCategoryController.java @@ -21,32 +21,32 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; /** -* @author mallplus -* @date 2019-12-04 -* 页面模版 -*/ + * @author mallplus + * @date 2019-12-04 + * 页面模版 + */ @Slf4j @RestController @RequestMapping("/sms/smsDiypageTemplateCategory") public class SmsDiypageTemplateCategoryController { -@Resource -private ISmsDiypageTemplateCategoryService ISmsDiypageTemplateCategoryService; - -@SysLog(MODULE = "sms", REMARK = "根据条件查询所有页面模版列表") -@ApiOperation("根据条件查询所有页面模版列表") -@GetMapping(value = "/list") -@PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:read')") -public Object getSmsDiypageTemplateCategoryByPage(SmsDiypageTemplateCategory entity, -@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, -@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize -) { -try { -return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); - } catch (Exception e) { - log.error("根据条件查询所有页面模版列表:%s", e.getMessage(), e); - } - return new CommonResult().failed(); + @Resource + private ISmsDiypageTemplateCategoryService ISmsDiypageTemplateCategoryService; + + @SysLog(MODULE = "sms", REMARK = "根据条件查询所有页面模版列表") + @ApiOperation("根据条件查询所有页面模版列表") + @GetMapping(value = "/list") + @PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:read')") + public Object getSmsDiypageTemplateCategoryByPage(SmsDiypageTemplateCategory entity, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + ) { + try { + return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); + } catch (Exception e) { + log.error("根据条件查询所有页面模版列表:%s", e.getMessage(), e); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sms", REMARK = "保存页面模版") @@ -54,16 +54,16 @@ return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Pa @PostMapping(value = "/create") @PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:create')") public Object saveSmsDiypageTemplateCategory(@RequestBody SmsDiypageTemplateCategory entity) { - try { + try { - if (ISmsDiypageTemplateCategoryService.save(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存页面模版:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); + if (ISmsDiypageTemplateCategoryService.save(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("保存页面模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sms", REMARK = "更新页面模版") @@ -71,15 +71,15 @@ return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Pa @PostMapping(value = "/update/{id}") @PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:update')") public Object updateSmsDiypageTemplateCategory(@RequestBody SmsDiypageTemplateCategory entity) { - try { - if (ISmsDiypageTemplateCategoryService.updateById(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新页面模版:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); + try { + if (ISmsDiypageTemplateCategoryService.updateById(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("更新页面模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sms", REMARK = "删除页面模版") @@ -87,18 +87,18 @@ return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Pa @GetMapping(value = "/delete/{id}") @PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:delete')") public Object deleteSmsDiypageTemplateCategory(@ApiParam("页面模版id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("页面模版id"); - } - if (ISmsDiypageTemplateCategoryService.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除页面模版:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("页面模版id"); + } + if (ISmsDiypageTemplateCategoryService.removeById(id)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("删除页面模版:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sms", REMARK = "给页面模版分配页面模版") @@ -106,16 +106,16 @@ return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Pa @GetMapping(value = "/{id}") @PreAuthorize("hasAuthority('sms:smsDiypageTemplateCategory:read')") public Object getSmsDiypageTemplateCategoryById(@ApiParam("页面模版id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("页面模版id"); - } - SmsDiypageTemplateCategory coupon = ISmsDiypageTemplateCategoryService.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询页面模版明细:%s", e.getMessage(), e); - return new CommonResult().failed(); - } + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("页面模版id"); + } + SmsDiypageTemplateCategory coupon = ISmsDiypageTemplateCategoryService.getById(id); + return new CommonResult().success(coupon); + } catch (Exception e) { + log.error("查询页面模版明细:%s", e.getMessage(), e); + return new CommonResult().failed(); + } } @@ -126,30 +126,29 @@ return new CommonResult().success(ISmsDiypageTemplateCategoryService.page(new Pa public Object deleteBatch(@RequestParam("ids") List ids) { boolean count = ISmsDiypageTemplateCategoryService.removeByIds(ids); if (count) { - return new CommonResult().success(count); + return new CommonResult().success(count); } else { - return new CommonResult().failed(); + return new CommonResult().failed(); } - } - + } - @SysLog(MODULE = "sms", REMARK = "导出社区数据") - @GetMapping("/exportExcel") - public void export(HttpServletResponse response, SmsDiypageTemplateCategory entity) { + @SysLog(MODULE = "sms", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, SmsDiypageTemplateCategory entity) { // 模拟从数据库获取需要导出的数据 List personList = ISmsDiypageTemplateCategoryService.list(new QueryWrapper<>(entity)); - // 导出操作 - EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", SmsDiypageTemplateCategory.class, "导出社区数据.xls", response); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", SmsDiypageTemplateCategory.class, "导出社区数据.xls", response); - } + } - @SysLog(MODULE = "sms", REMARK = "导入社区数据") - @PostMapping("/importExcel") - public void importUsers(@RequestParam MultipartFile file) { - List personList = EasyPoiUtils.importExcel(file, SmsDiypageTemplateCategory.class); - ISmsDiypageTemplateCategoryService.saveBatch(personList); - } - } + @SysLog(MODULE = "sms", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List personList = EasyPoiUtils.importExcel(file, SmsDiypageTemplateCategory.class); + ISmsDiypageTemplateCategoryService.saveBatch(personList); + } +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupActivityController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupActivityController.java index a6f07ede70757b7b1301551f367f271861d34feb..d192432839f0769c2c9fc5982601e66317035208 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupActivityController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupActivityController.java @@ -20,7 +20,7 @@ import java.util.List; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -38,8 +38,8 @@ public class SmsGroupActivityController { @ApiOperation("根据条件查询所有团购活动表列表") @GetMapping(value = "/list") public Object getSmsGroupActivityByPage(SmsGroupActivity entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(smsGroupActivityService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); @@ -56,13 +56,13 @@ public class SmsGroupActivityController { try { List list = entity.getProductList(); String goodsIs = ""; - BigDecimal originPrice= BigDecimal.ZERO; - for (PmsProduct p: list){ - originPrice=originPrice.add(p.getPrice()); - goodsIs=goodsIs+p.getId()+","; + BigDecimal originPrice = BigDecimal.ZERO; + for (PmsProduct p : list) { + originPrice = originPrice.add(p.getPrice()); + goodsIs = goodsIs + p.getId() + ","; } entity.setOriginprice(originPrice); - entity.setGoodsIds(goodsIs.substring(0,goodsIs.length()-1)); + entity.setGoodsIds(goodsIs.substring(0, goodsIs.length() - 1)); if (smsGroupActivityService.save(entity)) { return new CommonResult().success(); } @@ -80,13 +80,13 @@ public class SmsGroupActivityController { try { List list = entity.getProductList(); String goodsIs = ""; - BigDecimal originPrice= BigDecimal.ZERO; - for (PmsProduct p: list){ - originPrice=originPrice.add(p.getPrice()); - goodsIs=goodsIs+p.getId()+","; + BigDecimal originPrice = BigDecimal.ZERO; + for (PmsProduct p : list) { + originPrice = originPrice.add(p.getPrice()); + goodsIs = goodsIs + p.getId() + ","; } entity.setOriginprice(originPrice); - entity.setGoodsIds(goodsIs.substring(0,goodsIs.length()-1)); + entity.setGoodsIds(goodsIs.substring(0, goodsIs.length() - 1)); if (smsGroupActivityService.updateById(entity)) { return new CommonResult().success(); } @@ -144,6 +144,7 @@ public class SmsGroupActivityController { return new CommonResult().failed(); } } + @ApiOperation("修改展示状态") @RequestMapping(value = "/update/updateShowStatus") @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupController.java index cc081a3451eddc5b62b4f5afe35b4e673201972f..81f655c771e8c6b6810457fc5f5f14368c69f226 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsGroupController.java @@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zscat.mallplus.annotation.SysLog; import com.zscat.mallplus.sms.entity.SmsGroup; import com.zscat.mallplus.sms.entity.SmsGroupMember; +import com.zscat.mallplus.sms.entity.SmsGroupRecord; import com.zscat.mallplus.sms.mapper.SmsGroupMemberMapper; +import com.zscat.mallplus.sms.mapper.SmsGroupRecordMapper; import com.zscat.mallplus.sms.service.ISmsGroupService; -import com.zscat.mallplus.ums.entity.UmsMember; import com.zscat.mallplus.ums.service.IUmsMemberService; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; @@ -19,8 +20,6 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; @@ -37,8 +36,14 @@ import java.util.List; @Api(tags = "SmsGroupController", description = "管理") @RequestMapping("/sms/SmsGroup") public class SmsGroupController { + @Resource + private SmsGroupRecordMapper groupRecordMapper; @Resource private ISmsGroupService ISmsGroupService; + @Resource + private IUmsMemberService memberService; + @Resource + private SmsGroupMemberMapper groupMemberMapper; @SysLog(MODULE = "sms", REMARK = "根据条件查询所有列表") @ApiOperation("根据条件查询所有列表") @@ -56,29 +61,21 @@ public class SmsGroupController { } return new CommonResult().failed(); } - @Resource - private IUmsMemberService memberService; - @Resource - private SmsGroupMemberMapper groupMemberMapper; + @SysLog(MODULE = "sms", REMARK = "根据条件查询所有列表") @ApiOperation("根据条件查询所有列表") @GetMapping(value = "/listGroupMember") - public Object listGroupMember(SmsGroupMember entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + public Object listGroupMember(SmsGroupRecord entity, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { - List list = new ArrayList<>(); - List groupMembers = groupMemberMapper.selectList(new QueryWrapper().eq("group_id",entity.getGroupId())); - for (SmsGroupMember groupMember : groupMembers){ - if (ValidatorUtils.notEmpty(groupMember.getMemberId()) ){ - List ids = Arrays.asList(groupMember.getMemberId().split(",")); - groupMember.setList((List) memberService.listByIds(ids)); - list.add(groupMember); - - } + List groupRecords = groupRecordMapper.selectList(new QueryWrapper().eq("group_id", entity.getId())); + for (SmsGroupRecord groupRecord : groupRecords) { + List groupMembers = groupMemberMapper.selectList(new QueryWrapper().eq("group_record_id", groupRecord.getId()).eq("status", 2)); + groupRecord.setList(groupMembers); } - return new CommonResult().success(list); + return new CommonResult().success(groupRecords); } catch (Exception e) { log.error("根据条件查询所有列表:%s", e.getMessage(), e); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeNewProductController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeNewProductController.java index a44c9941181909dee0a0c8bba5d0d8ebbc39cd3f..f4efe4717b06b062480ab48869107c7057f8e97f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeNewProductController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeNewProductController.java @@ -144,7 +144,6 @@ public class SmsHomeNewProductController { } - @ApiOperation("批量修改推荐状态") @RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST) @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendProductController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendProductController.java index cdf277ad90a337e11dd0c2e67068f1ca9e849c3b..64e86f5166d62500eca35ba80ec9552c879844cc 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendProductController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendProductController.java @@ -48,6 +48,7 @@ public class SmsHomeRecommendProductController { } return new CommonResult().failed(); } + @ApiOperation("添加首页推荐") @RequestMapping(value = "/create", method = RequestMethod.POST) @ResponseBody @@ -58,6 +59,7 @@ public class SmsHomeRecommendProductController { } return new CommonResult().failed(); } + @SysLog(MODULE = "sms", REMARK = "保存人气推荐商品表") @ApiOperation("保存人气推荐商品表") @PostMapping(value = "/creates") @@ -142,7 +144,6 @@ public class SmsHomeRecommendProductController { } - @ApiOperation("修改推荐排序") @RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST) @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendSubjectController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendSubjectController.java index 692c97cb56728f7e6cbd180ff98e201800445e8d..409a8a978d1924a41e05c2d814db91240021296b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendSubjectController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsHomeRecommendSubjectController.java @@ -144,7 +144,6 @@ public class SmsHomeRecommendSubjectController { } - @ApiOperation("修改推荐排序") @RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST) @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsPaimaiController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsPaimaiController.java index 4ff6ff641de7f1400bf80493a28bf4312c5cefc5..1a5213bf103e02914adcb50f0d0521db6d39747c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsPaimaiController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsPaimaiController.java @@ -50,12 +50,13 @@ public class SmsPaimaiController { } return new CommonResult().failed(); } + @SysLog(MODULE = "sms", REMARK = "根据条件查询所有竞拍表列表") @ApiOperation("根据条件查询所有竞拍表列表") @GetMapping(value = "/fetchPaiMaiLog") public Object fetchPaiMaiLog(SmsPaimaiLog entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(smsPaimaiLogService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("create_time"))); @@ -64,6 +65,7 @@ public class SmsPaimaiController { } return new CommonResult().failed(); } + @SysLog(MODULE = "sms", REMARK = "保存竞拍表") @ApiOperation("保存竞拍表") @PostMapping(value = "/create") @@ -130,6 +132,7 @@ public class SmsPaimaiController { } } + @ApiOperation("修改展示状态") @RequestMapping(value = "/update/updateShowStatus") @ResponseBody diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsShareController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsShareController.java index 855b2232d99f0c8771415492fef7873df9a6b50b..d43088cc2392e8409204d0184fdfee081bbbb414 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsShareController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/controller/SmsShareController.java @@ -47,6 +47,5 @@ public class SmsShareController { } - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicGiftsService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicGiftsService.java index a82ccd86b883e9ca77bd5b8bbb2a423cce78fed8..2fed5e6debc20229d7d34dae79adeb0f9da8416d 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicGiftsService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicGiftsService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.sms.entity.SmsBasicGifts; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicMarkingService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicMarkingService.java index e62fac4991de9e798c0da3086611509ea6aa3805..0ffaf3e73d6dd18303953468d17d698f97f130ac 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicMarkingService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsBasicMarkingService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.sms.entity.SmsBasicMarking; /** *

- * 服务类 + * 服务类 *

* * @author zscat @@ -13,5 +13,5 @@ import com.zscat.mallplus.sms.entity.SmsBasicMarking; */ public interface ISmsBasicMarkingService extends IService { - int updateStatus(Long id, Integer status,Integer bigType); + int updateStatus(Long id, Integer status, Integer bigType); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsContentService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsContentService.java new file mode 100644 index 0000000000000000000000000000000000000000..0837946a48e570041bd1d09a750be04baa9e36e9 --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsContentService.java @@ -0,0 +1,13 @@ +package com.zscat.mallplus.sms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sms.entity.SmsContent; + +/** + * @author mallplus + * @date 2019-12-07 + */ + +public interface ISmsContentService extends IService { + +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiyPageService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiyPageService.java index d37ebbaa32dbdaeb7a5915a46b32392dbf7c6d2a..854e56256e3d2380898925b8f71946e877585994 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiyPageService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiyPageService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.sms.service; -import com.zscat.mallplus.sms.entity.SmsDiyPage; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sms.entity.SmsDiyPage; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiypageTemplateCategoryService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiypageTemplateCategoryService.java index 0a9d0cc7718f226a3003329a4c0e1b83f06eb48d..bc090a90ea1d7faa71913e5217954054479cd6df 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiypageTemplateCategoryService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsDiypageTemplateCategoryService.java @@ -1,12 +1,12 @@ package com.zscat.mallplus.sms.service; -import com.zscat.mallplus.sms.entity.SmsDiypageTemplateCategory; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sms.entity.SmsDiypageTemplateCategory; /** -* @author mallplus -* @date 2019-12-04 -*/ + * @author mallplus + * @date 2019-12-04 + */ public interface ISmsDiypageTemplateCategoryService extends IService { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsGroupActivityService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsGroupActivityService.java index 9945993ae559f86f7ffc57814c381be82e574220..37c65e28bf4c49aa8e57c38d36f844f1f66fe80e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsGroupActivityService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsGroupActivityService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.sms.entity.SmsGroupActivity; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsPaimaiLogService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsPaimaiLogService.java index 7a61ec02ac69361ab4189fa81849bbf65fbce5ba..f26afda321ef7b8c557ce0e28942a43647caf09c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsPaimaiLogService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/ISmsPaimaiLogService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.sms.entity.SmsPaimaiLog; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicGiftsServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicGiftsServiceImpl.java index a2f2e4b2b11e2da6384d4383b544994fd3ff38ab..c0f0794a332440338ec5782dbf64d1086f0e1324 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicGiftsServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicGiftsServiceImpl.java @@ -10,7 +10,7 @@ import javax.annotation.Resource; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -20,7 +20,8 @@ import javax.annotation.Resource; public class SmsBasicGiftsServiceImpl extends ServiceImpl implements ISmsBasicGiftsService { @Resource - private SmsBasicGiftsMapper giftsMapper; + private SmsBasicGiftsMapper giftsMapper; + @Override public int updateStatus(Long id, Integer status) { SmsBasicGifts gifts = new SmsBasicGifts(); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicMarkingServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicMarkingServiceImpl.java index a6f2c908037728fd200f8456387a94c038fbe514..0c76a448cc9fa64bd59e55966d4f67fa1b63cf35 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicMarkingServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsBasicMarkingServiceImpl.java @@ -12,7 +12,7 @@ import javax.annotation.Resource; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -23,23 +23,25 @@ public class SmsBasicMarkingServiceImpl extends ServiceImpl().eq("big_type",bigType)); + markingMapper.update(marking, new QueryWrapper().eq("big_type", bigType)); marking.setId(id); marking.setStatus(0); markingMapper.updateById(marking); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsContentServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsContentServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..eaff2f0d809c1005ab825883e6dc850748abf6c8 --- /dev/null +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsContentServiceImpl.java @@ -0,0 +1,22 @@ +package com.zscat.mallplus.sms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zscat.mallplus.sms.entity.SmsContent; +import com.zscat.mallplus.sms.mapper.SmsContentMapper; +import com.zscat.mallplus.sms.service.ISmsContentService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * @author mallplus + * @date 2019-12-07 + */ +@Service +public class SmsContentServiceImpl extends ServiceImpl implements ISmsContentService { + + @Resource + private SmsContentMapper smsContentMapper; + + +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiyPageServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiyPageServiceImpl.java index 4f39074d77f3a35beec6d6220264cc112c9b6305..e462109188cb8fb1656b2a31b9de49e523309293 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiyPageServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiyPageServiceImpl.java @@ -1,17 +1,17 @@ package com.zscat.mallplus.sms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.sms.entity.SmsDiyPage; import com.zscat.mallplus.sms.mapper.SmsDiyPageMapper; import com.zscat.mallplus.sms.service.ISmsDiyPageService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -22,9 +22,10 @@ public class SmsDiyPageServiceImpl extends ServiceImpl().eq("status",1).eq("type",typeId).ne("id",id)); + return diyPageMapper.selectCount(new QueryWrapper().eq("status", 1).eq("type", typeId).ne("id", id)); } @Override @@ -34,6 +35,6 @@ public class SmsDiyPageServiceImpl extends ServiceImpl().eq("name",name).ne("id",id)); + return diyPageMapper.selectCount(new QueryWrapper().eq("name", name).ne("id", id)); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiypageTemplateCategoryServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiypageTemplateCategoryServiceImpl.java index 196b5fcb00da3cd41270a93796df7bdb95b16295..75973244e69197ecb9fab6ec72b4411f1f902561 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiypageTemplateCategoryServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsDiypageTemplateCategoryServiceImpl.java @@ -1,21 +1,23 @@ package com.zscat.mallplus.sms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.sms.entity.SmsDiypageTemplateCategory; import com.zscat.mallplus.sms.mapper.SmsDiypageTemplateCategoryMapper; import com.zscat.mallplus.sms.service.ISmsDiypageTemplateCategoryService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; + import javax.annotation.Resource; + /** -* @author mallplus -* @date 2019-12-04 -*/ + * @author mallplus + * @date 2019-12-04 + */ @Service public class SmsDiypageTemplateCategoryServiceImpl extends ServiceImpl implements ISmsDiypageTemplateCategoryService { @Resource - private SmsDiypageTemplateCategoryMapper smsDiypageTemplateCategoryMapper; + private SmsDiypageTemplateCategoryMapper smsDiypageTemplateCategoryMapper; @Override diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsGroupActivityServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsGroupActivityServiceImpl.java index 26df4543cf7a6bdec8ed60b99df432e3ffa68ea7..3d1f00b4a91d6434a12d1fb0f64a96ef211d7c41 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsGroupActivityServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsGroupActivityServiceImpl.java @@ -11,7 +11,7 @@ import javax.annotation.Resource; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -22,6 +22,7 @@ public class SmsGroupActivityServiceImpl extends ServiceImpl().in("id", ids)); } + @Override public int create(List homeBrandList) { for (SmsHomeBrand smsHomeBrand : homeBrandList) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeNewProductServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeNewProductServiceImpl.java index 248431ca982f3007feaabc1b547cbe29852a1d6a..5f812db840cce1078ca683161cb5cd2bb46dbfb7 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeNewProductServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeNewProductServiceImpl.java @@ -37,6 +37,7 @@ public class SmsHomeNewProductServiceImpl extends ServiceImpl homeNewProductList) { for (SmsHomeNewProduct SmsHomeNewProduct : homeNewProductList) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendProductServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendProductServiceImpl.java index f5381eff9cb422787da6235b14333eead9afa240..d9a84733f9fb80fa4ffb8bfac235b4851d78bfe4 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendProductServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendProductServiceImpl.java @@ -37,6 +37,7 @@ public class SmsHomeRecommendProductServiceImpl extends ServiceImpl().in("id", ids)); } + @Override public int create(List homeRecommendProductList) { for (SmsHomeRecommendProduct recommendProduct : homeRecommendProductList) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendSubjectServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendSubjectServiceImpl.java index b2d152ae1011e6c4f9d64619251ba782ae2dad9c..f03a988419c0d230dc54dd093c5071076c013c92 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendSubjectServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsHomeRecommendSubjectServiceImpl.java @@ -38,6 +38,7 @@ public class SmsHomeRecommendSubjectServiceImpl extends ServiceImpl().in("id", ids)); } + @Override public int create(List recommendSubjectList) { for (SmsHomeRecommendSubject recommendProduct : recommendSubjectList) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsPaimaiLogServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsPaimaiLogServiceImpl.java index 8feaee433f8703bec456b16f8c841527f801e79f..d035a78590fc40c534d76b2b8a44033a67598545 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsPaimaiLogServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sms/service/impl/SmsPaimaiLogServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobController.java index f7f6b81ad782ebc030054fc9a0573c9e3a299cb1..45e0b2731dda9cfaa2023fb519695d5318d6f66c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobController.java @@ -54,11 +54,11 @@ public class AdminSysJobController { public Object saveAdminSysJob(@RequestBody AdminSysJob entity) { try { - if (!adminSysJobService.checkCronExpressionIsValid(entity.getCronExpression())){ + if (!adminSysJobService.checkCronExpressionIsValid(entity.getCronExpression())) { return new CommonResult().failed("表达式错误"); } adminSysJobService.insertJob(entity); - return new CommonResult().success(); + return new CommonResult().success(); } catch (Exception e) { log.error("保存定时器日志表:%s", e.getMessage(), e); @@ -73,11 +73,11 @@ public class AdminSysJobController { public Object updateAdminSysJob(@RequestBody AdminSysJob entity) { try { - if (!adminSysJobService.checkCronExpressionIsValid(entity.getCronExpression())){ + if (!adminSysJobService.checkCronExpressionIsValid(entity.getCronExpression())) { return new CommonResult().failed("表达式错误"); } - adminSysJobService.updateJob(entity) ; - return new CommonResult().success(); + adminSysJobService.updateJob(entity); + return new CommonResult().success(); } catch (Exception e) { log.error("更新定时器日志表:%s", e.getMessage(), e); @@ -149,12 +149,13 @@ public class AdminSysJobController { return new CommonResult().failed(); } } + @ApiOperation("修改展示状态") @RequestMapping(value = "/run") @ResponseBody @SysLog(MODULE = "cms", REMARK = "修改展示状态") public Object run(@RequestBody AdminSysJob entity) { - adminSysJobService.run(entity); + adminSysJobService.run(entity); return new CommonResult().success(); } @@ -164,8 +165,7 @@ public class AdminSysJobController { */ @PostMapping("/checkCronExpressionIsValid") @ResponseBody - public Object checkCronExpressionIsValid(@RequestBody AdminSysJob job) - { + public Object checkCronExpressionIsValid(@RequestBody AdminSysJob job) { adminSysJobService.checkCronExpressionIsValid(job.getCronExpression()); return new CommonResult().success(); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobLogController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobLogController.java index c4c0735e99f4b7515e80b570445bd2860f48a575..c6186af1e4ee046f1820148529035f48193f59ae 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobLogController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AdminSysJobLogController.java @@ -37,8 +37,8 @@ public class AdminSysJobLogController { @GetMapping(value = "/list") public Object getAdminSysJobLogByPage(AdminSysJobLog entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { return new CommonResult().success(adminSysJobService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("create_time"))); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AliPayController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AliPayController.java index 747cb8fdf21f849134562807ce493aedcede7607..099d533b6da1b8bd5cf450a6760938c4a6149385 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AliPayController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/AliPayController.java @@ -33,21 +33,21 @@ import java.util.Map; public class AliPayController { @Resource - private AlipayUtils alipayUtils; + private AlipayUtils alipayUtils; @Resource - private ISysAlipayConfigService alipayService; + private ISysAlipayConfigService alipayService; @GetMapping(value = "/{id}") - public Object get(){ + public Object get() { return new CommonResult().success(alipayService.getOne(new QueryWrapper<>())); } @ApiOperation("配置支付宝") @PostMapping(value = "/update") - public Object payConfig(@Validated @RequestBody SysAlipayConfig alipayConfig){ + public Object payConfig(@Validated @RequestBody SysAlipayConfig alipayConfig) { alipayService.updateById(alipayConfig); return new CommonResult().success(); @@ -56,43 +56,43 @@ public class AliPayController { @ApiOperation("PC网页支付") @PostMapping(value = "/toPayAsPC") - public Object toPayAsPC(@Validated @RequestBody TradeVo trade) throws Exception{ + public Object toPayAsPC(@Validated @RequestBody TradeVo trade) throws Exception { log.info("toPayAsPC"); SysAlipayConfig alipay = alipayService.getOne(new QueryWrapper<>()); trade.setOutTradeNo(alipayUtils.getOrderCode()); - String payUrl = alipayService.toPayAsPC(alipay,trade); + String payUrl = alipayService.toPayAsPC(alipay, trade); return new CommonResult().success(payUrl); } @ApiOperation("手机网页支付") @PostMapping(value = "/toPayAsWeb") - public Object toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception{ + public Object toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception { log.info("toPayAsWeb"); SysAlipayConfig alipay = alipayService.getOne(new QueryWrapper<>()); trade.setOutTradeNo(alipayUtils.getOrderCode()); - String payUrl = alipayService.toPayAsWeb(alipay,trade); + String payUrl = alipayService.toPayAsWeb(alipay, trade); return new CommonResult().success(payUrl); } @ApiIgnore @GetMapping("/return") @ApiOperation("支付之后跳转的链接") - public Object returnPage(HttpServletRequest request, HttpServletResponse response){ + public Object returnPage(HttpServletRequest request, HttpServletResponse response) { log.info("returnPage"); SysAlipayConfig alipay = alipayService.getOne(new QueryWrapper<>()); response.setContentType("text/html;charset=" + alipay.getCharset()); //内容验签,防止黑客篡改参数 - if(alipayUtils.rsaCheck(request,alipay)){ + if (alipayUtils.rsaCheck(request, alipay)) { //商户订单号 String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); //支付宝交易号 String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); - System.out.println("商户订单号"+outTradeNo+" "+"第三方交易号"+tradeNo); + System.out.println("商户订单号" + outTradeNo + " " + "第三方交易号" + tradeNo); // 根据业务需要返回数据,这里统一返回OK return new CommonResult().success("payment successful", HttpStatus.OK); - }else{ + } else { // 根据业务需要返回数据 return new CommonResult().success(HttpStatus.BAD_REQUEST); } @@ -101,12 +101,12 @@ public class AliPayController { @ApiIgnore @RequestMapping("/notify") @ApiOperation("支付异步通知(要公网访问),接收异步通知,检查通知内容app_id、out_trade_no、total_amount是否与请求中的一致,根据trade_status进行后续业务处理") - public Object notify(HttpServletRequest request){ + public Object notify(HttpServletRequest request) { log.info("notify"); SysAlipayConfig alipay = alipayService.getOne(new QueryWrapper<>()); Map parameterMap = request.getParameterMap(); //内容验签,防止黑客篡改参数 - if (alipayUtils.rsaCheck(request,alipay)) { + if (alipayUtils.rsaCheck(request, alipay)) { //交易状态 String tradeStatus = new String(request.getParameter("trade_status").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); // 商户订单号 @@ -116,8 +116,8 @@ public class AliPayController { //付款金额 String totalAmount = new String(request.getParameter("total_amount").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); //验证 - if(tradeStatus.equals(AliPayStatusEnum.SUCCESS.getValue())||tradeStatus.equals(AliPayStatusEnum.FINISHED.getValue())){ - // 验证通过后应该根据业务需要处理订单 + if (tradeStatus.equals(AliPayStatusEnum.SUCCESS.getValue()) || tradeStatus.equals(AliPayStatusEnum.FINISHED.getValue())) { + // 验证通过后应该根据业务需要处理订单 } return new CommonResult().success(HttpStatus.OK); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/GeneratorController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/GeneratorController.java index a01815bac9248c87ca157b609a829f1055718162..59b1c0789a69c9adfc1c8a182c0230a90368c245 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/GeneratorController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/GeneratorController.java @@ -23,41 +23,41 @@ public class GeneratorController { @Resource - private GeneratorConfigMapper generatorConfigMapper; + private GeneratorConfigMapper generatorConfigMapper; @ApiOperation("查询数据库元数据") @GetMapping(value = "/tables") public Object getTables(@RequestParam(defaultValue = "") String name, - @RequestParam(defaultValue = "0")Integer page, - @RequestParam(defaultValue = "10")Integer size){ - int[] startEnd = PageUtil.transToStartEnd(page+1, size); - return new CommonResult().success(generatorService.getTables(name,startEnd)); + @RequestParam(defaultValue = "0") Integer page, + @RequestParam(defaultValue = "10") Integer size) { + int[] startEnd = PageUtil.transToStartEnd(page + 1, size); + return new CommonResult().success(generatorService.getTables(name, startEnd)); } @ApiOperation("查询表内元数据") @GetMapping(value = "/columns") - public Object getTables(@RequestParam String tableName){ + public Object getTables(@RequestParam String tableName) { return new CommonResult().success(generatorService.getColumns(tableName)); } @ApiOperation("生成代码") @PostMapping - public Object generator(@RequestBody List columnInfos, @RequestParam String tableName){ + public Object generator(@RequestBody List columnInfos, @RequestParam String tableName) { - generatorService.generator(columnInfos,generatorConfigMapper.selectById(1),tableName); + generatorService.generator(columnInfos, generatorConfigMapper.selectById(1), tableName); return new CommonResult().success(); } @ApiOperation("查询") @GetMapping(value = "/get") - public Object get(){ + public Object get() { return new CommonResult().success(generatorConfigMapper.selectById(1)); } @ApiOperation("修改") @PostMapping(value = "/update") - public Object emailConfig(@Validated @RequestBody GenConfig genConfig){ + public Object emailConfig(@Validated @RequestBody GenConfig genConfig) { genConfig.setId(1L); return new CommonResult().success(generatorConfigMapper.updateById(genConfig)); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/HomeController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/HomeController.java index 74b6a3085fab166a7e4836ab9a30842904195c4f..2074575eeef19b0241d3ac23ee128af257103f0e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/HomeController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/HomeController.java @@ -49,6 +49,14 @@ import java.util.*; @RequestMapping("/home") public class HomeController extends BaseController { + @Resource + CmsSubjectCategoryMapper categoryMapper; + @Resource + CmsSubjectMapper subjectMapper; + @Resource + SysSchoolMapper schoolMapper; + @Resource + SysAreaMapper sysAreaMapper; @Resource private IOmsOrderService orderService; @Resource @@ -56,20 +64,19 @@ public class HomeController extends BaseController { @Resource private IUmsMemberService memberService; - @ApiOperation("按时间统计订单 会员和商品") @SysLog(MODULE = "home", REMARK = "首页订单日统计") @RequestMapping(value = "/dayStatic", method = RequestMethod.GET) - public Object dayStatic(@RequestParam String date,@RequestParam Integer type) throws Exception { - return new CommonResult().success(orderService.dayStatic(date,type)); + public Object dayStatic(@RequestParam String date, @RequestParam Integer type) throws Exception { + return new CommonResult().success(orderService.dayStatic(date, type)); } @ApiOperation("首页订单日统计") @SysLog(MODULE = "home", REMARK = "首页订单日统计") @RequestMapping(value = "/orderDayStatic", method = RequestMethod.GET) public Object orderDayStatic(@RequestParam String date) throws Exception { - if (date.startsWith("--")){ - date=DateUtils.currentDay(); + if (date.startsWith("--")) { + date = DateUtils.currentDay(); } return new CommonResult().success(orderService.orderDayStatic(date)); } @@ -78,8 +85,8 @@ public class HomeController extends BaseController { @SysLog(MODULE = "home", REMARK = "首页订单月统计") @RequestMapping(value = "/orderMonthStatic", method = RequestMethod.GET) public Object orderMonthStatic(@RequestParam String date) throws Exception { - if (date.startsWith("--")){ - date=DateUtils.currentDay(); + if (date.startsWith("--")) { + date = DateUtils.currentDay(); } return new CommonResult().success(orderService.orderMonthStatic(date)); } @@ -121,27 +128,27 @@ public class HomeController extends BaseController { for (OmsOrder order : orderList) { if (DateUtils.format(order.getCreateTime()).equals(DateUtils.format(new Date())) - && (order.getStatus() <9 )) { + && (order.getStatus() < 9)) { nowOrderCount++; nowOrderPay = nowOrderPay.add(order.getPayAmount()); } if (DateUtils.format(order.getCreateTime()).equals(DateUtils.addDay(new Date(), -1)) - && (order.getStatus() <9 )) { + && (order.getStatus() < 9)) { yesOrderCount++; yesOrderPay = yesOrderPay.add(order.getPayAmount()); } if (DateUtils.calculateDaysNew(order.getCreateTime(), new Date()) >= 7 - && (order.getStatus() <9 )) { + && (order.getStatus() < 9)) { qiOrderCount++; qiOrderPay = qiOrderPay.add(order.getPayAmount()); } if (order.getCreateTime().getTime() >= DateUtils.geFirstDayDateByMonth().getTime() - && (order.getStatus() <9 )) { + && (order.getStatus() < 9)) { monthOrderCount++; monthOrderPay = monthOrderPay.add(order.getPayAmount()); } if (order.getCreateTime().getTime() >= DateUtils.getFirstDayOfWeek().getTime() - && (order.getStatus() <9 )) { + && (order.getStatus() < 9)) { weekOrderCount++; weekOrderPay = weekOrderPay.add(order.getPayAmount()); } @@ -196,7 +203,7 @@ public class HomeController extends BaseController { public Object goodsStatic() throws Exception { StopWatch stopWatch = new StopWatch("首页商品统计"); stopWatch.start("首页商品列表2"); - List goodsList = productService.list(new QueryWrapper<>(new PmsProduct()).select("publish_status","create_time")); + List goodsList = productService.list(new QueryWrapper<>(new PmsProduct()).select("publish_status", "create_time")); stopWatch.stop(); stopWatch.start("首页商品"); @@ -255,9 +262,9 @@ public class HomeController extends BaseController { if (DateUtils.format(member.getCreateTime()).equals(DateUtils.format(new Date()))) { nowCount++; } - if (member.getGender()==null || member.getGender()==1){ + if (member.getGender() == null || member.getGender() == 1) { mallCount++; - }else { + } else { femallount++; } } @@ -271,11 +278,11 @@ public class HomeController extends BaseController { return new CommonResult().success(map); } - /** * 导出:http://localhost:8080/home/export/users - 导入:http://localhost:8080/demo/import/users (用postman或者curl测试吧) - http://localhost:8080/home/import/goods + * 导入:http://localhost:8080/demo/import/users (用postman或者curl测试吧) + * http://localhost:8080/home/import/goods + * * @param response */ @RequestMapping(value = "/export/users", method = RequestMethod.GET) @@ -283,36 +290,30 @@ public class HomeController extends BaseController { List userList = getUserList(); EasyPoiUtils.exportExcel(getUserList(), "用户列表", "用户报表", ExportUser.class, "用户明细报表.xls", response); } + @RequestMapping("/import/users") @ResponseBody public List importUsers(@RequestParam MultipartFile file) { List d = EasyPoiUtils.importExcel(file, ExportUser.class); return EasyPoiUtils.importExcel(file, ExportUser.class); } + @RequestMapping("/import/goods") @ResponseBody public void importgoods(@RequestParam MultipartFile file) { List list = EasyPoiUtils.importExcel(file, ExportGoods.class); - for (ExportGoods gg : list){ + for (ExportGoods gg : list) { createG(gg); } } - @Resource - CmsSubjectCategoryMapper categoryMapper; - @Resource - CmsSubjectMapper subjectMapper; - @Resource - SysSchoolMapper schoolMapper; - @Resource - SysAreaMapper sysAreaMapper; @RequestMapping("/import/subject") @ResponseBody public void importSubject(@RequestParam MultipartFile file) { List areas = sysAreaMapper.selectList(new QueryWrapper<>()); List schools = schoolMapper.selectList(new QueryWrapper<>()); List list = EasyPoiUtils.importExcel(file, ExportSubject.class); - for (ExportSubject subject1 : list){ + for (ExportSubject subject1 : list) { try { CmsSubject subject = new CmsSubject(); subject.setTitle(subject1.getTitle()); @@ -321,50 +322,52 @@ public class HomeController extends BaseController { subject.setAlbumPics(subject1.getPic()); - Random r = new Random(); Integer a = r.nextInt(100); + Random r = new Random(); + Integer a = r.nextInt(100); Integer c = r.nextInt(3); Integer d = r.nextInt(5); subject.setCollectCount(r.nextInt(100)); subject.setReadCount(r.nextInt(100)); subject.setForwardCount(r.nextInt(100)); - subject.setCategoryName("游戏专题"); - subject.setCategoryId(2L); + subject.setCategoryName("游戏专题"); + subject.setCategoryId(2L); subject.setType(c); Integer b = r.nextInt(100); - SysSchool school = schools.get(a); - if (school!=null){ + SysSchool school = schools.get(a); + if (school != null) { subject.setSchoolId(school.getId()); subject.setSchoolName(school.getName()); - }else{ - SysSchool school1 = schools.get(b); - if (school1!=null){ + } else { + SysSchool school1 = schools.get(b); + if (school1 != null) { subject.setSchoolId(school1.getId()); subject.setSchoolName(school1.getName()); } } - SysArea area = areas.get(b); - if (area!=null){ + SysArea area = areas.get(b); + if (area != null) { subject.setAreaId(area.getId()); subject.setAreaName(area.getName()); - }else{ - SysArea area1 = areas.get(a); - if (area1!=null){ + } else { + SysArea area1 = areas.get(a); + if (area1 != null) { subject.setAreaId(area1.getId()); subject.setAreaName(area1.getName()); } } subjectMapper.insert(subject); - }catch (Exception e){ + } catch (Exception e) { System.out.println(e.getMessage()); } } } - void createG(ExportGoods gg){ + + void createG(ExportGoods gg) { PmsProduct g = new PmsProduct(); g.setName(gg.getUsername()); g.setSubTitle(gg.getUsername()); @@ -376,10 +379,10 @@ public class HomeController extends BaseController { g.setPic(gg.getImg()); g.setAlbumPics(gg.getImg()); - if (ValidatorUtils.notEmpty(gg.getPrice())){ + if (ValidatorUtils.notEmpty(gg.getPrice())) { g.setPrice(new BigDecimal(gg.getPrice().substring(1))); } - if (ValidatorUtils.notEmpty(gg.getOriginprice())){ + if (ValidatorUtils.notEmpty(gg.getOriginprice())) { g.setOriginalPrice(new BigDecimal(gg.getOriginprice().substring(1))); } @@ -392,7 +395,7 @@ public class HomeController extends BaseController { g.setPublishStatus(1); g.setPromotionType(0); g.setVerifyStatus(1); - g.setProductSn("X"+System.currentTimeMillis()); + g.setProductSn("X" + System.currentTimeMillis()); g.setQsType(1); g.setNewStatus(1); g.setCreateTime(new Date()); @@ -404,6 +407,7 @@ public class HomeController extends BaseController { g.setProductAttributeCategoryId(11L); productService.save(g); } + private List getUserList() { List userList = new ArrayList<>(); userList.add(new ExportUser("tom", new Date())); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/OssController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/OssController.java index b9fd5135e70772eecfb61c2b91a5e81dc145f201..e8b58dbbd97e1e5c1d30843b1ec2b87e83bc9421 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/OssController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/OssController.java @@ -35,8 +35,23 @@ import java.util.Random; @Api(tags = "OssController", description = "Oss管理") @RequestMapping("/aliyun/oss") public class OssController { + @Autowired + OssAliyunUtil aliyunOSSUtil; @Autowired private OssServiceImpl ossService; + @Resource + private PmsAlbumPicMapper albumPicMapper; + + private static ByteArrayInputStream getRandomDataStream(int length) { + return new ByteArrayInputStream(getRandomBuffer(length)); + } + + private static byte[] getRandomBuffer(int length) { + final Random randGenerator = new Random(); + final byte[] buff = new byte[length]; + randGenerator.nextBytes(buff); + return buff; + } @ApiOperation(value = "oss上传签名生成") @RequestMapping(value = "/policy", method = RequestMethod.GET) @@ -54,13 +69,6 @@ public class OssController { return new CommonResult().success(ossCallbackResult); } - - @Autowired - OssAliyunUtil aliyunOSSUtil; - @Resource - private PmsAlbumPicMapper albumPicMapper; - - @SysLog(MODULE = "图片上传管理", REMARK = "上传") @ApiOperation("上传") @RequestMapping(value = "upload", method = RequestMethod.POST) @@ -68,7 +76,7 @@ public class OssController { List list = new ArrayList<>(); String name = aliyunOSSUtil.upload(multipartFile); - insertPic(groupId, multipartFile, name,"image"); + insertPic(groupId, multipartFile, name, "image"); BlobUpload blobUploadEntity = new BlobUpload(); blobUploadEntity.setFileName(multipartFile.getOriginalFilename()); blobUploadEntity.setFileUrl(name); @@ -87,7 +95,7 @@ public class OssController { if (multipartFile != null && multipartFile.length > 0) { for (int i = 0; i < multipartFile.length; i++) { String name = aliyunOSSUtil.upload(multipartFile[i]); - insertPic(groupId, multipartFile[i], name,"image"); + insertPic(groupId, multipartFile[i], name, "image"); BlobUpload blobUploadEntity = new BlobUpload(); blobUploadEntity.setFileName(multipartFile[i].getOriginalFilename()); blobUploadEntity.setFileUrl(name); @@ -120,13 +128,13 @@ public class OssController { } String name = aliyunOSSUtil.upload(multipartFile); - return new CommonResult().success(insertPic(groupId, multipartFile, name,fileType)); + return new CommonResult().success(insertPic(groupId, multipartFile, name, fileType)); } return new CommonResult().success(list); } - private PmsAlbumPic insertPic(Long groupId, @RequestPart("file") MultipartFile multipartFile, String name,String type) { + private PmsAlbumPic insertPic(Long groupId, @RequestPart("file") MultipartFile multipartFile, String name, String type) { PmsAlbumPic attachment = new PmsAlbumPic(); if (ValidatorUtils.notEmpty(UserUtils.getCurrentMember())) { attachment.setUserId(UserUtils.getCurrentMember().getId()); @@ -134,14 +142,13 @@ public class OssController { attachment.setAlbumId(groupId); attachment.setCreateTime(new Date()); attachment.setName(multipartFile.getOriginalFilename()); - attachment.setStoreId(Long.parseLong("1")); + // attachment.setStoreId(Long.parseLong("1")); attachment.setType(type); attachment.setPic(name); albumPicMapper.insert(attachment); return attachment; } - @IgnoreAuth @PostMapping("/upload1") @ApiOperation("上传文件") @@ -162,17 +169,6 @@ public class OssController { return new CommonResult().success(stringBuffer); } - private static ByteArrayInputStream getRandomDataStream(int length) { - return new ByteArrayInputStream(getRandomBuffer(length)); - } - - private static byte[] getRandomBuffer(int length) { - final Random randGenerator = new Random(); - final byte[] buff = new byte[length]; - randGenerator.nextBytes(buff); - return buff; - } - private String getFileExtension(String fileName) { int position = fileName.indexOf('.'); if (position > 0) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysEmailConfigController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysEmailConfigController.java index 1b296752e39b4756289c800c9c0ab2f70d4bfce3..ae94ea43bf3dd41982eeca6d99a1e4bb93c16cc1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysEmailConfigController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysEmailConfigController.java @@ -14,7 +14,7 @@ import javax.annotation.Resource; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -29,14 +29,14 @@ public class SysEmailConfigController { @GetMapping(value = "/{id}") - public Object get(){ + public Object get() { return new CommonResult().success(emailService.getOne(new QueryWrapper<>())); } @PostMapping(value = "/update") @ApiOperation("配置邮件") - public Object emailConfig(@Validated @RequestBody SysEmailConfig emailConfig){ + public Object emailConfig(@Validated @RequestBody SysEmailConfig emailConfig) { emailService.updateById(emailConfig); return new CommonResult().success(); } @@ -45,7 +45,7 @@ public class SysEmailConfigController { @PostMapping(value = "/send") @ApiOperation("发送邮件") public Object send(@Validated @RequestBody EmailVo emailVo) throws Exception { - emailService.send(emailVo,emailService.getOne(new QueryWrapper<>())); + emailService.send(emailVo, emailService.getOne(new QueryWrapper<>())); return new CommonResult().success(); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysPermissionController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysPermissionController.java index c478b1ad9ba55cae852726df13d7295f26169bd5..9131c8abf1625bd1222082f69da0a7abc6025ff1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysPermissionController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysPermissionController.java @@ -47,8 +47,10 @@ public class SysPermissionController extends BaseController { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize ) { try { - Object data = ISysPermissionService.list(new QueryWrapper<>(entity)); - return new CommonResult().success(data); + if (ValidatorUtils.notEmpty(entity.getName())){ + return new CommonResult().success(ISysPermissionService.list(new QueryWrapper(new SysPermission()).like("name",entity.getName()).orderByAsc("sort"))); + } + return new CommonResult().success(ISysPermissionService.list(new QueryWrapper<>(entity).orderByAsc("sort"))); } catch (Exception e) { log.error("根据条件查询所有后台用户权限表列表:%s", e.getMessage(), e); } @@ -166,7 +168,7 @@ public class SysPermissionController extends BaseController { @ResponseBody public Object findPermissions() { Long userId = getCurrentUser().getId(); - if (getCurrentUser().getSupplyId()!=null && getCurrentUser().getSupplyId() == 1L) { + if (getCurrentUser().getSupplyId() != null && getCurrentUser().getSupplyId() == 1L) { return new CommonResult().success(ISysPermissionService.getAllPermission()); } return new CommonResult().success(ISysPermissionService.getPermissionsByUserId(userId)); @@ -182,6 +184,4 @@ public class SysPermissionController extends BaseController { } - - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuConfigController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuConfigController.java index 185b2ce585e943b4cc85a0f0276b6960659d8324..041d5c2f1d271491e91353c5d414fa14aac8df3f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuConfigController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuConfigController.java @@ -24,7 +24,7 @@ import java.util.Map; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat @@ -40,16 +40,16 @@ public class SysQiniuConfigController { private ISysQiniuContentService qiniuContentService; @GetMapping(value = "/config") - public Object get(){ + public Object get() { return new CommonResult().success(qiNiuService.getOne(new QueryWrapper<>())); } @ApiOperation("配置七牛云存储") @PutMapping(value = "/config") - public Object emailConfig(@Validated @RequestBody SysQiniuConfig qiniuConfig){ + public Object emailConfig(@Validated @RequestBody SysQiniuConfig qiniuConfig) { qiNiuService.updateById(qiniuConfig); - // qiNiuService.update(qiniuConfig.getType()); + // qiNiuService.update(qiniuConfig.getType()); return new ResponseEntity(HttpStatus.OK); } @@ -65,7 +65,7 @@ public class SysQiniuConfigController { @GetMapping public Object getRoles(SysQiniuConfig entity, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){ + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { try { return new CommonResult().success(qiNiuService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); } catch (Exception e) { @@ -77,19 +77,19 @@ public class SysQiniuConfigController { @ApiOperation("上传文件") @PostMapping - public Object upload(@RequestParam MultipartFile file){ - SysQiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.getOne(new QueryWrapper<>())); - Map map = new HashMap<>(3); - map.put("id",qiniuContent.getId()); - map.put("errno",0); - map.put("data",new String[]{qiniuContent.getUrl()}); - return new ResponseEntity<>(map,HttpStatus.OK); + public Object upload(@RequestParam MultipartFile file) { + SysQiniuContent qiniuContent = qiNiuService.upload(file, qiNiuService.getOne(new QueryWrapper<>())); + Map map = new HashMap<>(3); + map.put("id", qiniuContent.getId()); + map.put("errno", 0); + map.put("data", new String[]{qiniuContent.getUrl()}); + return new ResponseEntity<>(map, HttpStatus.OK); } @ApiOperation("同步七牛云数据") @PostMapping(value = "/synchronize") - public Object synchronize(){ + public Object synchronize() { qiNiuService.synchronize(qiNiuService.getOne(new QueryWrapper<>())); return new ResponseEntity(HttpStatus.OK); } @@ -97,17 +97,17 @@ public class SysQiniuConfigController { @ApiOperation("下载文件") @GetMapping(value = "/download/{id}") - public Object download(@PathVariable Long id){ - Map map = new HashMap<>(1); - map.put("url", qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.getOne(new QueryWrapper<>()))); - return new ResponseEntity<>(map,HttpStatus.OK); + public Object download(@PathVariable Long id) { + Map map = new HashMap<>(1); + map.put("url", qiNiuService.download(qiNiuService.findByContentId(id), qiNiuService.getOne(new QueryWrapper<>()))); + return new ResponseEntity<>(map, HttpStatus.OK); } @ApiOperation("删除文件") @DeleteMapping(value = "/{id}") - public Object delete(@PathVariable Long id){ - qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.getOne(new QueryWrapper<>())); + public Object delete(@PathVariable Long id) { + qiNiuService.delete(qiNiuService.findByContentId(id), qiNiuService.getOne(new QueryWrapper<>())); return new ResponseEntity(HttpStatus.OK); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuContentController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuContentController.java index df5becbd5ccd957b2900547308e380e00227faaa..51ab5d556ef943dba17bf7f2daff9c0cbde61cad 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuContentController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysQiniuContentController.java @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RestController; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysRoleController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysRoleController.java index 36d31d9f6fbaa742c46389bf6c8c30979580f652..d8f09e25ebf348389509a26f27c1b4f54bf53c6c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysRoleController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysRoleController.java @@ -153,6 +153,7 @@ public class SysRoleController extends ApiController { List rolePermission = sysRoleService.getRolePermission(roleId); return new CommonResult().success(rolePermission); } + @ApiOperation("修改展示状态") @RequestMapping(value = "/update/updateShowStatus") @ResponseBody @@ -164,7 +165,7 @@ public class SysRoleController extends ApiController { role.setStatus(showStatus); sysRoleService.updates(role); - return new CommonResult().success(); + return new CommonResult().success(); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysStoreController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysStoreController.java index 13c52d81c82d03ecdc485cb755fb054ac333b587..f91ea0c550bc6c867047c23767852de08280dd4f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysStoreController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysStoreController.java @@ -3,6 +3,7 @@ package com.zscat.mallplus.sys.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.annotation.SysLog; import com.zscat.mallplus.bill.entity.BakCategory; import com.zscat.mallplus.bill.mapper.BakCategoryMapper; @@ -16,7 +17,6 @@ import com.zscat.mallplus.sys.service.ISysStoreService; import com.zscat.mallplus.sys.service.impl.RedisUtil; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; -import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.vo.Rediskey; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -55,13 +55,15 @@ public class SysStoreController { private PmsProductAttributeCategoryMapper productAttributeCategoryMapper; @Autowired private ApiContext apiContext; + @Resource + private BakCategoryMapper bakCategoryMapper; @SysLog(MODULE = "sys", REMARK = "根据条件查询所有列表") @ApiOperation("根据条件查询所有列表") @GetMapping(value = "/setStoreId/{id}") public Object setStoreId(@ApiParam("id") @PathVariable Integer id) { try { - // apiContext.setCurrentProviderId(id); + // apiContext.setCurrentProviderId(id); return new CommonResult().success(); } catch (Exception e) { log.error("根据条件查询所有列表:%s", e.getMessage(), e); @@ -69,7 +71,6 @@ public class SysStoreController { } } - @SysLog(MODULE = "sys", REMARK = "根据条件查询所有列表") @ApiOperation("根据条件查询所有列表") @GetMapping(value = "/list") @@ -163,18 +164,15 @@ public class SysStoreController { } } - @Resource - private BakCategoryMapper bakCategoryMapper; - @SysLog(MODULE = "sys", REMARK = "根据条件查询所有列表") @ApiOperation("根据条件查询所有列表") @GetMapping(value = "/listBakCate") public Object listCate(BakCategory entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "30") Integer pageSize + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "30") Integer pageSize ) { try { - return new CommonResult().success(bakCategoryMapper.selectList(new QueryWrapper().eq("pid",0))); + return new CommonResult().success(bakCategoryMapper.selectList(new QueryWrapper().eq("pid", 0))); } catch (Exception e) { log.error("根据条件查询所有列表:%s", e.getMessage(), e); } @@ -186,36 +184,36 @@ public class SysStoreController { @ResponseBody public Object storeDetail() { SysStore store = ISysStoreService.getById(1); - List list = productAttributeCategoryMapper.selectList(new QueryWrapper().eq("store_id",store.getId())); + List list = productAttributeCategoryMapper.selectList(new QueryWrapper().eq("store_id", store.getId())); for (PmsProductAttributeCategory gt : list) { PmsProduct productQueryParam = new PmsProduct(); productQueryParam.setProductAttributeCategoryId(gt.getId()); productQueryParam.setPublishStatus(1); productQueryParam.setVerifyStatus(1); - IPage goodsList = pmsProductService.page(new Page(0, 8),new QueryWrapper<>(productQueryParam).select(ConstansValue.sampleGoodsList)); - if (goodsList!=null&& goodsList.getRecords()!=null && goodsList.getRecords().size()>0){ + IPage goodsList = pmsProductService.page(new Page(0, 8), new QueryWrapper<>(productQueryParam).select(ConstansValue.sampleGoodsList)); + if (goodsList != null && goodsList.getRecords() != null && goodsList.getRecords().size() > 0) { gt.setGoodsList(goodsList.getRecords()); - }else{ + } else { gt.setGoodsList(new ArrayList<>()); } } store.setList(list); - store.setGoodsCount(pmsProductService.count(new QueryWrapper().eq("store_id",store.getId()))); + store.setGoodsCount(pmsProductService.count(new QueryWrapper().eq("store_id", store.getId()))); //记录浏览量到redis,然后定时更新到数据库 - String key= Rediskey.STORE_VIEWCOUNT_CODE+store.getId(); + String key = Rediskey.STORE_VIEWCOUNT_CODE + store.getId(); //找到redis中该篇文章的点赞数,如果不存在则向redis中添加一条 - Map viewCountItem=redisUtil.hGetAll(Rediskey.STORE_VIEWCOUNT_KEY); - Integer viewCount=0; - if(!viewCountItem.isEmpty()){ - if(viewCountItem.containsKey(key)){ - viewCount=Integer.parseInt(viewCountItem.get(key).toString())+1; - redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY,key,viewCount+""); - }else { - viewCount=1; - redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY,key,1+""); + Map viewCountItem = redisUtil.hGetAll(Rediskey.STORE_VIEWCOUNT_KEY); + Integer viewCount = 0; + if (!viewCountItem.isEmpty()) { + if (viewCountItem.containsKey(key)) { + viewCount = Integer.parseInt(viewCountItem.get(key).toString()) + 1; + redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY, key, viewCount + ""); + } else { + viewCount = 1; + redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY, key, 1 + ""); } - }else{ - redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY,key,1+""); + } else { + redisUtil.hPut(Rediskey.STORE_VIEWCOUNT_KEY, key, 1 + ""); } Map map = new HashMap<>(); store.setHit(viewCount); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysTestController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysTestController.java index a527bc61bd79064b4c0f190127179287c12bd4f1..f117aa4ec8f7f08b1d121bad7fbc43e7f0fbfdc3 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysTestController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysTestController.java @@ -21,32 +21,32 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; /** -* @author mallplus -* @date 2019-12-02 -* 测试 -*/ + * @author mallplus + * @date 2019-12-02 + * 测试 + */ @Slf4j @RestController @RequestMapping("/sys/sysTest") public class SysTestController { -@Resource -private ISysTestService ISysTestService; - -@SysLog(MODULE = "sys", REMARK = "根据条件查询所有测试列表") -@ApiOperation("根据条件查询所有测试列表") -@GetMapping(value = "/list") -@PreAuthorize("hasAuthority('sys:sysTest:read')") -public Object getSysTestByPage(SysTest entity, -@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, -@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize -) { -try { -return new CommonResult().success(ISysTestService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); - } catch (Exception e) { - log.error("根据条件查询所有测试列表:%s", e.getMessage(), e); - } - return new CommonResult().failed(); + @Resource + private ISysTestService ISysTestService; + + @SysLog(MODULE = "sys", REMARK = "根据条件查询所有测试列表") + @ApiOperation("根据条件查询所有测试列表") + @GetMapping(value = "/list") + @PreAuthorize("hasAuthority('sys:sysTest:read')") + public Object getSysTestByPage(SysTest entity, + @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize + ) { + try { + return new CommonResult().success(ISysTestService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); + } catch (Exception e) { + log.error("根据条件查询所有测试列表:%s", e.getMessage(), e); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sys", REMARK = "保存测试") @@ -54,16 +54,16 @@ return new CommonResult().success(ISysTestService.page(new Page(pageNum @PostMapping(value = "/create") @PreAuthorize("hasAuthority('sys:sysTest:create')") public Object saveSysTest(@RequestBody SysTest entity) { - try { + try { - if (ISysTestService.save(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存测试:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); + if (ISysTestService.save(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("保存测试:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sys", REMARK = "更新测试") @@ -71,15 +71,15 @@ return new CommonResult().success(ISysTestService.page(new Page(pageNum @PostMapping(value = "/update/{id}") @PreAuthorize("hasAuthority('sys:sysTest:update')") public Object updateSysTest(@RequestBody SysTest entity) { - try { - if (ISysTestService.updateById(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新测试:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); + try { + if (ISysTestService.updateById(entity)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("更新测试:%s", e.getMessage(), e); + return new CommonResult().failed(e.getMessage()); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sys", REMARK = "删除测试") @@ -87,18 +87,18 @@ return new CommonResult().success(ISysTestService.page(new Page(pageNum @GetMapping(value = "/delete/{id}") @PreAuthorize("hasAuthority('sys:sysTest:delete')") public Object deleteSysTest(@ApiParam("测试id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("测试id"); - } - if (ISysTestService.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除测试:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("测试id"); + } + if (ISysTestService.removeById(id)) { + return new CommonResult().success(); + } + } catch (Exception e) { + log.error("删除测试:%s", e.getMessage(), e); + return new CommonResult().failed(); + } + return new CommonResult().failed(); } @SysLog(MODULE = "sys", REMARK = "给测试分配测试") @@ -106,16 +106,16 @@ return new CommonResult().success(ISysTestService.page(new Page(pageNum @GetMapping(value = "/{id}") @PreAuthorize("hasAuthority('sys:sysTest:read')") public Object getSysTestById(@ApiParam("测试id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("测试id"); - } - SysTest coupon = ISysTestService.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询测试明细:%s", e.getMessage(), e); - return new CommonResult().failed(); - } + try { + if (ValidatorUtils.empty(id)) { + return new CommonResult().paramFailed("测试id"); + } + SysTest coupon = ISysTestService.getById(id); + return new CommonResult().success(coupon); + } catch (Exception e) { + log.error("查询测试明细:%s", e.getMessage(), e); + return new CommonResult().failed(); + } } @@ -126,30 +126,29 @@ return new CommonResult().success(ISysTestService.page(new Page(pageNum public Object deleteBatch(@RequestParam("ids") List ids) { boolean count = ISysTestService.removeByIds(ids); if (count) { - return new CommonResult().success(count); + return new CommonResult().success(count); } else { - return new CommonResult().failed(); + return new CommonResult().failed(); } - } - + } - @SysLog(MODULE = "sys", REMARK = "导出社区数据") - @GetMapping("/exportExcel") - public void export(HttpServletResponse response, SysTest entity) { + @SysLog(MODULE = "sys", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, SysTest entity) { // 模拟从数据库获取需要导出的数据 List personList = ISysTestService.list(new QueryWrapper<>(entity)); - // 导出操作 - EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", SysTest.class, "导出社区数据.xls", response); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", SysTest.class, "导出社区数据.xls", response); - } + } - @SysLog(MODULE = "sys", REMARK = "导入社区数据") - @PostMapping("/importExcel") - public void importUsers(@RequestParam MultipartFile file) { - List personList = EasyPoiUtils.importExcel(file, SysTest.class); - ISysTestService.saveBatch(personList); - } - } + @SysLog(MODULE = "sys", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List personList = EasyPoiUtils.importExcel(file, SysTest.class); + ISysTestService.saveBatch(personList); + } +} diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysUserController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysUserController.java index e70fa3d6d7b219ccf5cb83f10ae5ec3325da0ecd..9e9fdea50ab8482750501fe7052626204825f770 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysUserController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/SysUserController.java @@ -18,7 +18,6 @@ import com.zscat.mallplus.sys.service.ISysRoleService; import com.zscat.mallplus.sys.service.ISysUserService; import com.zscat.mallplus.ums.service.RedisService; import com.zscat.mallplus.util.JsonUtil; -import com.zscat.mallplus.util.UserUtils; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; import com.zscat.mallplus.vo.Rediskey; @@ -66,6 +65,10 @@ public class SysUserController extends ApiController { private SysPermissionMapper permissionMapper; @Resource private RedisService redisService; + @Resource + private UserCommunityRelateMapper userCommunityRelateMapper; + @Resource + private BuildingCommunityMapper buildingCommunityMapper; @SysLog(MODULE = "sys", REMARK = "根据条件查询所有用户列表") @ApiOperation("根据条件查询所有用户列表") @@ -87,9 +90,9 @@ public class SysUserController extends ApiController { @PostMapping(value = "/register") public Object saveUser(@RequestBody SysUser entity) { try { - if (ValidatorUtils.empty(entity.getStoreId())){ + /* if (ValidatorUtils.empty(entity.getStoreId())){ entity.setStoreId(UserUtils.getCurrentMember().getStoreId()); - } + }*/ if (sysUserService.saves(entity)) { return new CommonResult().success(); } @@ -123,8 +126,8 @@ public class SysUserController extends ApiController { if (ValidatorUtils.empty(id)) { return new CommonResult().paramFailed("用户id"); } - SysUser user= sysUserService.getById(id); - if (user.getSupplyId()!=null && user.getSupplyId()==1){ + SysUser user = sysUserService.getById(id); + if (user.getSupplyId() != null && user.getSupplyId() == 1) { return new CommonResult().paramFailed("管理员账号不能删除"); } if (sysUserService.removeById(id)) { @@ -176,15 +179,20 @@ public class SysUserController extends ApiController { @RequestMapping(value = "/login", method = RequestMethod.POST) @ResponseBody public Object login(@RequestBody SysUser umsAdminLoginParam, BindingResult result) { - String token = sysUserService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword()); - if (token == null) { - return new CommonResult().paramFailed("用户名或密码错误"); + try { + String token = sysUserService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword()); + if (token == null) { + return new CommonResult().paramFailed("用户名或密码错误"); + } + Map tokenMap = new HashMap<>(); + tokenMap.put("token", token); + tokenMap.put("tokenHead", tokenHead); + // tokenMap.put("userId", UserUtils.getCurrentMember().getId()); + return new CommonResult().success(tokenMap); + } catch (Exception e) { + return new CommonResult().failed(e.getMessage()); } - Map tokenMap = new HashMap<>(); - tokenMap.put("token", token); - tokenMap.put("tokenHead", tokenHead); - tokenMap.put("userId", UserUtils.getCurrentMember().getId()); - return new CommonResult().success(tokenMap); + } @SysLog(MODULE = "sys", REMARK = "获取当前登录用户信息") @@ -197,7 +205,7 @@ public class SysUserController extends ApiController { queryU.setUsername(username); SysUser umsAdmin = sysUserService.getOne(new QueryWrapper<>(queryU)); Map data = new HashMap<>(); - data.put("username", umsAdmin.getUsername()); + data.put("username", username); data.put("roles", new String[]{"TEST"}); data.put("icon", umsAdmin.getIcon()); return new CommonResult().success(data); @@ -211,7 +219,6 @@ public class SysUserController extends ApiController { return new CommonResult().success(null); } - @SysLog(MODULE = "sys", REMARK = "给用户分配角色") @ApiOperation("给用户分配角色") @RequestMapping(value = "/role/update", method = RequestMethod.POST) @@ -248,10 +255,10 @@ public class SysUserController extends ApiController { public Object userRoleCheck(@RequestParam("adminId") Long adminId) { List roleList = sysUserService.getRoleListByUserId(adminId); List allroleList = roleService.list(new QueryWrapper<>()); - if (roleList!=null && roleList.size()>0){ + if (roleList != null && roleList.size() > 0) { for (SysRole a : allroleList) { for (SysRole u : roleList) { - if (u!=null && u.getId()!=null){ + if (u != null && u.getId() != null) { if (a.getId().equals(u.getId())) { a.setChecked(true); } @@ -285,7 +292,6 @@ public class SysUserController extends ApiController { return new CommonResult().success(permissionList); } - @ApiOperation("修改展示状态") @RequestMapping(value = "/update/updateShowStatus") @ResponseBody @@ -301,47 +307,43 @@ public class SysUserController extends ApiController { } - @ApiOperation("修改密码") @RequestMapping(value = "/updatePassword") @ResponseBody @SysLog(MODULE = "sys", REMARK = "修改密码") public Object updatePassword(@RequestParam("password") String password, - @RequestParam("renewPassword") String renewPassword, - @RequestParam("newPassword") String newPassword) { - if (ValidatorUtils.empty(password)){ + @RequestParam("renewPassword") String renewPassword, + @RequestParam("newPassword") String newPassword) { + if (ValidatorUtils.empty(password)) { return new CommonResult().failed("参数为空"); } - if (ValidatorUtils.empty(renewPassword)){ + if (ValidatorUtils.empty(renewPassword)) { return new CommonResult().failed("参数为空"); } - if (ValidatorUtils.empty(newPassword)){ + if (ValidatorUtils.empty(newPassword)) { return new CommonResult().failed("参数为空"); } - if (!renewPassword.equals(newPassword)){ + if (!renewPassword.equals(newPassword)) { return new CommonResult().failed("新密码不一致!"); } try { - sysUserService.updatePassword(password,newPassword); - }catch (Exception e){ + sysUserService.updatePassword(password, newPassword); + } catch (Exception e) { return new CommonResult().failed(e.getMessage()); } return new CommonResult().success(); } - @Resource - private UserCommunityRelateMapper userCommunityRelateMapper; - @Resource - private BuildingCommunityMapper buildingCommunityMapper; @SysLog(MODULE = "sys", REMARK = "获取用户的小区") @ApiOperation("获取相应角色权限") @RequestMapping(value = "/community/{userId}", method = RequestMethod.GET) @ResponseBody public Object communityList(@PathVariable Long userId) { - List permissionList = userCommunityRelateMapper.selectList(new QueryWrapper().eq("user_id",userId)); + List permissionList = userCommunityRelateMapper.selectList(new QueryWrapper().eq("user_id", userId)); return new CommonResult().success(permissionList); } + @SysLog(MODULE = "sys", REMARK = "获取用户的小区") @ApiOperation("获取相应角色权限") @RequestMapping(value = "/userCommunityRelate", method = RequestMethod.POST) @@ -355,11 +357,11 @@ public class SysUserController extends ApiController { @RequestMapping(value = "/communityUser/{userId}", method = RequestMethod.GET) @ResponseBody public Object communityUser(@PathVariable Long userId) { - List permissionList = userCommunityRelateMapper.selectList(new QueryWrapper().eq("user_id",userId)); + List permissionList = userCommunityRelateMapper.selectList(new QueryWrapper().eq("user_id", userId)); List newList = new ArrayList<>(); - for (UserCommunityRelate relate: permissionList){ + for (UserCommunityRelate relate : permissionList) { BuildingCommunity community = buildingCommunityMapper.selectById(relate.getCommunityId()); - if (community!=null){ + if (community != null) { relate.setName(community.getName()); newList.add(relate); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/TestController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/TestController.java index 78fafc61571ea67e40537743dc091855c5ea3cd1..cf8ecc7f7c46c2768a993b9d44b9253de2a5778d 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/TestController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/controller/TestController.java @@ -14,6 +14,4 @@ public class TestController { GeneratorService generatorService; - - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobLogService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobLogService.java index 114add57d856b25eb6ac4a491c6066657570e7e8..1d7a1e20ee486937fe679ba79aa67ef3e6e5ef46 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobLogService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobLogService.java @@ -1,7 +1,7 @@ package com.zscat.mallplus.sys.service; -import com.zscat.mallplus.sys.entity.AdminSysJobLog; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sys.entity.AdminSysJobLog; /** *

diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobService.java index 6c2f7db104c0d80fd7452f9c02045a8eebbf4a28..ee152663e0e4a08253604ef490858599e6f5c9d9 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/IAdminSysJobService.java @@ -25,6 +25,7 @@ public interface IAdminSysJobService extends IService { * @param jobLog 调度日志信息 */ public void addJobLog(AdminSysJob jobLog); + /** * 暂停任务 * @@ -39,7 +40,7 @@ public interface IAdminSysJobService extends IService { * @param job 调度信息 * @return 结果 */ - public int resumeJob(AdminSysJob job) ; + public int resumeJob(AdminSysJob job); /** * 删除任务后,所对应的trigger也将被删除 @@ -47,8 +48,7 @@ public interface IAdminSysJobService extends IService { * @param job 调度信息 * @return 结果 */ - public int deleteJob(AdminSysJob job) ; - + public int deleteJob(AdminSysJob job); /** @@ -57,7 +57,7 @@ public interface IAdminSysJobService extends IService { * @param job 调度信息 * @return 结果 */ - public int changeStatus(AdminSysJob job) ; + public int changeStatus(AdminSysJob job); /** * 立即运行任务 @@ -65,7 +65,7 @@ public interface IAdminSysJobService extends IService { * @param job 调度信息 * @return 结果 */ - public void run(AdminSysJob job) ; + public void run(AdminSysJob job); /** * 新增任务 @@ -81,7 +81,7 @@ public interface IAdminSysJobService extends IService { * @param job 调度信息 * @return 结果 */ - public int updateJob(AdminSysJob job) ; + public int updateJob(AdminSysJob job); /** * 校验cron表达式是否有效 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAdminLogService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAdminLogService.java index d7c2456798ab97f695e11f9716fc9636f0ce5c22..0d73be1d49cb782de2d7f8cb47c06a6adae30f58 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAdminLogService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAdminLogService.java @@ -17,5 +17,5 @@ import java.util.List; * @since 2019-04-14 */ public interface ISysAdminLogService extends IService { - List selectPageExt(LogParam entity); + List selectPageExt(LogParam entity); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAlipayConfigService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAlipayConfigService.java index df14875f6f23ed864708dd9d85165b6189ba4cf9..7fb900d6054896b3be7cf09486552592c5622427 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAlipayConfigService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysAlipayConfigService.java @@ -6,7 +6,7 @@ import com.zscat.mallplus.sys.vo.TradeVo; /** *

- * 服务类 + * 服务类 *

* * @author zscat @@ -17,8 +17,9 @@ public interface ISysAlipayConfigService extends IService { /** * 处理来自PC的交易请求 + * * @param alipay 支付宝配置 - * @param trade 交易详情 + * @param trade 交易详情 * @return String * @throws Exception 异常 */ @@ -26,8 +27,9 @@ public interface ISysAlipayConfigService extends IService { /** * 处理来自手机网页的交易请求 + * * @param alipay 支付宝配置 - * @param trade 交易详情 + * @param trade 交易详情 * @return String * @throws Exception 异常 */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysEmailConfigService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysEmailConfigService.java index 2f1a12d3c39a4bb1bf1dc47b7e8cadc8d3ec78b0..5290d00df51eade51e6926fba96d3d7b0ef56aae 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysEmailConfigService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysEmailConfigService.java @@ -7,7 +7,7 @@ import org.springframework.scheduling.annotation.Async; /** *

- * 服务类 + * 服务类 *

* * @author zscat @@ -17,7 +17,8 @@ public interface ISysEmailConfigService extends IService { /** * 发送邮件 - * @param emailVo 邮件发送的内容 + * + * @param emailVo 邮件发送的内容 * @param emailConfig 邮件配置 * @throws Exception / */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuConfigService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuConfigService.java index d1f93ec84867ec3ac754dd0bb1850ce49fa8b662..6c39f1628ad7c96b72a2d6af6176d794442149f1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuConfigService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuConfigService.java @@ -11,7 +11,7 @@ import java.util.List; /** *

- * 服务类 + * 服务类 *

* * @author zscat @@ -20,9 +20,11 @@ import java.util.List; public interface ISysQiniuConfigService extends IService { int update(SysQiniuConfig qiniuConfig); + /** * 上传文件 - * @param file 文件 + * + * @param file 文件 * @param qiniuConfig 配置 * @return QiniuContent */ @@ -30,6 +32,7 @@ public interface ISysQiniuConfigService extends IService { /** * 查询文件 + * * @param id 文件ID * @return QiniuContent */ @@ -37,36 +40,40 @@ public interface ISysQiniuConfigService extends IService { /** * 下载文件 + * * @param content 文件信息 - * @param config 配置 + * @param config 配置 * @return String */ String download(SysQiniuContent content, SysQiniuConfig config); /** * 删除文件 + * * @param content 文件 - * @param config 配置 + * @param config 配置 */ void delete(SysQiniuContent content, SysQiniuConfig config); /** * 同步数据 + * * @param config 配置 */ void synchronize(SysQiniuConfig config); /** * 删除文件 - * @param ids 文件ID数组 + * + * @param ids 文件ID数组 * @param config 配置 */ void deleteAll(Long[] ids, SysQiniuConfig config); - /** * 导出数据 + * * @param queryAll / * @param response / */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuContentService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuContentService.java index 98ae1fc59c05efbf5d7d1da2313a702f19ba0990..1feb43d66fb8d37be5e85439ccb32ec543147690 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuContentService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysQiniuContentService.java @@ -1,11 +1,11 @@ package com.zscat.mallplus.sys.service; -import com.zscat.mallplus.sys.entity.SysQiniuContent; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sys.entity.SysQiniuContent; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysTestService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysTestService.java index 4842edeace3618baa10043d097c2f512006487ef..8684cbf93d4271f0e96160902fd8fef9a467925a 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysTestService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysTestService.java @@ -1,14 +1,13 @@ package com.zscat.mallplus.sys.service; -import com.zscat.mallplus.sys.entity.SysTest; import com.baomidou.mybatisplus.extension.service.IService; +import com.zscat.mallplus.sys.entity.SysTest; /** -* @author mallplus -* @date 2019-12-02 -*/ + * @author mallplus + * @date 2019-12-02 + */ -public interface ISysTestService extends IService -{ +public interface ISysTestService extends IService { } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysUserService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysUserService.java index 509a95f25fb3e4dd31e1d2aa32a932db48afcde5..f8e88d15418bba6588c493fb5e4a398aec35b783 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysUserService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysUserService.java @@ -41,6 +41,7 @@ public interface ISysUserService extends IService { void removePermissRedis(Long id); List listPerms(); + Object reg(SysUser entity); // SmsCode generateCode(String phone); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysWebLogService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysWebLogService.java index e94a8f0b313c11a517342730dc8c412790c9c0e8..b106d85e12af0a02282eff620502d2ab950ec02b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysWebLogService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/ISysWebLogService.java @@ -17,5 +17,5 @@ import java.util.List; */ public interface ISysWebLogService extends IService { - List selectPageExt(LogParam entity); + List selectPageExt(LogParam entity); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobLogServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobLogServiceImpl.java index 0fbc9efa9a542f72bdc63c1a67feabfc44d8f88f..bd3c3a0c3a9d59fb9022894475226f5276302656 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobLogServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobLogServiceImpl.java @@ -1,9 +1,9 @@ package com.zscat.mallplus.sys.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.sys.entity.AdminSysJobLog; import com.zscat.mallplus.sys.mapper.AdminSysJobLogMapper; import com.zscat.mallplus.sys.service.IAdminSysJobLogService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobServiceImpl.java index f703e26c9bf8ed08b44483abd79d2b959402d507..f2bc2d9ff45b972eaf29334d48494a0d81ca1c21 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/AdminSysJobServiceImpl.java @@ -31,9 +31,10 @@ import java.util.List; public class AdminSysJobServiceImpl extends ServiceImpl implements IAdminSysJobService { @Resource - private Scheduler scheduler; + AdminSysJobMapper jobMapper; @Resource - AdminSysJobMapper jobMapper; + private Scheduler scheduler; + @Override public boolean delete(Long id) { return false; @@ -42,8 +43,7 @@ public class AdminSysJobServiceImpl extends ServiceImpl ids) { - for (Long jobId : ids) - { + for (Long jobId : ids) { AdminSysJob job = jobMapper.selectById(jobId); deleteJob(job); } @@ -62,13 +62,11 @@ public class AdminSysJobServiceImpl extends ServiceImpl 0) - { + if (rows > 0) { try { scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup)); } catch (SchedulerException e) { @@ -77,19 +75,19 @@ public class AdminSysJobServiceImpl extends ServiceImpl jobList = jobMapper.selectList(new QueryWrapper<>()); - for (AdminSysJob job : jobList) - { + for (AdminSysJob job : jobList) { updateSchedulerJob(job, job.getJobGroup()); } } + /** * 暂停任务 * @@ -97,14 +95,12 @@ public class AdminSysJobServiceImpl extends ServiceImpl 0) - { + if (rows > 0) { try { scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); } catch (SchedulerException e) { @@ -121,14 +117,12 @@ public class AdminSysJobServiceImpl extends ServiceImpl 0) - { + if (rows > 0) { try { scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup)); } catch (SchedulerException e) { @@ -137,6 +131,7 @@ public class AdminSysJobServiceImpl extends ServiceImpl 0) - { + if (rows > 0) { ScheduleUtils.createScheduleJob(scheduler, job); } return rows; @@ -206,12 +194,10 @@ public class AdminSysJobServiceImpl extends ServiceImpl 0) - { + if (rows > 0) { updateSchedulerJob(job, properties.getJobGroup()); } return rows; @@ -220,22 +206,20 @@ public class AdminSysJobServiceImpl extends ServiceImpl> list = generatorMapper.list(name,startEnd[0],startEnd[1]); + List> list = generatorMapper.list(name, startEnd[0], startEnd[1]); List tableInfos = new ArrayList<>(); for (Map obj : list) { - tableInfos.add(new TableInfo(obj.get("tableName"),obj.get("createTime"),obj.get("engine"),obj.get("coding"), ObjectUtil.isNotEmpty(obj.get("table_comment"))? obj.get("table_comment").toString() : "-")); + tableInfos.add(new TableInfo(obj.get("tableName"), obj.get("createTime"), obj.get("engine"), obj.get("coding"), ObjectUtil.isNotEmpty(obj.get("table_comment")) ? obj.get("table_comment").toString() : "-")); } Object totalElements = generatorMapper.count(null); - return PageUtil.toPage(tableInfos,totalElements); + return PageUtil.toPage(tableInfos, totalElements); } @Override @@ -47,16 +46,16 @@ public class GeneratorServiceImpl implements GeneratorService { List columnInfos = new ArrayList<>(); for (Map obj : result) { - columnInfos.add(new ColumnInfo(obj.get("column_name"),obj.get("is_nullable"),obj.get("data_type"),obj.get("column_comment"),obj.get("columnkey"),obj.get("extra"),null,"true")); + columnInfos.add(new ColumnInfo(obj.get("column_name"), obj.get("is_nullable"), obj.get("data_type"), obj.get("column_comment"), obj.get("columnkey"), obj.get("extra"), null, "true")); } - return PageUtil.toPage(columnInfos,columnInfos.size()); + return PageUtil.toPage(columnInfos, columnInfos.size()); } @Override public void generator(List columnInfos, GenConfig genConfig, String tableName) { try { - GenUtil.generatorCode(columnInfos,genConfig,tableName); + GenUtil.generatorCode(columnInfos, genConfig, tableName); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/RedisUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/RedisUtil.java index 62783afcfadfd904cd52eafaf8659c373ad98e1c..acdf2724996a589cd6810656c7bb7179fc642e24 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/RedisUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/RedisUtil.java @@ -16,1343 +16,1314 @@ import java.util.concurrent.TimeUnit; * Redis工具类 * * @author WangFan - * @date 2018-02-24 下午03:09:50 * @version 1.1 (GitHub文档: https://github.com/whvcse/RedisUtil ) + * @date 2018-02-24 下午03:09:50 */ @Service public class RedisUtil { - @Autowired - private StringRedisTemplate redisTemplate; - - - /** -------------------key相关操作--------------------- */ - - /** - * 删除key - * - * @param key - */ - public void delete(String key) { - redisTemplate.delete(key); - } - - /** - * 批量删除key - * - * @param keys - */ - public void delete(Collection keys) { - redisTemplate.delete(keys); - } - - /** - * 序列化key - * - * @param key - * @return - */ - public byte[] dump(String key) { - return redisTemplate.dump(key); - } - - /** - * 是否存在key - * - * @param key - * @return - */ - public Boolean hasKey(String key) { - return redisTemplate.hasKey(key); - } - - /** - * 设置过期时间 - * - * @param key - * @param timeout - * @param unit - * @return - */ - public Boolean expire(String key, long timeout, TimeUnit unit) { - return redisTemplate.expire(key, timeout, unit); - } - - /** - * 设置过期时间 - * - * @param key - * @param date - * @return - */ - public Boolean expireAt(String key, Date date) { - return redisTemplate.expireAt(key, date); - } - - /** - * 查找匹配的key - * - * @param pattern - * @return - */ - public Set keys(String pattern) { - return redisTemplate.keys(pattern); - } - - /** - * 将当前数据库的 key 移动到给定的数据库 db 当中 - * - * @param key - * @param dbIndex - * @return - */ - public Boolean move(String key, int dbIndex) { - return redisTemplate.move(key, dbIndex); - } - - /** - * 移除 key 的过期时间,key 将持久保持 - * - * @param key - * @return - */ - public Boolean persist(String key) { - return redisTemplate.persist(key); - } - - /** - * 返回 key 的剩余的过期时间 - * - * @param key - * @param unit - * @return - */ - public Long getExpire(String key, TimeUnit unit) { - return redisTemplate.getExpire(key, unit); - } - - /** - * 返回 key 的剩余的过期时间 - * - * @param key - * @return - */ - public Long getExpire(String key) { - return redisTemplate.getExpire(key); - } - - /** - * 从当前数据库中随机返回一个 key - * - * @return - */ - public String randomKey() { - return redisTemplate.randomKey(); - } - - /** - * 修改 key 的名称 - * - * @param oldKey - * @param newKey - */ - public void rename(String oldKey, String newKey) { - redisTemplate.rename(oldKey, newKey); - } - - /** - * 仅当 newkey 不存在时,将 oldKey 改名为 newkey - * - * @param oldKey - * @param newKey - * @return - */ - public Boolean renameIfAbsent(String oldKey, String newKey) { - return redisTemplate.renameIfAbsent(oldKey, newKey); - } - - /** - * 返回 key 所储存的值的类型 - * - * @param key - * @return - */ - public DataType type(String key) { - return redisTemplate.type(key); - } - - /** -------------------string相关操作--------------------- */ - - /** - * 设置指定 key 的值 - * @param key - * @param value - */ - public void set(String key, String value) { - redisTemplate.opsForValue().set(key, value); - } - - /** - * 获取指定 key 的值 - * @param key - * @return - */ - public String get(String key) { - return redisTemplate.opsForValue().get(key); - } - - /** - * 返回 key 中字符串值的子字符 - * @param key - * @param start - * @param end - * @return - */ - public String getRange(String key, long start, long end) { - return redisTemplate.opsForValue().get(key, start, end); - } - - /** - * 将给定 key 的值设为 value ,并返回 key 的旧值(old value) - * - * @param key - * @param value - * @return - */ - public String getAndSet(String key, String value) { - return redisTemplate.opsForValue().getAndSet(key, value); - } - - /** - * 对 key 所储存的字符串值,获取指定偏移量上的位(bit) - * - * @param key - * @param offset - * @return - */ - public Boolean getBit(String key, long offset) { - return redisTemplate.opsForValue().getBit(key, offset); - } - - /** - * 批量获取 - * - * @param keys - * @return - */ - public List multiGet(Collection keys) { - return redisTemplate.opsForValue().multiGet(keys); - } - - /** - * 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value - * - * @param key - * @param postion - * 位置 - * @param value - * 值,true为1, false为0 - * @return - */ - public boolean setBit(String key, long offset, boolean value) { - return redisTemplate.opsForValue().setBit(key, offset, value); - } - - /** - * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout - * - * @param key - * @param value - * @param timeout - * 过期时间 - * @param unit - * 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES - * 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS - */ - public void setEx(String key, String value, long timeout, TimeUnit unit) { - redisTemplate.opsForValue().set(key, value, timeout, unit); - } - - /** - * 只有在 key 不存在时设置 key 的值 - * - * @param key - * @param value - * @return 之前已经存在返回false,不存在返回true - */ - public boolean setIfAbsent(String key, String value) { - return redisTemplate.opsForValue().setIfAbsent(key, value); - } - - /** - * 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始 - * - * @param key - * @param value - * @param offset - * 从指定位置开始覆写 - */ - public void setRange(String key, String value, long offset) { - redisTemplate.opsForValue().set(key, value, offset); - } - - /** - * 获取字符串的长度 - * - * @param key - * @return - */ - public Long size(String key) { - return redisTemplate.opsForValue().size(key); - } - - /** - * 批量添加 - * - * @param maps - */ - public void multiSet(Map maps) { - redisTemplate.opsForValue().multiSet(maps); - } - - /** - * 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在 - * - * @param maps - * @return 之前已经存在返回false,不存在返回true - */ - public boolean multiSetIfAbsent(Map maps) { - return redisTemplate.opsForValue().multiSetIfAbsent(maps); - } - - /** - * 增加(自增长), 负数则为自减 - * - * @param key - * @param value - * @return - */ - public Long incrBy(String key, long increment) { - return redisTemplate.opsForValue().increment(key, increment); - } - - /** - * - * @param key - * @param value - * @return - */ - public Double incrByFloat(String key, double increment) { - return redisTemplate.opsForValue().increment(key, increment); - } - - /** - * 追加到末尾 - * - * @param key - * @param value - * @return - */ - public Integer append(String key, String value) { - return redisTemplate.opsForValue().append(key, value); - } - - /** -------------------hash相关操作------------------------- */ - - /** - * 获取存储在哈希表中指定字段的值 - * - * @param key - * @param field - * @return - */ - public Object hGet(String key, String field) { - return redisTemplate.opsForHash().get(key, field); - } - - /** - * 获取所有给定字段的值 - * - * @param key - * @return - */ - public Map hGetAll(String key) { - return redisTemplate.opsForHash().entries(key); - } - - /** - * 获取所有给定字段的值 - * - * @param key - * @param fields - * @return - */ - public List hMultiGet(String key, Collection fields) { - return redisTemplate.opsForHash().multiGet(key, fields); - } - - public void hPut(String key, String hashKey, String value) { - redisTemplate.opsForHash().put(key, hashKey, value); - } - - public void hPutAll(String key, Map maps) { - redisTemplate.opsForHash().putAll(key, maps); - } - - /** - * 仅当hashKey不存在时才设置 - * - * @param key - * @param hashKey - * @param value - * @return - */ - public Boolean hPutIfAbsent(String key, String hashKey, String value) { - return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value); - } - - /** - * 删除一个或多个哈希表字段 - * - * @param key - * @param fields - * @return - */ - public Long hDelete(String key, Object... fields) { - return redisTemplate.opsForHash().delete(key, fields); - } - - /** - * 查看哈希表 key 中,指定的字段是否存在 - * - * @param key - * @param field - * @return - */ - public boolean hExists(String key, String field) { - return redisTemplate.opsForHash().hasKey(key, field); - } - - /** - * 为哈希表 key 中的指定字段的整数值加上增量 increment - * - * @param key - * @param field - * @param increment - * @return - */ - public Long hIncrBy(String key, Object field, long increment) { - return redisTemplate.opsForHash().increment(key, field, increment); - } - - /** - * 为哈希表 key 中的指定字段的整数值加上增量 increment - * - * @param key - * @param field - * @param delta - * @return - */ - public Double hIncrByFloat(String key, Object field, double delta) { - return redisTemplate.opsForHash().increment(key, field, delta); - } - - /** - * 获取所有哈希表中的字段 - * - * @param key - * @return - */ - public Set hKeys(String key) { - return redisTemplate.opsForHash().keys(key); - } - - /** - * 获取哈希表中字段的数量 - * - * @param key - * @return - */ - public Long hSize(String key) { - return redisTemplate.opsForHash().size(key); - } - - /** - * 获取哈希表中所有值 - * - * @param key - * @return - */ - public List hValues(String key) { - return redisTemplate.opsForHash().values(key); - } - - /** - * 迭代哈希表中的键值对 - * - * @param key - * @param options - * @return - */ - public Cursor> hScan(String key, ScanOptions options) { - return redisTemplate.opsForHash().scan(key, options); - } - - /** ------------------------list相关操作---------------------------- */ - - /** - * 通过索引获取列表中的元素 - * - * @param key - * @param index - * @return - */ - public String lIndex(String key, long index) { - return redisTemplate.opsForList().index(key, index); - } - - /** - * 获取列表指定范围内的元素 - * - * @param key - * @param start - * 开始位置, 0是开始位置 - * @param end - * 结束位置, -1返回所有 - * @return - */ - public List lRange(String key, long start, long end) { - return redisTemplate.opsForList().range(key, start, end); - } - - /** - * 存储在list头部 - * - * @param key - * @param value - * @return - */ - public Long lLeftPush(String key, String value) { - return redisTemplate.opsForList().leftPush(key, value); - } - - /** - * - * @param key - * @param value - * @return - */ - public Long lLeftPushAll(String key, String... value) { - return redisTemplate.opsForList().leftPushAll(key, value); - } - - /** - * - * @param key - * @param value - * @return - */ - public Long lLeftPushAll(String key, Collection value) { - return redisTemplate.opsForList().leftPushAll(key, value); - } - - /** - * 当list存在的时候才加入 - * - * @param key - * @param value - * @return - */ - public Long lLeftPushIfPresent(String key, String value) { - return redisTemplate.opsForList().leftPushIfPresent(key, value); - } - - /** - * 如果pivot存在,再pivot前面添加 - * - * @param key - * @param pivot - * @param value - * @return - */ - public Long lLeftPush(String key, String pivot, String value) { - return redisTemplate.opsForList().leftPush(key, pivot, value); - } - - /** - * - * @param key - * @param value - * @return - */ - public Long lRightPush(String key, String value) { - return redisTemplate.opsForList().rightPush(key, value); - } - - /** - * - * @param key - * @param value - * @return - */ - public Long lRightPushAll(String key, String... value) { - return redisTemplate.opsForList().rightPushAll(key, value); - } - - /** - * - * @param key - * @param value - * @return - */ - public Long lRightPushAll(String key, Collection value) { - return redisTemplate.opsForList().rightPushAll(key, value); - } - - /** - * 为已存在的列表添加值 - * - * @param key - * @param value - * @return - */ - public Long lRightPushIfPresent(String key, String value) { - return redisTemplate.opsForList().rightPushIfPresent(key, value); - } - - /** - * 在pivot元素的右边添加值 - * - * @param key - * @param pivot - * @param value - * @return - */ - public Long lRightPush(String key, String pivot, String value) { - return redisTemplate.opsForList().rightPush(key, pivot, value); - } - - /** - * 通过索引设置列表元素的值 - * - * @param key - * @param index - * 位置 - * @param value - */ - public void lSet(String key, long index, String value) { - redisTemplate.opsForList().set(key, index, value); - } - - /** - * 移出并获取列表的第一个元素 - * - * @param key - * @return 删除的元素 - */ - public String lLeftPop(String key) { - return redisTemplate.opsForList().leftPop(key); - } - - /** - * 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 - * - * @param key - * @param timeout - * 等待时间 - * @param unit - * 时间单位 - * @return - */ - public String lBLeftPop(String key, long timeout, TimeUnit unit) { - return redisTemplate.opsForList().leftPop(key, timeout, unit); - } - - /** - * 移除并获取列表最后一个元素 - * - * @param key - * @return 删除的元素 - */ - public String lRightPop(String key) { - return redisTemplate.opsForList().rightPop(key); - } - - /** - * 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 - * - * @param key - * @param timeout - * 等待时间 - * @param unit - * 时间单位 - * @return - */ - public String lBRightPop(String key, long timeout, TimeUnit unit) { - return redisTemplate.opsForList().rightPop(key, timeout, unit); - } - - /** - * 移除列表的最后一个元素,并将该元素添加到另一个列表并返回 - * - * @param sourceKey - * @param destinationKey - * @return - */ - public String lRightPopAndLeftPush(String sourceKey, String destinationKey) { - return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, - destinationKey); - } - - /** - * 从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 - * - * @param sourceKey - * @param destinationKey - * @param timeout - * @param unit - * @return - */ - public String lBRightPopAndLeftPush(String sourceKey, String destinationKey, - long timeout, TimeUnit unit) { - return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, - destinationKey, timeout, unit); - } - - /** - * 删除集合中值等于value得元素 - * - * @param key - * @param index - * index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素; - * index<0, 从尾部开始删除第一个值等于value的元素; - * @param value - * @return - */ - public Long lRemove(String key, long index, String value) { - return redisTemplate.opsForList().remove(key, index, value); - } - - /** - * 裁剪list - * - * @param key - * @param start - * @param end - */ - public void lTrim(String key, long start, long end) { - redisTemplate.opsForList().trim(key, start, end); - } - - /** - * 获取列表长度 - * - * @param key - * @return - */ - public Long lLen(String key) { - return redisTemplate.opsForList().size(key); - } - - /** --------------------set相关操作-------------------------- */ - - /** - * set添加元素 - * - * @param key - * @param values - * @return - */ - public Long sAdd(String key, String... values) { - return redisTemplate.opsForSet().add(key, values); - } - - /** - * set移除元素 - * - * @param key - * @param values - * @return - */ - public Long sRemove(String key, Object... values) { - return redisTemplate.opsForSet().remove(key, values); - } - - /** - * 移除并返回集合的一个随机元素 - * - * @param key - * @return - */ - public String sPop(String key) { - return redisTemplate.opsForSet().pop(key); - } - - /** - * 将元素value从一个集合移到另一个集合 - * - * @param key - * @param value - * @param destKey - * @return - */ - public Boolean sMove(String key, String value, String destKey) { - return redisTemplate.opsForSet().move(key, value, destKey); - } - - /** - * 获取集合的大小 - * - * @param key - * @return - */ - public Long sSize(String key) { - return redisTemplate.opsForSet().size(key); - } - - /** - * 判断集合是否包含value - * - * @param key - * @param value - * @return - */ - public Boolean sIsMember(String key, Object value) { - return redisTemplate.opsForSet().isMember(key, value); - } - - /** - * 获取两个集合的交集 - * - * @param key - * @param otherKey - * @return - */ - public Set sIntersect(String key, String otherKey) { - return redisTemplate.opsForSet().intersect(key, otherKey); - } - - /** - * 获取key集合与多个集合的交集 - * - * @param key - * @param otherKeys - * @return - */ - public Set sIntersect(String key, Collection otherKeys) { - return redisTemplate.opsForSet().intersect(key, otherKeys); - } - - /** - * key集合与otherKey集合的交集存储到destKey集合中 - * - * @param key - * @param otherKey - * @param destKey - * @return - */ - public Long sIntersectAndStore(String key, String otherKey, String destKey) { - return redisTemplate.opsForSet().intersectAndStore(key, otherKey, - destKey); - } - - /** - * key集合与多个集合的交集存储到destKey集合中 - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Long sIntersectAndStore(String key, Collection otherKeys, - String destKey) { - return redisTemplate.opsForSet().intersectAndStore(key, otherKeys, - destKey); - } - - /** - * 获取两个集合的并集 - * - * @param key - * @param otherKeys - * @return - */ - public Set sUnion(String key, String otherKeys) { - return redisTemplate.opsForSet().union(key, otherKeys); - } - - /** - * 获取key集合与多个集合的并集 - * - * @param key - * @param otherKeys - * @return - */ - public Set sUnion(String key, Collection otherKeys) { - return redisTemplate.opsForSet().union(key, otherKeys); - } - - /** - * key集合与otherKey集合的并集存储到destKey中 - * - * @param key - * @param otherKey - * @param destKey - * @return - */ - public Long sUnionAndStore(String key, String otherKey, String destKey) { - return redisTemplate.opsForSet().unionAndStore(key, otherKey, destKey); - } - - /** - * key集合与多个集合的并集存储到destKey中 - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Long sUnionAndStore(String key, Collection otherKeys, - String destKey) { - return redisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey); - } - - /** - * 获取两个集合的差集 - * - * @param key - * @param otherKey - * @return - */ - public Set sDifference(String key, String otherKey) { - return redisTemplate.opsForSet().difference(key, otherKey); - } - - /** - * 获取key集合与多个集合的差集 - * - * @param key - * @param otherKeys - * @return - */ - public Set sDifference(String key, Collection otherKeys) { - return redisTemplate.opsForSet().difference(key, otherKeys); - } - - /** - * key集合与otherKey集合的差集存储到destKey中 - * - * @param key - * @param otherKey - * @param destKey - * @return - */ - public Long sDifference(String key, String otherKey, String destKey) { - return redisTemplate.opsForSet().differenceAndStore(key, otherKey, - destKey); - } - - /** - * key集合与多个集合的差集存储到destKey中 - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Long sDifference(String key, Collection otherKeys, - String destKey) { - return redisTemplate.opsForSet().differenceAndStore(key, otherKeys, - destKey); - } - - /** - * 获取集合所有元素 - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Set setMembers(String key) { - return redisTemplate.opsForSet().members(key); - } - - /** - * 随机获取集合中的一个元素 - * - * @param key - * @return - */ - public String sRandomMember(String key) { - return redisTemplate.opsForSet().randomMember(key); - } - - /** - * 随机获取集合中count个元素 - * - * @param key - * @param count - * @return - */ - public List sRandomMembers(String key, long count) { - return redisTemplate.opsForSet().randomMembers(key, count); - } - - /** - * 随机获取集合中count个元素并且去除重复的 - * - * @param key - * @param count - * @return - */ - public Set sDistinctRandomMembers(String key, long count) { - return redisTemplate.opsForSet().distinctRandomMembers(key, count); - } - - /** - * - * @param key - * @param options - * @return - */ - public Cursor sScan(String key, ScanOptions options) { - return redisTemplate.opsForSet().scan(key, options); - } - - /**------------------zSet相关操作--------------------------------*/ - - /** - * 添加元素,有序集合是按照元素的score值由小到大排列 - * - * @param key - * @param value - * @param score - * @return - */ - public Boolean zAdd(String key, String value, double score) { - return redisTemplate.opsForZSet().add(key, value, score); - } - - /** - * - * @param key - * @param values - * @return - */ - public Long zAdd(String key, Set> values) { - return redisTemplate.opsForZSet().add(key, values); - } - - /** - * - * @param key - * @param values - * @return - */ - public Long zRemove(String key, Object... values) { - return redisTemplate.opsForZSet().remove(key, values); - } - - /** - * 增加元素的score值,并返回增加后的值 - * - * @param key - * @param value - * @param delta - * @return - */ - public Double zIncrementScore(String key, String value, double delta) { - return redisTemplate.opsForZSet().incrementScore(key, value, delta); - } - - /** - * 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列 - * - * @param key - * @param value - * @return 0表示第一位 - */ - public Long zRank(String key, Object value) { - return redisTemplate.opsForZSet().rank(key, value); - } - - /** - * 返回元素在集合的排名,按元素的score值由大到小排列 - * - * @param key - * @param value - * @return - */ - public Long zReverseRank(String key, Object value) { - return redisTemplate.opsForZSet().reverseRank(key, value); - } - - /** - * 获取集合的元素, 从小到大排序 - * - * @param key - * @param start - * 开始位置 - * @param end - * 结束位置, -1查询所有 - * @return - */ - public Set zRange(String key, long start, long end) { - return redisTemplate.opsForZSet().range(key, start, end); - } - - /** - * 获取集合元素, 并且把score值也获取 - * - * @param key - * @param start - * @param end - * @return - */ - public Set> zRangeWithScores(String key, long start, - long end) { - return redisTemplate.opsForZSet().rangeWithScores(key, start, end); - } - - /** - * 根据Score值查询集合元素 - * - * @param key - * @param min - * 最小值 - * @param max - * 最大值 - * @return - */ - public Set zRangeByScore(String key, double min, double max) { - return redisTemplate.opsForZSet().rangeByScore(key, min, max); - } - - /** - * 根据Score值查询集合元素, 从小到大排序 - * - * @param key - * @param min - * 最小值 - * @param max - * 最大值 - * @return - */ - public Set> zRangeByScoreWithScores(String key, - double min, double max) { - return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max); - } - - /** - * - * @param key - * @param min - * @param max - * @param start - * @param end - * @return - */ - public Set> zRangeByScoreWithScores(String key, - double min, double max, long start, long end) { - return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max, - start, end); - } - - /** - * 获取集合的元素, 从大到小排序 - * - * @param key - * @param start - * @param end - * @return - */ - public Set zReverseRange(String key, long start, long end) { - return redisTemplate.opsForZSet().reverseRange(key, start, end); - } - - /** - * 获取集合的元素, 从大到小排序, 并返回score值 - * - * @param key - * @param start - * @param end - * @return - */ - public Set> zReverseRangeWithScores(String key, - long start, long end) { - return redisTemplate.opsForZSet().reverseRangeWithScores(key, start, - end); - } - - /** - * 根据Score值查询集合元素, 从大到小排序 - * - * @param key - * @param min - * @param max - * @return - */ - public Set zReverseRangeByScore(String key, double min, - double max) { - return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max); - } - - /** - * 根据Score值查询集合元素, 从大到小排序 - * - * @param key - * @param min - * @param max - * @return - */ - public Set> zReverseRangeByScoreWithScores( - String key, double min, double max) { - return redisTemplate.opsForZSet().reverseRangeByScoreWithScores(key, - min, max); - } - - /** - * - * @param key - * @param min - * @param max - * @param start - * @param end - * @return - */ - public Set zReverseRangeByScore(String key, double min, - double max, long start, long end) { - return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max, - start, end); - } - - /** - * 根据score值获取集合元素数量 - * - * @param key - * @param min - * @param max - * @return - */ - public Long zCount(String key, double min, double max) { - return redisTemplate.opsForZSet().count(key, min, max); - } - - /** - * 获取集合大小 - * - * @param key - * @return - */ - public Long zSize(String key) { - return redisTemplate.opsForZSet().size(key); - } - - /** - * 获取集合大小 - * - * @param key - * @return - */ - public Long zZCard(String key) { - return redisTemplate.opsForZSet().zCard(key); - } - - /** - * 获取集合中value元素的score值 - * - * @param key - * @param value - * @return - */ - public Double zScore(String key, Object value) { - return redisTemplate.opsForZSet().score(key, value); - } - - /** - * 移除指定索引位置的成员 - * - * @param key - * @param start - * @param end - * @return - */ - public Long zRemoveRange(String key, long start, long end) { - return redisTemplate.opsForZSet().removeRange(key, start, end); - } - - /** - * 根据指定的score值的范围来移除成员 - * - * @param key - * @param min - * @param max - * @return - */ - public Long zRemoveRangeByScore(String key, double min, double max) { - return redisTemplate.opsForZSet().removeRangeByScore(key, min, max); - } - - /** - * 获取key和otherKey的并集并存储在destKey中 - * - * @param key - * @param otherKey - * @param destKey - * @return - */ - public Long zUnionAndStore(String key, String otherKey, String destKey) { - return redisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey); - } - - /** - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Long zUnionAndStore(String key, Collection otherKeys, - String destKey) { - return redisTemplate.opsForZSet() - .unionAndStore(key, otherKeys, destKey); - } - - /** - * 交集 - * - * @param key - * @param otherKey - * @param destKey - * @return - */ - public Long zIntersectAndStore(String key, String otherKey, - String destKey) { - return redisTemplate.opsForZSet().intersectAndStore(key, otherKey, - destKey); - } - - /** - * 交集 - * - * @param key - * @param otherKeys - * @param destKey - * @return - */ - public Long zIntersectAndStore(String key, Collection otherKeys, - String destKey) { - return redisTemplate.opsForZSet().intersectAndStore(key, otherKeys, - destKey); - } - - /** - * - * @param key - * @param options - * @return - */ - public Cursor> zScan(String key, ScanOptions options) { - return redisTemplate.opsForZSet().scan(key, options); - } + @Autowired + private StringRedisTemplate redisTemplate; + + + /** -------------------key相关操作--------------------- */ + + /** + * 删除key + * + * @param key + */ + public void delete(String key) { + redisTemplate.delete(key); + } + + /** + * 批量删除key + * + * @param keys + */ + public void delete(Collection keys) { + redisTemplate.delete(keys); + } + + /** + * 序列化key + * + * @param key + * @return + */ + public byte[] dump(String key) { + return redisTemplate.dump(key); + } + + /** + * 是否存在key + * + * @param key + * @return + */ + public Boolean hasKey(String key) { + return redisTemplate.hasKey(key); + } + + /** + * 设置过期时间 + * + * @param key + * @param timeout + * @param unit + * @return + */ + public Boolean expire(String key, long timeout, TimeUnit unit) { + return redisTemplate.expire(key, timeout, unit); + } + + /** + * 设置过期时间 + * + * @param key + * @param date + * @return + */ + public Boolean expireAt(String key, Date date) { + return redisTemplate.expireAt(key, date); + } + + /** + * 查找匹配的key + * + * @param pattern + * @return + */ + public Set keys(String pattern) { + return redisTemplate.keys(pattern); + } + + /** + * 将当前数据库的 key 移动到给定的数据库 db 当中 + * + * @param key + * @param dbIndex + * @return + */ + public Boolean move(String key, int dbIndex) { + return redisTemplate.move(key, dbIndex); + } + + /** + * 移除 key 的过期时间,key 将持久保持 + * + * @param key + * @return + */ + public Boolean persist(String key) { + return redisTemplate.persist(key); + } + + /** + * 返回 key 的剩余的过期时间 + * + * @param key + * @param unit + * @return + */ + public Long getExpire(String key, TimeUnit unit) { + return redisTemplate.getExpire(key, unit); + } + + /** + * 返回 key 的剩余的过期时间 + * + * @param key + * @return + */ + public Long getExpire(String key) { + return redisTemplate.getExpire(key); + } + + /** + * 从当前数据库中随机返回一个 key + * + * @return + */ + public String randomKey() { + return redisTemplate.randomKey(); + } + + /** + * 修改 key 的名称 + * + * @param oldKey + * @param newKey + */ + public void rename(String oldKey, String newKey) { + redisTemplate.rename(oldKey, newKey); + } + + /** + * 仅当 newkey 不存在时,将 oldKey 改名为 newkey + * + * @param oldKey + * @param newKey + * @return + */ + public Boolean renameIfAbsent(String oldKey, String newKey) { + return redisTemplate.renameIfAbsent(oldKey, newKey); + } + + /** + * 返回 key 所储存的值的类型 + * + * @param key + * @return + */ + public DataType type(String key) { + return redisTemplate.type(key); + } + + /** -------------------string相关操作--------------------- */ + + /** + * 设置指定 key 的值 + * + * @param key + * @param value + */ + public void set(String key, String value) { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 获取指定 key 的值 + * + * @param key + * @return + */ + public String get(String key) { + return redisTemplate.opsForValue().get(key); + } + + /** + * 返回 key 中字符串值的子字符 + * + * @param key + * @param start + * @param end + * @return + */ + public String getRange(String key, long start, long end) { + return redisTemplate.opsForValue().get(key, start, end); + } + + /** + * 将给定 key 的值设为 value ,并返回 key 的旧值(old value) + * + * @param key + * @param value + * @return + */ + public String getAndSet(String key, String value) { + return redisTemplate.opsForValue().getAndSet(key, value); + } + + /** + * 对 key 所储存的字符串值,获取指定偏移量上的位(bit) + * + * @param key + * @param offset + * @return + */ + public Boolean getBit(String key, long offset) { + return redisTemplate.opsForValue().getBit(key, offset); + } + + /** + * 批量获取 + * + * @param keys + * @return + */ + public List multiGet(Collection keys) { + return redisTemplate.opsForValue().multiGet(keys); + } + + /** + * 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value + * + * @param key + * @param postion 位置 + * @param value 值,true为1, false为0 + * @return + */ + public boolean setBit(String key, long offset, boolean value) { + return redisTemplate.opsForValue().setBit(key, offset, value); + } + + /** + * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout + * + * @param key + * @param value + * @param timeout 过期时间 + * @param unit 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES + * 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS + */ + public void setEx(String key, String value, long timeout, TimeUnit unit) { + redisTemplate.opsForValue().set(key, value, timeout, unit); + } + + /** + * 只有在 key 不存在时设置 key 的值 + * + * @param key + * @param value + * @return 之前已经存在返回false, 不存在返回true + */ + public boolean setIfAbsent(String key, String value) { + return redisTemplate.opsForValue().setIfAbsent(key, value); + } + + /** + * 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始 + * + * @param key + * @param value + * @param offset 从指定位置开始覆写 + */ + public void setRange(String key, String value, long offset) { + redisTemplate.opsForValue().set(key, value, offset); + } + + /** + * 获取字符串的长度 + * + * @param key + * @return + */ + public Long size(String key) { + return redisTemplate.opsForValue().size(key); + } + + /** + * 批量添加 + * + * @param maps + */ + public void multiSet(Map maps) { + redisTemplate.opsForValue().multiSet(maps); + } + + /** + * 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在 + * + * @param maps + * @return 之前已经存在返回false, 不存在返回true + */ + public boolean multiSetIfAbsent(Map maps) { + return redisTemplate.opsForValue().multiSetIfAbsent(maps); + } + + /** + * 增加(自增长), 负数则为自减 + * + * @param key + * @param value + * @return + */ + public Long incrBy(String key, long increment) { + return redisTemplate.opsForValue().increment(key, increment); + } + + /** + * @param key + * @param value + * @return + */ + public Double incrByFloat(String key, double increment) { + return redisTemplate.opsForValue().increment(key, increment); + } + + /** + * 追加到末尾 + * + * @param key + * @param value + * @return + */ + public Integer append(String key, String value) { + return redisTemplate.opsForValue().append(key, value); + } + + /** -------------------hash相关操作------------------------- */ + + /** + * 获取存储在哈希表中指定字段的值 + * + * @param key + * @param field + * @return + */ + public Object hGet(String key, String field) { + return redisTemplate.opsForHash().get(key, field); + } + + /** + * 获取所有给定字段的值 + * + * @param key + * @return + */ + public Map hGetAll(String key) { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 获取所有给定字段的值 + * + * @param key + * @param fields + * @return + */ + public List hMultiGet(String key, Collection fields) { + return redisTemplate.opsForHash().multiGet(key, fields); + } + + public void hPut(String key, String hashKey, String value) { + redisTemplate.opsForHash().put(key, hashKey, value); + } + + public void hPutAll(String key, Map maps) { + redisTemplate.opsForHash().putAll(key, maps); + } + + /** + * 仅当hashKey不存在时才设置 + * + * @param key + * @param hashKey + * @param value + * @return + */ + public Boolean hPutIfAbsent(String key, String hashKey, String value) { + return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value); + } + + /** + * 删除一个或多个哈希表字段 + * + * @param key + * @param fields + * @return + */ + public Long hDelete(String key, Object... fields) { + return redisTemplate.opsForHash().delete(key, fields); + } + + /** + * 查看哈希表 key 中,指定的字段是否存在 + * + * @param key + * @param field + * @return + */ + public boolean hExists(String key, String field) { + return redisTemplate.opsForHash().hasKey(key, field); + } + + /** + * 为哈希表 key 中的指定字段的整数值加上增量 increment + * + * @param key + * @param field + * @param increment + * @return + */ + public Long hIncrBy(String key, Object field, long increment) { + return redisTemplate.opsForHash().increment(key, field, increment); + } + + /** + * 为哈希表 key 中的指定字段的整数值加上增量 increment + * + * @param key + * @param field + * @param delta + * @return + */ + public Double hIncrByFloat(String key, Object field, double delta) { + return redisTemplate.opsForHash().increment(key, field, delta); + } + + /** + * 获取所有哈希表中的字段 + * + * @param key + * @return + */ + public Set hKeys(String key) { + return redisTemplate.opsForHash().keys(key); + } + + /** + * 获取哈希表中字段的数量 + * + * @param key + * @return + */ + public Long hSize(String key) { + return redisTemplate.opsForHash().size(key); + } + + /** + * 获取哈希表中所有值 + * + * @param key + * @return + */ + public List hValues(String key) { + return redisTemplate.opsForHash().values(key); + } + + /** + * 迭代哈希表中的键值对 + * + * @param key + * @param options + * @return + */ + public Cursor> hScan(String key, ScanOptions options) { + return redisTemplate.opsForHash().scan(key, options); + } + + /** ------------------------list相关操作---------------------------- */ + + /** + * 通过索引获取列表中的元素 + * + * @param key + * @param index + * @return + */ + public String lIndex(String key, long index) { + return redisTemplate.opsForList().index(key, index); + } + + /** + * 获取列表指定范围内的元素 + * + * @param key + * @param start 开始位置, 0是开始位置 + * @param end 结束位置, -1返回所有 + * @return + */ + public List lRange(String key, long start, long end) { + return redisTemplate.opsForList().range(key, start, end); + } + + /** + * 存储在list头部 + * + * @param key + * @param value + * @return + */ + public Long lLeftPush(String key, String value) { + return redisTemplate.opsForList().leftPush(key, value); + } + + /** + * @param key + * @param value + * @return + */ + public Long lLeftPushAll(String key, String... value) { + return redisTemplate.opsForList().leftPushAll(key, value); + } + + /** + * @param key + * @param value + * @return + */ + public Long lLeftPushAll(String key, Collection value) { + return redisTemplate.opsForList().leftPushAll(key, value); + } + + /** + * 当list存在的时候才加入 + * + * @param key + * @param value + * @return + */ + public Long lLeftPushIfPresent(String key, String value) { + return redisTemplate.opsForList().leftPushIfPresent(key, value); + } + + /** + * 如果pivot存在,再pivot前面添加 + * + * @param key + * @param pivot + * @param value + * @return + */ + public Long lLeftPush(String key, String pivot, String value) { + return redisTemplate.opsForList().leftPush(key, pivot, value); + } + + /** + * @param key + * @param value + * @return + */ + public Long lRightPush(String key, String value) { + return redisTemplate.opsForList().rightPush(key, value); + } + + /** + * @param key + * @param value + * @return + */ + public Long lRightPushAll(String key, String... value) { + return redisTemplate.opsForList().rightPushAll(key, value); + } + + /** + * @param key + * @param value + * @return + */ + public Long lRightPushAll(String key, Collection value) { + return redisTemplate.opsForList().rightPushAll(key, value); + } + + /** + * 为已存在的列表添加值 + * + * @param key + * @param value + * @return + */ + public Long lRightPushIfPresent(String key, String value) { + return redisTemplate.opsForList().rightPushIfPresent(key, value); + } + + /** + * 在pivot元素的右边添加值 + * + * @param key + * @param pivot + * @param value + * @return + */ + public Long lRightPush(String key, String pivot, String value) { + return redisTemplate.opsForList().rightPush(key, pivot, value); + } + + /** + * 通过索引设置列表元素的值 + * + * @param key + * @param index 位置 + * @param value + */ + public void lSet(String key, long index, String value) { + redisTemplate.opsForList().set(key, index, value); + } + + /** + * 移出并获取列表的第一个元素 + * + * @param key + * @return 删除的元素 + */ + public String lLeftPop(String key) { + return redisTemplate.opsForList().leftPop(key); + } + + /** + * 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 + * + * @param key + * @param timeout 等待时间 + * @param unit 时间单位 + * @return + */ + public String lBLeftPop(String key, long timeout, TimeUnit unit) { + return redisTemplate.opsForList().leftPop(key, timeout, unit); + } + + /** + * 移除并获取列表最后一个元素 + * + * @param key + * @return 删除的元素 + */ + public String lRightPop(String key) { + return redisTemplate.opsForList().rightPop(key); + } + + /** + * 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 + * + * @param key + * @param timeout 等待时间 + * @param unit 时间单位 + * @return + */ + public String lBRightPop(String key, long timeout, TimeUnit unit) { + return redisTemplate.opsForList().rightPop(key, timeout, unit); + } + + /** + * 移除列表的最后一个元素,并将该元素添加到另一个列表并返回 + * + * @param sourceKey + * @param destinationKey + * @return + */ + public String lRightPopAndLeftPush(String sourceKey, String destinationKey) { + return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, + destinationKey); + } + + /** + * 从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 + * + * @param sourceKey + * @param destinationKey + * @param timeout + * @param unit + * @return + */ + public String lBRightPopAndLeftPush(String sourceKey, String destinationKey, + long timeout, TimeUnit unit) { + return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, + destinationKey, timeout, unit); + } + + /** + * 删除集合中值等于value得元素 + * + * @param key + * @param index index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素; + * index<0, 从尾部开始删除第一个值等于value的元素; + * @param value + * @return + */ + public Long lRemove(String key, long index, String value) { + return redisTemplate.opsForList().remove(key, index, value); + } + + /** + * 裁剪list + * + * @param key + * @param start + * @param end + */ + public void lTrim(String key, long start, long end) { + redisTemplate.opsForList().trim(key, start, end); + } + + /** + * 获取列表长度 + * + * @param key + * @return + */ + public Long lLen(String key) { + return redisTemplate.opsForList().size(key); + } + + /** --------------------set相关操作-------------------------- */ + + /** + * set添加元素 + * + * @param key + * @param values + * @return + */ + public Long sAdd(String key, String... values) { + return redisTemplate.opsForSet().add(key, values); + } + + /** + * set移除元素 + * + * @param key + * @param values + * @return + */ + public Long sRemove(String key, Object... values) { + return redisTemplate.opsForSet().remove(key, values); + } + + /** + * 移除并返回集合的一个随机元素 + * + * @param key + * @return + */ + public String sPop(String key) { + return redisTemplate.opsForSet().pop(key); + } + + /** + * 将元素value从一个集合移到另一个集合 + * + * @param key + * @param value + * @param destKey + * @return + */ + public Boolean sMove(String key, String value, String destKey) { + return redisTemplate.opsForSet().move(key, value, destKey); + } + + /** + * 获取集合的大小 + * + * @param key + * @return + */ + public Long sSize(String key) { + return redisTemplate.opsForSet().size(key); + } + + /** + * 判断集合是否包含value + * + * @param key + * @param value + * @return + */ + public Boolean sIsMember(String key, Object value) { + return redisTemplate.opsForSet().isMember(key, value); + } + + /** + * 获取两个集合的交集 + * + * @param key + * @param otherKey + * @return + */ + public Set sIntersect(String key, String otherKey) { + return redisTemplate.opsForSet().intersect(key, otherKey); + } + + /** + * 获取key集合与多个集合的交集 + * + * @param key + * @param otherKeys + * @return + */ + public Set sIntersect(String key, Collection otherKeys) { + return redisTemplate.opsForSet().intersect(key, otherKeys); + } + + /** + * key集合与otherKey集合的交集存储到destKey集合中 + * + * @param key + * @param otherKey + * @param destKey + * @return + */ + public Long sIntersectAndStore(String key, String otherKey, String destKey) { + return redisTemplate.opsForSet().intersectAndStore(key, otherKey, + destKey); + } + + /** + * key集合与多个集合的交集存储到destKey集合中 + * + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Long sIntersectAndStore(String key, Collection otherKeys, + String destKey) { + return redisTemplate.opsForSet().intersectAndStore(key, otherKeys, + destKey); + } + + /** + * 获取两个集合的并集 + * + * @param key + * @param otherKeys + * @return + */ + public Set sUnion(String key, String otherKeys) { + return redisTemplate.opsForSet().union(key, otherKeys); + } + + /** + * 获取key集合与多个集合的并集 + * + * @param key + * @param otherKeys + * @return + */ + public Set sUnion(String key, Collection otherKeys) { + return redisTemplate.opsForSet().union(key, otherKeys); + } + + /** + * key集合与otherKey集合的并集存储到destKey中 + * + * @param key + * @param otherKey + * @param destKey + * @return + */ + public Long sUnionAndStore(String key, String otherKey, String destKey) { + return redisTemplate.opsForSet().unionAndStore(key, otherKey, destKey); + } + + /** + * key集合与多个集合的并集存储到destKey中 + * + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Long sUnionAndStore(String key, Collection otherKeys, + String destKey) { + return redisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey); + } + + /** + * 获取两个集合的差集 + * + * @param key + * @param otherKey + * @return + */ + public Set sDifference(String key, String otherKey) { + return redisTemplate.opsForSet().difference(key, otherKey); + } + + /** + * 获取key集合与多个集合的差集 + * + * @param key + * @param otherKeys + * @return + */ + public Set sDifference(String key, Collection otherKeys) { + return redisTemplate.opsForSet().difference(key, otherKeys); + } + + /** + * key集合与otherKey集合的差集存储到destKey中 + * + * @param key + * @param otherKey + * @param destKey + * @return + */ + public Long sDifference(String key, String otherKey, String destKey) { + return redisTemplate.opsForSet().differenceAndStore(key, otherKey, + destKey); + } + + /** + * key集合与多个集合的差集存储到destKey中 + * + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Long sDifference(String key, Collection otherKeys, + String destKey) { + return redisTemplate.opsForSet().differenceAndStore(key, otherKeys, + destKey); + } + + /** + * 获取集合所有元素 + * + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Set setMembers(String key) { + return redisTemplate.opsForSet().members(key); + } + + /** + * 随机获取集合中的一个元素 + * + * @param key + * @return + */ + public String sRandomMember(String key) { + return redisTemplate.opsForSet().randomMember(key); + } + + /** + * 随机获取集合中count个元素 + * + * @param key + * @param count + * @return + */ + public List sRandomMembers(String key, long count) { + return redisTemplate.opsForSet().randomMembers(key, count); + } + + /** + * 随机获取集合中count个元素并且去除重复的 + * + * @param key + * @param count + * @return + */ + public Set sDistinctRandomMembers(String key, long count) { + return redisTemplate.opsForSet().distinctRandomMembers(key, count); + } + + /** + * @param key + * @param options + * @return + */ + public Cursor sScan(String key, ScanOptions options) { + return redisTemplate.opsForSet().scan(key, options); + } + + /**------------------zSet相关操作--------------------------------*/ + + /** + * 添加元素,有序集合是按照元素的score值由小到大排列 + * + * @param key + * @param value + * @param score + * @return + */ + public Boolean zAdd(String key, String value, double score) { + return redisTemplate.opsForZSet().add(key, value, score); + } + + /** + * @param key + * @param values + * @return + */ + public Long zAdd(String key, Set> values) { + return redisTemplate.opsForZSet().add(key, values); + } + + /** + * @param key + * @param values + * @return + */ + public Long zRemove(String key, Object... values) { + return redisTemplate.opsForZSet().remove(key, values); + } + + /** + * 增加元素的score值,并返回增加后的值 + * + * @param key + * @param value + * @param delta + * @return + */ + public Double zIncrementScore(String key, String value, double delta) { + return redisTemplate.opsForZSet().incrementScore(key, value, delta); + } + + /** + * 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列 + * + * @param key + * @param value + * @return 0表示第一位 + */ + public Long zRank(String key, Object value) { + return redisTemplate.opsForZSet().rank(key, value); + } + + /** + * 返回元素在集合的排名,按元素的score值由大到小排列 + * + * @param key + * @param value + * @return + */ + public Long zReverseRank(String key, Object value) { + return redisTemplate.opsForZSet().reverseRank(key, value); + } + + /** + * 获取集合的元素, 从小到大排序 + * + * @param key + * @param start 开始位置 + * @param end 结束位置, -1查询所有 + * @return + */ + public Set zRange(String key, long start, long end) { + return redisTemplate.opsForZSet().range(key, start, end); + } + + /** + * 获取集合元素, 并且把score值也获取 + * + * @param key + * @param start + * @param end + * @return + */ + public Set> zRangeWithScores(String key, long start, + long end) { + return redisTemplate.opsForZSet().rangeWithScores(key, start, end); + } + + /** + * 根据Score值查询集合元素 + * + * @param key + * @param min 最小值 + * @param max 最大值 + * @return + */ + public Set zRangeByScore(String key, double min, double max) { + return redisTemplate.opsForZSet().rangeByScore(key, min, max); + } + + /** + * 根据Score值查询集合元素, 从小到大排序 + * + * @param key + * @param min 最小值 + * @param max 最大值 + * @return + */ + public Set> zRangeByScoreWithScores(String key, + double min, double max) { + return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max); + } + + /** + * @param key + * @param min + * @param max + * @param start + * @param end + * @return + */ + public Set> zRangeByScoreWithScores(String key, + double min, double max, long start, long end) { + return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max, + start, end); + } + + /** + * 获取集合的元素, 从大到小排序 + * + * @param key + * @param start + * @param end + * @return + */ + public Set zReverseRange(String key, long start, long end) { + return redisTemplate.opsForZSet().reverseRange(key, start, end); + } + + /** + * 获取集合的元素, 从大到小排序, 并返回score值 + * + * @param key + * @param start + * @param end + * @return + */ + public Set> zReverseRangeWithScores(String key, + long start, long end) { + return redisTemplate.opsForZSet().reverseRangeWithScores(key, start, + end); + } + + /** + * 根据Score值查询集合元素, 从大到小排序 + * + * @param key + * @param min + * @param max + * @return + */ + public Set zReverseRangeByScore(String key, double min, + double max) { + return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max); + } + + /** + * 根据Score值查询集合元素, 从大到小排序 + * + * @param key + * @param min + * @param max + * @return + */ + public Set> zReverseRangeByScoreWithScores( + String key, double min, double max) { + return redisTemplate.opsForZSet().reverseRangeByScoreWithScores(key, + min, max); + } + + /** + * @param key + * @param min + * @param max + * @param start + * @param end + * @return + */ + public Set zReverseRangeByScore(String key, double min, + double max, long start, long end) { + return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max, + start, end); + } + + /** + * 根据score值获取集合元素数量 + * + * @param key + * @param min + * @param max + * @return + */ + public Long zCount(String key, double min, double max) { + return redisTemplate.opsForZSet().count(key, min, max); + } + + /** + * 获取集合大小 + * + * @param key + * @return + */ + public Long zSize(String key) { + return redisTemplate.opsForZSet().size(key); + } + + /** + * 获取集合大小 + * + * @param key + * @return + */ + public Long zZCard(String key) { + return redisTemplate.opsForZSet().zCard(key); + } + + /** + * 获取集合中value元素的score值 + * + * @param key + * @param value + * @return + */ + public Double zScore(String key, Object value) { + return redisTemplate.opsForZSet().score(key, value); + } + + /** + * 移除指定索引位置的成员 + * + * @param key + * @param start + * @param end + * @return + */ + public Long zRemoveRange(String key, long start, long end) { + return redisTemplate.opsForZSet().removeRange(key, start, end); + } + + /** + * 根据指定的score值的范围来移除成员 + * + * @param key + * @param min + * @param max + * @return + */ + public Long zRemoveRangeByScore(String key, double min, double max) { + return redisTemplate.opsForZSet().removeRangeByScore(key, min, max); + } + + /** + * 获取key和otherKey的并集并存储在destKey中 + * + * @param key + * @param otherKey + * @param destKey + * @return + */ + public Long zUnionAndStore(String key, String otherKey, String destKey) { + return redisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey); + } + + /** + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Long zUnionAndStore(String key, Collection otherKeys, + String destKey) { + return redisTemplate.opsForZSet() + .unionAndStore(key, otherKeys, destKey); + } + + /** + * 交集 + * + * @param key + * @param otherKey + * @param destKey + * @return + */ + public Long zIntersectAndStore(String key, String otherKey, + String destKey) { + return redisTemplate.opsForZSet().intersectAndStore(key, otherKey, + destKey); + } + + /** + * 交集 + * + * @param key + * @param otherKeys + * @param destKey + * @return + */ + public Long zIntersectAndStore(String key, Collection otherKeys, + String destKey) { + return redisTemplate.opsForZSet().intersectAndStore(key, otherKeys, + destKey); + } + + /** + * @param key + * @param options + * @return + */ + public Cursor> zScan(String key, ScanOptions options) { + return redisTemplate.opsForZSet().scan(key, options); + } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAdminLogServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAdminLogServiceImpl.java index 4cf7f132ec8673c6ee4ab1c517a710b288bf6822..6fef4eb90a3cecb988be8ebdaba47f2e547620ab 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAdminLogServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAdminLogServiceImpl.java @@ -24,6 +24,7 @@ public class SysAdminLogServiceImpl extends ServiceImpl selectPageExt(LogParam entity) { return logMapper.getLogStatisc(entity); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAlipayConfigServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAlipayConfigServiceImpl.java index 7274fb62c306d133b004f6fd2c4648f312e0600a..bb4fa9a0bbd18a6d570ad5733f36f2ffb806c50e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAlipayConfigServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysAlipayConfigServiceImpl.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -26,7 +26,7 @@ public class SysAlipayConfigServiceImpl extends ServiceImpl= 5000){ + if (money <= 0 || money >= 5000) { throw new BusinessMallException("测试金额过大"); } // 创建API对应的request(手机网页版) @@ -71,14 +71,14 @@ public class SysAlipayConfigServiceImpl extends ServiceImpl * 系统配置信息表 服务实现类 diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysEmailConfigServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysEmailConfigServiceImpl.java index 3d6142b93a637ea3832ce7e1bf08bc0f181ff359..b92a879b63629d96c9a2249cfc9dc0aeeb404e43 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysEmailConfigServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysEmailConfigServiceImpl.java @@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -25,8 +25,8 @@ public class SysEmailConfigServiceImpl extends ServiceImpl"); + account.setFrom(emailConfig.getUser() + "<" + emailConfig.getFromUser() + ">"); // ssl方式发送 account.setSslEnable(true); String content = emailVo.getContent(); @@ -55,7 +55,7 @@ public class SysEmailConfigServiceImpl extends ServiceImpl menuDOs; if (!redisService.exists(String.format(Rediskey.allTreesList, "admin"))) { List types = Lists.newArrayList(1L, 0L); - menuDOs = permissionMapper.selectList(new QueryWrapper().eq("status",1).in("type", types).orderByAsc("sort")); + menuDOs = permissionMapper.selectList(new QueryWrapper().eq("status", 1).in("type", types).orderByAsc("sort")); redisService.set(String.format(Rediskey.allTreesList, "admin"), JsonUtil.objectToJson(menuDOs)); } else { menuDOs = JsonUtil.jsonToList(redisService.get(String.format(Rediskey.allTreesList, "admin")), SysPermission.class); @@ -57,7 +58,10 @@ public class SysPermissionServiceImpl extends ServiceImpl tree = new Tree(); tree.setId(sysMenuDO.getId().toString()); - tree.setParentId(sysMenuDO.getPid().toString()); + if (ValidatorUtils.notEmpty(sysMenuDO.getPid())){ + tree.setParentId(sysMenuDO.getPid().toString()); + } + tree.setTitle(sysMenuDO.getName()); Map attributes = new HashMap<>(16); attributes.put("url", sysMenuDO.getUri()); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuConfigServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuConfigServiceImpl.java index f84a88d91cdbf556a3ef97862e4e2aac250c7d5f..91acff9ee8f0abafc6fe01609dc9a6fd0e71715a 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuConfigServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuConfigServiceImpl.java @@ -35,7 +35,7 @@ import java.util.Map; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat @@ -52,7 +52,7 @@ public class SysQiniuConfigServiceImpl extends ServiceImpl().eq("name",key)) != null) { + if (qiniuContentMapper.selectOne(new QueryWrapper().eq("name", key)) != null) { key = QiNiuUtil.getKey(key); } Response response = uploadManager.put(file.getBytes(), key, upToken); @@ -86,9 +86,9 @@ public class SysQiniuConfigServiceImpl extends ServiceImpl().eq("name",FileUtil.getFileNameNoEx(item.key))) == null){ + if (qiniuContentMapper.selectOne(new QueryWrapper().eq("name", FileUtil.getFileNameNoEx(item.key))) == null) { qiniuContent = new SysQiniuContent(); - qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(item.fsize+""))); + qiniuContent.setSize(FileUtil.getSize(Integer.parseInt(item.fsize + ""))); qiniuContent.setSuffix(FileUtil.getExtensionName(item.key)); qiniuContent.setName(FileUtil.getFileNameNoEx(item.key)); qiniuContent.setType(config.getType()); qiniuContent.setBucket(config.getBucket()); - qiniuContent.setUrl(config.getHost()+"/"+item.key); + qiniuContent.setUrl(config.getHost() + "/" + item.key); qiniuContentMapper.insert(qiniuContent); } } @@ -176,12 +176,11 @@ public class SysQiniuConfigServiceImpl extends ServiceImpl queryAll, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); for (SysQiniuContent content : queryAll) { - Map map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); map.put("文件名", content.getName()); map.put("文件类型", content.getSuffix()); map.put("空间名称", content.getBucket()); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuContentServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuContentServiceImpl.java index c8d60e9f730652c4eee971e6410fc28e21df0088..9c4fe4dabcd9ca23abf8d9b9457a62b98f2942a7 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuContentServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysQiniuContentServiceImpl.java @@ -1,14 +1,14 @@ package com.zscat.mallplus.sys.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zscat.mallplus.sys.entity.SysQiniuContent; import com.zscat.mallplus.sys.mapper.SysQiniuContentMapper; import com.zscat.mallplus.sys.service.ISysQiniuContentService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysStoreServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysStoreServiceImpl.java index 913cbc6ea6f918d2d9dcb4c242144c24535cc76c..6d0bd8b3c363bf562ed5eaab9441e897135ab18f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysStoreServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysStoreServiceImpl.java @@ -2,6 +2,7 @@ package com.zscat.mallplus.sys.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.bill.entity.BakBrand; import com.zscat.mallplus.bill.entity.BakCategory; import com.zscat.mallplus.bill.entity.BakGoods; @@ -22,7 +23,6 @@ import com.zscat.mallplus.sys.mapper.SysStoreMapper; import com.zscat.mallplus.sys.mapper.SysUserMapper; import com.zscat.mallplus.sys.service.ISysStoreService; import com.zscat.mallplus.utils.ValidatorUtils; -import com.zscat.mallplus.ApiContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -69,6 +69,7 @@ public class SysStoreServiceImpl extends ServiceImpl i private PmsProductAttributeCategoryMapper pmsProductAttributeCategoryMapper; @Resource private PmsBrandMapper pmsBrandMapper; + @Transactional @Override public boolean saveStore(SysStore entity) { @@ -78,7 +79,7 @@ public class SysStoreServiceImpl extends ServiceImpl i SysUser user = new SysUser(); user.setUsername(entity.getName()); SysUser umsAdminList = userMapper.selectByUserName(entity.getName()); - if (umsAdminList!=null) { + if (umsAdminList != null) { return false; } user.setStatus(1); @@ -89,70 +90,71 @@ public class SysStoreServiceImpl extends ServiceImpl i user.setNickName(entity.getName()); //user.setStoreId(entity.getId()); user.setEmail(entity.getSupportPhone()); - // apiContext.setCurrentProviderId(entity.getId()); + apiContext.setCurrentProviderId(entity.getId()); // - if (entity.getType()!=null){ + if (entity.getType() != null) { CompletableFuture.runAsync(() -> { - BakCategory category = bakCategoryMapper.selectById(entity.getType()); - PmsProductCategory pmsProductCategory = new PmsProductCategory(); - pmsProductCategory.setIcon(category.getIconUrl()); - pmsProductCategory.setName(category.getName()); - pmsProductCategory.setKeywords(category.getKeywords()); - pmsProductCategory.setParentId(category.getPid().longValue()); - pmsProductCategory.setLevel(Integer.parseInt(category.getLevel().substring(1))); - pmsProductCategoryMapper.insert(pmsProductCategory); - - - PmsProductAttributeCategory pmsProductAttributeCategory = new PmsProductAttributeCategory(); - pmsProductAttributeCategory.setPic(category.getIconUrl()); - pmsProductAttributeCategory.setName(category.getName()); - - pmsProductAttributeCategoryMapper.insert(pmsProductAttributeCategory); - - List categoryList = bakCategoryMapper.selectList(new QueryWrapper().eq("pid",entity.getType())); - for (BakCategory bakCategory :categoryList){ - - PmsProductCategory pmsProductCategory1 = new PmsProductCategory(); - pmsProductCategory1.setIcon(bakCategory.getIconUrl()); - pmsProductCategory1.setName(bakCategory.getName()); - pmsProductCategory1.setKeywords(bakCategory.getKeywords()); - pmsProductCategory1.setParentId(bakCategory.getPid().longValue()); - pmsProductCategory1.setLevel(Integer.parseInt(bakCategory.getLevel().substring(1))); - pmsProductCategoryMapper.insert(pmsProductCategory1); - } - List ids = categoryList.stream() - .map(BakCategory::getId) - .collect(Collectors.toList()); - if (ids!=null){ - List goodsList = bakGoodsMapper.selectList(new QueryWrapper().in("category_id",ids)); - for (BakGoods gg : goodsList){ - createG(gg,entity.getId()); + BakCategory category = bakCategoryMapper.selectById(entity.getType()); + PmsProductCategory pmsProductCategory = new PmsProductCategory(); + pmsProductCategory.setIcon(category.getIconUrl()); + pmsProductCategory.setName(category.getName()); + pmsProductCategory.setKeywords(category.getKeywords()); + pmsProductCategory.setParentId(category.getPid().longValue()); + pmsProductCategory.setLevel(Integer.parseInt(category.getLevel().substring(1))); + pmsProductCategoryMapper.insert(pmsProductCategory); + + + PmsProductAttributeCategory pmsProductAttributeCategory = new PmsProductAttributeCategory(); + pmsProductAttributeCategory.setPic(category.getIconUrl()); + pmsProductAttributeCategory.setName(category.getName()); + + pmsProductAttributeCategoryMapper.insert(pmsProductAttributeCategory); + + List categoryList = bakCategoryMapper.selectList(new QueryWrapper().eq("pid", entity.getType())); + for (BakCategory bakCategory : categoryList) { + + PmsProductCategory pmsProductCategory1 = new PmsProductCategory(); + pmsProductCategory1.setIcon(bakCategory.getIconUrl()); + pmsProductCategory1.setName(bakCategory.getName()); + pmsProductCategory1.setKeywords(bakCategory.getKeywords()); + pmsProductCategory1.setParentId(bakCategory.getPid().longValue()); + pmsProductCategory1.setLevel(Integer.parseInt(bakCategory.getLevel().substring(1))); + pmsProductCategoryMapper.insert(pmsProductCategory1); } - List brands = goodsList.stream() - .map(BakGoods::getBrandId) + List ids = categoryList.stream() + .map(BakCategory::getId) .collect(Collectors.toList()); - if (brands!=null){ - List bakBrands =bakBrandMapper.selectBatchIds(brands); - if (bakBrands!=null && bakBrands.size()>0){ - for (BakBrand bakBrand : bakBrands){ - PmsBrand brand = new PmsBrand(); - brand.setBigPic(bakBrand.getPicUrl()); - brand.setName(bakBrand.getName()); - brand.setShowStatus(1); - brand.setFactoryStatus(1); - brand.setLogo(bakBrand.getPicUrl()); - brand.setSort(bakBrand.getSortOrder()); - pmsBrandMapper.insert(brand); + if (ids != null) { + List goodsList = bakGoodsMapper.selectList(new QueryWrapper().in("category_id", ids)); + for (BakGoods gg : goodsList) { + createG(gg, entity.getId()); + } + List brands = goodsList.stream() + .map(BakGoods::getBrandId) + .collect(Collectors.toList()); + if (brands != null) { + List bakBrands = bakBrandMapper.selectBatchIds(brands); + if (bakBrands != null && bakBrands.size() > 0) { + for (BakBrand bakBrand : bakBrands) { + PmsBrand brand = new PmsBrand(); + brand.setBigPic(bakBrand.getPicUrl()); + brand.setName(bakBrand.getName()); + brand.setShowStatus(1); + brand.setFactoryStatus(1); + brand.setLogo(bakBrand.getPicUrl()); + brand.setSort(bakBrand.getSortOrder()); + pmsBrandMapper.insert(brand); + } } } } - } }); } return userMapper.insert(user) > 0; } - void createG(BakGoods gg,Integer storeId){ + + void createG(BakGoods gg, Long storeId) { PmsProduct g = new PmsProduct(); g.setName(gg.getName()); @@ -166,10 +168,10 @@ public class SysStoreServiceImpl extends ServiceImpl i g.setPic(gg.getPicUrl()); g.setAlbumPics(gg.getPicUrl()); - if (ValidatorUtils.notEmpty(gg.getCounterPrice())){ + if (ValidatorUtils.notEmpty(gg.getCounterPrice())) { g.setPrice(gg.getCounterPrice()); } - if (ValidatorUtils.notEmpty(gg.getRetailPrice())){ + if (ValidatorUtils.notEmpty(gg.getRetailPrice())) { g.setOriginalPrice(gg.getRetailPrice()); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysTestServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysTestServiceImpl.java index aa862b8890ceaa4fe642e356584ffed33f762b98..a8a285bb4fade51db12ac8d497c9f2da4bb9b18f 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysTestServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysTestServiceImpl.java @@ -9,15 +9,15 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; /** -* @author mallplus -* @date 2019-12-02 -*/ + * @author mallplus + * @date 2019-12-02 + */ @Service public class SysTestServiceImpl extends ServiceImpl implements ISysTestService { @Resource - private SysTestMapper sysTestMapper; + private SysTestMapper sysTestMapper; } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysUserServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysUserServiceImpl.java index 33a340a5028a16ee427c7b0187059df006bd9e44..5fefbebf5e3918177dc9a88c573fea966000e070 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysUserServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysUserServiceImpl.java @@ -2,6 +2,7 @@ package com.zscat.mallplus.sys.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.build.entity.UserCommunityRelate; import com.zscat.mallplus.build.mapper.UserCommunityRelateMapper; import com.zscat.mallplus.exception.BusinessMallException; @@ -17,7 +18,6 @@ import com.zscat.mallplus.util.JwtTokenUtil; import com.zscat.mallplus.util.UserUtils; import com.zscat.mallplus.utils.CommonResult; import com.zscat.mallplus.utils.ValidatorUtils; -import com.zscat.mallplus.ApiContext; import com.zscat.mallplus.vo.Rediskey; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -95,6 +95,9 @@ public class SysUserServiceImpl extends ServiceImpl impl private Integer dayCount; @Autowired private ApiContext apiContext; + @Resource + private UserCommunityRelateMapper userCommunityRelateMapper; + @Override public String refreshToken(String oldToken) { String token = oldToken.substring(tokenHead.length()); @@ -108,7 +111,7 @@ public class SysUserServiceImpl extends ServiceImpl impl public String login(String username, String password) { String token = null; //密码需要客户端加密后传递 - try { + try { UserDetails userDetails = userDetailsService.loadUserByUsername(username); if (!passwordEncoder.matches(password, userDetails.getPassword())) { throw new BadCredentialsException("密码不正确"); @@ -117,7 +120,7 @@ public class SysUserServiceImpl extends ServiceImpl impl userDetails, null, userDetails.getAuthorities()); SecurityContextHolder.getContext().setAuthentication(authentication); token = jwtTokenUtil.generateToken(userDetails); - + apiContext.setCurrentProviderId(UserUtils.getCurrentMember().getStoreId()); this.removePermissRedis(UserUtils.getCurrentMember().getId()); } catch (AuthenticationException e) { log.warn("登录异常:{}", e.getMessage()); @@ -206,7 +209,7 @@ public class SysUserServiceImpl extends ServiceImpl impl //查询是否有相同用户名的用户 SysUser umsAdminList = adminMapper.selectByUserName(umsAdmin.getUsername()); - if (umsAdminList!=null) { + if (umsAdminList != null) { return false; } //将密码进行加密操作 @@ -215,7 +218,7 @@ public class SysUserServiceImpl extends ServiceImpl impl } String md5Password = passwordEncoder.encode(umsAdmin.getPassword()); umsAdmin.setPassword(md5Password); - // umsAdmin.setStoreId(UserUtils.getCurrentMember().getStoreId()); + // umsAdmin.setStoreId(UserUtils.getCurrentMember().getStoreId()); adminMapper.insert(umsAdmin); updateRole(umsAdmin.getId(), umsAdmin.getRoleIds()); @@ -286,7 +289,7 @@ public class SysUserServiceImpl extends ServiceImpl impl //查询是否有相同用户名的用户 SysUser umsAdminList = adminMapper.selectByUserName(umsAdmin.getUsername()); - if (umsAdminList!=null) { + if (umsAdminList != null) { return new CommonResult().failed("手机号已注册"); } //将密码进行加密操作 @@ -302,15 +305,6 @@ public class SysUserServiceImpl extends ServiceImpl impl adminRoleRelationMapper.insert(roleRelation); return new CommonResult().failed("注册成功"); } - - //对输入的验证码进行校验 - public boolean verifyAuthCode(String authCode, String telephone) { - if (StringUtils.isEmpty(authCode)) { - return false; - } - String realAuthCode = redisService.get(REDIS_KEY_PREFIX_AUTH_CODE + telephone); - return authCode.equals(realAuthCode); - } // @Override // public SmsCode generateCode(String phone) { // //生成流水号 @@ -336,6 +330,15 @@ public class SysUserServiceImpl extends ServiceImpl impl // return smsCode; // } + //对输入的验证码进行校验 + public boolean verifyAuthCode(String authCode, String telephone) { + if (StringUtils.isEmpty(authCode)) { + return false; + } + String realAuthCode = redisService.get(REDIS_KEY_PREFIX_AUTH_CODE + telephone); + return authCode.equals(realAuthCode); + } + @Override public int updateShowStatus(List ids, Integer showStatus) { SysUser productCategory = new SysUser(); @@ -343,8 +346,6 @@ public class SysUserServiceImpl extends ServiceImpl impl return adminMapper.update(productCategory, new QueryWrapper().in("id", ids)); } - @Resource - private UserCommunityRelateMapper userCommunityRelateMapper; @Transactional @Override @@ -352,28 +353,28 @@ public class SysUserServiceImpl extends ServiceImpl impl //先删除原有关系 userCommunityRelateMapper.delete(new QueryWrapper().eq("user_id", entity.getUserId())); //批量插入新关系 - // List relationList = new ArrayList<>(); + // List relationList = new ArrayList<>(); if (!StringUtils.isEmpty(entity.getCommunityIds())) { String[] mids = entity.getCommunityIds().split(","); for (String permissionId : mids) { UserCommunityRelate relation = new UserCommunityRelate(); relation.setUserId(entity.getUserId()); relation.setCommunityId(Long.valueOf(permissionId)); - // relationList.add(relation); + // relationList.add(relation); userCommunityRelateMapper.insert(relation); } } - return 1; + return 1; } @Override public void updatePassword(String password, String newPassword) { SysUser oldUser = UserUtils.getCurrentMember(); - log.info("旧密码="+passwordEncoder.encode(password)); + log.info("旧密码=" + passwordEncoder.encode(password)); if (!passwordEncoder.matches(password, oldUser.getPassword())) { - // if (!oldUser.getPassword().equals(passwordEncoder.encode(password))){ - throw new BusinessMallException("旧密码错误"); + // if (!oldUser.getPassword().equals(passwordEncoder.encode(password))){ + throw new BusinessMallException("旧密码错误"); } SysUser role = new SysUser(); role.setId(oldUser.getId()); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysWebLogServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysWebLogServiceImpl.java index 7b962e6b2ad8cd48b96290c53f510f598d8cbc3a..4a418c3a2e8975f173b6018ea287a463de5e8e3b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysWebLogServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/SysWebLogServiceImpl.java @@ -24,6 +24,7 @@ public class SysWebLogServiceImpl extends ServiceImpl selectPageExt(LogParam entity) { return logMapper.getLogStatisc(entity); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/task/RyTask.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/task/RyTask.java index ef346608c7f299d689ba39776f052246b2467dec..e2d5c5896b593d7719b6027c8b48d98e93ae0539 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/task/RyTask.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/task/RyTask.java @@ -18,7 +18,6 @@ import java.util.Map; public class RyTask { - public static void main(String[] args) { Map params = new HashMap<>(); Calendar calendar = Calendar.getInstance(); @@ -34,7 +33,7 @@ public class RyTask { } public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { - // System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); + // System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); } public void ryParams(String params) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AbstractQuartzJob.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AbstractQuartzJob.java index 5a069ff4d2984730a7d7269e56abbc02321693ce..478d07e406ed0ca91dea097f641d0c823be65002 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AbstractQuartzJob.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AbstractQuartzJob.java @@ -17,8 +17,7 @@ import java.util.Date; * * @author ruoyi */ -public abstract class AbstractQuartzJob implements org.quartz.Job -{ +public abstract class AbstractQuartzJob implements org.quartz.Job { private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); /** @@ -27,21 +26,16 @@ public abstract class AbstractQuartzJob implements org.quartz.Job private static ThreadLocal threadLocal = new ThreadLocal<>(); @Override - public void execute(JobExecutionContext context) throws JobExecutionException - { + public void execute(JobExecutionContext context) throws JobExecutionException { AdminSysJob job = new AdminSysJob(); BeanUtils.copyBeanProp(job, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); - try - { + try { before(context, job); - if (job != null) - { + if (job != null) { doExecute(context, job); } after(context, job, null); - } - catch (Exception e) - { + } catch (Exception e) { log.error("任务执行异常 - :", e); after(context, job, e); } @@ -51,10 +45,9 @@ public abstract class AbstractQuartzJob implements org.quartz.Job * 执行前 * * @param context 工作执行上下文对象 - * @param job 系统计划任务 + * @param job 系统计划任务 */ - protected void before(JobExecutionContext context, AdminSysJob job) - { + protected void before(JobExecutionContext context, AdminSysJob job) { threadLocal.set(new Date()); } @@ -62,10 +55,9 @@ public abstract class AbstractQuartzJob implements org.quartz.Job * 执行后 * * @param context 工作执行上下文对象 - * @param job 系统计划任务 + * @param job 系统计划任务 */ - protected void after(JobExecutionContext context, AdminSysJob job, Exception e) - { + protected void after(JobExecutionContext context, AdminSysJob job, Exception e) { Date startTime = threadLocal.get(); threadLocal.remove(); @@ -77,14 +69,11 @@ public abstract class AbstractQuartzJob implements org.quartz.Job jobLog.setEndTime(new Date()); long runMs = jobLog.getEndTime().getTime() - jobLog.getStartTime().getTime(); jobLog.setJobMessage(jobLog.getJobName() + " 总共耗时:" + runMs + "毫秒"); - if (e != null) - { + if (e != null) { jobLog.setStatus(Constants.FAIL); String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); jobLog.setExceptionInfo(errorMsg); - } - else - { + } else { jobLog.setStatus(Constants.SUCCESS); } @@ -96,7 +85,7 @@ public abstract class AbstractQuartzJob implements org.quartz.Job * 执行方法,由子类重载 * * @param context 工作执行上下文对象 - * @param job 系统计划任务 + * @param job 系统计划任务 * @throws Exception 执行过程中的异常 */ protected abstract void doExecute(JobExecutionContext context, AdminSysJob job) throws Exception; diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AliPayStatusEnum.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AliPayStatusEnum.java index 82b8ab5651453a34f220c28e86197ab60820ee58..76ec98413f0b6b831c55c2ad65370b02c753e19b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AliPayStatusEnum.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AliPayStatusEnum.java @@ -2,10 +2,11 @@ package com.zscat.mallplus.sys.util; /** * 支付状态 + * * @author zhengjie * @date 2018/08/01 16:45:43 */ -public enum AliPayStatusEnum { +public enum AliPayStatusEnum { FINISHED("交易成功", "TRADE_FINISHED"), diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AlipayUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AlipayUtils.java index 95c3918a651cd8b95caa915e4de53d8e1367450d..4e347422b95e12daac5e6d31ffbdeca480e6cbbf 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AlipayUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/AlipayUtils.java @@ -13,6 +13,7 @@ import java.util.Map; /** * 支付宝工具类 + * * @author zhengjie * @date 2018/09/30 14:04:35 */ @@ -21,11 +22,12 @@ public class AlipayUtils { /** * 生成订单号 + * * @return String */ public String getOrderCode() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - int a = (int)(Math.random() * 9000.0D) + 1000; + int a = (int) (Math.random() * 9000.0D) + 1000; System.out.println(a); Date date = new Date(); String str = sdf.format(date); @@ -39,14 +41,15 @@ public class AlipayUtils { /** * 校验签名 + * * @param request HttpServletRequest - * @param alipay 阿里云配置 + * @param alipay 阿里云配置 * @return boolean */ - public boolean rsaCheck(HttpServletRequest request, SysAlipayConfig alipay){ + public boolean rsaCheck(HttpServletRequest request, SysAlipayConfig alipay) { // 获取支付宝POST过来反馈信息 - Map params = new HashMap<>(1); + Map params = new HashMap<>(1); Map requestParams = request.getParameterMap(); for (Object o : requestParams.keySet()) { String name = (String) o; diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/BeanUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/BeanUtils.java index 40bcbe724bf698009b132a536c062739f0b62de2..772f91709c3c590918fefe4d600d926aa2a6d3fc 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/BeanUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/BeanUtils.java @@ -11,31 +11,32 @@ import java.util.regex.Pattern; * * @author ruoyi */ -public class BeanUtils extends org.springframework.beans.BeanUtils -{ - /** Bean方法名中属性名开始的下标 */ +public class BeanUtils extends org.springframework.beans.BeanUtils { + /** + * Bean方法名中属性名开始的下标 + */ private static final int BEAN_METHOD_PROP_INDEX = 3; - /** * 匹配getter方法的正则表达式 */ + /** + * 匹配getter方法的正则表达式 + */ private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); - /** * 匹配setter方法的正则表达式 */ + /** + * 匹配setter方法的正则表达式 + */ private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); /** * Bean属性复制工具方法。 * * @param dest 目标对象 - * @param src 源对象 + * @param src 源对象 */ - public static void copyBeanProp(Object dest, Object src) - { - try - { + public static void copyBeanProp(Object dest, Object src) { + try { copyProperties(src, dest); - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); } } @@ -46,8 +47,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils * @param obj 对象 * @return 对象的setter方法列表 */ - public static List getSetterMethods(Object obj) - { + public static List getSetterMethods(Object obj) { // setter方法列表 List setterMethods = new ArrayList(); @@ -56,11 +56,9 @@ public class BeanUtils extends org.springframework.beans.BeanUtils // 查找setter方法 - for (Method method : methods) - { + for (Method method : methods) { Matcher m = SET_PATTERN.matcher(method.getName()); - if (m.matches() && (method.getParameterTypes().length == 1)) - { + if (m.matches() && (method.getParameterTypes().length == 1)) { setterMethods.add(method); } } @@ -75,18 +73,15 @@ public class BeanUtils extends org.springframework.beans.BeanUtils * @return 对象的getter方法列表 */ - public static List getGetterMethods(Object obj) - { + public static List getGetterMethods(Object obj) { // getter方法列表 List getterMethods = new ArrayList(); // 获取所有方法 Method[] methods = obj.getClass().getMethods(); // 查找getter方法 - for (Method method : methods) - { + for (Method method : methods) { Matcher m = GET_PATTERN.matcher(method.getName()); - if (m.matches() && (method.getParameterTypes().length == 0)) - { + if (m.matches() && (method.getParameterTypes().length == 0)) { getterMethods.add(method); } } @@ -103,8 +98,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils * @return 属性名一样返回true,否则返回false */ - public static boolean isMethodPropEquals(String m1, String m2) - { + public static boolean isMethodPropEquals(String m1, String m2) { return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/Constants.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/Constants.java index b657fde2854b76dc6358505823b8eb27e42f412b..b04fc4d3df5a0b33b4f6e80411163b10934e2d58 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/Constants.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/Constants.java @@ -5,8 +5,7 @@ package com.zscat.mallplus.sys.util; * * @author ruoyi */ -public class Constants -{ +public class Constants { /** * UTF-8 字符集 */ diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/CronUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/CronUtils.java index cf834efee323923f47155510bf949b9df82a356d..f0694e7e71504c6e38e7e5a2cc1c5a0ca88036ac 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/CronUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/CronUtils.java @@ -9,18 +9,15 @@ import java.util.Date; * cron表达式工具类 * * @author ruoyi - * */ -public class CronUtils -{ +public class CronUtils { /** * 返回一个布尔值代表一个给定的Cron表达式的有效性 * * @param cronExpression Cron表达式 * @return boolean 表达式是否有效 */ - public static boolean isValid(String cronExpression) - { + public static boolean isValid(String cronExpression) { return CronExpression.isValidExpression(cronExpression); } @@ -30,15 +27,11 @@ public class CronUtils * @param cronExpression Cron表达式 * @return String 无效时返回表达式错误描述,如果有效返回null */ - public static String getInvalidMessage(String cronExpression) - { - try - { + public static String getInvalidMessage(String cronExpression) { + try { new CronExpression(cronExpression); return null; - } - catch (ParseException pe) - { + } catch (ParseException pe) { return pe.getMessage(); } } @@ -49,15 +42,11 @@ public class CronUtils * @param cronExpression Cron表达式 * @return Date 下次Cron表达式执行时间 */ - public static Date getNextExecution(String cronExpression) - { - try - { + public static Date getNextExecution(String cronExpression) { + try { CronExpression cron = new CronExpression(cronExpression); return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); - } - catch (ParseException e) - { + } catch (ParseException e) { throw new IllegalArgumentException(e.getMessage()); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ExceptionUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ExceptionUtil.java index 92e75f74143c4c217ccd11e0f746550eea7b8e25..c990fb86e817e3d76dff1673e330f1fb20d1bbbe 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ExceptionUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ExceptionUtil.java @@ -12,30 +12,25 @@ import java.io.StringWriter; * * @author ruoyi */ -public class ExceptionUtil -{ +public class ExceptionUtil { /** * 获取exception的详细错误信息。 */ - public static String getExceptionMessage(Throwable e) - { + public static String getExceptionMessage(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw, true)); String str = sw.toString(); return str; } - public static String getRootErrorMseeage(Exception e) - { + public static String getRootErrorMseeage(Exception e) { Throwable root = ExceptionUtils.getRootCause(e); root = (root == null ? e : root); - if (root == null) - { + if (root == null) { return ""; } String msg = root.getMessage(); - if (msg == null) - { + if (msg == null) { return "null"; } return StringUtils.defaultString(msg); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/JobInvokeUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/JobInvokeUtil.java index 3766c1440c6eb7096aed3d15e8083f7dabae662e..d5442d8144f7df361b299580874a99eba1ce3446 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/JobInvokeUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/JobInvokeUtil.java @@ -14,27 +14,22 @@ import java.util.List; * * @author ruoyi */ -public class JobInvokeUtil -{ +public class JobInvokeUtil { /** * 执行方法 * * @param job 系统任务 */ - public static void invokeMethod(AdminSysJob job) throws Exception - { + public static void invokeMethod(AdminSysJob job) throws Exception { String invokeTarget = job.getInvokeTarget(); String beanName = getBeanName(invokeTarget); String methodName = getMethodName(invokeTarget); List methodParams = getMethodParams(invokeTarget); - if (!isValidClassName(beanName)) - { + if (!isValidClassName(beanName)) { Object bean = SpringUtils.getBean(beanName); invokeMethod(bean, methodName, methodParams); - } - else - { + } else { Object bean = Class.forName(beanName).newInstance(); invokeMethod(bean, methodName, methodParams); } @@ -43,21 +38,17 @@ public class JobInvokeUtil /** * 调用任务方法 * - * @param bean 目标对象 - * @param methodName 方法名称 + * @param bean 目标对象 + * @param methodName 方法名称 * @param methodParams 方法参数 */ private static void invokeMethod(Object bean, String methodName, List methodParams) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException - { - if (methodParams!=null && methodParams.size() > 0) - { + InvocationTargetException { + if (methodParams != null && methodParams.size() > 0) { Method method = bean.getClass().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); method.invoke(bean, getMethodParamsValue(methodParams)); - } - else - { + } else { Method method = bean.getClass().getDeclaredMethod(methodName); method.invoke(bean); } @@ -69,8 +60,7 @@ public class JobInvokeUtil * @param invokeTarget 名称 * @return true是 false否 */ - public static boolean isValidClassName(String invokeTarget) - { + public static boolean isValidClassName(String invokeTarget) { return StringUtils.countMatches(invokeTarget, ".") > 1; } @@ -80,8 +70,7 @@ public class JobInvokeUtil * @param invokeTarget 目标字符串 * @return bean名称 */ - public static String getBeanName(String invokeTarget) - { + public static String getBeanName(String invokeTarget) { String beanName = StringUtils.substringBefore(invokeTarget, "("); return StringUtils.substringBeforeLast(beanName, "."); } @@ -92,8 +81,7 @@ public class JobInvokeUtil * @param invokeTarget 目标字符串 * @return method方法 */ - public static String getMethodName(String invokeTarget) - { + public static String getMethodName(String invokeTarget) { String methodName = StringUtils.substringBefore(invokeTarget, "("); return StringUtils.substringAfterLast(methodName, "."); } @@ -104,42 +92,34 @@ public class JobInvokeUtil * @param invokeTarget 目标字符串 * @return method方法相关参数列表 */ - public static List getMethodParams(String invokeTarget) - { + public static List getMethodParams(String invokeTarget) { String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); - if (StringUtils.isEmpty(methodStr)) - { + if (StringUtils.isEmpty(methodStr)) { return null; } String[] methodParams = methodStr.split(","); List classs = new LinkedList<>(); - for (int i = 0; i < methodParams.length; i++) - { + for (int i = 0; i < methodParams.length; i++) { String str = StringUtils.trimToEmpty(methodParams[i]); // String字符串类型,包含' - if (StringUtils.contains(str, "'")) - { - classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class }); + if (StringUtils.contains(str, "'")) { + classs.add(new Object[]{StringUtils.replace(str, "'", ""), String.class}); } // boolean布尔类型,等于true或者false - else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) - { - classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); + else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) { + classs.add(new Object[]{Boolean.valueOf(str), Boolean.class}); } // long长整形,包含L - else if (StringUtils.containsIgnoreCase(str, "L")) - { - classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class }); + else if (StringUtils.containsIgnoreCase(str, "L")) { + classs.add(new Object[]{Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class}); } // double浮点类型,包含D - else if (StringUtils.containsIgnoreCase(str, "D")) - { - classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class }); + else if (StringUtils.containsIgnoreCase(str, "D")) { + classs.add(new Object[]{Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class}); } // 其他类型归类为整形 - else - { - classs.add(new Object[] { Integer.valueOf(str), Integer.class }); + else { + classs.add(new Object[]{Integer.valueOf(str), Integer.class}); } } return classs; @@ -151,12 +131,10 @@ public class JobInvokeUtil * @param methodParams 参数相关列表 * @return 参数类型列表 */ - public static Class[] getMethodParamsType(List methodParams) - { + public static Class[] getMethodParamsType(List methodParams) { Class[] classs = new Class[methodParams.size()]; int index = 0; - for (Object[] os : methodParams) - { + for (Object[] os : methodParams) { classs[index] = (Class) os[1]; index++; } @@ -169,12 +147,10 @@ public class JobInvokeUtil * @param methodParams 参数相关列表 * @return 参数值列表 */ - public static Object[] getMethodParamsValue(List methodParams) - { + public static Object[] getMethodParamsValue(List methodParams) { Object[] classs = new Object[methodParams.size()]; int index = 0; - for (Object[] os : methodParams) - { + for (Object[] os : methodParams) { classs[index] = (Object) os[0]; index++; } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzDisallowConcurrentExecution.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzDisallowConcurrentExecution.java index 02ed9fc5a1e6bb9ac18a555c067f208aa6e8368f..d431d990d156cfdf900388f3a4dc3017cfd4c8c1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzDisallowConcurrentExecution.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzDisallowConcurrentExecution.java @@ -8,14 +8,11 @@ import org.quartz.JobExecutionContext; * 定时任务处理(禁止并发执行) * * @author ruoyi - * */ @DisallowConcurrentExecution -public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob -{ +public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob { @Override - protected void doExecute(JobExecutionContext context, AdminSysJob job) throws Exception - { + protected void doExecute(JobExecutionContext context, AdminSysJob job) throws Exception { JobInvokeUtil.invokeMethod(job); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzJobExecution.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzJobExecution.java index c6ae07918d816973533bc84a3c0b30e84e36cafa..ef6770fd18fe70da9f8a4e455bb6622249ee0a90 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzJobExecution.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/QuartzJobExecution.java @@ -7,13 +7,10 @@ import org.quartz.JobExecutionContext; * 定时任务处理(允许并发执行) * * @author ruoyi - * */ -public class QuartzJobExecution extends AbstractQuartzJob -{ +public class QuartzJobExecution extends AbstractQuartzJob { @Override - protected void doExecute(JobExecutionContext context, AdminSysJob job) throws Exception - { + protected void doExecute(JobExecutionContext context, AdminSysJob job) throws Exception { JobInvokeUtil.invokeMethod(job); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleConstants.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleConstants.java index 1ed620b09d57055032632edc03c86f2be820d74b..182c5acc4f86a2e856aff3f39c21eadf6e0a19f7 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleConstants.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleConstants.java @@ -5,27 +5,35 @@ package com.zscat.mallplus.sys.util; * * @author ruoyi */ -public interface ScheduleConstants -{ +public interface ScheduleConstants { public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; - /** 执行目标key */ + /** + * 执行目标key + */ public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; - /** 默认 */ + /** + * 默认 + */ public static final String MISFIRE_DEFAULT = "0"; - /** 立即触发执行 */ + /** + * 立即触发执行 + */ public static final String MISFIRE_IGNORE_MISFIRES = "1"; - /** 触发一次执行 */ + /** + * 触发一次执行 + */ public static final String MISFIRE_FIRE_AND_PROCEED = "2"; - /** 不触发立即执行 */ + /** + * 不触发立即执行 + */ public static final String MISFIRE_DO_NOTHING = "3"; - public enum Status - { + public enum Status { /** * 正常 */ @@ -37,13 +45,11 @@ public interface ScheduleConstants private Integer value; - private Status(Integer value) - { + private Status(Integer value) { this.value = value; } - public Integer getValue() - { + public Integer getValue() { return value; } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleUtils.java index 5a96531e1efe6cbdbea88b9e451943233a69f019..def39abb653a06e887a19ddd557f1aca6004897c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/ScheduleUtils.java @@ -8,18 +8,15 @@ import org.quartz.*; * 定时任务工具类 * * @author ruoyi - * */ -public class ScheduleUtils -{ +public class ScheduleUtils { /** * 得到quartz任务类 * * @param job 执行计划 * @return 具体执行任务类 */ - private static Class getQuartzJobClass(AdminSysJob job) - { + private static Class getQuartzJobClass(AdminSysJob job) { boolean isConcurrent = "0".equals(job.getConcurrent()); return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; } @@ -27,24 +24,21 @@ public class ScheduleUtils /** * 构建任务触发对象 */ - public static TriggerKey getTriggerKey(Long jobId, String jobGroup) - { + public static TriggerKey getTriggerKey(Long jobId, String jobGroup) { return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); } /** * 构建任务键对象 */ - public static JobKey getJobKey(Long jobId, String jobGroup) - { + public static JobKey getJobKey(Long jobId, String jobGroup) { return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); } /** * 创建定时任务 */ - public static void createScheduleJob(Scheduler scheduler, AdminSysJob job) - { + public static void createScheduleJob(Scheduler scheduler, AdminSysJob job) { Class jobClass = getQuartzJobClass(job); // 构建job信息 Long jobId = job.getJobId(); @@ -64,16 +58,14 @@ public class ScheduleUtils // 判断是否存在 try { - if (scheduler.checkExists(getJobKey(jobId, jobGroup))) - { + if (scheduler.checkExists(getJobKey(jobId, jobGroup))) { // 防止创建时存在数据问题 先移除,然后在执行创建操作 scheduler.deleteJob(getJobKey(jobId, jobGroup)); } scheduler.scheduleJob(jobDetail, trigger); // 暂停任务 - if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) - { + if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) { scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); } } catch (SchedulerException e) { @@ -86,11 +78,8 @@ public class ScheduleUtils /** * 设置定时任务策略 */ - public static CronScheduleBuilder handleCronScheduleMisfirePolicy(AdminSysJob job, CronScheduleBuilder cb) - - { - switch (job.getMisfirePolicy()) - { + public static CronScheduleBuilder handleCronScheduleMisfirePolicy(AdminSysJob job, CronScheduleBuilder cb) { + switch (job.getMisfirePolicy()) { case ScheduleConstants.MISFIRE_DEFAULT: return cb; case ScheduleConstants.MISFIRE_IGNORE_MISFIRES: diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/SpringUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/SpringUtils.java index 0610b14503d4abd290667f16a4a8425f58c88687..4fc4a04b4fbdc6c55269c751dc948baaf1f573f6 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/SpringUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/util/SpringUtils.java @@ -13,28 +13,21 @@ import org.springframework.stereotype.Component; * @author ruoyi */ @Component -public final class SpringUtils implements BeanFactoryPostProcessor -{ - /** Spring应用上下文环境 */ +public final class SpringUtils implements BeanFactoryPostProcessor { + /** + * Spring应用上下文环境 + */ private static ConfigurableListableBeanFactory beanFactory; - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException - { - SpringUtils.beanFactory = beanFactory; - } - /** * 获取对象 * * @param name * @return Object 一个以所给名字注册的bean的实例 * @throws BeansException - * */ @SuppressWarnings("unchecked") - public static T getBean(String name) throws BeansException - { + public static T getBean(String name) throws BeansException { return (T) beanFactory.getBean(name); } @@ -44,10 +37,8 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @param clz * @return * @throws BeansException - * */ - public static T getBean(Class clz) throws BeansException - { + public static T getBean(Class clz) throws BeansException { T result = (T) beanFactory.getBean(clz); return result; } @@ -58,8 +49,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @param name * @return boolean */ - public static boolean containsBean(String name) - { + public static boolean containsBean(String name) { return beanFactory.containsBean(name); } @@ -69,10 +59,8 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @param name * @return boolean * @throws NoSuchBeanDefinitionException - * */ - public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException - { + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException { return beanFactory.isSingleton(name); } @@ -80,10 +68,8 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @param name * @return Class 注册对象的类型 * @throws NoSuchBeanDefinitionException - * */ - public static Class getType(String name) throws NoSuchBeanDefinitionException - { + public static Class getType(String name) throws NoSuchBeanDefinitionException { return beanFactory.getType(name); } @@ -93,10 +79,8 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @param name * @return * @throws NoSuchBeanDefinitionException - * */ - public static String[] getAliases(String name) throws NoSuchBeanDefinitionException - { + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException { return beanFactory.getAliases(name); } @@ -107,8 +91,12 @@ public final class SpringUtils implements BeanFactoryPostProcessor * @return */ @SuppressWarnings("unchecked") - public static T getAopProxy(T invoker) - { + public static T getAopProxy(T invoker) { return (T) AopContext.currentProxy(); } + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + SpringUtils.beanFactory = beanFactory; + } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/SysAppletSetController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/SysAppletSetController.java index bd38bb011624b56daf8df573e422b7605dcd93bc..7ef5974592b7c8fa6932046a71f02beb0c953620 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/SysAppletSetController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/SysAppletSetController.java @@ -70,7 +70,7 @@ public class SysAppletSetController { @PostMapping(value = "/update/{id}") public Object updateSysAppletSet(@RequestBody SysAppletSet entity) { try { - if (ISysAppletSetService.update(entity,new QueryWrapper<>())) { + if (ISysAppletSetService.update(entity, new QueryWrapper<>())) { return new CommonResult().success(); } } catch (Exception e) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationChangeHistoryController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationChangeHistoryController.java index d624e4387fe79aaae95ffde2b5960885b2953dc9..d4ca69853dd17985314f4c48c53d03f9528ca018 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationChangeHistoryController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationChangeHistoryController.java @@ -65,5 +65,4 @@ public class UmsIntegrationChangeHistoryController { } - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationConsumeSettingController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationConsumeSettingController.java index f0d9a415f923081d4bcba727fcb04d0ebfe58916..1d4e73ca16e7f8fa7841c9e315390f11147956ca 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationConsumeSettingController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsIntegrationConsumeSettingController.java @@ -68,7 +68,7 @@ public class UmsIntegrationConsumeSettingController { @SysLog(MODULE = "ums", REMARK = "更新积分消费设置") @ApiOperation("更新积分消费设置") @PostMapping(value = "/update/{id}") - // @PreAuthorize("hasAuthority('ums:UmsIntegrationConsumeSetting:update')") + // @PreAuthorize("hasAuthority('ums:UmsIntegrationConsumeSetting:update')") public Object updateUmsIntegrationConsumeSetting(@RequestBody UmsIntegrationConsumeSetting entity) { try { if (IUmsIntegrationConsumeSettingService.updateById(entity)) { diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberBlanceLogController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberBlanceLogController.java index efff9d169a99743ae2bb584921a7565f860aaa33..bd3125a5309e85d54281a146fd1b407ef9ade0c0 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberBlanceLogController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberBlanceLogController.java @@ -65,5 +65,4 @@ public class UmsMemberBlanceLogController { } - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberController.java index e3e82744e638962eba97c6cae171a4b03f84b119..7456cf8b50720063078ca9404cc824121df86135 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UmsMemberController.java @@ -111,7 +111,8 @@ public class UmsMemberController { @RequestParam("blance") BigDecimal blance) { try { UmsMember entity = new UmsMember(); - entity.setId(id);entity.setBlance(blance); + entity.setId(id); + entity.setBlance(blance); UmsMember member = IUmsMemberService.getById(entity.getId()); entity.setBlance(entity.getBlance().add(member.getBlance())); UmsMemberBlanceLog blog = new UmsMemberBlanceLog(); @@ -142,7 +143,8 @@ public class UmsMemberController { try { UmsMember entity = new UmsMember(); - entity.setId(id);entity.setIntegration(integration); + entity.setId(id); + entity.setIntegration(integration); UmsMember member = IUmsMemberService.getById(entity.getId()); entity.setIntegration(entity.getIntegration() + member.getIntegration()); @@ -151,7 +153,7 @@ public class UmsMemberController { history.setChangeCount(entity.getIntegration()); history.setCreateTime(new Date()); history.setChangeType(AllEnum.ChangeType.Add.code()); - history.setOperateNote("后台积分充值:"+integration); + history.setOperateNote("后台积分充值:" + integration); history.setSourceType(AllEnum.ChangeSource.admin.code()); history.setOperateMan(UserUtils.getCurrentMember().getId() + ""); umsIntegrationChangeHistoryService.insert(history); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserBankcardsController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserBankcardsController.java index a3bf3d0277e84debbcc181f948e6c4ae9a7f2b77..0823b3546e4282cfb397dc98df86f4a5f7453615 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserBankcardsController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserBankcardsController.java @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RestController; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserTocashController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserTocashController.java index dbc6280bfbdb6427509ae0b1ac6d36793a221eb9..903eec23ab8159ea81d1009c8c69cbcb7f8dd5cb 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserTocashController.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/controller/UserTocashController.java @@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RestController; /** *

- * 前端控制器 + * 前端控制器 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/ISysAppletSetService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/ISysAppletSetService.java index 7d60ff2f535dcd592ea8f355ae93d9d08cd8b99a..f3d53e9113d03e5ddf51c79a6d061d93823ca866 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/ISysAppletSetService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/ISysAppletSetService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.ums.entity.SysAppletSet; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserBankcardsService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserBankcardsService.java index 19deb7695e552a3d837dfac0e8c030c14c91161f..bae27115fcb3f392dfbd325da18afc2c700b328c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserBankcardsService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserBankcardsService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.ums.entity.UserBankcards; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserTocashService.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserTocashService.java index b00e7e6734853f42e2ed2629542c201e9e9dbb4e..16ac3f3f11e30d4f8b08a8cd5625f0c2ed8d874c 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserTocashService.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/IUserTocashService.java @@ -5,7 +5,7 @@ import com.zscat.mallplus.ums.entity.UserTocash; /** *

- * 服务类 + * 服务类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/SysAppletSetServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/SysAppletSetServiceImpl.java index 6049db40ed69fc13577d43491fbc09f7b2e1ce55..1bfd23512cc8f629d9bdb262294749ea194fe0c3 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/SysAppletSetServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/SysAppletSetServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UmsMemberServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UmsMemberServiceImpl.java index b908223e2c26bc9d45ba394618e142ce371b500f..68c5188eff65d27abe8b87235e6a315c78e0ca43 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UmsMemberServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UmsMemberServiceImpl.java @@ -34,14 +34,14 @@ public class UmsMemberServiceImpl extends ServiceImpl orders = omsOrderMapper.listOrderGroupByMemberId(); + List orders = omsOrderMapper.listOrderGroupByMemberId(); List levelList = memberLevelService.list(new QueryWrapper().orderByDesc("price")); - for (OrderStstic o : orders){ + for (OrderStstic o : orders) { UmsMember member = new UmsMember(); member.setId(o.getMemberId()); member.setBuyMoney(o.getTotalPayAmount()); - for (UmsMemberLevel level: levelList){ - if (member.getBuyMoney().compareTo(level.getPrice())>=0){ + for (UmsMemberLevel level : levelList) { + if (member.getBuyMoney().compareTo(level.getPrice()) >= 0) { member.setMemberLevelId(level.getId()); member.setMemberLevelName(level.getName()); break; diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserBankcardsServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserBankcardsServiceImpl.java index a2fb0eff7f1630871d949583080600a747d42cab..aedb6a28e0e2c7dce7601a4a2445003c3a75105e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserBankcardsServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserBankcardsServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserTocashServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserTocashServiceImpl.java index 33fd3aac5e88bc42566d424123e9c56ab72e3045..bf9a973f85f8c4d28298573723d88e9cf6db2cb4 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserTocashServiceImpl.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/ums/service/impl/UserTocashServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zscat diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/ColUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/ColUtil.java index 16552ef31c7a46e15022c3fea75c7385f8a42e75..b0a217fa708c58464c3b8332c6a9fdf710e65742 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/ColUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/ColUtil.java @@ -14,13 +14,14 @@ public class ColUtil { /** * 转换mysql数据类型为java数据类型 + * * @param type 数据库字段类型 * @return String */ - static String cloToJava(String type){ + static String cloToJava(String type) { Configuration config = getConfig(); assert config != null; - return config.getString(type,"unknowType"); + return config.getString(type, "unknowType"); } /** @@ -28,7 +29,7 @@ public class ColUtil { */ public static PropertiesConfiguration getConfig() { try { - return new PropertiesConfiguration("generator.properties" ); + return new PropertiesConfiguration("generator.properties"); } catch (ConfigurationException e) { e.printStackTrace(); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/DateUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/DateUtils.java index b0f1e55b02c9112586491527a6b0645c40d110e7..2fc659db39adc93f8929ee5ba1de6e5bb85c09cc 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/DateUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/DateUtils.java @@ -41,6 +41,9 @@ public class DateUtils { {"\\d{4}((([0][1,3-9]|[1][0-2]|[1-9])([0-2]\\d|[3][0,1]|[1-9]))|((02|2)(([1-9])|[0-2]\\d)))([0,1]\\d|[2][0-3])([0-5]\\d|\\d)([0-5]\\d|\\d)\\d{1,3}", DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS_SSS} }; + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); + private static Calendar calendar = Calendar.getInstance(); + public static Date toDate(String d) throws Exception { return FORMATER_DATE_YMD.parse(d); } @@ -124,6 +127,7 @@ public class DateUtils { return FORMATER_DATE_YMD.format(cd.getTime()); } + /** * 转换为时间类型格式 * @@ -140,7 +144,6 @@ public class DateUtils { } } - /** * 根据传入的日期格式字符串,获取日期的格式 * @@ -164,6 +167,7 @@ public class DateUtils { } return style; } + /** * 返回当前时间的"yyyy-MM-dd"格式字符串 */ @@ -286,15 +290,12 @@ public class DateUtils { return cal.getTime(); } - private static SimpleDateFormat sdf=new SimpleDateFormat("yyyyMM"); - private static Calendar calendar=Calendar.getInstance(); - /* 输入日期字符串比如201703,返回当月第一天的Date */ - public static Date getMinDateMonth(String month){ + public static Date getMinDateMonth(String month) { try { - Date nowDate=sdf.parse(month); + Date nowDate = sdf.parse(month); calendar = Calendar.getInstance(); calendar.setTime(nowDate); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); @@ -308,9 +309,9 @@ public class DateUtils { /* 输入日期字符串,返回当月最后一天的Date */ - public static Date getMaxDateMonth(String month){ + public static Date getMaxDateMonth(String month) { try { - Date nowDate=sdf.parse(month); + Date nowDate = sdf.parse(month); calendar = Calendar.getInstance(); calendar.setTime(nowDate); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); @@ -322,7 +323,7 @@ public class DateUtils { } public static void main(String[] args) throws Exception { - String month="201705"; + String month = "201705"; System.out.println(getMinDateMonth(month)); System.out.println(getMaxDateMonth(month)); System.out.println(DateUtils.geLastDayByMonth()); diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/EasyPoiUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/EasyPoiUtils.java index 71c5f73d89e19be4c9413eb082075257e1c9bb5c..c14bf11e5ed78d8c9418785ec6ede9dd2fb37daa 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/EasyPoiUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/EasyPoiUtils.java @@ -18,7 +18,8 @@ import java.util.Map; public final class EasyPoiUtils { - private EasyPoiUtils() {} + private EasyPoiUtils() { + } private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { try { @@ -27,24 +28,24 @@ public final class EasyPoiUtils { response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); workbook.write(response.getOutputStream()); } catch (IOException e) { - throw new RuntimeException(e); + throw new RuntimeException(e); } } - private static void defaultExport(List dataList, Class clz, String fileName, HttpServletResponse response, ExportParams exportParams) { + private static void defaultExport(List dataList, Class clz, String fileName, HttpServletResponse response, ExportParams exportParams) { Workbook workbook = ExcelExportUtil.exportExcel(exportParams, clz, dataList); if (workbook != null) { downLoadExcel(fileName, response, workbook); } } - public static void exportExcel(List dataList, String title, String sheetName, Class clz, String fileName, boolean isCreateHeader, HttpServletResponse response) { + public static void exportExcel(List dataList, String title, String sheetName, Class clz, String fileName, boolean isCreateHeader, HttpServletResponse response) { ExportParams exportParams = new ExportParams(title, sheetName); exportParams.setCreateHeadRows(isCreateHeader); defaultExport(dataList, clz, fileName, response, exportParams); } - public static void exportExcel(List dataList, String title, String sheetName, Class clz, String fileName, HttpServletResponse response) { + public static void exportExcel(List dataList, String title, String sheetName, Class clz, String fileName, HttpServletResponse response) { defaultExport(dataList, clz, fileName, response, new ExportParams(title, sheetName)); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileTypeMap.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileTypeMap.java index 84a9265d98e4396e47f07815a79cb430472b3235..5aa4f4f36255f0a98c48f09a8f4ff77a22b37a86 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileTypeMap.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileTypeMap.java @@ -5,20 +5,22 @@ import java.util.Map; /** * 文件类型

允许上传的类型

+ * * @author Peter * @date 2018-4-11 */ public class FileTypeMap { public static final Map map = new HashMap(9); + static { - map.put("jpeg","FFD8FF"); - map.put("jpg","FFD8FFE0"); - map.put("png","89504E47"); - map.put("wav","57415645"); - map.put("avi","41564920"); - map.put("mp4","00000020667479706D70"); - map.put("mp3","49443303000000002176"); + map.put("jpeg", "FFD8FF"); + map.put("jpg", "FFD8FFE0"); + map.put("png", "89504E47"); + map.put("wav", "57415645"); + map.put("avi", "41564920"); + map.put("mp4", "00000020667479706D70"); + map.put("mp3", "49443303000000002176"); } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtil.java index 8b8d4e54c5f7179d7fd6e01c7149635c06fe6f86..2157e67a96e6fa7154dc31e568b49a17ae126259 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtil.java @@ -5,7 +5,6 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.ExcelUtil; - import com.zscat.mallplus.exception.BusinessMallException; import org.springframework.web.multipart.MultipartFile; @@ -22,6 +21,7 @@ import java.util.Map; /** * File工具类,扩展 hutool 工具包 + * * @author mallplus * @date 2018-12-27 */ @@ -48,11 +48,11 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { /** * MultipartFile转File */ - public static File toFile(MultipartFile multipartFile){ + public static File toFile(MultipartFile multipartFile) { // 获取文件名 String fileName = multipartFile.getOriginalFilename(); // 获取文件后缀 - String prefix="."+getExtensionName(fileName); + String prefix = "." + getExtensionName(fileName); File file = null; try { // 用uuid作为文件名,防止生成的临时文件重复 @@ -71,7 +71,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { public static String getExtensionName(String filename) { if ((filename != null) && (filename.length() > 0)) { int dot = filename.lastIndexOf('.'); - if ((dot >-1) && (dot < (filename.length() - 1))) { + if ((dot > -1) && (dot < (filename.length() - 1))) { return filename.substring(dot + 1); } } @@ -84,7 +84,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { public static String getFileNameNoEx(String filename) { if ((filename != null) && (filename.length() > 0)) { int dot = filename.lastIndexOf('.'); - if ((dot >-1) && (dot < (filename.length()))) { + if ((dot > -1) && (dot < (filename.length()))) { return filename.substring(0, dot); } } @@ -94,7 +94,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { /** * 文件大小转换 */ - public static String getSize(long size){ + public static String getSize(long size) { String resultSize; if (size / GB >= 1) { //如果当前Byte的值大于等于1GB @@ -114,7 +114,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { /** * inputStream 转 File */ - static File inputStreamToFile(InputStream ins, String name) throws Exception{ + static File inputStreamToFile(InputStream ins, String name) throws Exception { File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name); if (file.exists()) { return file; @@ -160,10 +160,10 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { public static String fileToBase64(File file) throws Exception { FileInputStream inputFile = new FileInputStream(file); String base64; - byte[] buffer = new byte[(int)file.length()]; + byte[] buffer = new byte[(int) file.length()]; inputFile.read(buffer); inputFile.close(); - base64=Base64.encode(buffer); + base64 = Base64.encode(buffer); return base64.replaceAll("[\\s*\t\n\r]", ""); } @@ -171,16 +171,16 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { * 导出excel */ public static void downloadExcel(List> list, HttpServletResponse response) throws IOException { - String tempPath =System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx"; + String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx"; File file = new File(tempPath); - BigExcelWriter writer= ExcelUtil.getBigWriter(file); + BigExcelWriter writer = ExcelUtil.getBigWriter(file); // 一次性写出内容,使用默认样式,强制输出标题 writer.write(list, true); //response为HttpServletResponse对象 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 - response.setHeader("Content-Disposition","attachment;filename=file.xlsx"); - ServletOutputStream out=response.getOutputStream(); + response.setHeader("Content-Disposition", "attachment;filename=file.xlsx"); + ServletOutputStream out = response.getOutputStream(); // 终止后删除临时文件 file.deleteOnExit(); writer.flush(out, true); @@ -193,13 +193,13 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { String music = "mp3 wav wma mpa ram ra aac aif m4a"; String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg"; String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg"; - if(image.contains(type)){ + if (image.contains(type)) { return "图片"; - } else if(documents.contains(type)){ + } else if (documents.contains(type)) { return "文档"; - } else if(music.contains(type)){ + } else if (music.contains(type)) { return "音乐"; - } else if(video.contains(type)){ + } else if (video.contains(type)) { return "视频"; } else { return "其他"; @@ -212,7 +212,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { } public static void checkSize(long maxSize, long size) { - if(size > (maxSize * 1024 * 1024)){ + if (size > (maxSize * 1024 * 1024)) { throw new BusinessMallException("文件超出规定大小"); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtils.java index 7db35c12041ade996aa0785322beb2eb9b7f8def..e20a004359b1669c6d52f85ae203414425db0797 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/FileUtils.java @@ -5,27 +5,30 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; -/** 文件工具类 +/** + * 文件工具类 + * * @author Peter * @date 2018-4-11 */ public class FileUtils { /** * 判断文件类型是否合法<>通过魔数判断 + * * @param file * @return */ public static boolean checkFileMagicNum(final MultipartFile file) { - if(file == null){ + if (file == null) { return false; } // 获取文件上传时带的后缀 String fileName = file.getOriginalFilename(); - String suffix = fileName.substring(fileName.lastIndexOf(".")+1); + String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); // 由文件后缀得到的魔数,由于后缀可以伪造,所以该魔数不一定是文件的真实魔数 - String magicNum = FileTypeMap.map.get(suffix.toLowerCase()); + String magicNum = FileTypeMap.map.get(suffix.toLowerCase()); // 取不到魔数,说明该文件类型不能上传 - if(magicNum == null){ + if (magicNum == null) { return false; } // 取到魔数之后,判断与文件的是否相同 @@ -33,14 +36,14 @@ public class FileUtils { try { InputStream in = file.getInputStream(); // 读取上传文件的前30个字节 - in.read(b,0,30); + in.read(b, 0, 30); in.close(); } catch (IOException e) { e.printStackTrace(); } String realMagicNum = bytesToHex(b); // 判断文件开始的一段内容是否是匹配的魔数 - if(realMagicNum.toUpperCase().startsWith(magicNum)){ + if (realMagicNum.toUpperCase().startsWith(magicNum)) { return true; } return false; @@ -48,10 +51,11 @@ public class FileUtils { /** * 将字节数组转换成16进制字符串 + * * @param src * @return */ - public static String bytesToHex(final byte[] src){ + public static String bytesToHex(final byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (src == null || src.length <= 0) { return null; @@ -67,12 +71,12 @@ public class FileUtils { return stringBuilder.toString(); } - public static String getSuffix(final MultipartFile file){ - if(file == null || file.getSize() == 0){ + public static String getSuffix(final MultipartFile file) { + if (file == null || file.getSize() == 0) { return null; } String fileName = file.getOriginalFilename(); - return fileName.substring(fileName.lastIndexOf(".")+1); + return fileName.substring(fileName.lastIndexOf(".") + 1); } } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtil.java index 3fd401e34ec29ac1858cb749fca0d212c85d0f8c..9c3dc8ed038341478d13880cccc7213190735c6b 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtil.java @@ -19,6 +19,7 @@ import java.util.Map; /** * 代码生成 + * * @author mallplus * @date 2019-01-02 */ @@ -35,6 +36,7 @@ public class GenUtil { /** * 获取后端代码模板名称 + * * @return List */ private static List getAdminTemplateNames() { @@ -52,6 +54,7 @@ public class GenUtil { /** * 获取前端代码模板名称 + * * @return List */ private static List getFrontTemplateNames() { @@ -66,96 +69,96 @@ public class GenUtil { /** * 生成代码 + * * @param columnInfos 表元数据 - */ public static void generatorCode(List columnInfos, GenConfig genConfig, String tableName) throws IOException { - Map map = new HashMap<>(); - map.put("package",genConfig.getPack()); - map.put("moduleName",genConfig.getModuleName()); - map.put("author",genConfig.getAuthor()); + Map map = new HashMap<>(); + map.put("package", genConfig.getPack()); + map.put("moduleName", genConfig.getModuleName()); + map.put("author", genConfig.getAuthor()); map.put("date", LocalDate.now().toString()); - map.put("tableName",tableName); - map.put("prefix",genConfig.getPrefix()); + map.put("tableName", tableName); + map.put("prefix", genConfig.getPrefix()); String className = StringUtils.toCapitalizeCamelCase(tableName); String changeClassName = StringUtils.toCamelCase(tableName); // 判断是否去除表前缀 if (StringUtils.isNotEmpty(genConfig.getPrefix())) { - className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(tableName,genConfig.getPrefix())); - changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(tableName,genConfig.getPrefix())); + className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(tableName, genConfig.getPrefix())); + changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(tableName, genConfig.getPrefix())); } map.put("className", className); map.put("upperCaseClassName", className.toUpperCase()); map.put("changeClassName", changeClassName); - map.put("hasTimestamp",false); - map.put("queryHasTimestamp",false); - map.put("queryHasBigDecimal",false); - map.put("hasBigDecimal",false); - map.put("hasQuery",false); - map.put("auto",false); - - List> columns = new ArrayList<>(); - List> queryColumns = new ArrayList<>(); + map.put("hasTimestamp", false); + map.put("queryHasTimestamp", false); + map.put("queryHasBigDecimal", false); + map.put("hasBigDecimal", false); + map.put("hasQuery", false); + map.put("auto", false); + + List> columns = new ArrayList<>(); + List> queryColumns = new ArrayList<>(); for (ColumnInfo column : columnInfos) { - Map listMap = new HashMap<>(); - listMap.put("columnComment",column.getColumnComment()); - listMap.put("columnKey",column.getColumnKey()); + Map listMap = new HashMap<>(); + listMap.put("columnComment", column.getColumnComment()); + listMap.put("columnKey", column.getColumnKey()); String colType = ColUtil.cloToJava(column.getColumnType().toString()); String changeColumnName = StringUtils.toCamelCase(column.getColumnName().toString()); String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName().toString()); - if(PK.equals(column.getColumnKey())){ - map.put("pkColumnType",colType); - map.put("pkChangeColName",changeColumnName); - map.put("pkCapitalColName",capitalColumnName); + if (PK.equals(column.getColumnKey())) { + map.put("pkColumnType", colType); + map.put("pkChangeColName", changeColumnName); + map.put("pkCapitalColName", capitalColumnName); } - if(TIMESTAMP.equals(colType)){ - map.put("hasTimestamp",true); + if (TIMESTAMP.equals(colType)) { + map.put("hasTimestamp", true); } - if(BIGDECIMAL.equals(colType)){ - map.put("hasBigDecimal",true); + if (BIGDECIMAL.equals(colType)) { + map.put("hasBigDecimal", true); } - if(EXTRA.equals(column.getExtra())){ - map.put("auto",true); + if (EXTRA.equals(column.getExtra())) { + map.put("auto", true); } - listMap.put("columnType",colType); - listMap.put("columnName",column.getColumnName()); - listMap.put("isNullable",column.getIsNullable()); - listMap.put("columnShow",column.getColumnShow()); - listMap.put("changeColumnName",changeColumnName); - listMap.put("capitalColumnName",capitalColumnName); + listMap.put("columnType", colType); + listMap.put("columnName", column.getColumnName()); + listMap.put("isNullable", column.getIsNullable()); + listMap.put("columnShow", column.getColumnShow()); + listMap.put("changeColumnName", changeColumnName); + listMap.put("capitalColumnName", capitalColumnName); // 判断是否有查询,如有则把查询的字段set进columnQuery - if(!StringUtils.isBlank(column.getColumnQuery())){ - listMap.put("columnQuery",column.getColumnQuery()); - map.put("hasQuery",true); - if(TIMESTAMP.equals(colType)){ - map.put("queryHasTimestamp",true); + if (!StringUtils.isBlank(column.getColumnQuery())) { + listMap.put("columnQuery", column.getColumnQuery()); + map.put("hasQuery", true); + if (TIMESTAMP.equals(colType)) { + map.put("queryHasTimestamp", true); } - if(BIGDECIMAL.equals(colType)){ - map.put("queryHasBigDecimal",true); + if (BIGDECIMAL.equals(colType)) { + map.put("queryHasBigDecimal", true); } queryColumns.add(listMap); } columns.add(listMap); } - map.put("columns",columns); - map.put("queryColumns",queryColumns); + map.put("columns", columns); + map.put("queryColumns", queryColumns); TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); // 生成后端代码 List templates = getAdminTemplateNames(); for (String templateName : templates) { - Template template = engine.getTemplate("generator/admin/"+templateName+".ftl"); - String filePath = getAdminFilePath(templateName,genConfig,className); + Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); + String filePath = getAdminFilePath(templateName, genConfig, className); assert filePath != null; File file = new File(filePath); // 如果非覆盖生成 - if(!genConfig.getCover() && FileUtil.exist(file)){ + if (!genConfig.getCover() && FileUtil.exist(file)) { continue; } // 生成代码 @@ -165,14 +168,14 @@ public class GenUtil { // 生成前端代码 templates = getFrontTemplateNames(); for (String templateName : templates) { - Template template = engine.getTemplate("generator/front/"+templateName+".ftl"); - String filePath = getFrontFilePath(templateName,genConfig,map.get("changeClassName").toString()); + Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); + String filePath = getFrontFilePath(templateName, genConfig, map.get("changeClassName").toString()); assert filePath != null; File file = new File(filePath); // 如果非覆盖生成 - if(!genConfig.getCover() && FileUtil.exist(file)){ + if (!genConfig.getCover() && FileUtil.exist(file)) { continue; } // 生成代码 @@ -187,33 +190,31 @@ public class GenUtil { String packagePath = genConfig.getPath(); if ("Entity".equals(templateName)) { - return packagePath + File.separator+ "entity" + File.separator + className + ".java"; + return packagePath + File.separator + "entity" + File.separator + className + ".java"; } if ("Controller".equals(templateName)) { - return packagePath + File.separator+ "controller" + File.separator + className + "Controller.java"; + return packagePath + File.separator + "controller" + File.separator + className + "Controller.java"; } if ("Service".equals(templateName)) { - return packagePath + File.separator+ "service" + File.separator +"I"+ className + "Service.java"; + return packagePath + File.separator + "service" + File.separator + "I" + className + "Service.java"; } if ("ServiceImpl".equals(templateName)) { - return packagePath + File.separator+ "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; + return packagePath + File.separator + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; } if ("menu.sql".equals(templateName)) { - return packagePath + File.separator + className + ".sql"; + return packagePath + File.separator + className + ".sql"; } - if ("Mapper".equals(templateName)) { - return packagePath + File.separator + "mapper" + File.separator + className + "Mapper.java"; + return packagePath + File.separator + "mapper" + File.separator + className + "Mapper.java"; } - return null; } @@ -228,17 +229,17 @@ public class GenUtil { } if ("index".equals(templateName)) { - return path + File.separator +apiName+ File.separator + "index.vue"; + return path + File.separator + apiName + File.separator + "index.vue"; } if ("eForm".equals(templateName)) { - return path + File.separator +apiName+ File.separator + "components" + File.separator + "detail.vue"; + return path + File.separator + apiName + File.separator + "components" + File.separator + "detail.vue"; } if ("add".equals(templateName)) { - return path + File.separator +apiName + File.separator + File.separator + "add.vue"; + return path + File.separator + apiName + File.separator + File.separator + "add.vue"; } if ("update".equals(templateName)) { - return path + File.separator +apiName + File.separator + File.separator + "update.vue"; + return path + File.separator + apiName + File.separator + File.separator + "update.vue"; } return null; } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtils1.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtils1.java index 79b82da6aec107e3c6dd1754f59822a675dec47f..3131c0c70feb1afdc8d678c173c3b5dea322f53e 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtils1.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/GenUtils1.java @@ -21,6 +21,16 @@ import java.util.zip.ZipOutputStream; */ /** * 代码生成器 工具类 + *

+ * 生成代码 + *

+ * 列名转换成Java属性名 + *

+ * 表名转换成Java类名 + *

+ * 获取配置信息 + *

+ * 获取文件名 *//* public class GenUtils1 { @@ -48,8 +58,8 @@ public class GenUtils1 { */ /** - * 生成代码 - *//* + * 生成代码 + *//* @@ -164,8 +174,8 @@ public class GenUtils1 { */ /** - * 列名转换成Java属性名 - *//* + * 列名转换成Java属性名 + *//* public static String columnToJava(String columnName) { return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", ""); @@ -173,8 +183,8 @@ public class GenUtils1 { */ /** - * 表名转换成Java类名 - *//* + * 表名转换成Java类名 + *//* public static String tableToJava(String tableName, String tablePrefix, String autoRemovePre) { if (Constant.AUTO_REOMVE_PRE.equals(autoRemovePre)) { @@ -189,8 +199,8 @@ public class GenUtils1 { */ /** - * 获取配置信息 - *//* + * 获取配置信息 + *//* public static Configuration getConfig() { try { @@ -202,8 +212,8 @@ public class GenUtils1 { */ /** - * 获取文件名 - *//* + * 获取文件名 + *//* public static String getFileName(String module, String template, String classname, String className, String packageName, String Module) { String packagePath = "main" + File.separator + "java" + File.separator; diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/JsonUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/JsonUtil.java index 9a730c5d4cab90eeaed87abab7d4f7103abf1ce7..bc7bd3e5b2c6164638b9ea16be905ce33ce8bcce 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/JsonUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/JsonUtil.java @@ -278,7 +278,7 @@ public class JsonUtil { * * @param @param jsondata * @param @return 设定文件 - * @return Map> 返回类型 + * @return Map> 返回类型 * @throws * @Title: readJsonMap * @Description: TODO(这里用一句话描述这个方法的作用) @@ -398,5 +398,4 @@ public class JsonUtil { } - } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/PageUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/PageUtil.java index 5782167b4f35e05debeab14b24153a30b9895c05..ccd91588a685733787488df2d236fac2e1f23fa1 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/PageUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/PageUtil.java @@ -9,6 +9,7 @@ import java.util.Map; /** * 分页工具 + * * @author Zheng Jie * @date 2018-12-10 */ @@ -17,36 +18,36 @@ public class PageUtil extends cn.hutool.core.util.PageUtil { /** * List 分页 */ - public static List toPage(int page, int size , List list) { + public static List toPage(int page, int size, List list) { int fromIndex = page * size; int toIndex = page * size + size; - if(fromIndex > list.size()){ + if (fromIndex > list.size()) { return new ArrayList(); - } else if(toIndex >= list.size()) { - return list.subList(fromIndex,list.size()); + } else if (toIndex >= list.size()) { + return list.subList(fromIndex, list.size()); } else { - return list.subList(fromIndex,toIndex); + return list.subList(fromIndex, toIndex); } } /** * Page 数据处理,预防redis反序列化报错 */ - public static Map toPage(Page page) { - Map map = new LinkedHashMap<>(2); - map.put("content",page.getContent()); - map.put("totalElements",page.getTotalElements()); + public static Map toPage(Page page) { + Map map = new LinkedHashMap<>(2); + map.put("content", page.getContent()); + map.put("totalElements", page.getTotalElements()); return map; } /** * 自定义分页 */ - public static Map toPage(Object object, Object totalElements) { - Map map = new LinkedHashMap<>(2); - map.put("content",object); - map.put("totalElements",totalElements); + public static Map toPage(Object object, Object totalElements) { + Map map = new LinkedHashMap<>(2); + map.put("content", object); + map.put("totalElements", totalElements); return map; } diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/QiNiuUtil.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/QiNiuUtil.java index bc54a0563ce0963b47222fa69448b9863a517118..4b9ee8a06fd715e69adc121b88a4c6d616542128 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/QiNiuUtil.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/QiNiuUtil.java @@ -7,6 +7,7 @@ import java.util.Date; /** * 七牛云存储工具类 + * * @author mallplus * @date 2018-12-31 */ @@ -22,18 +23,19 @@ public class QiNiuUtil { /** * 得到机房的对应关系 + * * @param zone 机房名称 * @return Region */ - public static Region getRegion(String zone){ + public static Region getRegion(String zone) { - if(HUAD.equals(zone)){ + if (HUAD.equals(zone)) { return Region.huadong(); - } else if(HUAB.equals(zone)){ + } else if (HUAB.equals(zone)) { return Region.huabei(); - } else if(HUAN.equals(zone)){ + } else if (HUAN.equals(zone)) { return Region.huanan(); - } else if (BEIM.equals(zone)){ + } else if (BEIM.equals(zone)) { return Region.beimei(); // 否则就是东南亚 } else { @@ -43,10 +45,11 @@ public class QiNiuUtil { /** * 默认不指定key的情况下,以文件内容的hash值作为文件名 + * * @param file 文件名 * @return String */ - public static String getKey(String file){ + public static String getKey(String file) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = new Date(); return FileUtil.getFileNameNoEx(file) + "-" + diff --git a/mallplus-admin/src/main/java/com/zscat/mallplus/util/StringUtils.java b/mallplus-admin/src/main/java/com/zscat/mallplus/util/StringUtils.java index 3ed298ec2feb825e76325fc10aeda8606a8c6cb4..070ffa18e11e6c4998ba082b1518882ea06829af 100644 --- a/mallplus-admin/src/main/java/com/zscat/mallplus/util/StringUtils.java +++ b/mallplus-admin/src/main/java/com/zscat/mallplus/util/StringUtils.java @@ -115,7 +115,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { if (ip.contains(",")) { ip = ip.split(",")[0]; } - if ("127.0.0.1".equals(ip)) { + if ("127.0.0.1".equals(ip)) { // 获取本机真正的ip地址 try { ip = InetAddress.getLocalHost().getHostAddress(); @@ -127,17 +127,16 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { } - /** * 获得当天是周几 */ - public static String getWeekDay(){ + public static String getWeekDay() { String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; - if (w < 0){ + if (w < 0) { w = 0; } return weekDays[w]; diff --git a/mallplus-admin/src/main/resources/application-dev.properties b/mallplus-admin/src/main/resources/application-dev.properties index 7b37709f082ab3cbc68a4e29c0ee53ef0589a5ec..73f245f88cfda3971cb3434b6c0a741ccde6cda3 100644 --- a/mallplus-admin/src/main/resources/application-dev.properties +++ b/mallplus-admin/src/main/resources/application-dev.properties @@ -1,4 +1,4 @@ -spring.datasource.url=jdbc:mysql://39.106.212.32:3306/mallplus?characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false +spring.datasource.url=jdbc:mysql://localhost:3306/mallplus1?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&useTimezone=true&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root@123 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver diff --git a/mallplus-admin/src/main/resources/application-prod.properties b/mallplus-admin/src/main/resources/application-prod.properties index 73287a410c34afa8b06515431d53633dcc232d51..779de324d28956b8dca905546b4bfbc77f14320b 100644 --- a/mallplus-admin/src/main/resources/application-prod.properties +++ b/mallplus-admin/src/main/resources/application-prod.properties @@ -1,4 +1,4 @@ -spring.datasource.url=jdbc:mysql://39.106.212.32:3306/mallplus1?characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false +spring.datasource.url=jdbc:mysql://39.106.212.32:3306/mallplus1?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&useTimezone=true&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root@123 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -37,13 +37,13 @@ mybatis-plus.configuration.map-underscore-to-camel-case=true mybatis-plus.configuration.cache-enabled=false #===redis start=== # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 -spring.redis.database=1 +spring.redis.database=5 # Redis\u670D\u52A1\u5668\u5730\u5740 spring.redis.host=39.106.212.32 # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 spring.redis.port=6379 # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 -spring.redis.password=password +spring.redis.password= # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 spring.redis.pool.max-active=8 # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 diff --git a/mallplus-admin/src/main/resources/application.properties b/mallplus-admin/src/main/resources/application.properties index f1a1d0207139b9d663102523fb54ac2b0700fdd2..a708525e8256609cf6a8a7b1dbea39c6bdf769d1 100644 --- a/mallplus-admin/src/main/resources/application.properties +++ b/mallplus-admin/src/main/resources/application.properties @@ -1,6 +1,8 @@ #\u9ED8\u8BA4\u4E3A\u5F00\u53D1\u73AF\u5883 spring.profiles.active=prod server.port=8085 + +spring.jackson.time-zone=GMT+8 #===mybatis start=== redis.key.prefix.authCode=admin:authCode: redis.key.prefix.orderId=admin:orderId: @@ -39,7 +41,7 @@ jwt.tokenHead=Bearer #===JWT end=== #===OSS start=== aliyun.oss.endpoint=oss-cn-beijing.aliyuncs.com -aliyun.oss.accessKeyId=5Jii89BFukxmun5j +aliyun.oss.accessKeyId=LTAI4FhoMuUqdigjDnFT1bY6 aliyun.oss.accessKeySecret=JvE9FcILlHu5gClmAJr89ZkEv00l9s aliyun.oss.bucketName=yjlive160322 aliyun.oss.policy.expire=300 @@ -52,9 +54,8 @@ qiniu.secretKey=1iUDYRKdibiVP-WZLrGoErtdWWCqYWXjKUbQtAYQ qiniu.bucketName=j5shop qiniu.basePath=http://p0bt2oaom.bkt.clouddn.com/ qiniu.max-size=15 - oss.type=1 -oss.aliyun.first.accessKeyId=5Jii89BFukxmun5j +oss.aliyun.first.accessKeyId=LTAI4FhoMuUqdigjDnFT1bY6 oss.aliyun.first.accessKeySecret=JvE9FcILlHu5gClmAJr89ZkEv00l9s oss.aliyun.first.bucketName=yjlive160322 oss.aliyun.first.endPoint=oss-cn-beijing.aliyuncs.com @@ -67,7 +68,7 @@ oss.aliyun.second.endPoint=oss-cn-beijing.aliyuncs.com oss.aliyun.second.styleName= oss.aliyun.second.prefix=user oss.aliyun.domain=http://yjlive160322.oss-cn-beijing.aliyuncs.com/ -oss.aliyun.defalut.accessKeyId=5Jii89BFukxmun5j +oss.aliyun.defalut.accessKeyId=LTAI4FhoMuUqdigjDnFT1bY6 oss.aliyun.defalut.accessKeySecret=JvE9FcILlHu5gClmAJr89ZkEv00l9s oss.aliyun.defalut.bucketName=yjlive160322 oss.aliyun.defalut.endPoint=oss-cn-beijing.aliyuncs.com diff --git a/mallplus-admin/src/main/resources/template/email/email.ftl b/mallplus-admin/src/main/resources/template/email/email.ftl index 3a1863582c4ec46c47164a81c82be0c5ca8d7f9c..7eb0a7954c72f89451385a8223237afbe8ab7788 100644 --- a/mallplus-admin/src/main/resources/template/email/email.ftl +++ b/mallplus-admin/src/main/resources/template/email/email.ftl @@ -21,7 +21,7 @@

尊敬的用户,您好:

您正在申请邮箱验证,您的验证码为:

-

-

Github:https://github.com/elunez/eladmin

+

Github:https://github.com/elunez/eladmin +

- Copyright ©${.now?string("yyyy")} EL-ADMIN 后台管理系统 All Rights Reserved. + Copyright ©${.now?string("yyyy")} EL-ADMIN 后台管理系统 All Rights Reserved.
diff --git a/mallplus-admin/src/main/resources/template/generator/admin/Controller.ftl b/mallplus-admin/src/main/resources/template/generator/admin/Controller.ftl index 169ad117cfb7abeee99982e7fae58bb91719052c..824602b80fba8d5b8fc886c9cc83282f76aa2de1 100644 --- a/mallplus-admin/src/main/resources/template/generator/admin/Controller.ftl +++ b/mallplus-admin/src/main/resources/template/generator/admin/Controller.ftl @@ -43,113 +43,113 @@ public Object get${className}ByPage(${className} entity, ) { try { return new CommonResult().success(I${className}Service.page(new Page<${className}>(pageNum, pageSize), new QueryWrapper<>(entity))); - } catch (Exception e) { - log.error("根据条件查询所有${prefix}列表:%s", e.getMessage(), e); - } - return new CommonResult().failed(); - } - - @SysLog(MODULE = "${moduleName}", REMARK = "保存${prefix}") - @ApiOperation("保存${prefix}") - @PostMapping(value = "/create") - @PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:create')") - public Object save${className}(@RequestBody ${className} entity) { - try { +} catch (Exception e) { +log.error("根据条件查询所有${prefix}列表:%s", e.getMessage(), e); +} +return new CommonResult().failed(); +} + +@SysLog(MODULE = "${moduleName}", REMARK = "保存${prefix}") +@ApiOperation("保存${prefix}") +@PostMapping(value = "/create") +@PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:create')") +public Object save${className}(@RequestBody ${className} entity) { +try { - if (I${className}Service.save(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存${prefix}:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } +if (I${className}Service.save(entity)) { +return new CommonResult().success(); +} +} catch (Exception e) { +log.error("保存${prefix}:%s", e.getMessage(), e); +return new CommonResult().failed(e.getMessage()); +} +return new CommonResult().failed(); +} + +@SysLog(MODULE = "${moduleName}", REMARK = "更新${prefix}") +@ApiOperation("更新${prefix}") +@PostMapping(value = "/update/{id}") +@PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:update')") +public Object update${className}(@RequestBody ${className} entity) { +try { +if (I${className}Service.updateById(entity)) { +return new CommonResult().success(); +} +} catch (Exception e) { +log.error("更新${prefix}:%s", e.getMessage(), e); +return new CommonResult().failed(e.getMessage()); +} +return new CommonResult().failed(); +} + +@SysLog(MODULE = "${moduleName}", REMARK = "删除${prefix}") +@ApiOperation("删除${prefix}") +@GetMapping(value = "/delete/{id}") +@PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:delete')") +public Object delete${className}(@ApiParam("${prefix}id") @PathVariable Long id) { +try { +if (ValidatorUtils.empty(id)) { +return new CommonResult().paramFailed("${prefix}id"); +} +if (I${className}Service.removeById(id)) { +return new CommonResult().success(); +} +} catch (Exception e) { +log.error("删除${prefix}:%s", e.getMessage(), e); +return new CommonResult().failed(e.getMessage()); +} +return new CommonResult().failed(); +} + +@SysLog(MODULE = "${moduleName}", REMARK = "给${prefix}分配${prefix}") +@ApiOperation("查询${prefix}明细") +@GetMapping(value = "/{id}") +@PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:read')") +public Object get${className}ById(@ApiParam("${prefix}id") @PathVariable Long id) { +try { +if (ValidatorUtils.empty(id)) { +return new CommonResult().paramFailed("${prefix}id"); +} +${className} coupon = I${className}Service.getById(id); +return new CommonResult().success(coupon); +} catch (Exception e) { +log.error("查询${prefix}明细:%s", e.getMessage(), e); +return new CommonResult().failed(); +} + +} + +@ApiOperation(value = "批量删除${prefix}") +@RequestMapping(value = "/delete/batch", method = RequestMethod.GET) +@SysLog(MODULE = "${moduleName}", REMARK = "批量删除${prefix}") +@PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:delete')") +public Object deleteBatch(@RequestParam("ids") List + ids) { + boolean count = I${className}Service.removeByIds(ids); + if (count) { + return new CommonResult().success(count); + } else { return new CommonResult().failed(); } - - @SysLog(MODULE = "${moduleName}", REMARK = "更新${prefix}") - @ApiOperation("更新${prefix}") - @PostMapping(value = "/update/{id}") - @PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:update')") - public Object update${className}(@RequestBody ${className} entity) { - try { - if (I${className}Service.updateById(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新${prefix}:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); } - @SysLog(MODULE = "${moduleName}", REMARK = "删除${prefix}") - @ApiOperation("删除${prefix}") - @GetMapping(value = "/delete/{id}") - @PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:delete')") - public Object delete${className}(@ApiParam("${prefix}id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("${prefix}id"); - } - if (I${className}Service.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除${prefix}:%s", e.getMessage(), e); - return new CommonResult().failed(e.getMessage()); - } - return new CommonResult().failed(); - } - @SysLog(MODULE = "${moduleName}", REMARK = "给${prefix}分配${prefix}") - @ApiOperation("查询${prefix}明细") - @GetMapping(value = "/{id}") - @PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:read')") - public Object get${className}ById(@ApiParam("${prefix}id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("${prefix}id"); - } - ${className} coupon = I${className}Service.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询${prefix}明细:%s", e.getMessage(), e); - return new CommonResult().failed(); - } + @SysLog(MODULE = "${moduleName}", REMARK = "导出社区数据") + @GetMapping("/exportExcel") + public void export(HttpServletResponse response, ${className} entity) { + // 模拟从数据库获取需要导出的数据 + List<${className}> personList = I${className}Service.list(new QueryWrapper<>(entity)); + // 导出操作 + EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", ${className}.class, "导出社区数据.xls", response); } - @ApiOperation(value = "批量删除${prefix}") - @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) - @SysLog(MODULE = "${moduleName}", REMARK = "批量删除${prefix}") - @PreAuthorize("hasAuthority('${moduleName}:${changeClassName}:delete')") - public Object deleteBatch(@RequestParam("ids") List ids) { - boolean count = I${className}Service.removeByIds(ids); - if (count) { - return new CommonResult().success(count); - } else { - return new CommonResult().failed(); - } - } - - - - @SysLog(MODULE = "${moduleName}", REMARK = "导出社区数据") - @GetMapping("/exportExcel") - public void export(HttpServletResponse response, ${className} entity) { - // 模拟从数据库获取需要导出的数据 - List<${className}> personList = I${className}Service.list(new QueryWrapper<>(entity)); - // 导出操作 - EasyPoiUtils.exportExcel(personList, "导出社区数据", "社区数据", ${className}.class, "导出社区数据.xls", response); - - } - - @SysLog(MODULE = "${moduleName}", REMARK = "导入社区数据") - @PostMapping("/importExcel") - public void importUsers(@RequestParam MultipartFile file) { - List<${className}> personList = EasyPoiUtils.importExcel(file, ${className}.class); - I${className}Service.saveBatch(personList); - } - } + @SysLog(MODULE = "${moduleName}", REMARK = "导入社区数据") + @PostMapping("/importExcel") + public void importUsers(@RequestParam MultipartFile file) { + List<${className}> personList = EasyPoiUtils.importExcel(file, ${className}.class); + I${className}Service.saveBatch(personList); + } + } diff --git a/mallplus-admin/src/main/resources/template/generator/admin/Entity.ftl b/mallplus-admin/src/main/resources/template/generator/admin/Entity.ftl index 3ca86d91933339a19c8234d1507b6b2e82bec1b2..760f305368b2148d09ab478f59c084aa9bccc547 100644 --- a/mallplus-admin/src/main/resources/template/generator/admin/Entity.ftl +++ b/mallplus-admin/src/main/resources/template/generator/admin/Entity.ftl @@ -11,17 +11,17 @@ import java.util.Date; import lombok.Getter; import lombok.Setter; <#if hasTimestamp> -import java.sql.Timestamp; + import java.sql.Timestamp; <#if hasBigDecimal> -import java.math.BigDecimal; + import java.math.BigDecimal; import java.io.Serializable; /** * @author ${author} * @date ${date} - ${prefix} +${prefix} */ @Data @TableName("${tableName}") @@ -29,13 +29,14 @@ public class ${className} implements Serializable { <#if columns??> <#list columns as column> -<#if column.columnKey??> - <#if column.columnKey = 'PRI'> - @TableId(value = "id", type = IdType.AUTO) - - - @TableField( "${column.columnName}") - private ${column.columnType} ${column.changeColumnName}; + + <#if column.changeColumnName = 'id'> + @TableId(value = "id", type = IdType.AUTO) + + <#if column.changeColumnName != 'id'> + @TableField( "${column.columnName}") + + private ${column.columnType} ${column.changeColumnName}; diff --git a/mallplus-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl b/mallplus-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl index 97ebd9e8224dece509e8f1bc51e0f1be667aac73..f80189c3faf1d52722802fea9e5367e79959be93 100644 --- a/mallplus-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl +++ b/mallplus-admin/src/main/resources/template/generator/admin/ServiceImpl.ftl @@ -11,10 +11,11 @@ import javax.annotation.Resource; * @date ${date} */ @Service -public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${className}> implements I${className}Service { +public class ${className}ServiceImpl extends ServiceImpl +<${className}Mapper, ${className}> implements I${className}Service { - @Resource - private ${className}Mapper ${changeClassName}Mapper; +@Resource +private ${className}Mapper ${changeClassName}Mapper; } diff --git a/mallplus-admin/src/main/resources/template/generator/admin/menu.sql.ftl b/mallplus-admin/src/main/resources/template/generator/admin/menu.sql.ftl index 9fa97ed6a72acaa7300cc9e7b6d18746626d8ff2..d95ea5d467d26af90c9c0bb609c9a4623c6d969b 100644 --- a/mallplus-admin/src/main/resources/template/generator/admin/menu.sql.ftl +++ b/mallplus-admin/src/main/resources/template/generator/admin/menu.sql.ftl @@ -1,16 +1,13 @@ - - -- 菜单对应按钮SQL insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values - ( '${prefix}列表', '47', '1', '0', '${moduleName}:${changeClassName}:read', '1', '2018-09-29 16:18:51', '${changeClassName}', null); - insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values - ( '添加${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:create', '2', '2018-09-29 16:18:51', 'add${className}', null); - insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values - ( '修改${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:update', '2', '2018-09-29 16:18:51', 'update${className}', null); - insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values - ( '删除${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:delete', '2', '2018-09-29 16:18:51', 'delete${className}', null); - +( '${prefix}列表', '47', '1', '0', '${moduleName}:${changeClassName}:read', '1', '2018-09-29 16:18:51', '${changeClassName}', null); +insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values +( '添加${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:create', '2', '2018-09-29 16:18:51', 'add${className}', null); +insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values +( '修改${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:update', '2', '2018-09-29 16:18:51', 'update${className}', null); +insert into `sys_permission` ( `name`, `pid`, `status`, `sort`, `value`, `type`, `create_time`, `uri`, `icon`) values +( '删除${prefix}', '47', '1', '0', '${moduleName}:${changeClassName}:delete', '2', '2018-09-29 16:18:51', 'delete${className}', null); { diff --git a/mallplus-admin/src/main/resources/template/generator/front/eForm.ftl b/mallplus-admin/src/main/resources/template/generator/front/eForm.ftl index 9129135994c674116d160b64b1a9c18b66fd6e2b..e7f74398ba40ff59075bff3bf0bb45042b61a182 100644 --- a/mallplus-admin/src/main/resources/template/generator/front/eForm.ftl +++ b/mallplus-admin/src/main/resources/template/generator/front/eForm.ftl @@ -1,162 +1,165 @@ diff --git a/mallplus-admin/src/main/resources/template/generator/front/index.ftl b/mallplus-admin/src/main/resources/template/generator/front/index.ftl index 784e810a8cf8ba06fbc5b376a85954596843bf20..fef91e8607660c37feb072e22766088391115fa9 100644 --- a/mallplus-admin/src/main/resources/template/generator/front/index.ftl +++ b/mallplus-admin/src/main/resources/template/generator/front/index.ftl @@ -1,236 +1,238 @@ - - - - -

数据库名称:mallplus

- -
-

目录

- -
-
-
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + mallplus + + + + + + + + + +

数据库名称:mallplus

+ +
+

目录

+ +
+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 58b5152def6a914387c0b0b14f0add64497cddaf..732e913f667176992d3f883e938b7fa3c9cda2ac 100644 --- a/pom.xml +++ b/pom.xml @@ -11,11 +11,11 @@ mallplus-mbg - - mallplus-admin - + mallplus-pay + mallplus-wechat mallplus-portal - + mallplus-admin + diff --git a/test b/test index 4a9cc8745c1e8a1a80ffee406b7a5119eb8ec2ae..d700caaecd4e685df22dca3b8fa0e5c284b76358 100644 --- a/test +++ b/test @@ -1,93 +1,30 @@ -huobi = -55683750454 -55683748444 -55683746484 -55683744403 -55683742881 -55683741133 -55683738172 -55683736275 -55683733453 -55683731620 -55683729262 -55683727190 -55683723883 - -55683750454 -55683748444 - -55683746484 -55683744403 -55683742881 - - -ok== -3852769735361536 -3849181018407936 -3849180629644288 -3497496996495360 -3497496850742272 -3497496449987584 -3497495985802240 -3490711319364608 -3490711140714496 -3490710975560704 -3490710825744384 -3490710674686976 -3490710554754048 -3490710454947840 -3490710314764288 -3490709667793920 -3490709343587328 -3490709146782720 -3490708924219392 -3490708664698880 -3490707719343104 - -3852769735361536 -3849181018407936 -3849180629644288 - - -3820504368418816 -3820504368154624 -3819949997688832 -3819949980522496 -3819664206488576 -3819645980053504 -3819622403544064 -3819622396465152 -3819617916488704 -3819617908775936 -3818916520796160 -3818913804402688 -3809727518087168 -3809726264928256 -3809716797907968 -3809599290874880 -3809597304941568 -3780597561633792 -3780597561494528 -3780570430251008 -3780570358635520 -3779184077707264 -3769603442748416 -3769603390118912 -3769577977750528 -3769577921779712 -3768015115527168 -3756888029468672 -3756887123303424 -3756886422808576 - -3820504368418816 -3820504368154624 -3819949997688832 - -3819949980522496 -3819664206488576 -3819645980053504 - +server { + listen 80; + server_name example.com; + + location ^~ /web { + proxy_pass http://localhost:8081; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location ^~ /admin { + proxy_pass http://localhost:8085; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location ^~ /h5 { + proxy_pass http://localhost:8082; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} + +http://shop.legendshop.cn/s/system/paySite USE information_schema; @@ -180,62 +117,98 @@ http://ext.dcloud.net.cn/plugin?id=104 cms select DATE_FORMAT(create_time, '%Y-%m-%d') day1,sum(pay_amount) FROM oms_order group by day1 HAVING day1>='2019-08-01' ORDER BY day1 -3820504368418816 -3820504368154624 -3819949997688832 -3819949980522496 -3819664206488576 -3819645980053504 -3819622403544064 -3819622396465152 -3819617916488704 - -3819617908775936 -3818916520796160 -3818913804402688 -3809727518087168 -3809726264928256 -3809716797907968 -3809599290874880 -3809597304941568 -3780597561633792 -3780597561494528 -3780570430251008 -3780570358635520 -3779184077707264 -3769603442748416 -3769603390118912 -3769577977750528 -3769577921779712 -3768015115527168 -3756888029468672 -3756887123303424 -3756886422808576 -smallId=3756886422808576,by=3820504368418816 - -3820504368418816 -3820504368154624 -3819949997688832 -smallId=3819949997688832,by=3820504368418816 - - -55683748444 -55683746484 -smallId=55683744403,by=55683748444 - -55683750454 -55683748444 -55683746484 -55683744403 - -55683742881 -55683741133 -55683738172 -55683736275 -55683733453 -55683731620 -55683729262 -55683727190 +h5 +alipay WAP +isWeiXin wechatpay JSAPI_OFFICIAL +wechatpay MWEB + + + +####项目一nginx配置文件 + +server { + + #访问端口(页面访问端口) + listen 80; + server_name www.yjlive.cn; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + location / { + # 前端工程根目录 + root /root/jm/h5; + index index.html; + } + + + #没有跨域需求可以不配 + #代理路径 地址是以spi开头的 ‘/api开头的都走这个代理’ + # 将前端访问的后台端口变更为‘前台id:前台端口/api/xxx/xxx’ + + location /api { + + #正则表达式匹配路径 + + rewrite ^/api/(.*)$ /$1 break; + + include uwsgi_params; + + #后端端口(后端最终访问的端口) + proxy_pass http://39.106.212.32:8081 ; + } + location @router { + rewrite ^.*$ /index.html last; + } + } + + + + server { + + #访问端口(页面访问端口) + listen 80; + server_name www.yjlive.cn; + #root /usr/local/www/; + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + ##项目一,同过域名直接访问 + location / { + #前端工程根目录 + alias /root/jm/h5/; + index index.html; + } + ##项目二,同过域名.com/YYY访问 + location /h5 { + # 前端工程根目录 + alias /root/jm/mall/; + try_files $uri $uri/ @router; + index index.html; + } + # 没有跨域需求可以不配 + #代理路径 地址是以spi开头的 ‘/api开头的都走这个代理’ + # 将前端访问的后台端口变更为‘前台id:前台端口/api/xxx/xxx’ + location /api { + + #正则表达式匹配路径 + + rewrite ^/api/(.*)$ /$1 break; + + include uwsgi_params; + + #后端端口(后端最终访问的端口) + + proxy_pass http://39.106.212.32:8081 ; + + } + location @router { + rewrite ^.*$ /index.html last; + } + }