🔖 Releasing / Version tags. 5.2

🔖 Releasing / Version tags. 5.2
This commit is contained in:
lbw committed 2023-09-13 10:28:40 +08:00
1 parent 95371f54a8
commit 2c6a700154
100 files changed
+507 -439

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server-api</artifactId>
+2 -2
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server-biz</artifactId>
@@ -62,7 +62,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server-api</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</dependency>
<!--必备: log 依赖-->
<dependency>
@@ -47,9 +47,10 @@ public class AppArticleCollectController {
@GetMapping("/page")
public R getAppArticleCollectPage(@ParameterObject Page page) {
MPJLambdaWrapper<AppArticleCollectEntity> wrapper = new MPJLambdaWrapper<AppArticleCollectEntity>()
.selectAll(AppArticleCollectEntity.class).select(AppArticleEntity::getTitle)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
.selectAll(AppArticleCollectEntity.class)
.select(AppArticleEntity::getTitle)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
}
@@ -106,7 +107,8 @@ public class AppArticleCollectController {
public R removeByArticleId(@PathVariable String articleId) {
Long id = SecurityUtils.getUser().getId();
return R.ok(appArticleCollectService.remove(Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id).eq(AppArticleCollectEntity::getArticleId, articleId)));
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, articleId)));
}
/**
@@ -63,7 +63,7 @@ public class AppRoleController {
@GetMapping("/page")
public R getAppRolePage(Page page, AppRole appRole) {
return R.ok(appRoleService.page(page, Wrappers.<AppRole>lambdaQuery()
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
}
/**
@@ -63,8 +63,11 @@ public class AppUserController {
@Inner
@GetMapping("/info/{username}")
public R info(@PathVariable String username) {
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getUsername, username).or()
.eq(AppUser::getPhone, username));
AppUser user = appUserService.getOne(Wrappers.<AppUser>query()
.lambda()
.eq(AppUser::getUsername, username)
.or()
.eq(AppUser::getPhone, username));
if (user == null) {
return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
}
@@ -24,8 +24,9 @@ public class AppArticleCollectServiceImpl extends ServiceImpl<AppArticleCollectM
appArticleCollect.setUserId(id);
this.saveOrUpdate(appArticleCollect,
Wrappers.<AppArticleCollectEntity>lambdaQuery().eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()));
Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()));
return Boolean.TRUE;
}
@@ -40,8 +40,8 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
// 查询是否收藏了
if (Objects.nonNull(userId)) {
boolean exists = collectMapper.exists(Wrappers.<AppArticleCollectEntity>lambdaQuery()//
.eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
.eq(AppArticleCollectEntity::getUserId, userId));
.eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
.eq(AppArticleCollectEntity::getUserId, userId));
appArticleEntity.setCollect(exists);
}
@@ -49,8 +49,10 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
Integer nowVisit = appArticleEntity.getVisit();
appArticleEntity.setVisit(nowVisit + 1);
// 乐观锁
baseMapper.update(appArticleEntity, Wrappers.<AppArticleEntity>lambdaQuery().eq(AppArticleEntity::getId, id)
.eq(AppArticleEntity::getVisit, nowVisit));
baseMapper.update(appArticleEntity,
Wrappers.<AppArticleEntity>lambdaQuery()
.eq(AppArticleEntity::getId, id)
.eq(AppArticleEntity::getVisit, nowVisit));
return appArticleEntity;
}
@@ -64,11 +66,11 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
public Page pageAndCname(Page page, AppArticleEntity appArticle) {
MPJLambdaWrapper<AppArticleEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(AppArticleEntity.class)
.selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
.leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
.selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
.leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
return this.page(page, wrapper);
}
@@ -40,7 +40,7 @@ public class AppIndexServiceImpl implements AppIndexService {
Map<String, Object> response = new LinkedHashMap<>();
AppPageEntity appPageEntity = appPageMapper.selectById(1);
List<AppArticleEntity> articleList = appArticleMapper
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
response.put("pages", appPageEntity);
response.put("article", articleList);
return response;
@@ -54,7 +54,7 @@ public class AppMobileServiceImpl implements AppMobileService {
@Override
public R<Boolean> sendSmsCode(String mobile) {
Object codeObj = redisTemplate.opsForValue()
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
if (codeObj != null) {
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
@@ -63,9 +63,9 @@ public class AppMobileServiceImpl implements AppMobileService {
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
log.debug("手机号生成验证码成功:{},{}", mobile, code);
redisTemplate.opsForValue().set(
CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
redisTemplate.opsForValue()
.set(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
return R.ok(Boolean.TRUE, code);
}
@@ -77,8 +77,9 @@ public class AppRoleServiceImpl extends ServiceImpl<AppRoleMapper, AppRole> impl
for (AppRoleExcelVO excel : excelVOList) {
Set<String> errorMsg = new HashSet<>();
// 检验角色名称或者角色编码是否存在
boolean existRole = roleList.stream().anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
|| excel.getRoleCode().equals(appRole.getRoleCode()));
boolean existRole = roleList.stream()
.anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
|| excel.getRoleCode().equals(appRole.getRoleCode()));
if (existRole) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_NAMEORCODE_EXISTING, excel.getRoleName(),
@@ -159,8 +159,10 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
AppUserInfo info = new AppUserInfo();
info.setAppUser(user);
// 设置角色列表 (ID)
List<Long> roleIds = appRoleService.findRolesByUserId(user.getUserId()).stream().map(AppRole::getRoleId)
.collect(Collectors.toList());
List<Long> roleIds = appRoleService.findRolesByUserId(user.getUserId())
.stream()
.map(AppRole::getRoleId)
.collect(Collectors.toList());
info.setRoles(ArrayUtil.toArray(roleIds, Long.class));
// 设置权限列表(menu.permission)
@@ -211,7 +213,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
}
// 删除用户关联表
this.appUserRoleService
.remove(Wrappers.<AppUserRole>lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
.remove(Wrappers.<AppUserRole>lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
this.removeBatchByIds(CollUtil.toList(ids));
@@ -222,7 +224,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
@Override
public R registerAppUser(AppUserDTO appUser) {
List<AppUser> appUserList = baseMapper
.selectList(Wrappers.<AppUser>lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
.selectList(Wrappers.<AppUser>lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
if (CollUtil.isNotEmpty(appUserList)) {
return R.failed("手机号已注册,请使用验证码直接登录");
@@ -264,7 +266,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
Set<String> errorMsg = new HashSet<>();
// 校验用户名是否存在
boolean exsitUserName = userList.stream()
.anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
.anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
if (exsitUserName) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername()));
@@ -273,8 +275,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
// 判断输入的角色名称列表是否合法
List<String> roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
List<AppRole> roleCollList = roleList.stream()
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
.collect(Collectors.toList());
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
.collect(Collectors.toList());
if (roleCollList.size() != roleNameList.size()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList()));
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-auth</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-audit</artifactId>
+1 -1
View File
@@ -17,7 +17,7 @@
<description>pigx 公共版本控制</description>
<properties>
<pigx.version>5.2.0-snapshot</pigx.version>
<pigx.version>5.2.0</pigx.version>
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>
<mybatis-plus-join.version>1.4.5</mybatis-plus-join.version>
<dynamic-ds.version>4.1.3</dynamic-ds.version>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-core</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-data</artifactId>
@@ -44,8 +44,7 @@ public class DataScopeInnerInterceptor implements DataScopeInterceptor {
// 返回true 不拦截直接返回原始 SQL (只针对 COUNT 查询)
if (dataScopeHandle.calcScope(dataScope) && DataScopeFuncEnum.COUNT.equals(dataScope.getFunc())) {
mpBs.sql(String.format("SELECT %s FROM (%s) temp_data_scope",
dataScope.getFunc().getType(), originalSql));
mpBs.sql(String.format("SELECT %s FROM (%s) temp_data_scope", dataScope.getFunc().getType(), originalSql));
return;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>pigx-common</artifactId>
<groupId>com.pig4cloud</groupId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-encrypt-api</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-excel</artifactId>
@@ -63,7 +63,7 @@ public class ResponseExcelAutoConfiguration {
@PostConstruct
public void setReturnValueHandlers() {
List<HandlerMethodReturnValueHandler> returnValueHandlers = requestMappingHandlerAdapter
.getReturnValueHandlers();
.getReturnValueHandlers();
List<HandlerMethodReturnValueHandler> newHandlers = new ArrayList<>();
newHandlers.add(responseExcelReturnValueHandler);
@@ -71,12 +71,16 @@ public class RequestExcelArgumentResolver implements HandlerMethodArgumentResolv
Class<?> excelModelClass = ResolvableType.forMethodParameter(parameter).getGeneric(0).resolve();
// 这里需要指定读用哪个 class 去读,然后读取第一个 sheet 文件流会自动关闭
EasyExcel.read(inputStream, excelModelClass, readListener).registerConverter(LocalDateStringConverter.INSTANCE)
.registerConverter(LocalTimeStringConverter.INSTANCE)
.registerConverter(LocalDateTimeStringConverter.INSTANCE)
.registerConverter(LongStringConverter.INSTANCE).registerConverter(StringArrayConverter.INSTANCE)
.ignoreEmptyRow(requestExcel.ignoreEmptyRow()).sheet().headRowNumber(requestExcel.headRowNumber())
.doRead();
EasyExcel.read(inputStream, excelModelClass, readListener)
.registerConverter(LocalDateStringConverter.INSTANCE)
.registerConverter(LocalTimeStringConverter.INSTANCE)
.registerConverter(LocalDateTimeStringConverter.INSTANCE)
.registerConverter(LongStringConverter.INSTANCE)
.registerConverter(StringArrayConverter.INSTANCE)
.ignoreEmptyRow(requestExcel.ignoreEmptyRow())
.sheet()
.headRowNumber(requestExcel.headRowNumber())
.doRead();
// 校验失败的数据处理 交给 BindResult
WebDataBinder dataBinder = webDataBinderFactory.createBinder(webRequest, readListener.getErrors(), "excel");
@@ -51,8 +51,10 @@ public class ResponseExcelReturnValueHandler implements HandlerMethodReturnValue
Assert.state(responseExcel != null, "No @ResponseExcel");
mavContainer.setRequestHandled(true);
sheetWriteHandlerList.stream().filter(handler -> handler.support(o)).findFirst()
.ifPresent(handler -> handler.export(o, response, responseExcel));
sheetWriteHandlerList.stream()
.filter(handler -> handler.support(o))
.findFirst()
.ifPresent(handler -> handler.export(o, response, responseExcel));
}
}
@@ -41,7 +41,7 @@ public enum LocalDateStringConverter implements Converter<LocalDate> {
}
else {
DateTimeFormatter formatter = DateTimeFormatter
.ofPattern(contentProperty.getDateTimeFormatProperty().getFormat());
.ofPattern(contentProperty.getDateTimeFormatProperty().getFormat());
return LocalDate.parse(cellData.getStringValue(), formatter);
}
}
@@ -41,7 +41,7 @@ public enum LocalTimeStringConverter implements Converter<LocalTime> {
}
else {
DateTimeFormatter formatter = DateTimeFormatter
.ofPattern(contentProperty.getDateTimeFormatProperty().getFormat());
.ofPattern(contentProperty.getDateTimeFormatProperty().getFormat());
return LocalTime.parse(cellData.getStringValue(), formatter);
}
}
@@ -81,15 +81,16 @@ public abstract class AbstractSheetWriteHandler implements SheetWriteHandler, Ap
public void export(Object o, HttpServletResponse response, ResponseExcel responseExcel) {
check(responseExcel);
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
String name = (String) Objects.requireNonNull(requestAttributes).getAttribute(DynamicNameAspect.EXCEL_NAME_KEY,
RequestAttributes.SCOPE_REQUEST);
String name = (String) Objects.requireNonNull(requestAttributes)
.getAttribute(DynamicNameAspect.EXCEL_NAME_KEY, RequestAttributes.SCOPE_REQUEST);
if (name == null) {
name = UUID.randomUUID().toString();
}
String fileName = String.format("%s%s", URLEncoder.encode(name, "UTF-8"), responseExcel.suffix().getValue());
// 根据实际的文件类型找到对应的 contentType
String contentType = MediaTypeFactory.getMediaType(fileName).map(MediaType::toString)
.orElse("application/vnd.ms-excel");
String contentType = MediaTypeFactory.getMediaType(fileName)
.map(MediaType::toString)
.orElse("application/vnd.ms-excel");
response.setContentType(contentType);
response.setCharacterEncoding("utf-8");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename*=utf-8''" + fileName);
@@ -105,11 +106,14 @@ public abstract class AbstractSheetWriteHandler implements SheetWriteHandler, Ap
@SneakyThrows(IOException.class)
public ExcelWriter getExcelWriter(HttpServletResponse response, ResponseExcel responseExcel) {
ExcelWriterBuilder writerBuilder = EasyExcel.write(response.getOutputStream())
.registerConverter(LocalTimeStringConverter.INSTANCE)
.registerConverter(LocalDateStringConverter.INSTANCE)
.registerConverter(LocalDateTimeStringConverter.INSTANCE)
.registerConverter(LongStringConverter.INSTANCE).registerConverter(StringArrayConverter.INSTANCE)
.autoCloseStream(true).excelType(responseExcel.suffix()).inMemory(responseExcel.inMemory());
.registerConverter(LocalTimeStringConverter.INSTANCE)
.registerConverter(LocalDateStringConverter.INSTANCE)
.registerConverter(LocalDateTimeStringConverter.INSTANCE)
.registerConverter(LongStringConverter.INSTANCE)
.registerConverter(StringArrayConverter.INSTANCE)
.autoCloseStream(true)
.excelType(responseExcel.suffix())
.inMemory(responseExcel.inMemory());
if (StringUtils.hasText(responseExcel.password())) {
writerBuilder.password(responseExcel.password());
@@ -35,8 +35,9 @@ public class DefaultAnalysisEventListener extends ListAnalysisEventListener<Obje
Set<ConstraintViolation<Object>> violations = Validators.validate(o);
if (!violations.isEmpty()) {
Set<String> messageSet = violations.stream().map(ConstraintViolation::getMessage)
.collect(Collectors.toSet());
Set<String> messageSet = violations.stream()
.map(ConstraintViolation::getMessage)
.collect(Collectors.toSet());
errorMessageList.add(new ErrorMessage(lineNum, messageSet));
}
else {
@@ -51,8 +51,8 @@ public class I18nHeaderCellWriteHandler implements CellWriteHandler {
if (CollectionUtils.isNotEmpty(originHeadNameList)) {
// 国际化处理
List<String> i18nHeadNames = originHeadNameList.stream()
.map(headName -> propertyPlaceholderHelper.replacePlaceholders(headName, placeholderResolver))
.collect(Collectors.toList());
.map(headName -> propertyPlaceholderHelper.replacePlaceholders(headName, placeholderResolver))
.collect(Collectors.toList());
head.setHeadNameList(i18nHeadNames);
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -91,7 +91,8 @@ public class PigxFeignClientsRegistrar
continue;
}
registerClientConfiguration(registry, getClientName(attributes), className, attributes.get("configuration"));
registerClientConfiguration(registry, getClientName(attributes), className,
attributes.get("configuration"));
validate(attributes);
BeanDefinitionBuilder definition = BeanDefinitionBuilder
@@ -255,7 +256,7 @@ public class PigxFeignClientsRegistrar
}
private void registerClientConfiguration(BeanDefinitionRegistry registry, Object name, Object className,
Object configuration) {
Object configuration) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(FeignClientSpecification.class);
builder.addConstructorArgValue(name);
builder.addConstructorArgValue(className);
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-gateway</artifactId>
@@ -65,8 +65,8 @@ public class VersionGrayLoadBalancer implements GrayLoadBalancer {
if (StrUtil.isBlank(reqVersion)) {
// 过滤出不含VERSION实例
List<ServiceInstance> versionInstanceList = instances.stream()
.filter(instance -> !instance.getMetadata().containsKey(CommonConstants.VERSION))
.collect(Collectors.toList());
.filter(instance -> !instance.getMetadata().containsKey(CommonConstants.VERSION))
.collect(Collectors.toList());
if (CollUtil.isEmpty(versionInstanceList)) {
// 根据权重获取实例
return randomByWeight(instances);
@@ -76,9 +76,9 @@ public class VersionGrayLoadBalancer implements GrayLoadBalancer {
}
// 遍历可以实例元数据,若匹配则返回此实例
List<ServiceInstance> availableList = instances.stream()
.filter(instance -> reqVersion
.equalsIgnoreCase(MapUtil.getStr(instance.getMetadata(), CommonConstants.VERSION)))
.collect(Collectors.toList());
.filter(instance -> reqVersion
.equalsIgnoreCase(MapUtil.getStr(instance.getMetadata(), CommonConstants.VERSION)))
.collect(Collectors.toList());
if (CollUtil.isEmpty(availableList)) {
// 根据权重获取实例
return randomByWeight(instances);
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-gray</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-idempotent</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-job</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-log</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-oss</artifactId>
+1 -1
View File
@@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-seata</artifactId>
+1 -1
View File
@@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-security</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-sequence</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-swagger</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-websocket</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common-xss</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-common</artifactId>
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-engine</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine-api</artifactId>
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-engine</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine-biz</artifactId>
@@ -28,9 +28,9 @@ import java.util.List;
*/
@Slf4j
public class ModelUtil {
/**
* 构建模型
*
* @param nodeDto 前端传输节点
* @return
*/
@@ -42,17 +42,16 @@ public class ModelUtil {
process.setId(flowId);
process.setName(processName);
//流程监听器
// 流程监听器
ArrayList<EventListener> eventListeners = new ArrayList<>();
{
//流程实例监听器
// 流程实例监听器
EventListener eventListener = new EventListener();
eventListener.setImplementationType("class");
eventListener.setImplementation(FlowProcessEventListener.class.getCanonicalName());
eventListeners.add(eventListener);
}
@@ -60,24 +59,20 @@ public class ModelUtil {
NodeUtil.addEndNode(nodeDto);
//创建所有的节点
// 创建所有的节点
buildAllNode(process, nodeDto, flowId);
//创建所有的内部节点连接线
// 创建所有的内部节点连接线
buildAllNodeInnerSequence(process, nodeDto, flowId);
//创建节点间连线
// 创建节点间连线
buildAllNodeOuterSequence(process, nodeDto, null);
//处理分支和下级连线
// 处理分支和下级连线
bpmnModel.addProcess(process);
return bpmnModel;
}
/**
* 先创建所有的节点
*
* @param process
* @param nodeDto
* @param flowId
@@ -87,7 +82,6 @@ public class ModelUtil {
return;
}
List<FlowElement> flowElementList = buildNode(nodeDto, flowId);
for (FlowElement flowElement : flowElementList) {
if (process.getFlowElement(flowElement.getId()) == null) {
@@ -95,36 +89,33 @@ public class ModelUtil {
}
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
//条件分支
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
for (Node branch : branchs) {
buildAllNode(process, branch.getChildren(),
flowId);
buildAllNode(process, branch.getChildren(), flowId);
}
if (NodeUtil.isNode(children)) {
buildAllNode(process, children, flowId);
}
} else {
}
else {
if (NodeUtil.isNode(children)) {
buildAllNode(process, children, flowId);
}
}
}
/**
* 先创建所有的内部节点连接线
*
* @param process
* @param nodeDto
* @param flowId
@@ -134,41 +125,37 @@ public class ModelUtil {
return;
}
//画内部线
// 画内部线
List<SequenceFlow> flowList = buildInnerSequenceFlow(nodeDto, flowId);
for (SequenceFlow sequenceFlow : flowList) {
process.addFlowElement(sequenceFlow);
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch() ) {
//条件分支
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
for (Node branch : branchs) {
buildAllNodeInnerSequence(process, branch.getChildren(),
flowId);
buildAllNodeInnerSequence(process, branch.getChildren(), flowId);
}
if (NodeUtil.isNode(children)) {
buildAllNodeInnerSequence(process, children, flowId);
}
} else {
}
else {
if (NodeUtil.isNode(children)) {
buildAllNodeInnerSequence(process, children, flowId);
}
}
}
/**
* 递归创建节点间连线
*
* @param process 流程
* @param nodeDto 节点对象
* @param nextId
@@ -179,85 +166,81 @@ public class ModelUtil {
return;
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch() ) {
// children = children.getChildren();
//条件分支
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
// children = children.getChildren();
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
int ord = 1;
int size = branchs.size();
for (Node branch : branchs) {
buildAllNodeOuterSequence(process, branch.getChildren(), nodeDto.getTailId());
String expression = null;
if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() ) {
if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue()) {
if (ord == size) {
expression = NodeExpressionStrategyFactory.handleDefaultBranch(branchs, ord - 1);
} else if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() && ord > 1) {
}
else if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() && ord > 1) {
expression = NodeExpressionStrategyFactory.handleDefaultBranch(branchs, ord - 1);
} else {
}
else {
expression = NodeExpressionStrategyFactory.handle(branch);
}
}
//添加连线
// 添加连线
if (!NodeUtil.isNode(branch.getChildren())) {
//当前分支 没有其他节点了 所有就是网关和网关后面节点直接连线
// 当前分支 没有其他节点了 所有就是网关和网关后面节点直接连线
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(), nodeDto.getTailId(),
expression,
StrUtil.format("{}->{}", nodeDto.getName(), nodeDto.getName())
);
expression, StrUtil.format("{}->{}", nodeDto.getName(), nodeDto.getName()));
process.addFlowElement(sequenceFlow);
} else {
}
else {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(), branch.getChildren().getHeadId(),
expression,
StrUtil.format("{}->{}", nodeDto.getName(), branch.getChildren().getName())
);
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(),
branch.getChildren().getHeadId(), expression,
StrUtil.format("{}->{}", nodeDto.getName(), branch.getChildren().getName()));
process.addFlowElement(sequenceFlow);
}
ord++;
}
//分支结尾的合并分支节点-》下一个节点
if (children != null && StrUtil.isNotBlank(children.getHeadId()) && StrUtil.isNotBlank(nodeDto.getTailId())) {
// 分支结尾的合并分支节点-》下一个节点
if (children != null && StrUtil.isNotBlank(children.getHeadId())
&& StrUtil.isNotBlank(nodeDto.getTailId())) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), children.getHeadId(),
"",
StrUtil.format("{}->{}", nodeDto.getName(), children.getName())
);
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), children.getHeadId(), "",
StrUtil.format("{}->{}", nodeDto.getName(), children.getName()));
process.addFlowElement(sequenceFlow);
} else if (StrUtil.isAllNotBlank(nodeDto.getTailId(), nextId)) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), nextId,
"",
StrUtil.format("{}->{}", nodeDto.getName(), nextId)
);
}
else if (StrUtil.isAllNotBlank(nodeDto.getTailId(), nextId)) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "",
StrUtil.format("{}->{}", nodeDto.getName(), nextId));
process.addFlowElement(sequenceFlow);
}
buildAllNodeOuterSequence(process, children, nextId);
} else {
//添加连线
}
else {
// 添加连线
if (NodeUtil.isNode(children)) {
List<SequenceFlow> sequenceFlowList = buildSequenceFlow(children, nodeDto, "");
for (SequenceFlow sequenceFlow : sequenceFlowList) {
process.addFlowElement(sequenceFlow);
}
buildAllNodeOuterSequence(process, children, nextId);
} else if (nodeDto.getType() != NodeTypeEnum.END.getValue().intValue()) {
SequenceFlow seq = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "", StrUtil.format("{}->{}",
nodeDto.getName(), nextId));
}
else if (nodeDto.getType() != NodeTypeEnum.END.getValue().intValue()) {
SequenceFlow seq = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "",
StrUtil.format("{}->{}", nodeDto.getName(), nextId));
process.addFlowElement(seq);
@@ -266,11 +249,9 @@ public class ModelUtil {
}
/**
* 构建节点
*
* @param node 前端传输节点
* @param node 前端传输节点
* @param flowId
* @return
*/
@@ -280,13 +261,13 @@ public class ModelUtil {
return flowElementList;
}
//设置节点的连线头节点
// 设置节点的连线头节点
node.setHeadId(node.getId());
//设置节点的连线尾节点
// 设置节点的连线尾节点
node.setTailId(node.getId());
node.setName(StrUtil.format("{}[{}]", node.getName(), RandomUtil.randomNumbers(5)));
//存储节点数据
// 存储节点数据
RemoteFlowTaskService remoteFlowTaskService = SpringUtil.getBean(RemoteFlowTaskService.class);
ProcessNodeDataDto processNodeDataDto = new ProcessNodeDataDto();
processNodeDataDto.setFlowId(flowId);
@@ -294,32 +275,31 @@ public class ModelUtil {
processNodeDataDto.setData(JSONUtil.toJsonStr(node));
remoteFlowTaskService.saveNodeOriData(processNodeDataDto);
//开始
// 开始
if (node.getType() == NodeTypeEnum.ROOT.getValue().intValue()) {
flowElementList.addAll(buildStartNode(node));
}
//结束
// 结束
if (node.getType() == NodeTypeEnum.END.getValue().intValue()) {
flowElementList.add(buildEndNode(node, false));
}
//审批
// 审批
if (node.getType() == NodeTypeEnum.APPROVAL.getValue().intValue()) {
flowElementList.addAll(buildApproveNode(node));
}
//抄送
// 抄送
if (node.getType() == NodeTypeEnum.CC.getValue().intValue()) {
flowElementList.add(buildCCNode(node));
}
//条件分支
// 条件分支
if (node.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue()) {
flowElementList.addAll(buildInclusiveGatewayNode(node));
}
//并行分支
// 并行分支
if (node.getType() == NodeTypeEnum.PARALLEL_GATEWAY.getValue().intValue()) {
flowElementList.addAll(buildParallelGatewayNode(node));
}
@@ -328,9 +308,7 @@ public class ModelUtil {
}
/**
* 构建开始节点
* 添加一个自动完成任务的用户任务节点
*
* 构建开始节点 添加一个自动完成任务的用户任务节点
* @param node 前端传输节点
* @return
*/
@@ -338,22 +316,17 @@ public class ModelUtil {
List<FlowElement> flowElementList = new ArrayList<>();
StartEvent startEvent = new StartEvent();
startEvent.setId(node.getId());
startEvent.setName(node.getName());
flowElementList.add(startEvent);
return flowElementList;
}
/**
* 构建审批节点
*
* @param node
* @return
*/
@@ -361,21 +334,17 @@ public class ModelUtil {
List<FlowElement> flowElementList = new ArrayList<>();
node.setTailId(StrUtil.format("approve_service_task_{}", node.getId()));
//创建了任务执行监听器
//先执行指派人 后创建
//https://tkjohn.github.io/flowable-userguide/#eventDispatcher
// 创建了任务执行监听器
// 先执行指派人 后创建
// https://tkjohn.github.io/flowable-userguide/#eventDispatcher
FlowableListener createListener = new FlowableListener();
createListener.setImplementation(ApprovalCreateListener.class.getCanonicalName());
createListener.setImplementationType("class");
createListener.setEvent("create");
UserTask userTask = buildUserTask(node, createListener);
flowElementList.add(userTask);
ServiceTask serviceTask = new ServiceTask();
serviceTask.setId(StrUtil.format("approve_service_task_{}", node.getId()));
serviceTask.setName(StrUtil.format("{}_服务任务", node.getName()));
@@ -383,36 +352,31 @@ public class ModelUtil {
serviceTask.setImplementation(ApproveServiceTask.class.getCanonicalName());
serviceTask.setAsynchronous(false);
flowElementList.add(serviceTask);
{
//执行人处理
// 执行人处理
String inputDataItem = "${multiInstanceHandler.resolveAssignee(execution)}";
//串行
// 串行
boolean isSequential = true;
Integer multipleMode = node.getMultipleMode();
//多人
// 多人
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_AL_SAME)) {
//并行会签
// 并行会签
isSequential = false;
}
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_ALL_SORT)) {
//串行会签
// 串行会签
}
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_ONE)) {
//或签
// 或签
isSequential = false;
}
@@ -431,11 +395,8 @@ public class ModelUtil {
return flowElementList;
}
/**
* 创建用户任务
*
* @param node 前端传输节点
* @return
*/
@@ -459,13 +420,11 @@ public class ModelUtil {
/**
* 构建简单的包容网关
*
* @param node
* @return
*/
private static FlowElement buildSimpleExclusiveGatewayNode(Node node) {
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
exclusiveGateway.setId(node.getId());
exclusiveGateway.setName(node.getName());
@@ -474,10 +433,8 @@ public class ModelUtil {
}
/**
* 构建并行网关
*
* @param node
* @return
*/
@@ -490,7 +447,7 @@ public class ModelUtil {
inclusiveGateway.setName(node.getName());
flowElementList.add(inclusiveGateway);
//合并网关
// 合并网关
ParallelGateway parallelGateway = new ParallelGateway();
parallelGateway.setId(StrUtil.format("{}_merge_gateway", node.getId()));
parallelGateway.setName(StrUtil.format("{}_合并网关", node.getName()));
@@ -501,7 +458,6 @@ public class ModelUtil {
/**
* 构建包容网关
*
* @param node
* @return
*/
@@ -516,7 +472,7 @@ public class ModelUtil {
inclusiveGateway.setName(node.getName());
flowElementList.add(inclusiveGateway);
//合并网关
// 合并网关
InclusiveGateway gateway = new InclusiveGateway();
gateway.setId(StrUtil.format("{}_merge_gateway", node.getId()));
gateway.setName(StrUtil.format("{}_合并网关", node.getName()));
@@ -527,8 +483,7 @@ public class ModelUtil {
/**
* 构建结束节点
*
* @param node 前端传输节点
* @param node 前端传输节点
* @param terminateAll
* @return
*/
@@ -537,7 +492,6 @@ public class ModelUtil {
endEvent.setId(node.getId());
endEvent.setName(node.getName());
List<EventDefinition> definitionList = new ArrayList<>();
TerminateEventDefinition definition = new TerminateEventDefinition();
definition.setTerminateAll(terminateAll);
@@ -549,16 +503,14 @@ public class ModelUtil {
/**
* 创建连接线
*
* @param node 子级节点
* @param node 子级节点
* @param parentNode 父级节点
* @param expression
* @return 所有连接线
*/
private static List<SequenceFlow> buildSequenceFlow(Node node, Node parentNode, String expression
) {
private static List<SequenceFlow> buildSequenceFlow(Node node, Node parentNode, String expression) {
List<SequenceFlow> sequenceFlowList = new ArrayList<>();
//没有子级了
// 没有子级了
if (!NodeUtil.isNode(node)) {
return sequenceFlowList;
}
@@ -569,19 +521,15 @@ public class ModelUtil {
return sequenceFlowList;
}
SequenceFlow sequenceFlow = buildSingleSequenceFlow(parentNode.getTailId(), node.getHeadId(), expression,
StrUtil.format("{}->{}", parentNode.getName(), node.getName())
);
StrUtil.format("{}->{}", parentNode.getName(), node.getName()));
sequenceFlowList.add(sequenceFlow);
return sequenceFlowList;
}
/**
* 生成扩展数据
*
* @param key
* @param val
* @return
@@ -596,7 +544,6 @@ public class ModelUtil {
/**
* 创建抄送节点
*
* @param node
* @return
*/
@@ -612,9 +559,8 @@ public class ModelUtil {
ExtensionElement e = new ExtensionElement();
{
e.setName("flowable:failedJobRetryTimeCycle");
//上面的例子会让作业执行器重试5次,并在每次重试前等待1分钟。
// 上面的例子会让作业执行器重试5次,并在每次重试前等待1分钟。
e.setElementText("R5/PT1M");
}
@@ -623,57 +569,42 @@ public class ModelUtil {
return serviceTask;
}
/**
* 创建连接线
*
* @param node 父级节点
* @param node 父级节点
* @param flowId
* @return 所有连接线
*/
private static List<SequenceFlow> buildInnerSequenceFlow(Node node, String flowId
) {
private static List<SequenceFlow> buildInnerSequenceFlow(Node node, String flowId) {
List<SequenceFlow> sequenceFlowList = new ArrayList<>();
if (!NodeUtil.isNode(node)) {
return sequenceFlowList;
}
String nodeId = node.getId();
if (StrUtil.hasBlank(nodeId)) {
return sequenceFlowList;
}
if (node.getType() == NodeTypeEnum.APPROVAL.getValue().intValue()) {
String gatewayId = StrUtil.format("approve_service_task_{}", nodeId);
{
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeId, gatewayId, "${12==12}", null);
sequenceFlowList.add(sequenceFlow);
}
}
return sequenceFlowList;
}
/**
* 创建单个连接线
*
* @param pId 父级id
* @param childId 子级id
* @param pId 父级id
* @param childId 子级id
* @param expression 表达式
* @param name
* @return
@@ -693,5 +624,4 @@ public class ModelUtil {
return sequenceFlow;
}
}
@@ -506,7 +506,7 @@ public abstract class AbstractEngineConfiguration {
databaseTypeMappings.setProperty("DB2/PTX", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DB2/2", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DB2 UDB AS400", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DM DBMS",DATABASE_TYPE_MYSQL);//扩展支持达梦数据
databaseTypeMappings.setProperty("DM DBMS", DATABASE_TYPE_MYSQL);// 扩展支持达梦数据
databaseTypeMappings.setProperty(PRODUCT_NAME_CRDB, DATABASE_TYPE_COCKROACHDB);
return databaseTypeMappings;
}
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine</artifactId>
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-task</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task-api</artifactId>
@@ -115,7 +115,6 @@ public interface RemoteFlowEngineService {
@PostMapping("/task/delegateTask")
R<String> delegateTask(@RequestBody TaskParamDto taskParamDto);
/**
* 查询任务
* @param taskId 任务ID
@@ -10,8 +10,8 @@ import lombok.Data;
@Data
public class SelectValue {
private String key;
private String key;
private String value;
private String value;
}
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-task</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task-biz</artifactId>
@@ -52,7 +52,6 @@ public interface IProcessInstanceService {
*/
R queryMineCC(TaskQueryParamDto taskQueryParamDto);
/**
* 格式化流程显示
* @param nodeFormatParamVo
@@ -289,7 +289,6 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
return R.ok(p);
}
/**
* 格式化流程显示
* @param nodeFormatParamVo
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-gateway</artifactId>
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
*/
@RequiredArgsConstructor
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "springdoc.api-docs.enabled",matchIfMissing = true)
@ConditionalOnProperty(value = "springdoc.api-docs.enabled", matchIfMissing = true)
public class SpringDocConfiguration implements InitializingBean {
private final SwaggerUiConfigProperties swaggerUiConfigProperties;
+1 -1
View File
@@ -18,7 +18,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-register</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-upms</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-upms-api</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-upms</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-upms-biz</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-upms</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-codegen</artifactId>
@@ -299,7 +299,8 @@ public class GeneratorServiceImpl implements GeneratorService {
// 按字段类型分组,使用 Map 存储不同类型的字段列表
Map<Boolean, List<GenTableColumnEntity>> typeMap = table.getFieldList()
.stream()
.collect(Collectors.partitioningBy(columnEntity -> BooleanUtil.toBoolean(columnEntity.getPrimaryPk().toString())));
.collect(Collectors
.partitioningBy(columnEntity -> BooleanUtil.toBoolean(columnEntity.getPrimaryPk().toString())));
// 从分组后的 Map 中获取不同类型的字段列表
List<GenTableColumnEntity> primaryList = typeMap.get(true);
+1 -1
View File
@@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-daemon-elastic-job</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-jimu-platform</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-monitor</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-mp-platform</artifactId>
@@ -13,8 +13,11 @@ public class ImageBuilder extends AbstractBuilder {
@Override
public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, WxMpService service) {
WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content).fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser()).build();
WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE()
.mediaId(content)
.fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.build();
return m;
}
@@ -12,8 +12,11 @@ public class TextBuilder extends AbstractBuilder {
@Override
public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, WxMpService service) {
WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content).fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser()).build();
WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT()
.content(content)
.fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.build();
return m;
}
@@ -127,36 +127,72 @@ public class WxMpInitConfigRunner {
newRouter.rule().handler(this.logHandler).next();
// 接收客服会话管理事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_CREATE_SESSION).handler(this.kfSessionHandler).end();
newRouter.rule().async(false).msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_CLOSE_SESSION).handler(this.kfSessionHandler).end();
newRouter.rule().async(false).msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_SWITCH_SESSION).handler(this.kfSessionHandler).end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_CREATE_SESSION)
.handler(this.kfSessionHandler)
.end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_CLOSE_SESSION)
.handler(this.kfSessionHandler)
.end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.CustomerService.KF_SWITCH_SESSION)
.handler(this.kfSessionHandler)
.end();
// 门店审核事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(WxMpEventConstants.POI_CHECK_NOTIFY)
.handler(this.storeCheckNotifyHandler).end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(WxMpEventConstants.POI_CHECK_NOTIFY)
.handler(this.storeCheckNotifyHandler)
.end();
// 自定义菜单事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(MenuButtonType.CLICK).handler(this.menuHandler)
.end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(MenuButtonType.CLICK)
.handler(this.menuHandler)
.end();
// 点击菜单连接事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(MenuButtonType.VIEW).handler(this.nullHandler)
.end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(MenuButtonType.VIEW)
.handler(this.nullHandler)
.end();
// 关注事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.SUBSCRIBE)
.handler(this.subscribeHandler).end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(EventType.SUBSCRIBE)
.handler(this.subscribeHandler)
.end();
// 取消关注事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.UNSUBSCRIBE)
.handler(this.unsubscribeHandler).end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(EventType.UNSUBSCRIBE)
.handler(this.unsubscribeHandler)
.end();
// 上报地理位置事件
newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.LOCATION).handler(this.locationHandler)
.end();
newRouter.rule()
.async(false)
.msgType(XmlMsgType.EVENT)
.event(EventType.LOCATION)
.handler(this.locationHandler)
.end();
// 接收地理位置消息
newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end();
@@ -57,8 +57,8 @@ public class WxAccountController {
@GetMapping("/page")
public R getWxAccountPage(Page page, WxAccount wxAccount) {
LambdaQueryWrapper<WxAccount> wrapper = Wrappers.<WxAccount>lambdaQuery()
.like(StrUtil.isNotBlank(wxAccount.getName()), WxAccount::getName, wxAccount.getName())
.like(StrUtil.isNotBlank(wxAccount.getAccount()), WxAccount::getAccount, wxAccount.getAccount());
.like(StrUtil.isNotBlank(wxAccount.getName()), WxAccount::getName, wxAccount.getName())
.like(StrUtil.isNotBlank(wxAccount.getAccount()), WxAccount::getAccount, wxAccount.getAccount());
return R.ok(wxAccountService.page(page, wrapper));
}
@@ -132,8 +132,8 @@ public class WxAccountController {
*/
@GetMapping("/list")
public R list(String name) {
LambdaQueryWrapper<WxAccount> wrapper = Wrappers.<WxAccount>lambdaQuery().like(StrUtil.isNotBlank(name),
WxAccount::getName, name);
LambdaQueryWrapper<WxAccount> wrapper = Wrappers.<WxAccount>lambdaQuery()
.like(StrUtil.isNotBlank(name), WxAccount::getName, name);
return R.ok(wxAccountService.list(wrapper));
}
@@ -37,9 +37,9 @@ public class WxAccountTagController {
@GetMapping("/page")
public R<Page<WxAccountTag>> getWxAccountTagPage(Page<WxAccountTag> page, WxAccountTag wxAccountTag) {
LambdaQueryWrapper<WxAccountTag> wrapper = Wrappers.<WxAccountTag>lambdaQuery()
.like(StrUtil.isNotBlank(wxAccountTag.getTag()), WxAccountTag::getTag, wxAccountTag.getTag())
.eq(StrUtil.isNotBlank(wxAccountTag.getWxAccountAppid()), WxAccountTag::getWxAccountAppid,
wxAccountTag.getWxAccountAppid());
.like(StrUtil.isNotBlank(wxAccountTag.getTag()), WxAccountTag::getTag, wxAccountTag.getTag())
.eq(StrUtil.isNotBlank(wxAccountTag.getWxAccountAppid()), WxAccountTag::getWxAccountAppid,
wxAccountTag.getWxAccountAppid());
return R.ok(wxAccountTagService.page(page, wrapper));
}
@@ -87,8 +87,8 @@ public class WxAutoReplyController {
*/
public void jude(WxAutoReply wxAutoReply) {
if (ReplyTypeEnum.MSG.getType().equals(wxAutoReply.getType())) {
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery().eq(WxAutoReply::getReqType,
wxAutoReply.getReqType());
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
.eq(WxAutoReply::getReqType, wxAutoReply.getReqType());
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
if (wxAutoReply.getId() != null) {
if (list != null && list.size() == 1) {
@@ -103,8 +103,8 @@ public class WxAutoReplyController {
}
if (ReplyTypeEnum.KEYWORD.getType().equals(wxAutoReply.getType())) {
Wrapper<WxAutoReply> queryWrapper = Wrappers.<WxAutoReply>lambdaQuery()
.eq(WxAutoReply::getReqKey, wxAutoReply.getReqKey())
.eq(WxAutoReply::getRepType, wxAutoReply.getRepMate());
.eq(WxAutoReply::getReqKey, wxAutoReply.getReqKey())
.eq(WxAutoReply::getRepType, wxAutoReply.getRepMate());
List<WxAutoReply> list = wxAutoReplyService.list(queryWrapper);
if (list != null && list.size() == 1) {
if (!list.get(0).getId().equals(wxAutoReply.getId())) {
@@ -50,9 +50,9 @@ public class WxFansMsgController {
@GetMapping("/page")
public R getWxMsgPage(Page page, WxMsg msg) {
LambdaQueryWrapper<WxMsg> wrapper = Wrappers.<WxMsg>lambdaQuery()
.eq(StrUtil.isNotBlank(msg.getAppId()), WxMsg::getAppId, msg.getAppId())
.like(StrUtil.isNotBlank(msg.getNickName()), WxMsg::getNickName, msg.getNickName())
.eq(StrUtil.isNotBlank(msg.getType()), WxMsg::getType, msg.getType());
.eq(StrUtil.isNotBlank(msg.getAppId()), WxMsg::getAppId, msg.getAppId())
.like(StrUtil.isNotBlank(msg.getNickName()), WxMsg::getNickName, msg.getNickName())
.eq(StrUtil.isNotBlank(msg.getType()), WxMsg::getType, msg.getType());
return R.ok(wxMsgService.page(page, wrapper));
}
@@ -45,17 +45,18 @@ public class LocationHandler extends AbstractHandler {
wxMessage.getPrecision());
// 发送关注消息
List<WxAutoReply> listWxAutoReply = wxAutoReplyService
.list(Wrappers.<WxAutoReply>query().lambda().eq(WxAutoReply::getType, ReplyTypeEnum.MSG.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getReqType, wxMessage.getMsgType()));
List<WxAutoReply> listWxAutoReply = wxAutoReplyService.list(Wrappers.<WxAutoReply>query()
.lambda()
.eq(WxAutoReply::getType, ReplyTypeEnum.MSG.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getReqType, wxMessage.getMsgType()));
// 查询公众号 基本信息
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
// 查询粉丝基本信息
WxAccountFans fans = wxAccountFansMapper
.selectOne(Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
.selectOne(Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
return MsgHandler.getWxMpXmlOutMessage(wxMessage, listWxAutoReply, fans, msgMapper, wxAccount);
}
@@ -44,10 +44,10 @@ public class LogHandler extends AbstractHandler {
log.debug("接收到请求消息,内容:{}", wxMessage.getContent());
WxAccount wxAccount = accountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
WxAccountFans fans = fansMapper
.selectOne(Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
.selectOne(Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
if (fans == null) {
return null;
@@ -47,10 +47,11 @@ public class MenuHandler extends AbstractHandler {
*/
public WxMpXmlOutMessage getWxMpXmlOutMessage(WxMpXmlMessage wxMessage) {
WxMpMenu wxMpMenu = wxMenuMapper.selectOne(
Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, WxMpContextHolder.getAppId()));
List<JSONObject> buttons = JSONUtil.parseObj(wxMpMenu.getMenu()).getJSONArray("button")
.toList(JSONObject.class);
WxMpMenu wxMpMenu = wxMenuMapper
.selectOne(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, WxMpContextHolder.getAppId()));
List<JSONObject> buttons = JSONUtil.parseObj(wxMpMenu.getMenu())
.getJSONArray("button")
.toList(JSONObject.class);
String eventKey = wxMessage.getEventKey();
// 获取子集
@@ -80,23 +81,33 @@ public class MenuHandler extends AbstractHandler {
String repMediaId = button.getStr("repMediaId");
String repDesc = button.getStr("repDesc");
if (WxConsts.KefuMsgType.TEXT.equals(repType)) {
wxMpXmlOutMessage = new TextBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.content(repContent).build();
wxMpXmlOutMessage = new TextBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.content(repContent)
.build();
}
if (WxConsts.KefuMsgType.IMAGE.equals(repType)) {
wxMpXmlOutMessage = new ImageBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(repMediaId).build();
wxMpXmlOutMessage = new ImageBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(repMediaId)
.build();
}
if (WxConsts.KefuMsgType.VOICE.equals(repType)) {
wxMpXmlOutMessage = new VoiceBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(repMediaId).build();
wxMpXmlOutMessage = new VoiceBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(repMediaId)
.build();
}
if (WxConsts.KefuMsgType.VIDEO.equals(repType)) {
wxMpXmlOutMessage = new VideoBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(repMediaId).title(repName).description(repDesc).build();
wxMpXmlOutMessage = new VideoBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(repMediaId)
.title(repName)
.description(repDesc)
.build();
}
if (WxConsts.KefuMsgType.MUSIC.equals(repType)) {
@@ -104,17 +115,23 @@ public class MenuHandler extends AbstractHandler {
String repUrl = button.getStr("repUrl");
String repHqUrl = button.getStr("repHqUrl");
wxMpXmlOutMessage = new MusicBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.thumbMediaId(repThumbMediaId).title(repName).description(repDesc).musicUrl(repUrl)
.hqMusicUrl(repHqUrl).build();
wxMpXmlOutMessage = new MusicBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.thumbMediaId(repThumbMediaId)
.title(repName)
.description(repDesc)
.musicUrl(repUrl)
.hqMusicUrl(repHqUrl)
.build();
}
if (WxConsts.KefuMsgType.NEWS.equals(repType)) {
String content = button.getStr("content");
List<WxMpXmlOutNewsMessage.Item> list = new ArrayList<>();
List<JSONObject> articles = JSONUtil.parseObj(content).getJSONArray("articles")
.toList(JSONObject.class);
List<JSONObject> articles = JSONUtil.parseObj(content)
.getJSONArray("articles")
.toList(JSONObject.class);
WxMpXmlOutNewsMessage.Item t;
for (JSONObject jsonObject : articles) {
t = new WxMpXmlOutNewsMessage.Item();
@@ -124,8 +141,10 @@ public class MenuHandler extends AbstractHandler {
t.setUrl(jsonObject.getStr("url"));
list.add(t);
}
wxMpXmlOutMessage = new NewsBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.articles(list).build();
wxMpXmlOutMessage = new NewsBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.articles(list)
.build();
}
return wxMpXmlOutMessage;
}
@@ -53,19 +53,20 @@ public class MsgHandler extends AbstractHandler {
// 组装回复消息
if (!wxMessage.getMsgType().equals(XmlMsgType.EVENT)) {
WxMpXmlOutMessage rs;
WxAccountFans fans = wxAccountFansMapper.selectOne(
Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
WxAccountFans fans = wxAccountFansMapper
.selectOne(Wrappers.<WxAccountFans>lambdaQuery().eq(WxAccountFans::getOpenid, wxMessage.getFromUser()));
// 查询公众号 基本信息
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
// 1、先处理是否有文本关键字回复
if (WxConsts.KefuMsgType.TEXT.equals(wxMessage.getMsgType())) {
// 先全匹配
List<WxAutoReply> listWxAutoReply = wxAutoReplyService.list(
Wrappers.<WxAutoReply>query().lambda().eq(WxAutoReply::getType, ReplyTypeEnum.KEYWORD.getType())
.eq(WxAutoReply::getRepMate, ReplyMateEnum.ALL.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getReqKey, wxMessage.getContent()));
List<WxAutoReply> listWxAutoReply = wxAutoReplyService.list(Wrappers.<WxAutoReply>query()
.lambda()
.eq(WxAutoReply::getType, ReplyTypeEnum.KEYWORD.getType())
.eq(WxAutoReply::getRepMate, ReplyMateEnum.ALL.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getReqKey, wxMessage.getContent()));
if (listWxAutoReply != null && listWxAutoReply.size() > 0) {
rs = getWxMpXmlOutMessage(wxMessage, listWxAutoReply, fans, wxMsgMapper, wxAccount);
if (rs != null) {
@@ -73,11 +74,12 @@ public class MsgHandler extends AbstractHandler {
}
}
// 再半匹配
listWxAutoReply = wxAutoReplyService.list(
Wrappers.<WxAutoReply>query().lambda().eq(WxAutoReply::getType, ReplyTypeEnum.KEYWORD.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getRepMate, ReplyMateEnum.LIKE.getType())
.like(WxAutoReply::getReqKey, wxMessage.getContent()));
listWxAutoReply = wxAutoReplyService.list(Wrappers.<WxAutoReply>query()
.lambda()
.eq(WxAutoReply::getType, ReplyTypeEnum.KEYWORD.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getRepMate, ReplyMateEnum.LIKE.getType())
.like(WxAutoReply::getReqKey, wxMessage.getContent()));
if (listWxAutoReply != null && listWxAutoReply.size() > 0) {
rs = getWxMpXmlOutMessage(wxMessage, listWxAutoReply, fans, wxMsgMapper, wxAccount);
if (rs != null) {
@@ -86,10 +88,11 @@ public class MsgHandler extends AbstractHandler {
}
}
// 2、再处理消息回复
List<WxAutoReply> listWxAutoReply = wxAutoReplyService
.list(Wrappers.<WxAutoReply>query().lambda().eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getType, ReplyTypeEnum.MSG.getType())
.eq(WxAutoReply::getReqType, wxMessage.getMsgType()));
List<WxAutoReply> listWxAutoReply = wxAutoReplyService.list(Wrappers.<WxAutoReply>query()
.lambda()
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId())
.eq(WxAutoReply::getType, ReplyTypeEnum.MSG.getType())
.eq(WxAutoReply::getReqType, wxMessage.getMsgType()));
rs = getWxMpXmlOutMessage(wxMessage, listWxAutoReply, fans, wxMsgMapper, wxAccount);
return rs;
}
@@ -126,8 +129,10 @@ public class MsgHandler extends AbstractHandler {
// 文本
if (WxConsts.KefuMsgType.TEXT.equals(wxAutoReply.getRepType())) {
wxMsg.setRepContent(wxAutoReply.getRepContent());
wxMpXmlOutMessage = new TextBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.content(wxAutoReply.getRepContent()).build();
wxMpXmlOutMessage = new TextBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.content(wxAutoReply.getRepContent())
.build();
}
// 图片
@@ -135,24 +140,31 @@ public class MsgHandler extends AbstractHandler {
wxMsg.setRepName(wxAutoReply.getRepName());
wxMsg.setRepUrl(wxAutoReply.getRepUrl());
wxMsg.setRepMediaId(wxAutoReply.getRepMediaId());
wxMpXmlOutMessage = new ImageBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId()).build();
wxMpXmlOutMessage = new ImageBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId())
.build();
}
if (WxConsts.KefuMsgType.VOICE.equals(wxAutoReply.getRepType())) {
wxMsg.setRepName(wxAutoReply.getRepName());
wxMsg.setRepUrl(wxAutoReply.getRepUrl());
wxMsg.setRepMediaId(wxAutoReply.getRepMediaId());
wxMpXmlOutMessage = new VoiceBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId()).build();
wxMpXmlOutMessage = new VoiceBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId())
.build();
}
if (WxConsts.KefuMsgType.VIDEO.equals(wxAutoReply.getRepType())) {
wxMsg.setRepName(wxAutoReply.getRepName());
wxMsg.setRepDesc(wxAutoReply.getRepDesc());
wxMsg.setRepUrl(wxAutoReply.getRepUrl());
wxMsg.setRepMediaId(wxAutoReply.getRepMediaId());
wxMpXmlOutMessage = new VideoBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId()).title(wxAutoReply.getRepName())
.description(wxAutoReply.getRepDesc()).build();
wxMpXmlOutMessage = new VideoBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.mediaId(wxAutoReply.getRepMediaId())
.title(wxAutoReply.getRepName())
.description(wxAutoReply.getRepDesc())
.build();
}
if (WxConsts.KefuMsgType.MUSIC.equals(wxAutoReply.getRepType())) {
wxMsg.setRepName(wxAutoReply.getRepName());
@@ -161,10 +173,14 @@ public class MsgHandler extends AbstractHandler {
wxMsg.setRepHqUrl(wxAutoReply.getRepHqUrl());
wxMsg.setRepThumbMediaId(wxAutoReply.getRepThumbMediaId());
wxMsg.setRepThumbUrl(wxAutoReply.getRepThumbUrl());
wxMpXmlOutMessage = new MusicBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.thumbMediaId(wxAutoReply.getRepThumbMediaId()).title(wxAutoReply.getRepName())
.description(wxAutoReply.getRepDesc()).musicUrl(wxAutoReply.getRepUrl())
.hqMusicUrl(wxAutoReply.getRepHqUrl()).build();
wxMpXmlOutMessage = new MusicBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.thumbMediaId(wxAutoReply.getRepThumbMediaId())
.title(wxAutoReply.getRepName())
.description(wxAutoReply.getRepDesc())
.musicUrl(wxAutoReply.getRepUrl())
.hqMusicUrl(wxAutoReply.getRepHqUrl())
.build();
}
if (WxConsts.KefuMsgType.NEWS.equals(wxAutoReply.getRepType())) {
List<WxMpXmlOutNewsMessage.Item> list = new ArrayList<>();
@@ -183,8 +199,10 @@ public class MsgHandler extends AbstractHandler {
wxMsg.setRepUrl(wxAutoReply.getRepUrl());
wxMsg.setRepMediaId(wxAutoReply.getRepMediaId());
wxMsg.setContent(wxAutoReply.getContent());
wxMpXmlOutMessage = new NewsBuilder().fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.articles(list).build();
wxMpXmlOutMessage = new NewsBuilder().fromUser(wxMessage.getToUser())
.toUser(wxMessage.getFromUser())
.articles(list)
.build();
}
wxMsgMapper.insert(wxMsg);
}
@@ -66,7 +66,7 @@ public class SubscribeHandler extends AbstractHandler {
wxAccountFans.setOpenid(wxMpUser.getOpenId());
wxAccountFans.setSubscribeStatus(String.valueOf(BooleanUtil.toInt(wxMpUser.getSubscribe())));
wxAccountFans.setSubscribeTime(LocalDateTime
.ofInstant(Instant.ofEpochMilli(wxMpUser.getSubscribeTime() * 1000L), ZoneId.systemDefault()));
.ofInstant(Instant.ofEpochMilli(wxMpUser.getSubscribeTime() * 1000L), ZoneId.systemDefault()));
// 随机生成一个昵称,方便平台内部使用
String generatedName = ChineseNameGenerator.getInstance().generate();
@@ -77,7 +77,7 @@ public class SubscribeHandler extends AbstractHandler {
wxAccountFans.setTagIds(wxAccountFans.getTagIds());
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, WxMpContextHolder.getAppId()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, WxMpContextHolder.getAppId()));
wxAccountFans.setWxAccountId(wxAccount.getId());
wxAccountFans.setWxAccountAppid(wxAccount.getAppid());
wxAccountFans.setWxAccountName(wxAccount.getName());
@@ -97,12 +97,13 @@ public class SubscribeHandler extends AbstractHandler {
*/
private WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage, WxAccountFans fans) {
// 发送关注消息
List<WxAutoReply> listWxAutoReply = wxAutoReplyService
.list(Wrappers.<WxAutoReply>query().lambda().eq(WxAutoReply::getType, ReplyTypeEnum.ATTENTION.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId()));
List<WxAutoReply> listWxAutoReply = wxAutoReplyService.list(Wrappers.<WxAutoReply>query()
.lambda()
.eq(WxAutoReply::getType, ReplyTypeEnum.ATTENTION.getType())
.eq(WxAutoReply::getAppId, WxMpContextHolder.getAppId()));
// 查询公众号 基本信息
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAccount, wxMessage.getToUser()));
WxMpXmlOutMessage wxMpXmlOutMessage = MsgHandler.getWxMpXmlOutMessage(wxMessage, listWxAutoReply, fans,
msgMapper, wxAccount);
return wxMpXmlOutMessage;
@@ -91,10 +91,10 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
// 翻页查询粉丝
LambdaQueryWrapper<WxAccountFans> wrapper = Wrappers.<WxAccountFans>lambdaQuery()
.eq(StrUtil.isNotBlank(wxAccountFans.getWxAccountAppid()), WxAccountFans::getWxAccountAppid,
wxAccountFans.getWxAccountAppid())
.like(StrUtil.isNotBlank(wxAccountFans.getNickname()), WxAccountFans::getNickname,
wxAccountFans.getNickname());
.eq(StrUtil.isNotBlank(wxAccountFans.getWxAccountAppid()), WxAccountFans::getWxAccountAppid,
wxAccountFans.getWxAccountAppid())
.like(StrUtil.isNotBlank(wxAccountFans.getNickname()), WxAccountFans::getNickname,
wxAccountFans.getNickname());
IPage<WxAccountFans> fansPage = baseMapper.selectPage(page, wrapper);
@@ -104,9 +104,9 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
// 赋值 TAG_NAME
if (ArrayUtil.isNotEmpty(fans.getTagIds())) {
List<WxAccountTag> tagList = wxAccountTags.stream()
.filter(tag -> tag.getWxAccountAppid().endsWith(fans.getWxAccountAppid()) //
&& ArrayUtil.contains(fans.getTagIds(), tag.getTagId()))
.collect(Collectors.toList());
.filter(tag -> tag.getWxAccountAppid().endsWith(fans.getWxAccountAppid()) //
&& ArrayUtil.contains(fans.getTagIds(), tag.getTagId()))
.collect(Collectors.toList());
vo.setTagList(tagList);
}
return vo;
@@ -198,7 +198,7 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
@Override
public Boolean syncAccountFans(String appId) {
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>query().lambda().eq(WxAccount::getAppid, appId));
.selectOne(Wrappers.<WxAccount>query().lambda().eq(WxAccount::getAppid, appId));
// 获取操作微信接口类
WxMpService wxMpService = WxMpInitConfigRunner.getMpServices().get(appId);
@@ -222,8 +222,10 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
try {
WxMpUserList wxMpUserList = wxMpUserService.userList(nextOpenid);
// openId 分组 每组 100个 openid
List<List<String>> openIdsList = CollUtil.split(wxMpUserList.getOpenids(), SIZE).stream()
.filter(CollUtil::isNotEmpty).collect(Collectors.toList());
List<List<String>> openIdsList = CollUtil.split(wxMpUserList.getOpenids(), SIZE)
.stream()
.filter(CollUtil::isNotEmpty)
.collect(Collectors.toList());
// 处理每个分组. 调用查询用户信息
for (List<String> openIdList : openIdsList) {
log.info("开始批量获取用户信息 {}", openIdList);
@@ -262,7 +264,7 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
// 2020-11-25 部分用户订阅时间为空,跳过此字段处理
if (ObjectUtil.isNotEmpty(wxMpUser.getSubscribeTime())) {
wxAccountFans.setSubscribeTime(LocalDateTime
.ofInstant(Instant.ofEpochMilli(wxMpUser.getSubscribeTime() * 1000L), ZoneId.systemDefault()));
.ofInstant(Instant.ofEpochMilli(wxMpUser.getSubscribeTime() * 1000L), ZoneId.systemDefault()));
}
// 随机生成一个昵称,方便平台内部使用
@@ -286,8 +288,11 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
*/
private String queryNextOpenId(String appId) {
Page<WxAccountFans> queryPage = new Page<>(0, 1);
Page<WxAccountFans> fansPage = baseMapper.selectPage(queryPage, Wrappers.<WxAccountFans>query().lambda()
.eq(WxAccountFans::getWxAccountAppid, appId).orderByDesc(WxAccountFans::getCreateTime));
Page<WxAccountFans> fansPage = baseMapper.selectPage(queryPage,
Wrappers.<WxAccountFans>query()
.lambda()
.eq(WxAccountFans::getWxAccountAppid, appId)
.orderByDesc(WxAccountFans::getCreateTime));
String nextOpenId = null;
if (fansPage.getTotal() > 0) {
nextOpenId = fansPage.getRecords().get(0).getOpenid();
@@ -64,7 +64,7 @@ public class WxAccountServiceImpl extends ServiceImpl<WxAccountMapper, WxAccount
String url = wxMpService.getQrcodeService().qrCodePictureUrl(ticket.getTicket());
WxAccount wxAccount = baseMapper
.selectOne(Wrappers.<WxAccount>query().lambda().eq(WxAccount::getAppid, appId));
.selectOne(Wrappers.<WxAccount>query().lambda().eq(WxAccount::getAppid, appId));
wxAccount.setQrUrl(url);
baseMapper.updateById(wxAccount);
}
@@ -94,29 +94,37 @@ public class WxAccountServiceImpl extends ServiceImpl<WxAccountMapper, WxAccount
List<List<Object>> result = new ArrayList<>();
try {
// 获取累计用户数据
List<Object> cumulateList = cubeService.getUserCumulate(start, end).stream()
.map(WxDataCubeUserCumulate::getCumulateUser).collect(Collectors.toList());
List<Object> cumulateList = cubeService.getUserCumulate(start, end)
.stream()
.map(WxDataCubeUserCumulate::getCumulateUser)
.collect(Collectors.toList());
result.add(cumulateList);
// 获取用户分享数据
List<Object> shareList = cubeService.getUserShare(start, end).stream()
.map(WxDataCubeArticleResult::getShareCount).collect(Collectors.toList());
List<Object> shareList = cubeService.getUserShare(start, end)
.stream()
.map(WxDataCubeArticleResult::getShareCount)
.collect(Collectors.toList());
result.add(shareList);
// 获取消息发送概况数据
List<Object> upstreamList = cubeService.getUpstreamMsg(start, end).stream()
.map(WxDataCubeMsgResult::getMsgCount).collect(Collectors.toList());
List<Object> upstreamList = cubeService.getUpstreamMsg(start, end)
.stream()
.map(WxDataCubeMsgResult::getMsgCount)
.collect(Collectors.toList());
result.add(upstreamList);
// 获取接口调用概况数据
List<WxDataCubeInterfaceResult> interfaceSummaryList = cubeService.getInterfaceSummary(start, end);
List<Object> interfaceList = interfaceSummaryList.stream().map(WxDataCubeInterfaceResult::getCallbackCount)
.collect(Collectors.toList());
List<Object> interfaceList = interfaceSummaryList.stream()
.map(WxDataCubeInterfaceResult::getCallbackCount)
.collect(Collectors.toList());
result.add(interfaceList);
// 接口日期保存
List<Object> dateList = interfaceSummaryList.stream().map(WxDataCubeInterfaceResult::getRefDate)
.collect(Collectors.toList());
List<Object> dateList = interfaceSummaryList.stream()
.map(WxDataCubeInterfaceResult::getRefDate)
.collect(Collectors.toList());
result.add(dateList);
}
catch (WxErrorException e) {
@@ -42,7 +42,7 @@ public class WxAccountTagServiceImpl extends ServiceImpl<WxAccountTagMapper, WxA
@Transactional(rollbackFor = Exception.class)
public WxAccountTag saveAccountTag(WxAccountTag accountTag) {
WxAccountTag wxAccountTag = baseMapper
.selectOne(Wrappers.<WxAccountTag>lambdaQuery().eq(WxAccountTag::getTag, accountTag.getTag()));
.selectOne(Wrappers.<WxAccountTag>lambdaQuery().eq(WxAccountTag::getTag, accountTag.getTag()));
Assert.isNull(wxAccountTag, StrUtil.format("名称为[{}]的标签已经存在", accountTag.getTag()));
// 调用微信公众号接口删除
@@ -52,7 +52,7 @@ public class WxAccountTagServiceImpl extends ServiceImpl<WxAccountTagMapper, WxA
// 查询公众号详细信息
WxAccount wxAccount = accountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, accountTag.getWxAccountAppid()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, accountTag.getWxAccountAppid()));
accountTag.setWxAccountId(wxAccount.getId());
accountTag.setWxAccountAppid(wxAccount.getAppid());
accountTag.setWxAccountName(wxAccount.getName());
@@ -64,7 +64,7 @@ public class WxMenuServiceImpl extends ServiceImpl<WxMenuMapper, WxMpMenu> imple
baseMapper.delete(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, appId));
WxAccount wxAccount = wxAccountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, appId));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, appId));
WxMpMenu wxMpMenu = new WxMpMenu();
wxMpMenu.setMenu(wxMenus.toStringPretty());
wxMpMenu.setWxAccountId(wxAccount.getId());
@@ -82,7 +82,7 @@ public class WxMenuServiceImpl extends ServiceImpl<WxMenuMapper, WxMpMenu> imple
@Override
public R push(String appId) {
List<WxMpMenu> wxMpMenuList = baseMapper
.selectList(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, appId));
.selectList(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, appId));
if (CollUtil.isEmpty(wxMpMenuList)) {
return R.failed("微信菜单配置未保存,不能发布");
@@ -118,7 +118,7 @@ public class WxMenuServiceImpl extends ServiceImpl<WxMenuMapper, WxMpMenu> imple
@Override
public R getByAppId(String appId) {
List<WxMpMenu> wxMpMenuList = baseMapper
.selectList(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, appId));
.selectList(Wrappers.<WxMpMenu>lambdaQuery().eq(WxMpMenu::getWxAccountAppid, appId));
if (CollUtil.isEmpty(wxMpMenuList)) {
return R.ok();
@@ -52,7 +52,7 @@ public class WxMsgServiceImpl extends ServiceImpl<WxMsgMapper, WxMsg> implements
// 查询用户详细
WxAccountFans wxUser = accountFansMapper.selectById(wxMsg.getWxUserId());
WxAccount wxAccount = accountMapper
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, wxMsg.getAppId()));
.selectOne(Wrappers.<WxAccount>lambdaQuery().eq(WxAccount::getAppid, wxMsg.getAppId()));
// 维护消息-用户
wxMsg.setNickName(wxAccount.getName());
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-pay-platform</artifactId>
@@ -28,9 +28,12 @@ public class SequenceConfig {
@Bean
public Sequence paySequence(DataSource dataSource, SequenceDbProperties properties) {
return DbSeqBuilder.create()
.bizName(() -> String.format("pay_%s_%s", TenantContextHolder.getTenantId(), DateUtil.today()))
.dataSource(dataSource).step(properties.getStep()).retryTimes(properties.getRetryTimes())
.tableName(properties.getTableName()).build();
.bizName(() -> String.format("pay_%s_%s", TenantContextHolder.getTenantId(), DateUtil.today()))
.dataSource(dataSource)
.step(properties.getStep())
.retryTimes(properties.getRetryTimes())
.tableName(properties.getTableName())
.build();
}
/**
@@ -41,9 +44,13 @@ public class SequenceConfig {
*/
@Bean
public Sequence channelSequence(DataSource dataSource, SequenceDbProperties properties) {
return DbSeqBuilder.create().bizName(() -> String.format("channel_%s", TenantContextHolder.getTenantId()))
.dataSource(dataSource).step(properties.getStep()).retryTimes(properties.getRetryTimes())
.tableName(properties.getTableName()).build();
return DbSeqBuilder.create()
.bizName(() -> String.format("channel_%s", TenantContextHolder.getTenantId()))
.dataSource(dataSource)
.step(properties.getStep())
.retryTimes(properties.getRetryTimes())
.tableName(properties.getTableName())
.build();
}
}
@@ -107,16 +107,16 @@ public class AlipayPayNotifyCallbackHandler extends AbstractPayNotifyCallbakHand
@Override
public String parse(Map<String, String> params) {
String tradeStatus = EnumUtil.fromString(TradeStatusEnum.class, params.get(PayConstants.TRADE_STATUS))
.getStatus();
.getStatus();
String orderNo = params.get(PayConstants.OUT_TRADE_NO);
PayGoodsOrder goodsOrder = goodsOrderService
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
goodsOrder.setStatus(tradeStatus);
goodsOrderService.updateById(goodsOrder);
PayTradeOrder tradeOrder = tradeOrderService
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
tradeOrder.setPaySuccTime(LocalDateTime.now());
tradeOrder.setChannelOrderNo(params.get("trade_no"));
tradeOrder.setStatus(TradeStatusEnum.TRADE_SUCCESS.getStatus());
@@ -57,10 +57,14 @@ public class AlipayPayOrderRefundHandler implements PayOrderRefundHandler {
}
JSONObject params = JSONUtil.parseObj(channel.getParam());
AliPayApiConfig aliPayApiConfig = AliPayApiConfig.builder().setAppId(channel.getAppId())
.setPrivateKey(params.getStr("privateKey")).setCharset(CharsetUtil.UTF_8)
.setAliPayPublicKey(params.getStr("publicKey")).setServiceUrl(params.getStr("serviceUrl"))
.setSignType("RSA2").build();
AliPayApiConfig aliPayApiConfig = AliPayApiConfig.builder()
.setAppId(channel.getAppId())
.setPrivateKey(params.getStr("privateKey"))
.setCharset(CharsetUtil.UTF_8)
.setAliPayPublicKey(params.getStr("publicKey"))
.setServiceUrl(params.getStr("serviceUrl"))
.setSignType("RSA2")
.build();
AliPayApiConfigKit.setThreadLocalAliPayApiConfig(aliPayApiConfig);
return channel;
}
@@ -81,10 +81,14 @@ public class AlipayWapPayOrderHandler extends AbstractPayOrderHandler {
}
JSONObject params = JSONUtil.parseObj(channel.getParam());
AliPayApiConfig aliPayApiConfig = AliPayApiConfig.builder().setAppId(channel.getAppId())
.setPrivateKey(params.getStr("privateKey")).setCharset(CharsetUtil.UTF_8)
.setAliPayPublicKey(params.getStr("publicKey")).setServiceUrl(params.getStr("serviceUrl"))
.setSignType("RSA2").build();
AliPayApiConfig aliPayApiConfig = AliPayApiConfig.builder()
.setAppId(channel.getAppId())
.setPrivateKey(params.getStr("privateKey"))
.setCharset(CharsetUtil.UTF_8)
.setAliPayPublicKey(params.getStr("publicKey"))
.setServiceUrl(params.getStr("serviceUrl"))
.setSignType("RSA2")
.build();
AliPayApiConfigKit.setThreadLocalAliPayApiConfig(aliPayApiConfig);
return channel;
}
@@ -79,8 +79,11 @@ public class WeChatMpPayOrderHandler extends AbstractPayOrderHandler {
}
JSONObject params = JSONUtil.parseObj(channel.getParam());
WxPayApiConfig wx = WxPayApiConfig.builder().appId(channel.getAppId()).mchId(channel.getChannelMchId())
.partnerKey(params.getStr("partnerKey")).build();
WxPayApiConfig wx = WxPayApiConfig.builder()
.appId(channel.getAppId())
.mchId(channel.getChannelMchId())
.partnerKey(params.getStr("partnerKey"))
.build();
WxPayApiConfigKit.setThreadLocalWxPayApiConfig(wx);
return channel;
@@ -117,14 +120,20 @@ public class WeChatMpPayOrderHandler extends AbstractPayOrderHandler {
WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig();
// 预订单参数
Map<String, String> params = UnifiedOrderModel.builder().appid(wxPayApiConfig.getAppId())
.mch_id(wxPayApiConfig.getMchId()).nonce_str(WxPayKit.generateStr()).body(goodsOrder.getGoodsName())
.attach(TenantContextHolder.getTenantId().toString())
.out_trade_no(String.valueOf(tradeOrder.getOrderId())).total_fee(goodsOrder.getAmount())
.spbill_create_ip(ip)
.notify_url(ChannelPayApiConfigKit.get().getNotifyUrl() + "/admin/notify/wx/callbak")
.trade_type(TradeType.JSAPI.getTradeType()).openid(goodsOrder.getUserId()).build()
.createSign(wxPayApiConfig.getPartnerKey(), SignType.HMACSHA256);
Map<String, String> params = UnifiedOrderModel.builder()
.appid(wxPayApiConfig.getAppId())
.mch_id(wxPayApiConfig.getMchId())
.nonce_str(WxPayKit.generateStr())
.body(goodsOrder.getGoodsName())
.attach(TenantContextHolder.getTenantId().toString())
.out_trade_no(String.valueOf(tradeOrder.getOrderId()))
.total_fee(goodsOrder.getAmount())
.spbill_create_ip(ip)
.notify_url(ChannelPayApiConfigKit.get().getNotifyUrl() + "/admin/notify/wx/callbak")
.trade_type(TradeType.JSAPI.getTradeType())
.openid(goodsOrder.getUserId())
.build()
.createSign(wxPayApiConfig.getPartnerKey(), SignType.HMACSHA256);
String xmlResult = WxPayApi.pushOrder(false, params);
log.info("微信统一下单返回 {}", xmlResult);
@@ -102,16 +102,16 @@ public class WeChatPayNotifyCallbackHandler extends AbstractPayNotifyCallbakHand
@Override
public String parse(Map<String, String> params) {
String tradeStatus = EnumUtil.fromString(TradeStatusEnum.class, params.get(PayConstants.RESULT_CODE))
.getStatus();
.getStatus();
String orderNo = params.get(PayConstants.OUT_TRADE_NO);
PayGoodsOrder goodsOrder = goodsOrderService
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
goodsOrder.setStatus(tradeStatus);
goodsOrderService.updateById(goodsOrder);
PayTradeOrder tradeOrder = tradeOrderService
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
tradeOrder.setPaySuccTime(LocalDateTime.now());
tradeOrder.setStatus(tradeStatus);
tradeOrder.setChannelOrderNo(params.get("transaction_id"));
@@ -86,9 +86,9 @@ public class YungouosMergePayNotifyCallbakHandler extends AbstractPayNotifyCallb
String mergeCode = params.get(PayConstants.MERGE_CODE);
String orderNo = params.get(PayConstants.MERGE_OUT_TRADE_NO);
PayGoodsOrder goodsOrder = goodsOrderService
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
.getOne(Wrappers.<PayGoodsOrder>lambdaQuery().eq(PayGoodsOrder::getPayOrderId, orderNo));
PayTradeOrder tradeOrder = tradeOrderService
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
.getOne(Wrappers.<PayTradeOrder>lambdaQuery().eq(PayTradeOrder::getOrderId, orderNo));
if (OrderStatusEnum.SUCCESS.getStatus().equals(mergeCode)) {
goodsOrder.setStatus(OrderStatusEnum.SUCCESS.getStatus());
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-visual</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-report-platform</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-visual</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<organization>