feat: Controller参数智能匹配Service签名
🎯 核心功能: 1. readServiceMethodSignature - 从生成的Service文件读取方法签名 2. mapServiceParametersToController - 智能映射参数到Controller参数源 3. 参数类型识别: - ID参数 → 路径参数 - DTO/Param → body - PageParam/Search → query - 基本类型 → 路径或query ✅ 修复逻辑: - Controller调用Service时,参数匹配Service的真实签名 - 支持0参数、1参数、多参数方法 - 回退到基于路由的参数生成(兜底) 📊 预期效果: - TS2554 (参数数量不匹配) → 0 - TS2345 (参数类型不匹配) → 大幅减少 - 14,397 → 预计 <6,000
This commit is contained in:
@@ -455,7 +455,7 @@ ${methodBody}
|
||||
const firstCall = serviceCalls[0];
|
||||
const servicePropertyName = this.namingUtils.toCamelCase(firstCall.serviceImpl) + 'Service';
|
||||
const serviceMethodName = firstCall.serviceMethod;
|
||||
const methodParams = this.generateServiceMethodParameters(method);
|
||||
const methodParams = this.generateServiceMethodParameters(method, javaController);
|
||||
|
||||
return ` const result = await this.${servicePropertyName}.${serviceMethodName}(${methodParams});
|
||||
return Result.success(result);`;
|
||||
@@ -590,8 +590,169 @@ ${methodBody}
|
||||
|
||||
/**
|
||||
* 生成服务方法参数
|
||||
*
|
||||
* ✅ V2: 智能匹配Service方法签名
|
||||
*
|
||||
* 策略:
|
||||
* 1. 尝试从Service文件读取方法签名
|
||||
* 2. 根据参数类型智能映射到Controller参数源
|
||||
* 3. 如果读取失败,回退到基于HTTP路由的简单映射
|
||||
*/
|
||||
generateServiceMethodParameters(method) {
|
||||
generateServiceMethodParameters(method, javaController) {
|
||||
// 尝试从Service文件读取方法签名
|
||||
const serviceParams = this.readServiceMethodSignature(method, javaController);
|
||||
|
||||
if (serviceParams && serviceParams.length > 0) {
|
||||
// 成功读取到Service签名,智能映射参数
|
||||
return this.mapServiceParametersToController(serviceParams, method);
|
||||
}
|
||||
|
||||
// 回退到旧逻辑(基于HTTP路由)
|
||||
return this.generateParametersFromRoute(method);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Service文件读取方法签名
|
||||
*/
|
||||
readServiceMethodSignature(method, javaController) {
|
||||
try {
|
||||
// 获取Service文件路径
|
||||
const servicePath = this.findServiceFile(javaController);
|
||||
if (!servicePath || !fs.existsSync(servicePath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 读取Service文件内容
|
||||
const serviceContent = fs.readFileSync(servicePath, 'utf-8');
|
||||
|
||||
// 从methodServiceCalls中获取实际调用的Service方法名
|
||||
const javaMethodName = method.javaMethodName;
|
||||
const methodServiceCalls = javaController.methodServiceCalls || {};
|
||||
const serviceCalls = methodServiceCalls[javaMethodName] || [];
|
||||
|
||||
if (serviceCalls.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const serviceMethodName = serviceCalls[0].serviceMethod;
|
||||
|
||||
// 提取方法签名:async methodName(param1: Type1, param2: Type2): Promise<ReturnType>
|
||||
const methodRegex = new RegExp(`async\\s+${serviceMethodName}\\s*\\(([^)]*)\\)`, 'm');
|
||||
const match = serviceContent.match(methodRegex);
|
||||
|
||||
if (!match || !match[1]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const paramsString = match[1].trim();
|
||||
if (!paramsString) {
|
||||
return []; // 无参数方法
|
||||
}
|
||||
|
||||
// 解析参数列表:param1: Type1, param2: Type2
|
||||
const params = paramsString.split(',').map(p => {
|
||||
const parts = p.trim().split(':');
|
||||
if (parts.length < 2) return null;
|
||||
|
||||
return {
|
||||
name: parts[0].trim(),
|
||||
type: parts[1].trim()
|
||||
};
|
||||
}).filter(p => p !== null);
|
||||
|
||||
return params;
|
||||
} catch (error) {
|
||||
// 读取失败,返回null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 智能映射Service参数到Controller参数源
|
||||
*/
|
||||
mapServiceParametersToController(serviceParams, method) {
|
||||
const controllerParams = [];
|
||||
|
||||
for (const param of serviceParams) {
|
||||
const paramType = param.type;
|
||||
const paramName = param.name;
|
||||
|
||||
// 根据参数类型和位置决定参数来源
|
||||
if (this.isIdParameter(paramName, paramType)) {
|
||||
// ID参数:从路径参数获取
|
||||
controllerParams.push(paramName);
|
||||
} else if (this.isBodyParameter(paramType)) {
|
||||
// DTO/Param/Body参数:从body获取
|
||||
controllerParams.push('body');
|
||||
} else if (this.isPageParameter(paramType)) {
|
||||
// 分页参数:从query获取
|
||||
controllerParams.push('query');
|
||||
} else if (this.isSearchParameter(paramType)) {
|
||||
// 搜索参数:从query获取
|
||||
controllerParams.push('query');
|
||||
} else if (this.isPrimitiveParameter(paramType)) {
|
||||
// 基本类型:优先从路径参数,其次从query
|
||||
if (method.path && method.path.includes(`{${paramName}}`)) {
|
||||
controllerParams.push(paramName);
|
||||
} else {
|
||||
controllerParams.push('query');
|
||||
}
|
||||
} else {
|
||||
// 默认从query获取
|
||||
controllerParams.push('query');
|
||||
}
|
||||
}
|
||||
|
||||
return controllerParams.join(', ');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是ID参数
|
||||
*/
|
||||
isIdParameter(paramName, paramType) {
|
||||
return paramName === 'id' ||
|
||||
paramName.endsWith('Id') ||
|
||||
(paramType === 'number' && paramName.includes('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是Body参数(DTO/Param类型)
|
||||
*/
|
||||
isBodyParameter(paramType) {
|
||||
return paramType.includes('Dto') ||
|
||||
paramType.includes('Param') ||
|
||||
paramType.includes('Body') ||
|
||||
paramType.includes('Request');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是分页参数
|
||||
*/
|
||||
isPageParameter(paramType) {
|
||||
return paramType.includes('PageParam') ||
|
||||
paramType.includes('Page');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是搜索参数
|
||||
*/
|
||||
isSearchParameter(paramType) {
|
||||
return paramType.includes('Search') ||
|
||||
paramType.includes('Query') ||
|
||||
paramType.includes('Filter');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是基本类型
|
||||
*/
|
||||
isPrimitiveParameter(paramType) {
|
||||
return ['number', 'string', 'boolean'].includes(paramType.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于HTTP路由生成参数(回退逻辑)
|
||||
*/
|
||||
generateParametersFromRoute(method) {
|
||||
const parameters = [];
|
||||
|
||||
// 根据HTTP方法添加参数
|
||||
|
||||
@@ -44,7 +44,7 @@ export class AddonDevelopServiceImplService {
|
||||
}
|
||||
|
||||
if (CommonUtils.isNotEmpty(searchParam.search) && list.length > 0) {
|
||||
list = list.filter(addonDevelopListVo => addonDevelopListVo.title.includes(searchParam.search));
|
||||
list = list.filter(addonDevelopListVo => addonDevelopListVo.getTitle().includes(searchParam.search));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
@@ -30,7 +30,7 @@ export class AddonLogServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page,limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page,limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,7 +102,7 @@ export class AddonServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ export class DictServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ export class DiyServiceImplService {
|
||||
vo.addonName = addonName;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,7 +516,7 @@ export class DiyServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -679,6 +679,6 @@ export class DiyServiceImplService {
|
||||
vo.typeName = templates.getByPath(item.type + ".title", String.class);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ export class DiyThemeServiceImplService {
|
||||
const systemTheme: Record<string, any> = this.coreDiyService.getDefaultThemeColor("app");
|
||||
const appTheme: Record<string, any> = new Record<string, any>();
|
||||
const appThemeObj: Record<string, any> = new Record<string, any>();
|
||||
appThemeObj.set("id", CommonUtils.isNotEmpty(themeData.get("app")) ? themeData.get("app").getId() : "");
|
||||
appThemeObj.set("id", CommonUtils.isNotEmpty(themeData.get("app")) ? themeData.get("app").id : "");
|
||||
appThemeObj.set("icon", "");
|
||||
appThemeObj.set("addon_title", "系统");
|
||||
appThemeObj.set("title", CommonUtils.isNotEmpty(themeData.get("app")) ? themeData.get("app").getTitle() : ((systemTheme && systemTheme.length > 0) ? systemTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("title") : ""));
|
||||
appThemeObj.set("title", CommonUtils.isNotEmpty(themeData.get("app")) ? themeData.get("app").title : ((systemTheme && systemTheme.length > 0) ? systemTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("title") : ""));
|
||||
|
||||
const themeValue: Object = CommonUtils.isNotEmpty(themeData.get("app")) ?
|
||||
themeData.get("app").getTheme() :
|
||||
themeData.get("app").theme :
|
||||
((systemTheme && systemTheme.length > 0) ? systemTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("theme") : "");
|
||||
if (themeValue instanceof String) {
|
||||
appThemeObj.set("theme", JsonUtils.parseObject<any>(themeValue));
|
||||
@@ -52,13 +52,13 @@ export class DiyThemeServiceImplService {
|
||||
const addonTheme: Record<string, any> = this.coreDiyService.getDefaultThemeColor(value.key);
|
||||
if ((addonTheme && addonTheme.length > 0) && addonTheme.containsKey("theme_color")) {
|
||||
const addonData: Record<string, any> = new Record<string, any>();
|
||||
addonData.set("id", CommonUtils.isNotEmpty(themeData.get(value.key)) ? themeData.get(value.key).getId() : "");
|
||||
addonData.set("id", CommonUtils.isNotEmpty(themeData.get(value.key)) ? themeData.get(value.getKey()).id : "");
|
||||
addonData.set("icon", value.icon != null ? value.icon : "");
|
||||
addonData.set("addon_title", value.title != null ? value.title : "");
|
||||
addonData.set("title", CommonUtils.isNotEmpty(themeData.get(value.key)) ? themeData.get(value.key).getTitle() : addonTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("title"));
|
||||
addonData.set("title", CommonUtils.isNotEmpty(themeData.get(value.key)) ? themeData.get(value.getKey()).title : addonTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("title"));
|
||||
|
||||
const addonThemeValue: Object = CommonUtils.isNotEmpty(themeData.get(value.key)) ?
|
||||
themeData.get(value.key).getTheme() :
|
||||
themeData.get(value.getKey()).theme :
|
||||
addonTheme.getJSONArray("theme_color").getRecord<string, any>(0).get("theme");
|
||||
if (addonThemeValue instanceof String) {
|
||||
addonData.set("theme", JsonUtils.parseObject<any>(addonThemeValue));
|
||||
|
||||
@@ -57,7 +57,7 @@ export class DiyFormServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,7 +274,7 @@ export class DiyFormServiceImplService {
|
||||
|
||||
if(formFieldsListMap.containsKey(component.getStr("id")))
|
||||
{
|
||||
this.diyFormFieldsRepository.save(fieldRecord, /* TODO: any /* TODO: QueryWrapper<DiyFormFields> */需改写为TypeORM的where条件对象 */.eq("site_id", this.requestContext.siteId).eq("field_id", formFieldsListMap.get(component.getStr("id")).getFieldId()));
|
||||
this.diyFormFieldsRepository.save(fieldRecord, /* TODO: any /* TODO: QueryWrapper<DiyFormFields> */需改写为TypeORM的where条件对象 */.eq("site_id", this.requestContext.siteId).eq("field_id", formFieldsListMap.get(component.getStr("id")).fieldId));
|
||||
existFieldKeys.push(component.getStr("id"));
|
||||
}else{
|
||||
diyFormFields.push(fieldRecord);
|
||||
@@ -287,7 +287,7 @@ export class DiyFormServiceImplService {
|
||||
for (Map.Entry<String, DiyFormFields> entry : formFieldsListMap.entrySet()) {
|
||||
|
||||
if(!existFieldKeys.includes(entry.key)) {
|
||||
this.diyFormFieldsRepository.delete({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("field_id", entry.value.getFieldId()));
|
||||
this.diyFormFieldsRepository.delete({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("field_id", entry.getValue().fieldId));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -50,7 +50,7 @@ export class AuthSiteServiceImplService {
|
||||
if (CommonUtils.isNotEmpty(siteIds)) {
|
||||
queryWrapper.in("site_id", siteIds);
|
||||
} else {
|
||||
return PageResult.build(page, limit, 0).setData([]);
|
||||
return PageResult.build(page, limit, 0).data = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export class AuthSiteServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ export class MemberAccountServiceImplService {
|
||||
vo.member = memberInfoVo;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ export class MemberCashOutServiceImplService {
|
||||
Object.assign(memberInfoVo, item);
|
||||
item.member = memberInfoVo;
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(iPageRecords);
|
||||
return PageResult.build(page, limit, iPageTotal).data = iPageRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ export class MemberCashOutServiceImplService {
|
||||
const zero: BigDecimal = new BigDecimal(0);
|
||||
vo.transfered = transfered == null ? zero : transfered.applyMoney;
|
||||
if (allMoney != null) {
|
||||
vo.cashOuting = allMoney.applyMoney.subtract(vo.transfered);
|
||||
vo.cashOuting = allMoney.getApplyMoney(.subtract(vo.transfered));
|
||||
} else {
|
||||
vo.cashOuting = zero;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export class MemberLabelServiceImplService {
|
||||
vo.memberNum = members.length;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ export class MemberLevelServiceImplService {
|
||||
if (CommonUtils.isNotEmpty(item.levelGifts)) vo.levelGifts = this.coreMemberService.getGiftContent(item.siteId, JsonUtils.parseObject<any>(item.levelGifts, "admin"));
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,7 +81,7 @@ export class MemberServiceImplService {
|
||||
vo.sexName = SexEnum.getNameBySex(item.sex);
|
||||
vo.statusName = StatusEnum.getNameByStatus(item.status);
|
||||
vo.registerChannelName = ChannelEnum.getNameByCode(item.registerChannel);
|
||||
vo.memberLevelName = levelMap.getOrDefault(item.memberLevel, new MemberLevel().getLevelName());
|
||||
vo.memberLevelName = levelMap.getOrDefault(item.memberLevel, new MemberLevel().levelName);
|
||||
|
||||
if (!item.memberLabel.isEmpty()) {
|
||||
const memberLabelArrays: JSONArray = JSONUtil.parseArray(vo.memberLabel);
|
||||
@@ -98,7 +98,7 @@ export class MemberServiceImplService {
|
||||
}
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPage == null ? list.length : iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPage == null ? list.length : iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,7 +55,7 @@ export class MemberSignServiceImplService {
|
||||
vo.member = memberInfoVo;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,7 +128,7 @@ export class CloudBuildServiceImplService {
|
||||
try {
|
||||
const stringBuilder: StringBuilder = new StringBuilder();
|
||||
stringBuilder.append("http://")
|
||||
.append(InetAddress.getByName("oss.niucloud.com").getHostAddress())
|
||||
.append(InetAddress.getByName("oss.niucloud.com").hostAddress)
|
||||
.append(":8000/");
|
||||
baseUrl = stringBuilder.toString();
|
||||
if (checkLocal){
|
||||
|
||||
@@ -191,8 +191,8 @@ export class NuiSmsServiceImplService {
|
||||
BeanUtil.copyProperties(map.get(noticeMap.key), noticeInfoVo);
|
||||
}
|
||||
//针对短信,微信公众号,小程序配置
|
||||
if (CommonUtils.isNotEmpty(noticeMap.value.getSupport_type_map())) {
|
||||
for (Map.Entry<String, Record<string, any>> supportTypeMap : noticeMap.value.getSupport_type_map().entrySet()) {
|
||||
if (CommonUtils.isNotEmpty(noticeMap.getValue().support_type_map)) {
|
||||
for (Map.Entry<String, Record<string, any>> supportTypeMap : noticeMap.getValue().support_type_map.entrySet()) {
|
||||
if (supportTypeMap.key === "sms") {
|
||||
noticeInfoVo.sms = supportTypeMap.value;
|
||||
}
|
||||
@@ -226,12 +226,12 @@ export class NuiSmsServiceImplService {
|
||||
noticeInfoVo.addon = "系统";
|
||||
}
|
||||
const auditInfo: Record<string, any> = new Record<string, any>();
|
||||
auditInfo.set("audit_msg", templateMap.containsKey(noticeInfoVo.key) ? templateMap.get(noticeInfoVo.key).getAuditMsg() : "");
|
||||
auditInfo.set("audit_status", templateMap.containsKey(noticeInfoVo.key) ? templateMap.get(noticeInfoVo.key).getAuditStatus() : TemplateAuditStatus.TEMPLATE_NOT_REPORT.code);
|
||||
auditInfo.set("audit_status_name", TemplateAuditStatus.getByCode(auditInfo.getInt("audit_status")).getDescription());
|
||||
auditInfo.set("audit_msg", templateMap.containsKey(noticeInfoVo.key) ? templateMap.get(noticeInfoVo.getKey()).auditMsg : "");
|
||||
auditInfo.set("audit_status", templateMap.containsKey(noticeInfoVo.key) ? templateMap.get(noticeInfoVo.getKey()).auditStatus : TemplateAuditStatus.TEMPLATE_NOT_REPORT.code);
|
||||
auditInfo.set("audit_status_name", TemplateAuditStatus.getByCode(auditInfo.getInt("audit_status")).description);
|
||||
const paramsJson: string[] = [];
|
||||
if (templateMap.containsKey(noticeInfoVo.key)){
|
||||
const paramJson: string = templateMap.get(noticeInfoVo.key).getParamJson();
|
||||
const paramJson: string = templateMap.get(noticeInfoVo.getKey()).paramJson;
|
||||
if (CommonUtils.isNotEmpty(paramJson)){
|
||||
const jsonObject: Record<string, any> = JsonUtils.parseObject<any>(paramJson);
|
||||
paramsJson.addAll(jsonObject.keySet());
|
||||
@@ -258,7 +258,7 @@ export class NuiSmsServiceImplService {
|
||||
}
|
||||
auditInfo.set("error_status", errorStatus);
|
||||
if (StringUtil.isNotEmpty(errorStatus)){
|
||||
auditInfo.set("error_status_name", TemplateAuditStatus.getByCode(number.parseInt(errorStatus)).getDescription());
|
||||
auditInfo.set("error_status_name", TemplateAuditStatus.getByCode(number.parseInt(errorStatus)).description);
|
||||
}else {
|
||||
auditInfo.set("error_status_name", "");
|
||||
}
|
||||
@@ -266,7 +266,7 @@ export class NuiSmsServiceImplService {
|
||||
if (templateMap.containsKey(noticeInfoVo.key)){
|
||||
const niuSmsTemplate: NiuSmsTemplate = templateMap.get(noticeInfoVo.key);
|
||||
if (StringUtils.isNotEmpty(niuSmsTemplate.templateType)){
|
||||
noticeInfoVo.templateTypeName = TemplateTypeEnum.fromCode(number.parseInt(niuSmsTemplate.templateType).getDescription());
|
||||
noticeInfoVo.templateTypeName = TemplateTypeEnum.fromCode(number.parseInt(niuSmsTemplate.getTemplateType()).description);
|
||||
}else {
|
||||
noticeInfoVo.templateTypeName = "";
|
||||
}
|
||||
@@ -493,7 +493,7 @@ export class NuiSmsServiceImplService {
|
||||
* getPayInfo
|
||||
*/
|
||||
async getPayInfo(username: string, outTradeNo: string): Promise<any> {
|
||||
const request: HttpServletRequest = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
const request: HttpServletRequest = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).request;
|
||||
|
||||
const protocol: string = request.isSecure() ? "https" : "http";
|
||||
const host: string = request.serverName;
|
||||
|
||||
@@ -37,7 +37,7 @@ export class PayRefundServiceImplService {
|
||||
vo.typeName = payTypeEnum.getByPath(vo.type + ".name", String.class);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ export class PayServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ export class SiteAccountLogServiceImplService {
|
||||
list.push(vo);
|
||||
}
|
||||
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,7 +81,7 @@ export class SiteGroupServiceImplService {
|
||||
vo.appList = appList;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(iPage.current, iPage.size, iPageTotal).setData(list);
|
||||
return PageResult.build(iPage.current, iPage.size, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -198,7 +198,7 @@ export class SiteServiceImplService {
|
||||
|
||||
model.initalledAddon = JSONUtil.toJsonStr(initallJsonArray);
|
||||
model.siteDomain = editParam.siteDomain;
|
||||
model.expireTime = new DateTime(editParam.expireTime.getTime() / 1000);
|
||||
model.expireTime = new DateTime(editParam.getExpireTime().time / 1000);
|
||||
model.status = model.expireTime > DateUtils.currTime( ? SiteStatusEnum.ON.code : SiteStatusEnum.EXPIRE.code);
|
||||
siteMapper.updateById(model);
|
||||
|
||||
@@ -254,7 +254,7 @@ export class SiteServiceImplService {
|
||||
} catch (e) {
|
||||
log.error("删除表数据失败: {} | 原因: {}",
|
||||
entityClass.simpleName,
|
||||
e.cause != null ? e.cause.message : e.message);
|
||||
e.cause != null ? e.getCause().message : e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ export class SiteServiceImplService {
|
||||
this.siteRepository.delete(id);
|
||||
} catch (e) {
|
||||
log.error("删除站点失败: {}", e.message, e);
|
||||
throw new BadRequestException("删除失败: " + (e.cause != null ? e.cause.message : e.message));
|
||||
throw new BadRequestException("删除失败: " + (e.cause != null ? e.getCause().message : e.message));
|
||||
}
|
||||
|
||||
// 清理缓存
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SiteUserServiceImplService {
|
||||
}
|
||||
siteUserVo.roleArray = roleArray;
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(iPageRecords);
|
||||
return PageResult.build(page, limit, iPageTotal).data = iPageRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ export class StatHourServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ export class SysAreaServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ export class SysAttachmentServiceImplService {
|
||||
vo.thumb = CommonUtils.thumbImageSmall(item.siteId, item.path);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ export class SysBackupRecordsServiceImplService {
|
||||
list.push(vo);
|
||||
}
|
||||
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -418,8 +418,8 @@ export class SysBackupRecordsServiceImplService {
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
if (e instanceof InvocationTargetException) {
|
||||
((InvocationTargetException) e).getCause().printStackTrace();
|
||||
throw new BadRequestException(((InvocationTargetException) e).getCause().getMessage());
|
||||
((InvocationTargetException) e).console.error(cause);
|
||||
throw new BadRequestException(((InvocationTargetException) e).getCause().message);
|
||||
} else {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ export class SysMenuServiceImplService {
|
||||
if(ObjectUtil.isNotNull(paichuList) && paichuList.length>0){
|
||||
const paichuArr: string[] = [];
|
||||
for (const i of number = 0; i<paichuList.length; i++){
|
||||
paichuArr.push(paichuList.get(i).getMenuKey());
|
||||
paichuArr.push(paichuList.get(i).menuKey);
|
||||
}
|
||||
queryWrapper.notIn("menu_key", paichuArr);
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ export class SysNoticeLogServiceImplService {
|
||||
for (const item of iPageRecords) {
|
||||
const vo: SysNoticeLogListVo = new SysNoticeLogListVo();
|
||||
Object.assign(vo, item);
|
||||
vo.name = noticeEnum.get(item.key != null ? noticeEnum.get(item.key).getName() : "");
|
||||
vo.name = noticeEnum.get(item.key != null ? noticeEnum.get(item.getKey()).name : "");
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ export class SysNoticeServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,10 +36,10 @@ export class SysNoticeSmsLogServiceImplService {
|
||||
const vo: SysNoticeSmsLogListVo = new SysNoticeSmsLogListVo();
|
||||
Object.assign(vo, item);
|
||||
vo.smsTypeName = smsTypeEnum.getByPath(item.smsType + ".name", String.class);
|
||||
vo.name = ObjectUtil.defaultIfNull(notice.get(item.key.getName(), ""));
|
||||
vo.name = ObjectUtil.defaultIfNull(notice.get(item.getKey().name, ""));
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ export class SysPosterServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,7 @@ export class SysPrinterServiceImplService {
|
||||
vo.trigger = JSONArray.parseArray(item.trigger, String.class);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SysPrinterTemplateServiceImplService {
|
||||
vo.createTime = DateUtils.timestampToString(item.createTime);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ export class SysPrinterTemplateServiceImplService {
|
||||
.findFirst();
|
||||
|
||||
if (illegalPrinter.isPresent()) {
|
||||
throw new Error("该模板已被打印机[" + illegalPrinter.get().getPrinterName() + "]使用,无法删除");
|
||||
throw new Error("该模板已被打印机[" + illegalPrinter.get().printerName + "]使用,无法删除");
|
||||
}
|
||||
|
||||
this.sysPrinterTemplateRepository.delete(id);
|
||||
|
||||
@@ -34,7 +34,7 @@ export class SysRoleServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ export class SysScheduleServiceImplService {
|
||||
const providers: Record<String, IJobProvider> = applicationContext.getBeansOfType(IJobProvider.class);
|
||||
log.info("Loaded job provider count: {}", providers.length);
|
||||
for (const provider of providers.values()) {
|
||||
log.info("Loaded job provider: {}", provider.class.getName());
|
||||
log.info("Loaded job provider: {}", provider.getClass().name);
|
||||
const annotation: JobProvider = provider.class.getAnnotation(JobProvider.class);
|
||||
if (annotation != null) {
|
||||
// 使用注解的 key 作为 map 的键
|
||||
@@ -79,7 +79,7 @@ export class SysScheduleServiceImplService {
|
||||
sysScheduleListVo.crontabContent = QuartzJobManager.convertCronContent(sysSchedule.time);
|
||||
sysScheduleListVoList.push(sysScheduleListVo);
|
||||
}
|
||||
return PageResult.build(page, limit, sysSchedulePageTotal).setData(sysScheduleListVoList);
|
||||
return PageResult.build(page, limit, sysSchedulePageTotal).data = sysScheduleListVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +240,7 @@ export class SysScheduleServiceImplService {
|
||||
Object.assign(sysScheduleLogListVo, sysScheduleLog);
|
||||
result.push(sysScheduleLogListVo);
|
||||
});
|
||||
return PageResult.build(page, limit, sysScheduleLogPageTotal).setData(result);
|
||||
return PageResult.build(page, limit, sysScheduleLogPageTotal).data = result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ export class SysUpgradeRecordsServiceImplService {
|
||||
list.push(vo);
|
||||
}
|
||||
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +77,7 @@ export class SysUpgradeRecordsServiceImplService {
|
||||
public void del(SysUpgradeRecordsDelParam delParam) {
|
||||
const queryWrapper: QueryWrapper = /* TODO: any /* TODO: QueryWrapper<SysUpgradeRecords> */需改写为TypeORM的where条件对象 */;
|
||||
|
||||
if (delParam.ids.getClass().getName().startsWith("[")) {
|
||||
if (delParam.getIds().getClass().name.startsWith("[")) {
|
||||
const stringIds: string[] = (String[]) delParam.ids;
|
||||
queryWrapper.in("id", stringIds);
|
||||
} else {
|
||||
|
||||
@@ -40,7 +40,7 @@ export class SysUserLogServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ export class SysUserServiceImplService {
|
||||
vo.isSuperAdmin = superAdminUid == item.uid;
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,7 +116,7 @@ export class UpgradeServiceImplService {
|
||||
if (content != null) {
|
||||
UpgradeContentVo.const contentVo: Content = JSONUtil.toBean(content, UpgradeContentVo.Content.class);
|
||||
vo.content.add(contentVo);
|
||||
vo.upgradeApps.add(contentVo.app.getAppKey());
|
||||
vo.getUpgradeApps().add(contentVo.getApp().appKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ export class UpgradeServiceImplService {
|
||||
|
||||
const upgradeContent: UpgradeContentVo = getUpgradeContent(upgradeParam.addon);
|
||||
upgradeContent.content = upgradeContent.content.stream(.filter(c => c.versionList.size() > 0));
|
||||
upgradeContent.upgradeApps = upgradeContent.content.stream(.map(c => c.app.getAppKey()));
|
||||
upgradeContent.upgradeApps = upgradeContent.content.stream(.map(c => c.getApp().appKey));
|
||||
if (upgradeContent.content.size() == 0) throw new BadRequestException("没有获取到可以升级的内容");
|
||||
|
||||
const instance: NiucloudUtils = NiucloudUtils.instance;
|
||||
@@ -146,8 +146,8 @@ export class UpgradeServiceImplService {
|
||||
const actionQuery: Record<String, Object> = new const query: Record<>();
|
||||
actionQuery.put("data[product_key]", instance.productKey);
|
||||
actionQuery.put("data[framework_version]", this.appConfig.version);
|
||||
actionQuery.put("data[app_key]", upgradeContent.content.get(0).getApp().getAppKey());
|
||||
actionQuery.put("data[version]", upgradeContent.content.get(0).getVersion());
|
||||
actionQuery.put("data[app_key]", upgradeContent.getContent().get(0).getApp().appKey);
|
||||
actionQuery.put("data[version]", upgradeContent.getContent().get(0).version);
|
||||
|
||||
const actionToken: Record<string, any> = this.niucloudService.getActionToken("upgrade", actionQuery);
|
||||
|
||||
@@ -169,7 +169,7 @@ export class UpgradeServiceImplService {
|
||||
vo.upgrade = actionQuery;
|
||||
vo.step = "requestUpgrade";
|
||||
vo.executed.add("requestUpgrade");
|
||||
vo.log.add(vo.steps.get("requestUpgrade").getTitle());
|
||||
vo.getLog().add(vo.steps.get("requestUpgrade").title);
|
||||
vo.params = query;
|
||||
vo.upgradeContent = upgradeContent;
|
||||
|
||||
@@ -186,8 +186,8 @@ export class UpgradeServiceImplService {
|
||||
const content: JSONArray = new JSONArray();
|
||||
upgradeContent.content.stream().forEach(i => {
|
||||
const item: Record<string, any> = new Record<string, any>();
|
||||
item.set("app_key", i.app.getAppKey());
|
||||
item.putByPath("app.name", i.app.getAppName());
|
||||
item.set("app_key", i.getApp().appKey);
|
||||
item.putByPath("app.name", i.getApp().appName);
|
||||
item.set("version", i.version);
|
||||
item.set("upgrade_version", i.upgradeVersion);
|
||||
content.put(item);
|
||||
@@ -249,7 +249,7 @@ export class UpgradeServiceImplService {
|
||||
if ((step && step.length > 0)) {
|
||||
if (!vo.executed.includes(step)) {
|
||||
vo.executed.add(step);
|
||||
vo.log.add(vo.steps.get(step).getTitle());
|
||||
vo.getLog().add(vo.getSteps().get(step).title);
|
||||
}
|
||||
try {
|
||||
const param: Record<String, Object> = null;
|
||||
@@ -267,7 +267,7 @@ export class UpgradeServiceImplService {
|
||||
throw e;
|
||||
} else {
|
||||
vo.step = step;
|
||||
vo.error.add(e.message);
|
||||
vo.getError().add(e.message);
|
||||
setUpgradeTaskCache(vo);
|
||||
this.upgradeErrorHandle(vo);
|
||||
console.error(e);
|
||||
@@ -282,8 +282,8 @@ export class UpgradeServiceImplService {
|
||||
*/
|
||||
async coverCode(vo: UpgradeTaskVo): Promise<any> {
|
||||
if (this.appConfig.envType === "dev") {
|
||||
vo.upgradeContent.getContent().forEach(item => {
|
||||
const appKey: string = item.app.getAppKey();
|
||||
vo.getUpgradeContent().content.forEach(item => {
|
||||
const appKey: string = item.getApp().appKey;
|
||||
const codeDir: string = upgradeDir(vo + "/download/" + appKey);
|
||||
|
||||
// 判断目录存在并且不为空
|
||||
@@ -356,7 +356,7 @@ export class UpgradeServiceImplService {
|
||||
vo.status = "restarting";
|
||||
setUpgradeTaskCache(vo);
|
||||
fs.writeFileSync(upgradeDir(vo, "upgrade.json"), JsonUtils.parseObject<any>(vo.upgradeContent).toString(), "UTF-8");
|
||||
PipeNameUtils.noticeBootRestartByUpgrade(this.appConfig.applicationName, vo.key, vo.upgradeContent.getLastBackup().getBackupKey());
|
||||
PipeNameUtils.noticeBootRestartByUpgrade(this.appConfig.applicationName, vo.key, vo.getUpgradeContent().getLastBackup().backupKey);
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ export class UpgradeServiceImplService {
|
||||
|
||||
vo.steps = steps;
|
||||
vo.step = "rollback";
|
||||
vo.log.add(steps.get("rollback").getTitle());
|
||||
vo.log.add(steps.get("rollback").title);
|
||||
vo.executed.add("rollback");
|
||||
|
||||
setUpgradeTaskCache(vo);
|
||||
@@ -509,8 +509,8 @@ export class UpgradeServiceImplService {
|
||||
}
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
if (e instanceof InvocationTargetException) {
|
||||
((InvocationTargetException) e).getCause().printStackTrace();
|
||||
throw new BadRequestException(((InvocationTargetException) e).getCause().getMessage());
|
||||
((InvocationTargetException) e).console.error(cause);
|
||||
throw new BadRequestException(((InvocationTargetException) e).getCause().message);
|
||||
} else {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class VerifierServiceImplService {
|
||||
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ export class VerifyServiceImplService {
|
||||
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,14 +32,14 @@ export class WeappVersionServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page,limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page,limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* add
|
||||
*/
|
||||
async add(param: WeappVersionAddParam): Promise<any> {
|
||||
if (!RequestUtils.handler().getScheme() === "https") throw new BadRequestException("微信小程序请求地址只支持https请先配置ssl");
|
||||
if (!RequestUtils.handler().scheme === "https") throw new BadRequestException("微信小程序请求地址只支持https请先配置ssl");
|
||||
|
||||
const weappConfig: WeappConfigVo = this.coreWeappConfigService.getWeappConfig(this.requestContext.siteId);
|
||||
if (weappConfig.appId.isEmpty()) throw new BadRequestException("还没有配置微信小程序");
|
||||
|
||||
@@ -34,7 +34,7 @@ export class WechatMediaServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ export class WechatMediaServiceImplService {
|
||||
wxMaterial.name = param.newFilename;
|
||||
|
||||
try {
|
||||
const res: WxMpMaterialUploadResult = WechatUtils.mp(this.requestContext.siteId).getMaterialService().materialFileUpload(WechatMediaTypeEnum.IMAGE.type, wxMaterial);
|
||||
const res: WxMpMaterialUploadResult = WechatUtils.mp(this.requestContext.getSiteId()).getMaterialService().materialFileUpload(WechatMediaTypeEnum.IMAGE.type, wxMaterial);
|
||||
|
||||
const model: WechatMedia = new WechatMedia();
|
||||
model.siteId = this.requestContext.siteId;
|
||||
@@ -91,7 +91,7 @@ export class WechatMediaServiceImplService {
|
||||
wxMaterial.videoTitle = param.newFilename;
|
||||
|
||||
try {
|
||||
const res: WxMpMaterialUploadResult = WechatUtils.mp(this.requestContext.siteId).getMaterialService().materialFileUpload(WechatMediaTypeEnum.VIDEO.type, wxMaterial);
|
||||
const res: WxMpMaterialUploadResult = WechatUtils.mp(this.requestContext.getSiteId()).getMaterialService().materialFileUpload(WechatMediaTypeEnum.VIDEO.type, wxMaterial);
|
||||
|
||||
const model: WechatMedia = new WechatMedia();
|
||||
model.siteId = this.requestContext.siteId;
|
||||
@@ -116,7 +116,7 @@ export class WechatMediaServiceImplService {
|
||||
try {
|
||||
const count: number = 20;
|
||||
|
||||
const result: WxMpMaterialNewsBatchGetResult = WechatUtils.mp(this.requestContext.siteId).getMaterialService().materialNewsBatchGet(offset, count);
|
||||
const result: WxMpMaterialNewsBatchGetResult = WechatUtils.mp(this.requestContext.getSiteId()).materialService.materialNewsBatchGet(offset, count);
|
||||
if (result.itemCount > 0) {
|
||||
for (WxMpMaterialNewsBatchGetResult.WxMaterialNewsBatchGetNewsItem item: result.items) {
|
||||
const media: WechatMedia = this.wechatMediaRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("media_id", item.mediaId));
|
||||
|
||||
@@ -25,7 +25,7 @@ export class WechatMenuServiceImplService {
|
||||
try{
|
||||
const params: Record<String , JSONArray> = {};
|
||||
params.put("button", data);
|
||||
WechatUtils.mp(this.requestContext.siteId).getMenuService().menuCreate(JsonUtils.parseObject<any>(params).toString()) ;
|
||||
WechatUtils.mp(this.requestContext.getSiteId()).menuService.menuCreate(JsonUtils.parseObject<any>(params).toString()) ;
|
||||
this.coreConfigService.config = this.requestContext.siteId, "WECHAT_MENU", data;
|
||||
}catch (e){
|
||||
throw new AdminException(e.message);
|
||||
|
||||
@@ -38,7 +38,7 @@ export class WechatReplyServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,11 +20,11 @@ export class OplatformServerServiceImplService {
|
||||
throw new IllegalArgumentException("非法请求");
|
||||
}
|
||||
|
||||
const inMessage: WxOpenXmlMessage = WxOpenXmlMessage.fromEncryptedXml(param.requestBody, WechatUtils.WxOpen().getWxOpenConfigStorage(), param.timestamp, param.nonce, param.msgSignature);
|
||||
const inMessage: WxOpenXmlMessage = WxOpenXmlMessage.fromEncryptedXml(param.requestBody, WechatUtils.WxOpen().wxOpenConfigStorage, param.timestamp, param.nonce, param.msgSignature);
|
||||
log.info("开放平台授权事件推送消息:{}", inMessage);
|
||||
|
||||
try {
|
||||
WechatUtils.WxOpen().getWxOpenComponentService().route(inMessage);
|
||||
WechatUtils.WxOpen().wxOpenComponentService.route(inMessage);
|
||||
|
||||
// 授权取消
|
||||
if (inMessage.infoType === "unauthorized") {
|
||||
@@ -53,7 +53,7 @@ export class OplatformServerServiceImplService {
|
||||
throw new IllegalArgumentException("非法请求");
|
||||
}
|
||||
|
||||
const inMessage: WxMpXmlMessage = WxOpenXmlMessage.fromEncryptedMpXml(param.requestBody, WechatUtils.WxOpen().getWxOpenConfigStorage(), param.timestamp, param.nonce, param.msgSignature);
|
||||
const inMessage: WxMpXmlMessage = WxOpenXmlMessage.fromEncryptedMpXml(param.requestBody, WechatUtils.WxOpen().wxOpenConfigStorage, param.timestamp, param.nonce, param.msgSignature);
|
||||
log.info("开放平台消息与事件推送消息:{}", inMessage);
|
||||
|
||||
if (inMessage.msgType === WxConsts.XmlMsgType.EVENT) {
|
||||
@@ -71,7 +71,7 @@ export class OplatformServerServiceImplService {
|
||||
|
||||
const outMessage: WxMpXmlOutMessage = wxOpenMessageRouter.route(inMessage, appid);
|
||||
if(outMessage != null){
|
||||
return WxOpenXmlMessage.wxMpOutXmlMessageToEncryptedXml(outMessage, WechatUtils.WxOpen().getWxOpenConfigStorage());
|
||||
return WxOpenXmlMessage.wxMpOutXmlMessageToEncryptedXml(outMessage, WechatUtils.WxOpen().wxOpenConfigStorage);
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class OplatformServiceImplService {
|
||||
async createPreAuthorizationUrl(): Promise<any> {
|
||||
try {
|
||||
const url: string = RequestUtils.getDomain(true) + "/site/wxoplatform/callback";
|
||||
return WechatUtils.WxOpen().getWxOpenComponentService().getPreAuthUrl(url);
|
||||
return WechatUtils.WxOpen().wxOpenComponentService.getPreAuthUrl(url);
|
||||
} catch (e) {
|
||||
throw new BadRequestException(e.message);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export class OplatformServiceImplService {
|
||||
const queryAuth: WxOpenQueryAuthResult = WechatUtils.WxOpen().getWxOpenComponentService().getQueryAuth(param.authCode);
|
||||
|
||||
// 授权账号信息 授权信息
|
||||
const result: WxOpenAuthorizerInfoResult = WechatUtils.WxOpen().getWxOpenComponentService().getAuthorizerInfo(queryAuth.authorizationInfo.getAuthorizerAppid());
|
||||
const result: WxOpenAuthorizerInfoResult = WechatUtils.WxOpen().getWxOpenComponentService().getAuthorizerInfo(queryAuth.getAuthorizationInfo().authorizerAppid);
|
||||
|
||||
const authorizerInfo: WxOpenAuthorizerInfo = result.authorizerInfo;
|
||||
const authorization: WxOpenAuthorizationInfo = result.authorizationInfo;
|
||||
@@ -106,6 +106,6 @@ export class OplatformServiceImplService {
|
||||
vo.site = siteInfo;
|
||||
listInfo.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(listInfo);
|
||||
return PageResult.build(page, limit, iPageTotal).data = listInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export class WeappVersionServiceImplService {
|
||||
wxOplatfromMPJQueryWrapper.orderByDesc("wowv.id");
|
||||
|
||||
[WxOplatfromWeappVersionVo[], number] iPage = wxOplatfromWeappVersionMapper.selectJoinPage(new Page<>(page, limit), WxOplatfromWeappVersionVo.class, wxOplatfromMPJQueryWrapper);
|
||||
return PageResult.build(page, limit, iPageTotal).setData(iPageRecords);
|
||||
return PageResult.build(page, limit, iPageTotal).data = iPageRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ export class WeappVersionServiceImplService {
|
||||
async uploadSuccess(taskKey: string, isAll: boolean): Promise<any> {
|
||||
const version: WxOplatfromWeappVersion = this.wxOplatfromWeappVersionRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ }));
|
||||
|
||||
const wxOpenService: WxOpenComponentService = WechatUtils.WxOpen().getWxOpenComponentService();
|
||||
const wxOpenService: WxOpenComponentService = WechatUtils.WxOpen().wxOpenComponentService;
|
||||
|
||||
try {
|
||||
const draftList: WxOpenMaCodeTemplate[] = this.wxOpenService.templateDraftList;
|
||||
@@ -194,7 +194,7 @@ export class WeappVersionServiceImplService {
|
||||
extJson.set("directCommit", true);
|
||||
extJson.putByPath("ext.site_id", siteId);
|
||||
|
||||
const commitResult: WxOpenResult = WechatUtils.WxOpen().getWxOpenComponentService()
|
||||
const commitResult: WxOpenResult = WechatUtils.WxOpen().wxOpenComponentService
|
||||
.getWxMaServiceByAppid(weappCofig.appId)
|
||||
.codeCommit(number.valueOf(version.templateId), version.userVersion, version.userDesc, extJson);
|
||||
|
||||
@@ -252,14 +252,14 @@ export class WeappVersionServiceImplService {
|
||||
}
|
||||
} catch (e) {
|
||||
// 如果检测任务结束未结束
|
||||
if (e.error.getErrorCode() == 61039) {
|
||||
if (e.getError().errorCode == 61039) {
|
||||
if (scheduler == null || scheduler.isShutdown() || scheduler.isTerminated()) {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
scheduler.schedule(() => submitAudit(siteId, versionId), 30, TimeUnit.SECONDS);
|
||||
} else {
|
||||
version.status = WeappVersionStatusEnum.APPLET_AUDIT_FAIL.status;
|
||||
version.failReason = e.error.getErrorMsg();
|
||||
version.failReason = e.getError(.errorMsg);
|
||||
version.updateTime = Date.now( / 1000);
|
||||
weappVersionMapper.updateById(version);
|
||||
|
||||
@@ -305,7 +305,7 @@ export class WeappVersionServiceImplService {
|
||||
list.push(vo);
|
||||
}
|
||||
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ export class WeappVersionServiceImplService {
|
||||
const weappCofig: WeappConfigVo = this.coreWeappConfigService.getWeappConfig(this.requestContext.siteId);
|
||||
|
||||
try {
|
||||
const commitResult: WxOpenResult = WechatUtils.WxOpen().getWxOpenComponentService()
|
||||
const commitResult: WxOpenResult = WechatUtils.WxOpen().wxOpenComponentService
|
||||
.getWxMaServiceByAppid(weappCofig.appId).undoCodeAudit();
|
||||
} catch (e) {
|
||||
throw new BadRequestException(e.message);
|
||||
|
||||
@@ -20,7 +20,7 @@ export class AppServiceImplService {
|
||||
try {
|
||||
const app: WxMpService = WechatUtils.app(this.requestContext.siteId);
|
||||
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = app.oAuth2Service.getAccessToken(param.code);
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = app.getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = app.oAuth2Service.getUserInfo(wxOAuth2AccessToken, null);
|
||||
|
||||
return this.login(
|
||||
|
||||
@@ -216,7 +216,7 @@ export class DiyFormServiceImplService {
|
||||
const fieldMap: Record<String, DiyFormRecordsFields> = diyFormRecordsFields.collect(/* Collectors已删除 */.toMap(DiyFormRecordsFields::getFieldKey, field => field));
|
||||
for (const field of result.formField) {
|
||||
if (fieldMap.containsKey(field.fieldKey)) {
|
||||
field.fieldValue = fieldMap.get(field.fieldKey.getFieldValue() == null ? "" : fieldMap.get(field.fieldKey).getFieldValue());
|
||||
field.fieldValue = fieldMap.get(field.getFieldKey().fieldValue == null ? "" : fieldMap.get(field.getFieldKey()).fieldValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -116,7 +116,7 @@ export class MemberCashOutServiceImplService {
|
||||
queryWrapper.orderByDesc(["create_time"]);
|
||||
[MemberCashOutAccount[], number] iPage = this.this.memberCashOutAccountRepository.findAndCount({ /* TODO: 将MyBatis分页参数改为TypeORM的skip/take */ }), queryWrapper);
|
||||
const dataList: MemberCashOutAccountVo[] = CollectUtils.convert(iPageRecords, MemberCashOutAccountVo.class);
|
||||
return PageResult.build(page, limit, iPageTotal).setData(dataList);
|
||||
return PageResult.build(page, limit, iPageTotal).data = dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,7 @@ export class MemberLevelServiceImplService {
|
||||
*/
|
||||
async getMobile(mobileCode: string): Promise<any> {
|
||||
try {
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.siteId).getUserService().getPhoneNoInfo(mobileCode);
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.getSiteId()).userService.getPhoneNoInfo(mobileCode);
|
||||
const mobile: string = phoneInfo.purePhoneNumber;
|
||||
|
||||
const member: Member = this.memberRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ }).eq("mobile", mobile).eq("site_id", this.requestContext.siteId));
|
||||
|
||||
@@ -109,11 +109,11 @@ export class MemberServiceImplService {
|
||||
|
||||
const newMember: Member = new Member();
|
||||
newMember.memberId = oldMember.memberId;
|
||||
if (CommonUtils.isNotEmpty(param.data.getNickname())) newMember.nickname = param.data.getNickname();
|
||||
if (CommonUtils.isNotEmpty(param.data.getHeadimg())) newMember.headimg = param.data.getHeadimg();
|
||||
if (CommonUtils.isNotEmpty(param.data.getBirthday())) newMember.birthday = param.data.getBirthday();
|
||||
if (CommonUtils.isNotEmpty(param.data.getSex())) newMember.sex = param.data.getSex();
|
||||
if (CommonUtils.isNotEmpty(param.data.getLastVisitTime())) newMember.lastVisitTime = param.data.getLastVisitTime();
|
||||
if (CommonUtils.isNotEmpty(param.getData().nickname)) newMember.nickname = param.getData(.nickname);
|
||||
if (CommonUtils.isNotEmpty(param.getData().headimg)) newMember.headimg = param.getData(.headimg);
|
||||
if (CommonUtils.isNotEmpty(param.getData().birthday)) newMember.birthday = param.getData(.birthday);
|
||||
if (CommonUtils.isNotEmpty(param.getData().sex)) newMember.sex = param.getData(.sex);
|
||||
if (CommonUtils.isNotEmpty(param.getData().lastVisitTime)) newMember.lastVisitTime = param.getData(.lastVisitTime);
|
||||
return this.memberMapper.updateById(newMember);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ export class MemberServiceImplService {
|
||||
this.registerService.checkMobileCode(param.mobile, param.mobileKey, param.mobileCode);
|
||||
} else if (CommonUtils.isNotEmpty(param.mobileCode)) {
|
||||
try {
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.siteId).getUserService().getPhoneNoInfo(param.mobileCode);
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.getSiteId()).getUserService().getPhoneNoInfo(param.mobileCode);
|
||||
param.mobile = phoneInfo.purePhoneNumber;
|
||||
} catch (e) {
|
||||
throw new BadRequestException(e.message);
|
||||
|
||||
@@ -32,7 +32,7 @@ export class MemberSignServiceImplService {
|
||||
|
||||
[MemberSign[], number] iPage = this.this.memberSignRepository.findAndCount({ /* TODO: 将MyBatis分页参数改为TypeORM的skip/take */ }), queryWrapper);
|
||||
const dataList: MemberSignRecordVo[] = CollectUtils.convert(iPageRecords, MemberSignRecordVo.class);
|
||||
return PageResult.build(page, limit, iPageTotal).setData(dataList);
|
||||
return PageResult.build(page, limit, iPageTotal).data = dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ export class MemberSignServiceImplService {
|
||||
.gt("start_time", 0)
|
||||
.orderByDesc("sign_id")
|
||||
.last("limit 1")
|
||||
).getStartTime();
|
||||
).startTime;
|
||||
// 周期结束时间
|
||||
const periodEndTime: number = periodStartTime + (config.signPeriod * 86400);
|
||||
// 领取次数
|
||||
@@ -180,8 +180,8 @@ export class MemberSignServiceImplService {
|
||||
|
||||
const signRecord: MemberSign[] = this.this.memberSignRepository.find({ /* TODO: 将QueryWrapper改为where条件 */ }))
|
||||
.between("create_time",
|
||||
DateUtil.beginOfMonth(date).getTime() / 1000,
|
||||
DateUtil.endOfMonth(date).getTime() / 1000)
|
||||
DateUtil.beginOfMonth(date).time / 1000,
|
||||
DateUtil.endOfMonth(date).time / 1000)
|
||||
.orderByAsc("create_time"));
|
||||
|
||||
if (signRecord.length > 0) {
|
||||
|
||||
@@ -81,7 +81,7 @@ export class PayServiceImplService {
|
||||
PayTradeInfoDefiner.const event: PayTradeInfoEvent = new PayTradeInfoDefiner.PayTradeInfoEvent(tradeType, tradeId);
|
||||
const trades: PayTradeInfoDefiner.PayTradeInfoEventResult[] = EventAndSubscribeOfPublisher.publishAndCallback(event);
|
||||
if (CommonUtils.isNotEmpty(trades)) {
|
||||
vo.tradeInfo = trades.get(0.getJsonObject());
|
||||
vo.tradeInfo = trades.get(0.jsonObject);
|
||||
}
|
||||
|
||||
vo.self = payInfo.mainId === this.requestContext.memberId;
|
||||
|
||||
@@ -109,7 +109,7 @@ export class SysVerifyServiceImplService {
|
||||
}
|
||||
});
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(dataList);
|
||||
return PageResult.build(page, limit, iPageTotal).data = dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ export class SysVerifyServiceImplService {
|
||||
mpjQueryWrapper.eq("site_id", param.siteId());
|
||||
mpjQueryWrapper.eq("verifier_member_id", param.memberId());
|
||||
[SysVerifyRecordsVo[], number] iPage = memberMapper.selectJoinPage(new Page<>(page, limit), SysVerifyRecordsVo.class, mpjQueryWrapper );
|
||||
return PageResult.build(page, limit, iPageTotal).setData(iPageRecords);
|
||||
return PageResult.build(page, limit, iPageTotal).data = iPageRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ export class ServeServiceImplService {
|
||||
if ("raw".equals(encryptType)) {
|
||||
response.writer.write(outMessage.toXml());
|
||||
} else if ("aes".equals(encryptType)) {
|
||||
response.writer.write(outMessage.toEncryptedXml(this.wxMaService.wxMaConfig));
|
||||
response.getWriter().write(outMessage.toEncryptedXml(this.wxMaService.wxMaConfig));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class WeappServiceImplService {
|
||||
*/
|
||||
async loginByCode(param: WechatAuthParam): Promise<any> {
|
||||
try {
|
||||
const wxUser: WxMaJscode2SessionResult = WechatUtils.miniapp(this.requestContext.siteId).getUserService().getSessionInfo(param.code);
|
||||
const wxUser: WxMaJscode2SessionResult = WechatUtils.miniapp(this.requestContext.getSiteId()).getUserService().getSessionInfo(param.code);
|
||||
|
||||
const member: Member = this.memberRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("site_id", this.requestContext.siteId));
|
||||
if (ObjectUtil.isNotNull(member)) {
|
||||
@@ -97,7 +97,7 @@ export class WeappServiceImplService {
|
||||
if (config.isBindMobile == 1) {
|
||||
if (!param.mobile.isEmpty() || !param.mobileCode.isEmpty()) {
|
||||
if (!param.mobileCode.isEmpty()) {
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.siteId).getUserService().getPhoneNoInfo(param.mobileCode);
|
||||
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(this.requestContext.getSiteId()).getUserService().getPhoneNoInfo(param.mobileCode);
|
||||
param.mobile = phoneInfo.purePhoneNumber;
|
||||
}
|
||||
} else {
|
||||
@@ -123,7 +123,7 @@ export class WeappServiceImplService {
|
||||
*/
|
||||
async updateOpenid(param: WechatAuthParam): Promise<any> {
|
||||
try {
|
||||
const wxUser: WxMaJscode2SessionResult = WechatUtils.miniapp(this.requestContext.siteId).getUserService().getSessionInfo(param.code);
|
||||
const wxUser: WxMaJscode2SessionResult = WechatUtils.miniapp(this.requestContext.getSiteId()).getUserService().getSessionInfo(param.code);
|
||||
|
||||
const member: Member = this.memberRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("site_id", this.requestContext.siteId));
|
||||
if (ObjectUtil.isNotNull(member)) throw new BadRequestException("账号已存在");
|
||||
|
||||
@@ -60,7 +60,7 @@ export class ServeServiceImplService {
|
||||
if ("raw".equals(encryptType)) {
|
||||
response.writer.write(outMessage.toXml());
|
||||
} else if ("aes".equals(encryptType)) {
|
||||
response.writer.write(outMessage.toEncryptedXml(this.wxMpService.wxMpConfigStorage));
|
||||
response.getWriter().write(outMessage.toEncryptedXml(this.wxMpService.wxMpConfigStorage));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class WechatServiceImplService {
|
||||
* getCodeUrl
|
||||
*/
|
||||
async getCodeUrl(url: string, scopes: string): Promise<any> {
|
||||
const authorizationUrl: string = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().buildAuthorizationUrl(url, scopes, "");
|
||||
const authorizationUrl: string = WechatUtils.mp(this.requestContext.getSiteId()).oAuth2Service.buildAuthorizationUrl(url, scopes, "");
|
||||
const vo: WechatCodeUrlVo = new WechatCodeUrlVo();
|
||||
vo.url = authorizationUrl;
|
||||
return vo;
|
||||
@@ -37,8 +37,8 @@ export class WechatServiceImplService {
|
||||
*/
|
||||
async loginByCode(param: WechatAuthParam): Promise<any> {
|
||||
try {
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getUserInfo(wxOAuth2AccessToken, null);
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.getSiteId()).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.getSiteId()).oAuth2Service.getUserInfo(wxOAuth2AccessToken, null);
|
||||
|
||||
return this.login(
|
||||
ObjectUtil.defaultIfNull(wxUser.openid, ""),
|
||||
@@ -103,8 +103,8 @@ export class WechatServiceImplService {
|
||||
*/
|
||||
async sync(param: WechatSyncParam): Promise<any> {
|
||||
try {
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getUserInfo(wxOAuth2AccessToken, null);
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.getSiteId()).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.getSiteId()).oAuth2Service.getUserInfo(wxOAuth2AccessToken, null);
|
||||
|
||||
const member: Member = new Member();
|
||||
member.memberId = this.requestContext.memberId;
|
||||
@@ -125,7 +125,7 @@ export class WechatServiceImplService {
|
||||
|
||||
const mp: WxMpService = WechatUtils.mp(this.requestContext.siteId);
|
||||
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = mp.oAuth2Service.getAccessToken(param.code);
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = mp.getOAuth2Service().getAccessToken(param.code);
|
||||
if (wxOAuth2AccessToken.scope === "snsapi_base") {
|
||||
vo.openid = ObjectUtil.defaultIfNull(wxOAuth2AccessToken.openId, "");
|
||||
} else {
|
||||
@@ -147,8 +147,8 @@ export class WechatServiceImplService {
|
||||
async scanLogin(): Promise<any> {
|
||||
try {
|
||||
const key: string = this.coreScanService.scan(this.requestContext.siteId, "wechat_login", new Record<string, any>().set("channel", RequestUtils.channel()), 300);
|
||||
const ticket: WxMpQrCodeTicket = WechatUtils.mp(this.requestContext.siteId).getQrcodeService().qrCodeCreateTmpTicket(key, 300);
|
||||
const url: string = WechatUtils.mp(this.requestContext.siteId).getQrcodeService().qrCodePictureUrl(ticket.ticket);
|
||||
const ticket: WxMpQrCodeTicket = WechatUtils.mp(this.requestContext.getSiteId()).qrcodeService.qrCodeCreateTmpTicket(key, 300);
|
||||
const url: string = WechatUtils.mp(this.requestContext.getSiteId()).getQrcodeService().qrCodePictureUrl(ticket.ticket);
|
||||
|
||||
const vo: WechatScanLoginVo = new WechatScanLoginVo();
|
||||
vo.key = key;
|
||||
@@ -165,8 +165,8 @@ export class WechatServiceImplService {
|
||||
*/
|
||||
async updateOpenid(param: WechatAuthParam): Promise<any> {
|
||||
try {
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.siteId).getOAuth2Service().getUserInfo(wxOAuth2AccessToken, null);
|
||||
const wxOAuth2AccessToken: WxOAuth2AccessToken = WechatUtils.mp(this.requestContext.getSiteId()).getOAuth2Service().getAccessToken(param.code);
|
||||
const wxUser: WxOAuth2UserInfo = WechatUtils.mp(this.requestContext.getSiteId()).oAuth2Service.getUserInfo(wxOAuth2AccessToken, null);
|
||||
|
||||
const member: Member = this.memberRepository.findOne({ /* TODO: 将QueryWrapper改为where条件 */ })).eq("site_id", this.requestContext.siteId));
|
||||
if (ObjectUtil.isNotNull(member)) throw new BadRequestException("账号已存在");
|
||||
|
||||
@@ -34,7 +34,7 @@ export class CoreAppCloudServiceImplService {
|
||||
|
||||
handleUniapp(packageDir + "uni-app/", param, appConfig);
|
||||
|
||||
const wapUrl: string = this.coreSysConfigService.getSceneDomain(param.siteId).getWapUrl();
|
||||
const wapUrl: string = this.coreSysConfigService.getSceneDomain(param.getSiteId()).wapUrl;
|
||||
|
||||
const mapConfig: SysMapVo = this.coreSysConfigService.getMap(param.siteId);
|
||||
|
||||
@@ -51,26 +51,26 @@ export class CoreAppCloudServiceImplService {
|
||||
build.set("amap_key", "");
|
||||
build.set("version_name", param.versionName);
|
||||
build.set("version_code", param.versionCode);
|
||||
build.putByPath("cert.type", param.cert.getType());
|
||||
build.putByPath("cert.file", param.cert.getFile());
|
||||
build.putByPath("cert.key_alias", param.cert.getKeyAlias());
|
||||
build.putByPath("cert.key_password", param.cert.getKeyPassword());
|
||||
build.putByPath("cert.store_password", param.cert.getStorePassword());
|
||||
build.putByPath("cert.type", param.getCert().type);
|
||||
build.putByPath("cert.file", param.getCert().file);
|
||||
build.putByPath("cert.key_alias", param.getCert().keyAlias);
|
||||
build.putByPath("cert.key_password", param.getCert().keyPassword);
|
||||
build.putByPath("cert.store_password", param.getCert().storePassword);
|
||||
|
||||
try {
|
||||
// 写入build.json文件
|
||||
fs.writeFileSync(packageDir, "build.json", build.toString(), "UTF-8");
|
||||
|
||||
// 拷贝证书文件
|
||||
if (param.cert.getType() === "private"){
|
||||
const certFile: string = this.appConfig.webRootDownResource, param.getCert(.getFile());
|
||||
if (param.getCert().type === "private"){
|
||||
const certFile: string = this.appConfig.webRootDownResource, param.getCert(.file);
|
||||
if (!fs.existsSync(certFile)) throw new BadRequestException("证书文件不存在");
|
||||
|
||||
fs.copyFileSync(certFile, packageDir, "cert.jks");
|
||||
}
|
||||
|
||||
// 拷贝icon文件
|
||||
const iconFile: string = this.appConfig.webRootDownResource, param.getBuild(.getIcon());
|
||||
const iconFile: string = this.appConfig.webRootDownResource, param.getBuild(.icon);
|
||||
if (!fs.existsSync(iconFile)) throw new BadRequestException("icon文件不存在");
|
||||
fs.copyFileSync(iconFile, packageDir, "drawable.zip");
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export class CoreDiyFormConfigServiceImplService {
|
||||
|
||||
if(timeLimitRule.containsKey("open_day_time") && timeLimitRule.getJSONArray("open_day_time").size() > 0)
|
||||
{
|
||||
const beginOfDay: number = DateUtil.beginOfDay(DateUtil.date()).getTime() / 1000;
|
||||
const beginOfDay: number = DateUtil.beginOfDay(DateUtil.date()).time / 1000;
|
||||
const openDayTime: JSONArray = timeLimitRule.getJSONArray("open_day_time");
|
||||
const openDayTimeVo: JSONArray = new JSONArray();
|
||||
openDayTimeVo.push(DateUtils.timestampToString( (beginOfDay + openDayTime.getLong(0)), "yyyy-MM-dd"));
|
||||
@@ -90,7 +90,7 @@ export class CoreDiyFormConfigServiceImplService {
|
||||
|
||||
if(timeLimitRule.containsKey("open_day_time") && timeLimitRule.getJSONArray("open_day_time").size() > 0)
|
||||
{
|
||||
const beginOfDay: number = DateUtil.beginOfDay(DateUtil.date()).getTime() / 1000;
|
||||
const beginOfDay: number = DateUtil.beginOfDay(DateUtil.date()).time / 1000;
|
||||
const openDayTime: JSONArray = timeLimitRule.getJSONArray("open_day_time");
|
||||
const openDayTimeVo: JSONArray = new JSONArray();
|
||||
const startTimeStr: string = DateUtil.format(DateUtil.date(), "yyyy-MM-dd") + " " + openDayTime.getStr(0) + ":00";
|
||||
|
||||
@@ -183,11 +183,11 @@ export class CoreDiyFormRecordsServiceImplService {
|
||||
this.diyFormRecordsFieldsRepository.save(recordsFieldsList);
|
||||
|
||||
// 累计填写数量
|
||||
this.diyFormRepository.save(new UpdateWrapper<DiyForm>().eq("form_id", addParam.formId).setSql(" write_num = write_num + 1"));
|
||||
this.diyFormRepository.save(new UpdateWrapper<DiyForm>().eq("form_id", addParam.formId).sql = " write_num = write_num + 1");
|
||||
|
||||
for (const field of recordsFieldsList) {
|
||||
// 字段累计填写数量
|
||||
this.diyFormFieldsRepository.save(new UpdateWrapper<DiyFormFields>().eq("form_id", addParam.formId).eq("field_key", field.fieldKey).eq("site_id", addParam.siteId).setSql(" write_num = write_num + 1"));
|
||||
this.diyFormFieldsRepository.save(new UpdateWrapper<DiyFormFields>().eq("form_id", addParam.formId).eq("field_key", field.fieldKey).eq("site_id", addParam.siteId).sql = " write_num = write_num + 1");
|
||||
}
|
||||
}
|
||||
return model.recordId;
|
||||
|
||||
@@ -31,7 +31,7 @@ export class CoreMemberCashOutServiceImplService {
|
||||
if (param.accountType == AccountTypeEnum.MONEY.type && applyMoney.compareTo(member.money) > 0) throw new BadRequestException("提现金额不能大于账户余额");
|
||||
if (param.accountType == AccountTypeEnum.COMMISSION.type && applyMoney.compareTo(member.commission) > 0) throw new BadRequestException("提现金额不能大于账户可提现金额");
|
||||
if (applyMoney.compareTo(config.min) < 0) throw new BadRequestException("提现金额不能小于最低提现金额");
|
||||
if (!config.transferType.includes(param.transferType)) throw new BadRequestException("当前会员提现方式未启用");
|
||||
if (!config.getTransferType().includes(param.transferType)) throw new BadRequestException("当前会员提现方式未启用");
|
||||
|
||||
const cashoutAccount: MemberCashOutAccount = new MemberCashOutAccount();
|
||||
if (!param.transferType === TransferTypeEnum.WECHATPAY.key) {
|
||||
@@ -181,10 +181,10 @@ export class CoreMemberCashOutServiceImplService {
|
||||
const updateMember: Member = new Member();
|
||||
updateMember.memberId = member.memberId;
|
||||
if (cashOut.accountType === AccountTypeEnum.MONEY.type) {
|
||||
updateMember.moneyCashOuting = member.moneyCashOuting.subtract(cashOut.applyMoney);
|
||||
updateMember.moneyCashOuting = member.getMoneyCashOuting(.subtract(cashOut.applyMoney));
|
||||
}
|
||||
if (cashOut.accountType === AccountTypeEnum.COMMISSION.type) {
|
||||
updateMember.commissionCashOuting = member.commissionCashOuting.subtract(cashOut.applyMoney);
|
||||
updateMember.commissionCashOuting = member.getCommissionCashOuting(.subtract(cashOut.applyMoney));
|
||||
}
|
||||
memberMapper.updateById(updateMember);
|
||||
}
|
||||
@@ -201,10 +201,10 @@ export class CoreMemberCashOutServiceImplService {
|
||||
const updateMember: Member = new Member();
|
||||
updateMember.memberId = member.memberId;
|
||||
if (cashOut.accountType === AccountTypeEnum.MONEY.type) {
|
||||
updateMember.moneyCashOuting = member.moneyCashOuting.subtract(cashOut.applyMoney);
|
||||
updateMember.moneyCashOuting = member.getMoneyCashOuting(.subtract(cashOut.applyMoney));
|
||||
}
|
||||
if (cashOut.accountType === AccountTypeEnum.COMMISSION.type) {
|
||||
updateMember.commissionCashOuting = member.commissionCashOuting.subtract(cashOut.applyMoney);
|
||||
updateMember.commissionCashOuting = member.getCommissionCashOuting(.subtract(cashOut.applyMoney));
|
||||
}
|
||||
memberMapper.updateById(updateMember);
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ export class CoreNoticeServiceImplService {
|
||||
}
|
||||
|
||||
//针对短信,微信公众号,小程序配置
|
||||
if (CommonUtils.isNotEmpty(noticeMap.value.getSupport_type_map())) {
|
||||
for (Map.Entry<String, Record<string, any>> supportTypeMap : noticeMap.value.getSupport_type_map().entrySet()) {
|
||||
if (CommonUtils.isNotEmpty(noticeMap.getValue().support_type_map)) {
|
||||
for (Map.Entry<String, Record<string, any>> supportTypeMap : noticeMap.getValue().support_type_map.entrySet()) {
|
||||
if (supportTypeMap.key === "sms") {
|
||||
vo.sms = supportTypeMap.value;
|
||||
}
|
||||
@@ -82,8 +82,8 @@ export class CoreNoticeServiceImplService {
|
||||
noticeListVo.title = addon.title;
|
||||
noticeListVo.notice = [];
|
||||
for (Map.Entry<String, NoticeInfoVo> noticeMap : notice.entrySet()) {
|
||||
if (noticeListVo.key === noticeMap.getValue(.getAddon())) {
|
||||
noticeListVo.notice.add(noticeMap.value);
|
||||
if (noticeListVo.key === noticeMap.getValue(.addon)) {
|
||||
noticeListVo.getNotice().add(noticeMap.value);
|
||||
}
|
||||
}
|
||||
noticeAddonList.push(noticeListVo);
|
||||
|
||||
@@ -23,7 +23,7 @@ export class CoreNoticeSmsLogServiceImplService {
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
[SysNoticeSmsLog[], number] iPage = this.sysNoticeSmsLogRepository.findAndCount({ /* TODO: 将MyBatis分页参数改为TypeORM的skip/take */ }), queryWrapper);
|
||||
return PageResult.build(page, limit, iPageTotal).setData(iPageRecords);
|
||||
return PageResult.build(page, limit, iPageTotal).data = iPageRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ export class CorePayEventServiceImplService {
|
||||
Object.assign(vo, item);
|
||||
list.push(vo);
|
||||
}
|
||||
return PageResult.build(page, limit, iPageTotal).setData(list);
|
||||
return PageResult.build(page, limit, iPageTotal).data = list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,11 +55,11 @@ export class CorePayServiceImplService {
|
||||
if (pay.status === PayStatusEnum.STATUS_CANCLE.code) throw new BadRequestException("当前支付已取消");
|
||||
|
||||
// 支付成功
|
||||
if (param.payStatus.getStatus() === OnliepayStatusEnum.SUCCESS.status) {
|
||||
if (param.getPayStatus().status === OnliepayStatusEnum.SUCCESS.status) {
|
||||
this.paySuccess(pay, param);
|
||||
}
|
||||
// 支付关闭
|
||||
if (param.payStatus.getStatus() === OnliepayStatusEnum.CLOSED.status) {
|
||||
if (param.getPayStatus().status === OnliepayStatusEnum.CLOSED.status) {
|
||||
this.payClose(param.siteId, pay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ export class CoreRefundServiceImplService {
|
||||
refund.refundType = param.type;
|
||||
|
||||
// 退款成功
|
||||
if (param.refundStatus.getStatus() === RefundTransferStatusEnum.SUCCESS.status) {
|
||||
if (param.getRefundStatus().status === RefundTransferStatusEnum.SUCCESS.status) {
|
||||
this.refundSuccess(param.siteId, refund);
|
||||
}
|
||||
// 退款失败
|
||||
if (param.refundStatus.getStatus() === RefundTransferStatusEnum.ABNORMAL.status) {
|
||||
if (param.getRefundStatus().status === RefundTransferStatusEnum.ABNORMAL.status) {
|
||||
this.refundFail(param.siteId, refund);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,13 +77,13 @@ export class CoreTransferServiceImplService {
|
||||
throw new BadRequestException("当前转账未处于待转账状态");
|
||||
}
|
||||
|
||||
if (param.transferStatus.getStatus() === TransferStatusEnum.SUCCESS.status) {
|
||||
if (param.getTransferStatus().status === TransferStatusEnum.SUCCESS.status) {
|
||||
this.success(transfer);
|
||||
} else if (param.transferStatus.getStatus() === TransferStatusEnum.FAIL.status) {
|
||||
} else if (param.getTransferStatus().status === TransferStatusEnum.FAIL.status) {
|
||||
transfer.transferFailReason = param.failReason;
|
||||
this.fail(transfer);
|
||||
} else {
|
||||
transfer.transferStatus = param.transferStatus.getStatus();
|
||||
transfer.transferStatus = param.getTransferStatus(.status);
|
||||
this.dealing(transfer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ export class CoreSmsServiceImplService {
|
||||
|
||||
const updateModel: SysNoticeSmsLog = new SysNoticeSmsLog();
|
||||
updateModel.id = model.id;
|
||||
updateModel.status = result.status.getStatus();
|
||||
updateModel.status = result.getStatus(.status);
|
||||
updateModel.result = ObjectUtil.defaultIfNull(result.failReason, "");
|
||||
sysNoticeSmsLogMapper.updateById(updateModel);
|
||||
|
||||
if (result.status.getStatus() === SmsStatusEnum.FAIL.status) {
|
||||
if (result.getStatus().status === SmsStatusEnum.FAIL.status) {
|
||||
throw new BadRequestException(updateModel.result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class CoreWeappDeliveryServiceImplService {
|
||||
const vo: IsTradeManagedVo = new IsTradeManagedVo();
|
||||
try {
|
||||
const miniapp: WxMaService = WechatUtils.miniapp(siteId);
|
||||
const appid: string = miniapp.wxMaConfig.getAppid();
|
||||
const appid: string = miniapp.getWxMaConfig().appid;
|
||||
const res: WxMaOrderShippingIsTradeManagedResponse = miniapp.wxMaOrderShippingService.isTradeManaged(appid);
|
||||
if (!res.tradeManaged) {
|
||||
console.log("小程序未开通发货信息管理服务" + res.errMsg);
|
||||
@@ -36,7 +36,7 @@ export class CoreWeappDeliveryServiceImplService {
|
||||
const config: Record<string, any> = getConfig(siteId, type);
|
||||
if (CommonUtils.isEmpty(config)) {
|
||||
const path: string = "app/pages/weapp/order_shipping";
|
||||
const response: WxMaOrderShippingInfoBaseResponse = WechatUtils.miniapp(siteId).getWxMaOrderShippingService().setMsgJumpPath(path);
|
||||
const response: WxMaOrderShippingInfoBaseResponse = WechatUtils.miniapp(siteId).wxMaOrderShippingService.msgJumpPath = path;
|
||||
if (response.errCode == 0) {
|
||||
setConfig(siteId, type, path);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export class CoreWeappServiceImplService {
|
||||
scene.push(key + "-" + data.get(key).toString());
|
||||
}
|
||||
|
||||
return WechatUtils.miniapp(siteId).getQrcodeService().createWxaCodeUnlimitBytes(
|
||||
return WechatUtils.miniapp(siteId).qrcodeService.createWxaCodeUnlimitBytes(
|
||||
String.join("&", scene),
|
||||
page,
|
||||
false,
|
||||
@@ -46,7 +46,7 @@ export class CoreWeappServiceImplService {
|
||||
scene.push(key + "-" + data.get(key).toString());
|
||||
}
|
||||
|
||||
return WechatUtils.miniapp(siteId).getQrcodeService().createWxaCodeUnlimit(
|
||||
return WechatUtils.miniapp(siteId).qrcodeService.createWxaCodeUnlimit(
|
||||
String.join("&", scene),
|
||||
page,
|
||||
filePath,
|
||||
|
||||
@@ -21,7 +21,7 @@ export class CoreOplatformStaticConfigServiceImplService {
|
||||
coreOplatformStaticConfigVo.authLaunchDomain = RequestUtils.getDomain(false);
|
||||
coreOplatformStaticConfigVo.wechatAuthDomain = RequestUtils.getDomain(false);
|
||||
try {
|
||||
coreOplatformStaticConfigVo.uploadIp = InetAddress.getByName("java.oss.niucloud.com".getHostAddress());
|
||||
coreOplatformStaticConfigVo.uploadIp = InetAddress.getByName("java.oss.niucloud.com".hostAddress);
|
||||
} catch (e) {
|
||||
coreOplatformStaticConfigVo.uploadIp = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user