From 39526e938f70e4ceff2d8fa4e76a46f390feb395 Mon Sep 17 00:00:00 2001
From: "1439226817@qq.com" <1439226817@qq.com>
Date: Thu, 14 Nov 2019 08:51:47 +0800
Subject: [PATCH 01/34] pom
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 58b5152d..6a2e913c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
mallplus-admin
mallplus-portal
-
+ mallplus-search
--
Gitee
From 67f688eaf737531a53073f68103be4242dc9c191 Mon Sep 17 00:00:00 2001
From: "1439226817@qq.com" <1439226817@qq.com>
Date: Thu, 14 Nov 2019 10:26:13 +0800
Subject: [PATCH 02/34] pom
---
.../mallplus/controller/UmsMemberReceiveAddressController.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/controller/UmsMemberReceiveAddressController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/controller/UmsMemberReceiveAddressController.java
index 29187d02..5d659052 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/controller/UmsMemberReceiveAddressController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/controller/UmsMemberReceiveAddressController.java
@@ -51,6 +51,7 @@ public class UmsMemberReceiveAddressController {
@ResponseBody
public Object update(UmsMemberReceiveAddress address) {
boolean count = false;
+ address.setMemberId(memberService.getNewCurrentMember().getId());
if (address.getDefaultStatus()==1){
addressMapper.updateStatusByMember(address.getMemberId());
}
--
Gitee
From 549fa06f2c43c17c9de60c82ddd807f332de366a Mon Sep 17 00:00:00 2001
From: "1439226817@qq.com" <1439226817@qq.com>
Date: Wed, 20 Nov 2019 19:15:18 +0800
Subject: [PATCH 03/34] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E6=97=B6=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/zscat/mallplus/b2c/BHomeController.java | 12 ++++++------
.../java/com/zscat/mallplus/b2c/BOmsController.java | 4 ++--
.../java/com/zscat/mallplus/b2c/BPmsController.java | 10 +++++-----
.../zscat/mallplus/single/SingePmsController.java | 2 +-
.../zscat/mallplus/single/SingelHomeController.java | 12 ++++++------
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BHomeController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BHomeController.java
index b588cf22..a5832d6f 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BHomeController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BHomeController.java
@@ -106,14 +106,14 @@ public class BHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.contentPc();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(json, HomeContentResult.class);
}
}catch (Exception e){
contentResult = advertiseService.contentNew1();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
}
@@ -131,14 +131,14 @@ public class BHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.contentNew1();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(json, HomeContentResult.class);
}
}catch (Exception e){
contentResult = advertiseService.contentNew1();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
}
@@ -155,14 +155,14 @@ public class BHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.contentNew();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(json, Pages.class);
}
}catch (Exception e){
contentResult = advertiseService.contentNew();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BOmsController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BOmsController.java
index 2b394b2d..408e6f24 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BOmsController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BOmsController.java
@@ -368,7 +368,7 @@ public class BOmsController extends ApiBaseAction {
orderDetailResult.setBlance(member.getBlance());
}
redisService.set(key,JsonUtils.objectToJson(orderDetailResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
return new CommonResult().success(orderDetailResult);
}
@@ -722,7 +722,7 @@ public class BOmsController extends ApiBaseAction {
menuList.add(new ServiceMenu("联系客服","http://kaifa.crmeb.net/uploads/attach/2019/07/20190730/0ded3d3f72d654fb33c8c9f30a268c97.png","/pages/service/index","/customer/list"));
objectMap.put("menuList",menuList);
redisService.set(key,JsonUtils.objectToJson(objectMap));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
return new CommonResult().success(objectMap);
}
@Resource
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BPmsController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BPmsController.java
index f359b087..99ab3b0d 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BPmsController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/b2c/BPmsController.java
@@ -201,7 +201,7 @@ public class BPmsController extends ApiBaseAction {
category.setChildList(childlist);
}
redisService.set(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),JsonUtils.objectToJson(list));
- redisService.expire(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),3600*5);
+ redisService.expire(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),2);
}else{
list = JsonUtils.json2list(json, PmsProductCategory.class);
}
@@ -212,7 +212,7 @@ public class BPmsController extends ApiBaseAction {
category.setChildList(childlist);
}
redisService.set(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),JsonUtils.objectToJson(list));
- redisService.expire(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),3600*5);
+ redisService.expire(Rediskey.categoryAndChilds+apiContext.getCurrentProviderId(),2);
}
return new CommonResult().success(list);
@@ -283,7 +283,7 @@ public class BPmsController extends ApiBaseAction {
objectMap.put("list", list);
objectMap.put("count", count);
redisService.set(Rediskey.goodsConsult+apiContext.getCurrentProviderId()+"goods"+goodsId,JsonUtils.objectToJson(objectMap));
- redisService.expire(Rediskey.goodsConsult+apiContext.getCurrentProviderId()+"goods"+goodsId,3600*5);
+ redisService.expire(Rediskey.goodsConsult+apiContext.getCurrentProviderId()+"goods"+goodsId,2);
return new CommonResult().success(objectMap);
}
@@ -487,7 +487,7 @@ public class BPmsController extends ApiBaseAction {
gt.setGoodsList(pmsProductService.list(new QueryWrapper<>(productQueryParam).select(ConstansValue.sampleGoodsList)));
}
redisService.set(Rediskey.categoryAndGoodsList+apiContext.getCurrentProviderId(),JsonUtils.objectToJson(productAttributeCategoryList));
- redisService.expire(Rediskey.categoryAndGoodsList+apiContext.getCurrentProviderId(),3600*5);
+ redisService.expire(Rediskey.categoryAndGoodsList+apiContext.getCurrentProviderId(),2);
return new CommonResult().success(productAttributeCategoryList);
}
@@ -548,7 +548,7 @@ public class BPmsController extends ApiBaseAction {
}
}
redisService.set(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),JsonUtils.objectToJson(relList));
- redisService.expire(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),3600*5);
+ redisService.expire(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),2);
return new CommonResult().success(relList);
}
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingePmsController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingePmsController.java
index 6a49c07b..a5dba55f 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingePmsController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingePmsController.java
@@ -590,7 +590,7 @@ public class SingePmsController extends ApiBaseAction {
}
}
redisService.set(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),JsonUtils.objectToJson(relList));
- redisService.expire(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),3600*5);
+ redisService.expire(Rediskey.specialcategoryAndGoodsList+apiContext.getCurrentProviderId(),2);
return new CommonResult().success(relList);
}
diff --git a/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingelHomeController.java b/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingelHomeController.java
index 77f8f661..3ad1790f 100644
--- a/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingelHomeController.java
+++ b/mallplus-portal/src/main/java/com/zscat/mallplus/single/SingelHomeController.java
@@ -110,14 +110,14 @@ public class SingelHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.singelmobileContent();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(redisService.get(key), HomeContentResult.class);
}
}catch (Exception e){
contentResult = advertiseService.singelmobileContent();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
}
@@ -134,14 +134,14 @@ public class SingelHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.singelContent();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(redisService.get(key), HomeContentResult.class);
}
}catch (Exception e){
contentResult = advertiseService.singelContent();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
}
@@ -158,14 +158,14 @@ public class SingelHomeController {
if (ValidatorUtils.empty(json)){
contentResult = advertiseService.singelContent1();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}else{
contentResult = JsonUtils.jsonToPojo(redisService.get(key), HomeContentResult.class);
}
}catch (Exception e){
contentResult = advertiseService.singelContent1();
redisService.set(key,JsonUtils.objectToJson(contentResult));
- redisService.expire(key,3600*5);
+ redisService.expire(key,2);
}
return new CommonResult().success(contentResult);
}
--
Gitee
From 753d7097036284570ca060a4670ca56225a784dd Mon Sep 17 00:00:00 2001
From: "1439226817@qq.com" <1439226817@qq.com>
Date: Mon, 2 Dec 2019 17:05:04 +0800
Subject: [PATCH 04/34] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E5=99=A8=20=E7=89=A9=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mallplus/config/MybatisPlusConfig.java | 57 +++++++++++++++++++
.../service/impl/GeneratorServiceImpl.java | 2 +-
.../mallplus/sys/mapper/GeneratorMapper.java | 6 +-
3 files changed, 61 insertions(+), 4 deletions(-)
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 17304591..0428b117 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中。
+ Integer currentProviderId = apiContext.getCurrentProviderId();
+ if (null == currentProviderId) {
+ currentProviderId = 1;
+ 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/sys/service/impl/GeneratorServiceImpl.java b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/GeneratorServiceImpl.java
index 38389bb4..a75e536a 100644
--- a/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/GeneratorServiceImpl.java
+++ b/mallplus-admin/src/main/java/com/zscat/mallplus/sys/service/impl/GeneratorServiceImpl.java
@@ -33,7 +33,7 @@ public class GeneratorServiceImpl implements GeneratorService {
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(4))? obj.get(4).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);
diff --git a/mallplus-mbg/src/main/java/com/zscat/mallplus/sys/mapper/GeneratorMapper.java b/mallplus-mbg/src/main/java/com/zscat/mallplus/sys/mapper/GeneratorMapper.java
index c3c66ec8..768877a3 100644
--- a/mallplus-mbg/src/main/java/com/zscat/mallplus/sys/mapper/GeneratorMapper.java
+++ b/mallplus-mbg/src/main/java/com/zscat/mallplus/sys/mapper/GeneratorMapper.java
@@ -7,9 +7,9 @@ import java.util.Map;
public interface GeneratorMapper {
- @Select("select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables"
- + " where table_schema = (select database()) and table_name like '%#{name}%' limit ${page},${limit}")
- List
*
* @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 9548b3b6..c420b793 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 c94c1c36..c3cef351 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 f8d1af2c..a6753482 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 38ee8edf..df6c1e10 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 cbc24cb5..d9bf00c3 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
@@ -36,6 +36,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
@@ -45,9 +47,6 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
@Value("${jwt.tokenHead}")
private String tokenHead;
- @Resource
- public ISysAdminLogService fopSystemOperationLogService;
-
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
@@ -83,9 +82,9 @@ 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)) {
@@ -107,7 +106,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 +117,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 9784b97a..35288c1b 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 20f42d18..53eb05c3 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 0428b117..dbf1a0e4 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
@@ -52,9 +52,9 @@ public class MybatisPlusConfig {
@Override
public Expression getTenantId() {
// 从当前系统上下文中取出当前请求的服务商ID,通过解析器注入到SQL中。
- Integer currentProviderId = apiContext.getCurrentProviderId();
+ Long currentProviderId = apiContext.getCurrentProviderId();
if (null == currentProviderId) {
- currentProviderId = 1;
+ currentProviderId = 1l;
System.out.println("#1129 getCurrentProviderId error.");
// throw new RuntimeException("#1129 getCurrentProviderId error.");
}
@@ -68,7 +68,7 @@ public class MybatisPlusConfig {
@Override
public boolean doTableFilter(String tableName) {
- if (tableName.startsWith("admin_") || tableName.startsWith("QRTZ_")){
+ if (tableName.startsWith("admin_") || tableName.startsWith("QRTZ_")) {
return true;
}
return IGNORE_TENANT_TABLES.stream().anyMatch((e) -> e.equalsIgnoreCase(tableName));
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 25b23f95..ad8dc4a3 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/OmsCompanyAddressController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsCompanyAddressController.java
index 9c6afbb3..97e31d20 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,41 +1,42 @@
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;
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 zscat
- * @since 2019-04-19
+ * @author mallplus
+ * @date 2019-12-07
+ * 发货地址
*/
@Slf4j
@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")
+ @PreAuthorize("hasAuthority('oms:omsCompanyAddress:read')")
public Object getOmsCompanyAddressByPage(OmsCompanyAddress entity,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
@@ -43,84 +44,85 @@ public class OmsCompanyAddressController {
try {
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 +132,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 7190ac32..aa7f6bfa 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
@@ -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/OmsPaymentsController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsPaymentsController.java
new file mode 100644
index 00000000..32c8fd79
--- /dev/null
+++ b/mallplus-admin/src/main/java/com/zscat/mallplus/oms/controller/OmsPaymentsController.java
@@ -0,0 +1,154 @@
+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.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
+@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 788f3ff3..fad95771 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 6bc82a24..5b911859 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 00000000..1a76e934
--- /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 62b4dcbd..554017e2 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 67ce6c28..239b2c0a 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 00000000..aad195ad
--- /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/PmsProductAttributeController.java b/mallplus-admin/src/main/java/com/zscat/mallplus/pms/controller/PmsProductAttributeController.java
index 7586daae..777702c7 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 81451511..38e42467 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 ecce6b4b..5b4ad6fb 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 8d9897b3..62345ae3 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 99636a86..69870028 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 7eeb0184..eae42772 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,20 @@ 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 +139,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 +221,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 c7e6c7a5..7df5cb4e 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 00000000..48e1dbbf
--- /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 57f16c09..c6f9fe23 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 a454e611..65b2ec58 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 a6f07ede..d1924328 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 cc081a34..be7cf686 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
@@ -39,6 +39,10 @@ import java.util.List;
public class SmsGroupController {
@Resource
private ISmsGroupService ISmsGroupService;
+ @Resource
+ private IUmsMemberService memberService;
+ @Resource
+ private SmsGroupMemberMapper groupMemberMapper;
@SysLog(MODULE = "sms", REMARK = "根据条件查询所有列表")
@ApiOperation("根据条件查询所有列表")
@@ -56,22 +60,19 @@ 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
+ @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 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);
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 a44c9941..f4efe471 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 cdf277ad..64e86f51 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 692c97cb..409a8a97 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 4ff6ff64..1a5213bf 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 855b2232..d43088cc 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 a82ccd86..2fed5e6d 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 e62fac49..0ffaf3e7 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 00000000..0837946a
--- /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 d37ebbaa..854e5625 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 0a9d0cc7..bc090a90 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 9945993a..37c65e28 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 7a61ec02..f26afda3 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 a2f2e4b2..c0f0794a 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 a6f2c908..0c76a448 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 00000000..eaff2f0d
--- /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 4f39074d..e4621091 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 196b5fcb..75973244 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 26df4543..3d1f00b4 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 248431ca..5f812db8 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 f5381eff..d9a84733 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 b2d152ae..f03a9884 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 8feaee43..d035a785 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 f7f6b81a..45e0b273 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 c4c0735e..c6186af1 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 747cb8fd..099d533b 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 a01815ba..59b1c078 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 74b6a308..2074575e 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 b9fd5135..e8b58dbb 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 1b296752..ae94ea43 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 c478b1ad..ef204b2a 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
@@ -166,7 +166,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 +182,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 185b2ce5..041d5c2f 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 df5becbd..51ab5d55 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 36d31d9f..d8f09e25 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 13c52d81..f91ea0c5 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 a527bc61..f117aa4e 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 e70fa3d6..6c35ba4c 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 = "获取当前登录用户信息")
@@ -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 78fafc61..cf8ecc7f 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 114add57..1d7a1e20 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 6c2f7db1..ee152663 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 d7c24567..0d73be1d 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 df14875f..7fb900d6 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 2f1a12d3..5290d00d 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 d1f93ec8..6c39f162 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 98ae1fc5..1feb43d6 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 4842edea..8684cbf9 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 509a95f2..f8e88d15 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 e94a8f0b..b106d85e 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 0fbc9efa..bd3c3a0c 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 f703e26c..f2bc2d9f 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 62783afc..acdf2724 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