提交 d4c77984 作者: 沈振路

Merge branch 'customer_service_SZlu'

/.idea/ /.idea/
/target/ /target/
/customer-service/ /customer-service/
/test-customer-service/
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<finalName>customer_service</finalName> <finalName>customer-service</finalName>
<extensions> <extensions>
<extension> <extension>
<groupId>org.apache.maven.wagon</groupId> <groupId>org.apache.maven.wagon</groupId>
......
...@@ -12,7 +12,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -12,7 +12,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @date 2022/9/15 18:13 * @date 2022/9/15 18:13
*/ */
@SpringBootApplication @SpringBootApplication
@EnableScheduling //@EnableScheduling
@MapperScan("com.yaoyaozw.customer.mapper") @MapperScan("com.yaoyaozw.customer.mapper")
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
......
package com.yaoyaozw.customer.annotations;
import com.yaoyaozw.customer.enums.AccountParamType;
import com.yaoyaozw.customer.enums.AccountTableColumnType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author darker
* @date 2022/12/13 12:04
*/
@Retention(value = RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AccountOperateControl {
AccountParamType paramType();
// 校验参数名
String paramName();
// 校验参数类型, 是appId 还是 公众号主键id
AccountTableColumnType columnType() default AccountTableColumnType.AUTH_ID;
// property是 paramType 为 REQUEST_BODY 时, 用于指定参数实体类中公众号校验字段的字段名
String property() default "authId";
// table 和 column 是当 paramType 为 TABLE_PRIMARY 时需要的参数 table指定主键对应的表名,column指定该表中的公众号字段名
String table() default "";
String column() default "auth_id";
}
package com.yaoyaozw.customer.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author darker
* @date 2022/12/9 11:36
*/
@Retention(value = RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface OperateLog {
String module() default "";
String desc() default "";
}
package com.yaoyaozw.customer.aop;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yaoyaozw.customer.annotations.AccountOperateControl;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.entity.AccountSetup;
import com.yaoyaozw.customer.enums.AccountParamType;
import com.yaoyaozw.customer.enums.AccountTableColumnType;
import com.yaoyaozw.customer.exception.AopCommonException;
import com.yaoyaozw.customer.mapper.MaterialAopCommonMapper;
import com.yaoyaozw.customer.service.AccountSetupService;
import org.apache.commons.lang3.ObjectUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* @author darker
* @date 2022/12/13 12:11
*/
@Component
@Aspect
public class AccountOperateControlAop {
private final static Logger localLog = LoggerFactory.getLogger(AccountOperateControlAop.class);
@Autowired
private TokenManager tokenManager;
@Autowired
private AccountSetupService accountSetupService;
@Autowired
private MaterialAopCommonMapper aopCommonMapper;
@Pointcut("@annotation(com.yaoyaozw.customer.annotations.AccountOperateControl)")
public void operateControlCut() {
//公众号权限控制切点
}
@Before("operateControlCut()")
public void operateControl(JoinPoint joinPoint) throws Throwable {
// 获取注解的详细信息
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method declaredMethod = methodSignature.getMethod();
AccountOperateControl operateControl = declaredMethod.getAnnotation(AccountOperateControl.class);
// 获取校验字段值
String paramName = operateControl.paramName();
int index = 0;
for (String parameterName : methodSignature.getParameterNames()) {
if (parameterName.equals(paramName)) {
break;
}
index++;
}
Object paramObj = joinPoint.getArgs()[index];
if (ObjectUtil.isNull(paramObj)) {
throw new AopCommonException("找不到校验目标");
}
// 解析注解的内容
AccountParamType type = operateControl.paramType();
BaseResult baseResult;
// 分类校验
Long userIdLong = tokenManager.getUserIdFromToken();
String username = tokenManager.getUserNameFromToken();
String userId = userIdLong.toString();
localLog.info("操作人Id: {}, 用户名: {}", userId, username);
if (AccountParamType.TABLE_PRIMARY.equals(type)) {
// 是以表的主键为参数的
baseResult = handleTablePrimary(userId, paramObj.toString(), operateControl);
} else if (AccountParamType.ACCOUNT_PRIMARY.equals(type)) {
// 是以公众号id为参数的
baseResult = handleAccountPrimary(userId, paramObj.toString(), operateControl);
} else if (AccountParamType.REQUEST_BODY.equals(type)) {
// 是以包含公众号字段的实体为参数的
baseResult = handleRequestBody(userId, paramObj, operateControl);
} else {
baseResult = new BaseResult().error("权限校验异常-未知类型");
}
if (!baseResult.getSuccess()) {
throw new AopCommonException(baseResult.getMessage());
}
}
/**
* 校验以表主键id为参数的请求权限
* @param userId 用户名
* @param primaryId 表主键id
* @param annotation 注解
* @return 校验结果
*/
private BaseResult handleTablePrimary(String userId, String primaryId, AccountOperateControl annotation) {
if (!ObjectUtils.allNotNull(userId, primaryId, annotation.table(), annotation.column())) {
return new BaseResult().error("校验参数缺失");
}
// 通过参数获取这条数据对应的公众号的id
String accountParam = aopCommonMapper.getAccountFromTable(primaryId, annotation.table(), annotation.column());
localLog.info("TABLE_PRIMARY 类型 获取公众号ID: {}", accountParam);
// 调用方法处理username和公众号id的匹配关系
Boolean result = checkUserAccount(userId, accountParam, annotation.columnType());
return result ? new BaseResult().success() : new BaseResult().error("没有该公众号的操作权限");
}
/**
* 校验以公众号主键id为参数的请求
* @param userId 用户名
* @param accountParam 公众号主键id
* @return 检验结果
*/
private BaseResult handleAccountPrimary(String userId, String accountParam, AccountOperateControl annotation) {
localLog.info("ACCOUNT_PRIMARY 类型 获取公众号ID: {}", accountParam);
Boolean result = checkUserAccount(userId, accountParam,annotation.columnType());
return result ? new BaseResult().success() : new BaseResult().error("没有该公众号的操作权限");
}
/**
* 校验以实体类为参数的请求
* @param userId 用户名
* @param requestBody 实体类
* @param annotation 注解
* @return 校验结果
*/
private BaseResult handleRequestBody(String userId, Object requestBody, AccountOperateControl annotation) throws Exception {
// 获取实体中的公众号id字段值
Class<?> clazz = requestBody.getClass();
Field field = clazz.getDeclaredField(annotation.property());
field.setAccessible(true);
Object obj = field.get(requestBody);
if (ObjectUtil.isNull(obj)) {
return new BaseResult().error("无法获取公众号校验字段");
}
String accountParam = obj.toString();
localLog.info("REQUEST_BODY 类型 获取公众号ID: {}", accountParam);
Boolean result = checkUserAccount(userId, accountParam, annotation.columnType());
return result ? new BaseResult().success() : new BaseResult().error("没有该公众号的操作权限");
}
/**
* 最终校验
* @param userId 用户id
* @param accountParam 公众号相关参数(authId / appId)
* @param columnType 字段类型(authId / appId)
* @return 校验结果(true-通过;false-未通过)
*/
private Boolean checkUserAccount(String userId, String accountParam, AccountTableColumnType columnType) {
// 获取用户角色等级
Integer userRoleLevel = aopCommonMapper.getUserRoleLevel(userId);
if (userRoleLevel >= CustomerCommonConstant.PERMISSION_OPENING_ROLE_LEVEL) {
// 负责人及以上级别不加控制
return Boolean.TRUE;
}
QueryWrapper<AccountSetup> queryWrapper = new QueryWrapper<AccountSetup>().eq(AccountSetup.COL_USER_ID, userId);
if (AccountTableColumnType.AUTH_ID.equals(columnType)) {
queryWrapper = queryWrapper.eq(AccountSetup.COL_AUTH_ID, accountParam);
} else if (AccountTableColumnType.APP_ID.equals(columnType)) {
queryWrapper = queryWrapper.eq(AccountSetup.COL_APP_ID, accountParam);
}
int count = accountSetupService.count(queryWrapper);
return count != 0;
}
}
package com.yaoyaozw.customer.aop;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.entity.SystemOperateLog;
import com.yaoyaozw.customer.service.SystemOperateLogService;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Date;
/**
* @author darker
* @date 2022/12/9 11:41
*/
@Aspect
@Component
public class OperateLogAop {
private final static Integer LOG_PARAM_LENGTH_LIMIT = 200;
@Autowired
private TokenManager tokenManager;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private SystemOperateLogService operateLogService;
@Pointcut("@annotation(com.yaoyaozw.customer.annotations.OperateLog)")
public void operateLogCut() {
//操作日志切点
}
@Around("operateLogCut()")
public Object around(ProceedingJoinPoint point) throws Throwable{
// 获取这个注解对应的方法
Class<?> targetClazz = point.getTarget().getClass();
MethodSignature signature = (MethodSignature)point.getSignature();
// 根据方法名和方法参数获取该方法的实体对象
Method targetMethod = targetClazz.getDeclaredMethod(signature.getName(), signature.getParameterTypes());
String param = objectMapper.writeValueAsString(point.getArgs());
if (StringUtils.isNotBlank(param) && param.length() > LOG_PARAM_LENGTH_LIMIT) {
param = param.substring(0, LOG_PARAM_LENGTH_LIMIT);
}
// 构造保存实体
SystemOperateLog operateLogEntity = SystemOperateLog.builder()
.methodPath(targetClazz.getName() + "." + targetMethod.getName())
.operateTime(new Date())
.requestParam(param)
.operateUser(tokenManager.getUserIdFromToken())
.build();
// 获取这个方法上的对应注解的实体
OperateLog operateLog = targetMethod.getAnnotation(OperateLog.class);
if (ObjectUtil.isNotNull(operateLog)) {
operateLogEntity.setOperateModule(operateLog.module());
operateLogEntity.setOperateDesc(operateLog.desc());
}
long start = System.currentTimeMillis();
try {
return point.proceed();
} catch (Throwable throwable) {
operateLogEntity.setOperateResult(Boolean.FALSE);
throw throwable;
}finally {
// 统计处理时间, 保存操作记录
long end = System.currentTimeMillis();
operateLogEntity.setTimeCost(end - start);
operateLogService.save(operateLogEntity);
}
}
}
...@@ -51,6 +51,9 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -51,6 +51,9 @@ public class CustomerServiceCommonAsyncComponent {
private final static Logger LOCAL_LOG = LoggerFactory.getLogger(CustomerServiceCommonAsyncComponent.class); private final static Logger LOCAL_LOG = LoggerFactory.getLogger(CustomerServiceCommonAsyncComponent.class);
private final static String OVER_FREQUENCY_STR = "over_frequency";
private final static String OVER_FREQUENCY_MSG = "访问速度过快";
@Autowired @Autowired
private RegisterUserEntityService userEntityService; private RegisterUserEntityService userEntityService;
@Autowired @Autowired
...@@ -327,9 +330,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -327,9 +330,7 @@ public class CustomerServiceCommonAsyncComponent {
getCopyReferral(dateStr, authInfoVo, referralEntity); getCopyReferral(dateStr, authInfoVo, referralEntity);
} catch (Exception e) { } catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", authInfoVo.getAccountName(), e.getMessage()); LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", authInfoVo.getAccountName(), e.getMessage());
referralEntity.setReferral("error");
} }
referralEntityList.add(referralEntity); referralEntityList.add(referralEntity);
} }
...@@ -371,7 +372,11 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -371,7 +372,11 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setName(originKey); referralEntity.setName(originKey);
// 常用链接不需要日期 // 常用链接不需要日期
try {
getCopyReferral(null, authInfoVo, referralEntity); getCopyReferral(null, authInfoVo, referralEntity);
} catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", authInfoVo.getAccountName(), e.getMessage());
}
referralEntityList.add(referralEntity); referralEntityList.add(referralEntity);
} }
...@@ -530,7 +535,6 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -530,7 +535,6 @@ public class CustomerServiceCommonAsyncComponent {
getCopyReferral(dateStr, authInfoVo, targetReferralEntity); getCopyReferral(dateStr, authInfoVo, targetReferralEntity);
} catch (Exception e) { } catch (Exception e) {
LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", targetAuthInfo.getNickName(), e.getMessage()); LOCAL_LOG.warn("公众号: {} 获取链接异常: {}", targetAuthInfo.getNickName(), e.getMessage());
targetReferralEntity.setReferral("error");
} }
} }
...@@ -554,6 +558,13 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -554,6 +558,13 @@ public class CustomerServiceCommonAsyncComponent {
* 以下是公有方法 * 以下是公有方法
*/ */
public void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) { public void getCopyReferral(String dateStr, AuthInfoVO authInfoVo, ReferralEntity referralEntity) {
if (CustomerCommonConstant.STORE_NAME_TOMATO.equals(authInfoVo.getStoreType())) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
ygAccessLimit(true, authInfoVo.getStoreType()); ygAccessLimit(true, authInfoVo.getStoreType());
referralEntity.setStoreType(authInfoVo.getStoreType()); referralEntity.setStoreType(authInfoVo.getStoreType());
// 非常用链接类型的name需要处理 // 非常用链接类型的name需要处理
...@@ -565,6 +576,9 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -565,6 +576,9 @@ public class CustomerServiceCommonAsyncComponent {
throw new RuntimeException("无法获取链接类型"); throw new RuntimeException("无法获取链接类型");
} }
// 替换共用字段 // 替换共用字段
if (StringUtils.isBlank(referralEntity.getStoreTypeName())) {
referralEntity.setStoreTypeName("");
}
name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", authInfoVo.getAccountName()) name = name.replace("{newsType}", newsTypeName).replace("{accountNickName}", authInfoVo.getAccountName())
.replace("{storeType}", referralEntity.getStoreTypeName()).replace("{currentDate}", dateStr); .replace("{storeType}", referralEntity.getStoreTypeName()).replace("{currentDate}", dateStr);
if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) { if (newsType.equals(CustomerCommonConstant.BOOK_NEWS_TYPE)) {
...@@ -577,12 +591,15 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -577,12 +591,15 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setTemplateId(tempId); referralEntity.setTemplateId(tempId);
} }
long suffix = System.currentTimeMillis() % 100000; long suffix = System.currentTimeMillis() % 100000;
referralEntity.setName(name + suffix); referralEntity.setName(name + "-" + suffix);
} }
referralEntity.setInfoId(authInfoVo.getId()); referralEntity.setInfoId(authInfoVo.getId());
LOCAL_LOG.info("获取链接, 参数: {}", referralEntity); LOCAL_LOG.info("获取链接, 参数: {}", referralEntity);
R r = referralFeignClient.productReferral(referralEntity); R r = referralFeignClient.productReferral(referralEntity);
if (!r.getCode().equals(ApiResultConstant.SUCCESS_CODE)) { if (!r.getCode().equals(ApiResultConstant.SUCCESS_CODE)) {
if (OVER_FREQUENCY_MSG.equals(r.getMessage())) {
referralEntity.setReferral(OVER_FREQUENCY_STR);
}
throw new RuntimeException(r.getMessage()); throw new RuntimeException(r.getMessage());
} else { } else {
LOCAL_LOG.info("公众号: {} 获取链接成功", authInfoVo.getAccountName()); LOCAL_LOG.info("公众号: {} 获取链接成功", authInfoVo.getAccountName());
......
...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.constants; ...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.constants;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -12,11 +13,16 @@ import java.util.List; ...@@ -12,11 +13,16 @@ import java.util.List;
*/ */
public class CustomerCommonConstant { public class CustomerCommonConstant {
public final static Integer PERMISSION_OPENING_ROLE_LEVEL = 3;
public final static BigDecimal THOUSAND_BIG_DECIMAL = new BigDecimal(1000);
public final static String CROWD_HUMAN_NUN_REDIS_KEY = "crowdHumanNum"; public final static String CROWD_HUMAN_NUN_REDIS_KEY = "crowdHumanNum";
public final static String STORE_NAME_YANG_GUANG = "YANG_GUANG"; public final static String STORE_NAME_YANG_GUANG = "YANG_GUANG";
public final static String STORE_NAME_ZHANG_ZHONG_YUN = "ZHANG_ZHONG_YUN"; public final static String STORE_NAME_ZHANG_ZHONG_YUN = "ZHANG_ZHONG_YUN";
public final static String STORE_NAME_YUE_WEN = "YUE_WEN"; public final static String STORE_NAME_YUE_WEN = "YUE_WEN";
public final static String STORE_NAME_TOMATO = "TOMATO";
public final static String ERROR_LABEL = "error"; public final static String ERROR_LABEL = "error";
......
package com.yaoyaozw.customer.controller; package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.BaseResult; import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO; import com.yaoyaozw.customer.dto.crowd.CrowdPackageQueryDTO;
...@@ -29,6 +30,7 @@ public class CrowdPackageController { ...@@ -29,6 +30,7 @@ public class CrowdPackageController {
@ApiOperation("新增人群包") @ApiOperation("新增人群包")
@GetMapping("/insertPackage") @GetMapping("/insertPackage")
@OperateLog(desc = "新增人群包")
public GenericsResult<CrowdPackageCommonIdVO> insertCrowdPackage(@RequestParam(required = false) Long id, public GenericsResult<CrowdPackageCommonIdVO> insertCrowdPackage(@RequestParam(required = false) Long id,
@RequestParam(required = false) String name, @RequestParam(required = false) String name,
@RequestParam(required = false) Double activeTimeMin, @RequestParam(required = false) Double activeTimeMin,
...@@ -38,6 +40,7 @@ public class CrowdPackageController { ...@@ -38,6 +40,7 @@ public class CrowdPackageController {
@ApiOperation("向人群包内新增条件") @ApiOperation("向人群包内新增条件")
@PostMapping("/insertCondition") @PostMapping("/insertCondition")
@OperateLog(desc = "添加人群包条件")
public GenericsResult<CrowdPackageCommonIdVO> insertCondition(@RequestBody CrowdPackageConditionDTO conditionDto) { public GenericsResult<CrowdPackageCommonIdVO> insertCondition(@RequestBody CrowdPackageConditionDTO conditionDto) {
return crowdPackageService.insertConditionIntoPackage(conditionDto); return crowdPackageService.insertConditionIntoPackage(conditionDto);
} }
...@@ -50,12 +53,14 @@ public class CrowdPackageController { ...@@ -50,12 +53,14 @@ public class CrowdPackageController {
@ApiOperation("删除人群包") @ApiOperation("删除人群包")
@GetMapping("/removePackage/{id}") @GetMapping("/removePackage/{id}")
@OperateLog(desc = "删除人群包")
public BaseResult removeCrowdPackage(@PathVariable("id") Long id) { public BaseResult removeCrowdPackage(@PathVariable("id") Long id) {
return crowdPackageService.removeCrowdPackage(id); return crowdPackageService.removeCrowdPackage(id);
} }
@ApiOperation("从人群包中删除条件") @ApiOperation("从人群包中删除条件")
@GetMapping("/removeCondition/{linkedId}") @GetMapping("/removeCondition/{linkedId}")
@OperateLog(desc = "删除人群包条件")
public BaseResult removeCondition(@PathVariable("linkedId") Long linkedId) { public BaseResult removeCondition(@PathVariable("linkedId") Long linkedId) {
return crowdPackageService.removeConditionFromPackage(linkedId); return crowdPackageService.removeConditionFromPackage(linkedId);
} }
...@@ -80,6 +85,7 @@ public class CrowdPackageController { ...@@ -80,6 +85,7 @@ public class CrowdPackageController {
@ApiOperation("更新用户列表所属的人群包") @ApiOperation("更新用户列表所属的人群包")
@GetMapping("/updateUserPackageBatch") @GetMapping("/updateUserPackageBatch")
@OperateLog(desc = "更新用户列表所属的人群包")
public BaseResult updateUserPackageBatch(@RequestBody List<String> openIdList) { public BaseResult updateUserPackageBatch(@RequestBody List<String> openIdList) {
return crowdPackageService.updateUserPackageBatch(openIdList); return crowdPackageService.updateUserPackageBatch(openIdList);
} }
......
package com.yaoyaozw.customer.controller; package com.yaoyaozw.customer.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.annotations.AccountOperateControl;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.BaseResult; import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.enums.AccountParamType;
import com.yaoyaozw.customer.enums.AccountTableColumnType;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService; import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO; import com.yaoyaozw.customer.vo.kanban.CommonOptionResponseVO;
...@@ -32,12 +36,15 @@ public class CustomerDelayGraphicsController { ...@@ -32,12 +36,15 @@ public class CustomerDelayGraphicsController {
@ApiOperation("新增") @ApiOperation("新增")
@PostMapping("/insert") @PostMapping("/insert")
@OperateLog(desc = "新增图文延时客服")
@AccountOperateControl(paramType = AccountParamType.REQUEST_BODY, paramName = "saveDto", columnType = AccountTableColumnType.APP_ID, property = "appId")
public BaseResult insertCustomerDelay(@RequestBody CustomerDelaySaveDTO saveDto) { public BaseResult insertCustomerDelay(@RequestBody CustomerDelaySaveDTO saveDto) {
return customerGraphicsDelayService.insertCustomerDelay(saveDto); return customerGraphicsDelayService.insertCustomerDelay(saveDto);
} }
@ApiOperation("获取详情") @ApiOperation("获取详情")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
@AccountOperateControl(paramType = AccountParamType.TABLE_PRIMARY, paramName = "id", columnType = AccountTableColumnType.APP_ID, table = "customer_graphics_delay", column = "app_id")
public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(@PathVariable("id") Long id) { public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(@PathVariable("id") Long id) {
return customerGraphicsDelayService.getCustomerDelayDetail(id); return customerGraphicsDelayService.getCustomerDelayDetail(id);
} }
...@@ -56,6 +63,8 @@ public class CustomerDelayGraphicsController { ...@@ -56,6 +63,8 @@ public class CustomerDelayGraphicsController {
@ApiOperation("删除") @ApiOperation("删除")
@GetMapping("/remove/{id}") @GetMapping("/remove/{id}")
@OperateLog(desc = "删除图文延时客服")
@AccountOperateControl(paramType = AccountParamType.TABLE_PRIMARY, paramName = "id", columnType = AccountTableColumnType.APP_ID, table = "customer_graphics_delay", column = "app_id")
public BaseResult removeCustomerDelay(@PathVariable("id") Long id) { public BaseResult removeCustomerDelay(@PathVariable("id") Long id) {
return customerGraphicsDelayService.removeCustomerDelay(id); return customerGraphicsDelayService.removeCustomerDelay(id);
} }
...@@ -68,6 +77,7 @@ public class CustomerDelayGraphicsController { ...@@ -68,6 +77,7 @@ public class CustomerDelayGraphicsController {
@ApiOperation("复用") @ApiOperation("复用")
@PostMapping("/copy") @PostMapping("/copy")
@OperateLog(desc = "复用图文延时客服")
public BaseResult copy(@RequestParam String appId, public BaseResult copy(@RequestParam String appId,
@RequestParam(required = false) String bookId, @RequestParam(required = false) String bookId,
@RequestParam(required = false) String bookName, @RequestParam(required = false) String bookName,
......
package com.yaoyaozw.customer.controller; package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.annotations.AccountOperateControl;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.enums.AccountParamType;
import com.yaoyaozw.customer.enums.AccountTableColumnType;
import com.yaoyaozw.customer.service.CustomerDelayTextService; import com.yaoyaozw.customer.service.CustomerDelayTextService;
import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -24,24 +28,29 @@ public class CustomerDelayTextController { ...@@ -24,24 +28,29 @@ public class CustomerDelayTextController {
@ApiOperation("新增客服主体") @ApiOperation("新增客服主体")
@PostMapping("/insertCustomerDelay") @PostMapping("/insertCustomerDelay")
@OperateLog(desc = "新增文本延时客服")
@AccountOperateControl(paramType = AccountParamType.REQUEST_BODY, paramName = "saveDto", columnType = AccountTableColumnType.APP_ID, property = "appId")
public GenericsResult<String> insertCustomerDelay(@RequestBody CustomerDelayTextSaveDTO saveDto) { public GenericsResult<String> insertCustomerDelay(@RequestBody CustomerDelayTextSaveDTO saveDto) {
return textService.insertCustomerDelay(saveDto); return textService.insertCustomerDelay(saveDto);
} }
@ApiOperation("新增客服内容") @ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent") @PostMapping("/insertCustomerContent")
@OperateLog(desc = "新增文本延时客服子素材")
public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) { public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) {
return textService.insertCustomerContent(referralDto); return textService.insertCustomerContent(referralDto);
} }
@ApiOperation("获取文本客服详情") @ApiOperation("获取文本客服详情")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
@AccountOperateControl(paramType = AccountParamType.TABLE_PRIMARY, paramName = "id", columnType = AccountTableColumnType.APP_ID, table = "customer_graphics_delay", column = "app_id")
public GenericsResult<CustomerDelayTextDetailVO> getCustomerTextDetail(@PathVariable("id") Long id) { public GenericsResult<CustomerDelayTextDetailVO> getCustomerTextDetail(@PathVariable("id") Long id) {
return textService.getCustomerTextDetail(id); return textService.getCustomerTextDetail(id);
} }
@ApiOperation("删除单条文本内容") @ApiOperation("删除单条文本内容")
@GetMapping("/removeCustomerContent/{contentId}") @GetMapping("/removeCustomerContent/{contentId}")
@OperateLog(desc = "删除文本延时客服子素材")
public GenericsResult<CustomerDelayTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) { public GenericsResult<CustomerDelayTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) {
return textService.removeCustomerContent(contentId); return textService.removeCustomerContent(contentId);
} }
......
package com.yaoyaozw.customer.controller; package com.yaoyaozw.customer.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.BaseResult; import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO;
...@@ -31,6 +32,7 @@ public class CustomerMessageGraphicsController { ...@@ -31,6 +32,7 @@ public class CustomerMessageGraphicsController {
@ApiOperation("新增") @ApiOperation("新增")
@PostMapping("/insert") @PostMapping("/insert")
@OperateLog(desc = "新增图文客服消息")
public BaseResult insertCustomerMessage(@RequestBody CustomerMessageSaveDTO saveDto) { public BaseResult insertCustomerMessage(@RequestBody CustomerMessageSaveDTO saveDto) {
return customerGraphicsService.insertCustomerMessage(saveDto); return customerGraphicsService.insertCustomerMessage(saveDto);
} }
...@@ -49,12 +51,14 @@ public class CustomerMessageGraphicsController { ...@@ -49,12 +51,14 @@ public class CustomerMessageGraphicsController {
@ApiOperation("删除") @ApiOperation("删除")
@GetMapping("/remove/{id}") @GetMapping("/remove/{id}")
@OperateLog(desc = "删除图文客服消息")
public BaseResult removeCustomerMessage(@PathVariable("id") Long id) { public BaseResult removeCustomerMessage(@PathVariable("id") Long id) {
return customerGraphicsService.removeCustomerMessage(id); return customerGraphicsService.removeCustomerMessage(id);
} }
@ApiOperation("设置人群包") @ApiOperation("设置人群包")
@GetMapping("/setPack") @GetMapping("/setPack")
@OperateLog(desc = "设置人群包")
public BaseResult setPack(@RequestParam Long id, @RequestParam Long packId) { public BaseResult setPack(@RequestParam Long id, @RequestParam Long packId) {
return customerGraphicsService.setPack(id, packId); return customerGraphicsService.setPack(id, packId);
} }
......
package com.yaoyaozw.customer.controller; package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
...@@ -24,12 +25,14 @@ public class CustomerMessageTextController { ...@@ -24,12 +25,14 @@ public class CustomerMessageTextController {
@ApiOperation("新增客服主体") @ApiOperation("新增客服主体")
@PostMapping("/insertCustomerMessage") @PostMapping("/insertCustomerMessage")
@OperateLog(desc = "新增文本客服消息")
public GenericsResult<String> insertCustomerMessage(@RequestBody CustomerMessageTextSaveDTO saveDto) { public GenericsResult<String> insertCustomerMessage(@RequestBody CustomerMessageTextSaveDTO saveDto) {
return textService.insertCustomerMessage(saveDto); return textService.insertCustomerMessage(saveDto);
} }
@ApiOperation("新增客服内容") @ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent") @PostMapping("/insertCustomerContent")
@OperateLog(desc = "新增文本客服消息子素材")
public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) {
return textService.insertCustomerContent(referralDto); return textService.insertCustomerContent(referralDto);
} }
...@@ -42,6 +45,7 @@ public class CustomerMessageTextController { ...@@ -42,6 +45,7 @@ public class CustomerMessageTextController {
@ApiOperation("删除单条文本内容") @ApiOperation("删除单条文本内容")
@GetMapping("/removeCustomerContent/{contentId}") @GetMapping("/removeCustomerContent/{contentId}")
@OperateLog(desc = "删除文本客服消息子素材")
public GenericsResult<CustomerMessageTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) { public GenericsResult<CustomerMessageTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) {
return textService.removeCustomerContent(contentId); return textService.removeCustomerContent(contentId);
} }
......
package com.yaoyaozw.customer.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author didi
* @Create 2022/4/28 15:15
*/
@ApiModel(value="account_setup")
@Data
@TableName(value = "account_setup")
public class AccountSetup {
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="")
private Long id;
@TableField(value = "auth_id")
@ApiModelProperty(value="")
private Long authId;
@TableField(value = "app_id")
@ApiModelProperty(value="")
private String appId;
@TableField(value = "user_id")
@ApiModelProperty(value="")
private String userId;
public static final String COL_ID = "id";
public static final String COL_AUTH_ID = "auth_id";
public static final String COL_APP_ID = "app_id";
public static final String COL_USER_ID = "user_id";
}
\ No newline at end of file
package com.yaoyaozw.customer.entity;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
/**
* 材料操作日志
*
* @author darker
* @date 2022/12/09
*/
@Data
@TableName("system_operate_log")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SystemOperateLog implements Serializable {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 方法路径
*/
@TableField("method_path")
private String methodPath;
/**
* 请求参数
*/
@TableField("request_param")
private String requestParam;
/**
* 执行模块
*/
@TableField("operate_module")
private String operateModule;
/**
* 执行描述
*/
@TableField("operate_desc")
private String operateDesc;
/**
* 执行结果
*/
@TableField("operate_result")
private Boolean operateResult;
/**
* 执行时间
*/
@TableField("operate_time")
private Date operateTime;
/**
* 执行人
*/
@TableField("operate_user")
private Long operateUser;
/**
* 方法耗时
*/
@TableField("time_cost")
private BigDecimal timeCost;
public Boolean getOperateResult() {
return ObjectUtil.isNull(this.operateResult) ? Boolean.TRUE : this.operateResult;
}
public void setTimeCost(Long time) {
if (ObjectUtil.isNotNull(time)) {
this.timeCost = new BigDecimal(time).divide(CustomerCommonConstant.THOUSAND_BIG_DECIMAL, 3, RoundingMode.HALF_UP);
}
}
private static final long serialVersionUID = 1L;
}
package com.yaoyaozw.customer.enums;
/**
* @author darker
* @date 2022/12/13 11:59
*/
public enum AccountParamType {
/**
* 业务操作时,公众号参数的存在形式
*/
// 以数据表主键id作为参数的形式
TABLE_PRIMARY,
// 以公众号id作为参数的形式
ACCOUNT_PRIMARY,
// 参数是实体参数
REQUEST_BODY;
}
package com.yaoyaozw.customer.enums;
/**
* @author darker
* @date 2022/12/13 11:59
*/
public enum AccountTableColumnType {
/**
* 业务操作时,公众号参数的存在形式
*/
// 表中的公众号字段是appId
APP_ID,
// 表中的公众号字段是主键id
AUTH_ID;
}
package com.yaoyaozw.customer.exception;
/**
* @author 10626
*/
public class AopCommonException extends RuntimeException {
private static final long serialVersionUID = -5355745971968165717L;
public AopCommonException() {
}
public AopCommonException(String message) {
super(message);
}
}
package com.yaoyaozw.customer.exception;
/**
* @author 10626
*/
public class BaseException extends RuntimeException {
private static final long serialVersionUID = -5355745971968165717L;
public BaseException() {
}
public BaseException(String message) {
super(message);
}
}
package com.yaoyaozw.customer.exception;
import cn.hutool.core.text.StrBuilder;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.utils.LogUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.HashMap;
import java.util.Map;
/**
* @author 10626
*/
@Slf4j
@RestControllerAdvice(annotations = RestController.class)
public class ExceptionControllerAdvice {
@ExceptionHandler(value = MethodArgumentNotValidException.class)
public BaseResult handleValidException(MethodArgumentNotValidException e) {
log.error("数据校验出现问题{},异常类型:{}", e.getMessage(), e.getClass());
BindingResult bindingResult = e.getBindingResult();
// 将校验信息直接拼接进行返回
StrBuilder strBuilder = new StrBuilder();
for (FieldError fieldError : bindingResult.getFieldErrors()) {
strBuilder.append(fieldError.getDefaultMessage()).append("\n");
}
return new BaseResult().error(strBuilder.toString());
}
@ExceptionHandler(value = AopCommonException.class)
public BaseResult aopCommonException(AopCommonException e) {
String msg = LogUtils.getStackTraceInfo(e);
log.error("AOP异常-> {}", msg);
return new BaseResult().error(e.getMessage());
}
@ExceptionHandler(value = BaseException.class)
public BaseResult baseException(BaseException e) {
String msg = LogUtils.getStackTraceInfo(e);
log.error("系统出现异常{}", msg);
return new BaseResult().error(e.getMessage());
}
@ExceptionHandler(value = Exception.class)
public BaseResult handleException(Exception e) {
log.error("错误:{}", LogUtils.getStackTraceInfo(e));
e.printStackTrace();
return new BaseResult().error(e.getMessage());
}
}
package com.yaoyaozw.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.entity.AccountSetup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author didi
* @Create 2022/4/28 15:15
*/
@Mapper
public interface AccountSetupMapper extends BaseMapper<AccountSetup> {
}
\ No newline at end of file
package com.yaoyaozw.customer.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author darker
* @date 2022/12/13 15:51
*/
@Repository
public interface MaterialAopCommonMapper {
/**
* 从表获取帐户
*
* @param primaryId 主键id
* @param tableName 表名
* @param columnName 列名
* @return {@link String}
*/
String getAccountFromTable(@Param("primaryId") String primaryId, @Param("tableName") String tableName, @Param("columnName") String columnName);
/**
* 得到用户角色级别
*
* @param userId 用户id
* @return {@link Integer}
*/
Integer getUserRoleLevel(@Param("userId") String userId);
}
package com.yaoyaozw.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.entity.SystemOperateLog;
import org.springframework.stereotype.Repository;
/**
* @author darker
* @date 2022/12/9 12:11
*/
@Repository
public interface SystemOperateLogMapper extends BaseMapper<SystemOperateLog> {
}
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.entity.AccountSetup;
import java.util.List;
/**
* @Author didi
* @Create 2022/4/28 15:15
*/
public interface AccountSetupService extends IService<AccountSetup> {
}
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.entity.SystemOperateLog;
/**
* @author darker
* @date 2022/12/9 12:11
*/
public interface SystemOperateLogService extends IService<SystemOperateLog> {
}
package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.AccountSetup;
import com.yaoyaozw.customer.mapper.AccountSetupMapper;
import com.yaoyaozw.customer.service.AccountSetupService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author didi
* @Create 2022/4/28 15:15
*/
@Service
public class AccountSetupServiceImpl extends ServiceImpl<AccountSetupMapper, AccountSetup> implements AccountSetupService {
}
...@@ -47,6 +47,16 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -47,6 +47,16 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
@Override @Override
public GenericsResult<String> insertCustomerMessage(CustomerMessageTextSaveDTO saveDto) { public GenericsResult<String> insertCustomerMessage(CustomerMessageTextSaveDTO saveDto) {
StringBuilder builder = new StringBuilder();
if (StringUtils.isBlank(saveDto.getName())) {
builder.append("请填写标题");
}
if (ObjectUtil.isNull(saveDto.getPostTime())) {
builder.append(StringUtils.isBlank(builder) ? "请填写发送时间" : "、发送时间");
}
if (StringUtils.isNotBlank(builder)) {
return new GenericsResult<>(false, builder.toString());
}
// 主体数据 // 主体数据
LOCAL_LOG.info("处理主体数据"); LOCAL_LOG.info("处理主体数据");
CustomerGraphics customerGraphics = new CustomerGraphics(); CustomerGraphics customerGraphics = new CustomerGraphics();
......
package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.SystemOperateLog;
import com.yaoyaozw.customer.mapper.SystemOperateLogMapper;
import com.yaoyaozw.customer.service.SystemOperateLogService;
import org.springframework.stereotype.Service;
/**
* @author darker
* @date 2022/12/9 12:11
*/
@Service
public class SystemOperateLogServiceImpl extends ServiceImpl<SystemOperateLogMapper, SystemOperateLog> implements SystemOperateLogService {
}
package com.yaoyaozw.customer.utils;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* @author 10626
*/
public class LogUtils {
/**
* 获取e.printStackTrace() 的具体信息,赋值给String 变量,并返回
*
* @param e
* Exception
* @return e.printStackTrace() 中 的信息
*/
public static String getStackTraceInfo(Exception e) {
StringWriter sw = null;
PrintWriter pw = null;
try {
sw = new StringWriter();
pw = new PrintWriter(sw);
e.printStackTrace(pw);//将出错的栈信息输出到printWriter中
pw.flush();
sw.flush();
return sw.toString();
} catch (Exception ex) {
return "printStackTrace()转换错误";
} finally {
if (sw != null) {
try {
sw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (pw != null) {
pw.close();
}
}
}
}
...@@ -4,7 +4,7 @@ spring: ...@@ -4,7 +4,7 @@ spring:
application: application:
name: customer-service name: customer-service
profiles: profiles:
active: pro active: dev
--- ---
spring: spring:
profiles: dev profiles: dev
...@@ -12,7 +12,7 @@ spring: ...@@ -12,7 +12,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 47.103.117.175:8848 server-addr: 47.103.117.175:8848
namespace: 062507b6-b1d7-4aac-8ed8-0da1cd9451e1 namespace: 697c082b-664c-4b37-a3a9-4328df43a8bc
config: config:
server-addr: 47.103.117.175:8848 server-addr: 47.103.117.175:8848
namespace: 062507b6-b1d7-4aac-8ed8-0da1cd9451e1 namespace: 062507b6-b1d7-4aac-8ed8-0da1cd9451e1
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yaoyaozw.customer.mapper.AccountSetupMapper">
<resultMap id="BaseResultMap" type="com.yaoyaozw.customer.entity.AccountSetup">
<!--@mbg.generated-->
<!--@Table account_setup-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="auth_id" jdbcType="BIGINT" property="authId"/>
<result column="app_id" jdbcType="VARCHAR" property="appId"/>
<result column="user_id" jdbcType="CHAR" property="userId"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, auth_id, app_id, user_id, appid
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yaoyaozw.customer.mapper.MaterialAopCommonMapper">
<select id="getAccountFromTable" resultType="java.lang.String">
select
${columnName}
from ${tableName}
where id = ${primaryId}
</select>
<select id="getUserRoleLevel" resultType="java.lang.Integer">
select
max(role.role_level)
from acl_user_role aur
left join acl_role role
on aur.role_id = role.id
where aur.user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论