import "@post:/dev/maintenance/content/addupdate" as contentAdd; import "@post:/dev/maintenance/content/resultadd" as contentResultAdd; import "@post:/dev/maintenance/content/contentStrategy" as strategyBingContentAdd; import com.techiniot.techinapi.common.Common //新增修改策略 var strategyAdd = () => { var nowTime = Common.fromDateH(); var unId = Common.getUUID(); var insertstrategysql = """ insert into pa_maintenance_point_item(unid,name,description,domain_unid,system_dtime,asset_type) values(#{unId},#{body.name},#{body.description},#{body.domainUnid},#{nowTime},#{body.assetType}) """ var updatestrategysql = """ update pa_maintenance_point_item set name = #{body.name}, description = #{body.description}, domain_unid = #{body.domainUnid}, update_dtime = #{nowTime}, asset_type=#{body.assetType} where unid = #{body.unId} """ if (Common.isNotEmpty(body.unId)) { unId = body.unId db.update(updatestrategysql); } else { db.insert(insertstrategysql) } return unId; } var unid = strategyAdd() var itemContentList = []; body.contents.each(item => { //添加内容 var body = { name: item.name, description: item.description } var result = contentAdd(); //内容的结果项 body = item.resultContent; body.contentUnId = result.unid; //内容结果项添加 contentResultAdd(); itemContentList.add({ "contentUnId": result.unid }) }) //内容id策略id关联添加 var body = { pointItemId: unid, itemContentList: itemContentList } strategyBingContentAdd(); //策略id return unid;
时间: 2023-05-19 13:07:10 浏览: 60
这是一段 JavaScript 代码,用于导入一些模块。其中 "@post:/dev/maintenance/content/addupdate"、"@post:/dev/maintenance/content/resultadd"、"@post:/dev/maintenance/content/contentStrategy" 是模块的路径,而 "contentAdd"、"contentResultAdd"、"strategyBingContentAdd" 则是导入的模块的别名。另外,代码中还定义了一个名为 "strategyAdd" 的函数,用于新增修改策略。函数中使用了一个名为 "Common" 的模块,该模块的作用是提供一些常用的工具函数。
相关问题
POST http://localhost:8080/importexcel 500
Internal Server Error
This error message indicates that the server encountered an unexpected error while attempting to process the request to import an Excel file. The error could be due to a variety of issues, such as a problem with the server configuration, a bug in the application code, or a problem with the Excel file itself.
To resolve this issue, you may need to check the server logs for more information about the error and troubleshoot the issue accordingly. It may also be helpful to double-check that the Excel file is formatted correctly and does not contain any errors or corrupted data. If the issue persists, you may need to seek assistance from a developer or IT professional.
@nestjs/axios post 第三方接口
你可以使用 @nestjs/axios 模块来发送 POST 请求到第三方接口。首先,你需要安装该模块:
```
npm install @nestjs/axios axios
```
然后,你可以在你的 NestJS 服务中注入 `HttpService`,并使用其 `post` 方法来发送 POST 请求。例如:
```typescript
import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
@Injectable()
export class MyService {
constructor(private httpService: HttpService) {}
async sendPostRequest() {
const data = { key1: 'value1', key2: 'value2' };
const url = 'https://example.com/api';
const response = await this.httpService.post(url, data).toPromise();
console.log(response.data);
}
}
```
在上面的例子中,我们使用 `post` 方法来发送一个包含数据 `data` 的 POST 请求到 URL `url`。请求的响应存储在 `response` 变量中,我们可以使用其中的 `data` 属性来访问响应数据。
当然,你需要根据你的实际情况来替换 `data` 和 `url`。