Commit d0a165c8 by ilal

Merge branch 'develop' of 120.24.24.239:8timerv2/8timerapiv200 into lal

parents 08773eb7 1f5a2f6c
......@@ -4,7 +4,7 @@
* @author dsc
* @date 2020年4月21日
* @version 1.0
*/
*/
package cn.timer.api.bean.qyzx.businessService;
import java.util.Date;
......@@ -27,12 +27,17 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>Title: QyzxUseRecord.java</p>
* <p>Description: 使用记录表实体类</p>
* @author dsc
* @date 2020年4月21日
* @version 1.0
/**
* <p>
* Title: QyzxUseRecord.java
* </p>
* <p>
* Description: 使用记录表实体类
* </p>
*
* @author dsc
* @date 2020年4月21日
* @version 1.0
*/
@Entity
......@@ -40,46 +45,49 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="qyzx_use_record")
@Table(name = "qyzx_use_record")
@ApiModel("使用记录表")
public class QyzxUseRecord extends Model<QyzxUseRecord>{
public class QyzxUseRecord extends Model<QyzxUseRecord> {
private static final long serialVersionUID = 8623518557970200924L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="主键",example="1")
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键", example = "1")
private Integer id;
@ApiModelProperty(value="模块id 0-无 1-短信 2-电子合同 3-系统续费",example="1")
private Integer pmid;
@ApiModelProperty(value="订单号",example="1")
private String orderNo;
@ApiModelProperty(value="使用场景",example="1")
private String scene;
@ApiModelProperty(value="使用数量",example="1")
private Integer useNum;
@ApiModelProperty(value="原始总量",example="500")
private Integer originalTotalNum;
@ApiModelProperty(value="当前总量",example="499")
private Integer nowTotalNum;
@ApiModelProperty(value="是否删除",example="默认0-未删除,1-删除")
private Integer isDelete;
@ApiModelProperty(value = "模块id 0-无 1-短信 2-电子合同 3-系统续费", example = "1")
private Integer pmid;
@ApiModelProperty(value = "企业id", example = "117")
private Integer orgCode;
@ApiModelProperty(value = "订单号", example = "1")
private String orderNo;
@ApiModelProperty(value = "使用场景", example = "1")
private String scene;
@ApiModelProperty(value = "使用数量", example = "1")
private Integer useNum;
@ApiModelProperty(value = "原始总量", example = "500")
private Integer originalTotalNum;
@ApiModelProperty(value = "当前总量", example = "499")
private Integer nowTotalNum;
@ApiModelProperty(value = "是否删除", example = "默认0-未删除,1-删除")
private Integer isDelete;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="创建时间 ",example="")
@ApiModelProperty(value = "创建时间 ", example = "")
private Date createTime;
@ApiModelProperty(value="创建人 ",example="")
@ApiModelProperty(value = "创建人 ", example = "")
private String createUser;
@ApiModelProperty(value="使用人手机号 ",example="")
@ApiModelProperty(value = "使用人手机号 ", example = "")
private String userPhone;
}
......@@ -6,10 +6,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
......@@ -80,25 +77,25 @@ public class LoginController {
@Value("${config-8timer.Aliyun.SECRET}")
private String SECRET;
public static String host;
public static String PROJECT_ID;
public static String PROJECT_SECRET;
@Value("${config-8timer.esign.host}")
private String host_s;
@Value("${config-8timer.esign.PROJECT_ID}")
private String PROJECT_ID_s;
@Value("${config-8timer.esign.PROJECT_SECRET}")
private String PROJECT_SECRET_s;
@PostConstruct
public void init() {
host = host_s;
PROJECT_ID = PROJECT_ID_s;
PROJECT_SECRET = PROJECT_SECRET_s;
}
// public static String host;
// public static String PROJECT_ID;
// public static String PROJECT_SECRET;
//
// @Value("${config-8timer.esign.host}")
// private String host_s;
//
// @Value("${config-8timer.esign.PROJECT_ID}")
// private String PROJECT_ID_s;
//
// @Value("${config-8timer.esign.PROJECT_SECRET}")
// private String PROJECT_SECRET_s;
//
// @PostConstruct
// public void init() {
// host = host_s;
// PROJECT_ID = PROJECT_ID_s;
// PROJECT_SECRET = PROJECT_SECRET_s;
// }
@Value("${config-8timer.Aliyun.PROJECT_NAME}")
private String endpoint;
......@@ -132,9 +129,9 @@ public class LoginController {
map.put("3", REGION_ID);
map.put("4", ACCESSKEY_ID);
map.put("5", SECRET);
map.put("6", host);
map.put("7", PROJECT_ID);
map.put("8", PROJECT_SECRET);
// map.put("6", host);
// map.put("7", PROJECT_ID);
// map.put("8", PROJECT_SECRET);
map.put("9", endpoint);
map.put("10", accessKeyId);
map.put("11", accessKeySecret);
......
......@@ -334,8 +334,10 @@ public class DzhtController {
public Result<Object> rzUserNow(@CurrentUser UserBean userBean, Integer empNum) {
DzhtAssoGrrz grrz = new DzhtAssoGrrz();
grrz.setType(0);
System.err.println(empNum);
YgglMainEmp yg = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().select("phone")
.eq("org_code", userBean.getOrgCode()).eq("emp_num", empNum));
System.err.println(yg);
grrz.setMobileNo(yg.getPhone());
DzhtAssoGrzc grzc = DzhtAssoGrzc.builder().build().selectOne(new QueryWrapper<DzhtAssoGrzc>()
......
......@@ -97,7 +97,7 @@ public class DzhtController2 {
Integer orgCode = userBean.getOrgCode();
YgglMainEmp yg = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().eq("emp_num", empNum));
.selectOne(new QueryWrapper<YgglMainEmp>().eq("org_code", orgCode).eq("emp_num", empNum));
String phone = yg.getPhone();
String name = yg.getName();
......@@ -351,7 +351,8 @@ public class DzhtController2 {
dzhtQueryDto.getTotalPage() == null ? 10 : dzhtQueryDto.getTotalPage());
QueryWrapper<DzhtAssoHtmb> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_del", 0).eq("emp_num", userBean.getEmpNum()).like(mbmc != null, "mbmc", mbmc)
.select("template_id", "mbmc", "file_name", "created_time").orderByDesc("created_time");
.eq("org_code", userBean.getOrgCode()).select("template_id", "mbmc", "file_name", "created_time")
.orderByDesc("created_time");
IPage<DzhtAssoHtmb> dPage = DzhtAssoHtmb.builder().build().selectPage(page, queryWrapper);
List<DzhtAssoHtmb> htmbs = dPage.getRecords();
dPage.getCurrent();
......
......@@ -9,21 +9,9 @@ import org.apache.commons.lang3.StringUtils;
public class ConfigConstant {
public static String host = "https://smlopenapi.esign.cn";
// public static String host = "https://openapi.esign.cn";
public static String PROJECT_ID = "4438775940";
public static String PROJECT_SECRET = "7b100813cca2746081c57837855ac5af";
// @Value("${config-8timer.esign.host}")
// private String host_s;
// @Value("${config-8timer.esign.PROJECT_ID}")
// private String PROJECT_ID_s;
// @Value("${config-8timer.esign.PROJECT_SECRET}")
// private String PROJECT_SECRET_s;
//
// @PostConstruct
// public void init() {
// host = host_s;
// PROJECT_ID = PROJECT_ID_s;
// PROJECT_SECRET = PROJECT_SECRET_s;
// }
// 机构认证地址
public static final String getJgrz_URL(String accountId) {
......
......@@ -153,7 +153,7 @@ public class HtzzController {
htzzQueryDto.getTotalPage() == null ? 10 : htzzQueryDto.getTotalPage());
QueryWrapper<HtzzAdminZzda> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("lrrid", userBean.getEmpNum()).eq("org_code", userBean.getOrgCode())
queryWrapper.eq("org_code", userBean.getOrgCode())
.select("id", "zjmc", "czry", "czrdh", "fzrq", "yxdqr", "txkg_type").eq("is_delete", 0)
.gt(!StrUtil.hasBlank(e), "yxdqr", !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(!StrUtil.hasBlank(q), wq -> wq.like("zjmc", q).or().like("czry", q)).orderByDesc("lrsj_time");
......
......@@ -7,7 +7,9 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -15,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dto.oss.OssDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.aliyun.OSSUtil;
......@@ -113,4 +116,39 @@ public class OSSController {
return ResultUtil.data(url, "获取成功");
}
/***********
* DELETE
*
* @param moudle
************/
@DeleteMapping(value = "/delSingle")
@ApiOperation(value = "删除单个(谨慎使用)", httpMethod = "DELETE", notes = "接口发布说明")
public Result<String> delSingle(@CurrentUser UserBean userBean, @RequestParam(required = false) String moudle,
@RequestParam(required = false) String fileName) {
String path = "8timer2.0/" + userBean.getOrgCode() + "/" + moudle + "/" + fileName;
oss.delSingleFile(path);
return ResultUtil.success("删除成功");
}
@DeleteMapping(value = "/delFiles")
@ApiOperation(value = "删除多个(谨慎使用,谨慎使用)", httpMethod = "DELETE", notes = "接口发布说明")
public Result<List<String>> delFiles(@CurrentUser UserBean userBean, @RequestBody OssDto ossDto) {
List<String> keys = null;
for (String fileName : ossDto.getFileNames()) {
keys = new ArrayList<String>();
String key = "8timer2.0/" + userBean.getOrgCode() + "/" + ossDto.getMoudle() + "/" + fileName;
keys.add(key);
}
List<String> list = oss.delFiles(keys, ossDto.isQuiet());
return ResultUtil.data(list, "删除成功");
}
// @DeleteMapping(value = "/delWithPrefix")
// @ApiOperation(value = "删除指定前缀文件(谨慎使用,谨慎使用,谨慎使用)", httpMethod = "DELETE", notes = "接口发布说明")
// public Result<String> delWithPrefix(@RequestParam String prefix) {
// oss.delPrefixWith(prefix);
// return ResultUtil.success("删除成功");
// }
}
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -171,18 +172,21 @@ public class CmsController {
@ApiOperation(value = "添加/修改企业OA讯息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsContent> updateqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContentDto cmsContentDto) {
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
String str = StringUtils.join(cmsContentDto.getFilepath(), ","); // 数组转字符串(逗号分隔)(推荐)
CmsContent qynr = new CmsContent();
BeanUtil.copyProperties(cmsContentDto, qynr);
qynr.setFilepath(str);
Integer i = 10000;
qynr.setXxbh("XX" + i++);
// Integer i = 10000;
// qynr.setXxbh("XX" + i++);
Boolean a = qynr.getId() == null;
if (a && qynr.getPublisher() == null)
qynr.setPublisher(userBean.getEmpNum());
qynr.setOrganizationId(userBean.getOrgCode());
qynr.setPublisher(empNum);
qynr.setOrganizationId(orgCode);
Long now = new Date().getTime();
// 录入时间
qynr.setAddeddate(now);
......@@ -194,6 +198,8 @@ public class CmsController {
qynr.setReleasetime(qynr.getReleasetime());
}
qynr.setPublisherName(YgglMainEmp.builder().build().selectOne(new LambdaQueryWrapper<YgglMainEmp>()
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum)).getName());
qynr.setReleasetype(fbfs);
qynr.setStatus(0);
qynr.insertOrUpdate();
......@@ -225,9 +231,11 @@ public class CmsController {
@ApiOperation(value = "审核企业OA讯息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsContent> shqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContent qynr) {
Long now = new Date().getTime();
Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().eq("emp_num", userBean.getEmpNum()));
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum));
if (ygglMainEmp != null) {
qynr.setAuditor(ygglMainEmp.getName());// 审核人
}
......
......@@ -17,6 +17,7 @@ import java.util.stream.Collectors;
import javax.transaction.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -37,6 +38,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.qyzx.QyzxSms;
import cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxInvoiceData;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
......@@ -240,10 +242,9 @@ public class QyzxBusinessController {
@RequestBody QyzxInvoiceData qyzxInvoiceData) {
if (!ObjectUtil.isAllNotEmpty(
// qyzxInvoiceData,
qyzxInvoiceData.getInvoiceTitle(),
qyzxInvoiceData.getDutyParagraph(), qyzxInvoiceData.getCompanyAddress(),
qyzxInvoiceData.getCompanyPhone(), qyzxInvoiceData.getBankName(), qyzxInvoiceData.getBankAccount(),
qyzxInvoiceData.getInvoiceType(), qyzxInvoiceData.getInvoiceProject(),
qyzxInvoiceData.getInvoiceTitle(), qyzxInvoiceData.getDutyParagraph(),
qyzxInvoiceData.getCompanyAddress(), qyzxInvoiceData.getCompanyPhone(), qyzxInvoiceData.getBankName(),
qyzxInvoiceData.getBankAccount(), qyzxInvoiceData.getInvoiceType(), qyzxInvoiceData.getInvoiceProject(),
qyzxInvoiceData.getInvoiceValue(), qyzxInvoiceData.getConsignee(), qyzxInvoiceData.getConsigneePhone(),
qyzxInvoiceData.getEmail(), qyzxInvoiceData.getShippingArea(), qyzxInvoiceData.getShippingAddress(),
qyzxInvoiceData.getZipCode())) {
......@@ -296,7 +297,17 @@ public class QyzxBusinessController {
@ApiOperation(value = "查询短信使用记录", httpMethod = "GET", notes = "接口发布说明")
public Result<List<QyzxUseRecord>> queryMsgUseRecord(@CurrentUser UserBean userBean, String orderNo) {
return ResultUtil.data(QyzxUseRecord.builder().build()
.selectList(new LambdaQueryWrapper<QyzxUseRecord>().eq(QyzxUseRecord::getOrderNo, orderNo)), "查询成功");
.selectList(new LambdaQueryWrapper<QyzxUseRecord>().eq(QyzxUseRecord::getOrgCode, userBean.getOrgCode())
.eq(QyzxUseRecord::getPmid, 1).eq(orderNo != null, QyzxUseRecord::getOrderNo, orderNo)),
"查询成功");
}
@GetMapping(value = "/queryMsgUseDetal/{id}")
@ApiOperation(value = "查询短信使用详情", httpMethod = "GET", notes = "接口发布说明")
public Result<QyzxSms> queryMsgUseDetal(@CurrentUser UserBean userBean, @PathVariable Integer id) {
return ResultUtil.data(
QyzxSms.builder().build().selectOne(new LambdaQueryWrapper<QyzxSms>().eq(QyzxSms::getUseId, id)),
"查询成功");
}
// TODO 不同业务使用 不同数据表
......
/**
* <p>Title: OssDto.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
package cn.timer.api.dto.oss;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p>
* Title: OssDto.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年5月11日
* @version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OssDto implements Serializable {
private static final long serialVersionUID = 6897868588272725L;
private String moudle;
private List<String> fileNames;
private boolean quiet;
}
......@@ -162,6 +162,7 @@ public class AliyunSMS {
qyzxUseRecord.setUseNum(1);
qyzxUseRecord.setPmid(quantity.getPmid());
qyzxUseRecord.setCreateUser("System");
qyzxUseRecord.setOrgCode(orgCode);
qyzxUseRecord.insert();
id = qyzxUseRecord.getId();
......@@ -283,6 +284,7 @@ public class AliyunSMS {
qyzxUseRecord.setScene(QyzxScene.MSG_REMIND.getMessage());
qyzxUseRecord.setUseNum(1);
qyzxUseRecord.setPmid(quantity.getPmid());
qyzxUseRecord.setOrgCode(orgCode);
qyzxUseRecord.insert();
quantity.setRemainder(remainder);
......
......@@ -6,6 +6,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
......@@ -18,8 +19,13 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.DeleteObjectsRequest;
import com.aliyun.oss.model.DeleteObjectsResult;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.ListObjectsRequest;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.OSSObjectSummary;
import com.aliyun.oss.model.ObjectListing;
import com.aliyun.oss.model.PutObjectRequest;
import cn.hutool.core.util.StrUtil;
......@@ -40,22 +46,22 @@ public class OSSUtil {
@Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
private String accessKeyId;
@Value("${config-8timer.Aliyun.SECRET}")
private String accessKeySecret;
@Value("${config-8timer.Aliyun.bucketName}")
private String bucketName;
@Value("${config-8timer.Aliyun.bucketName_pri}")
private String bucketName_pri;
@Value("${config-8timer.Aliyun.project_package}")
private String project_package;
@Value("${config-8timer.Aliyun.expirationTime}")
private String expirationTime;
@Value("${config-8timer.Aliyun.expirationTime_pri}")
private String expirationTime_pri;
......@@ -70,7 +76,7 @@ public class OSSUtil {
// 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录
// https://ram.console.aliyun.com 创建RAM账号。
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 创建存储空间。
ossClient.createBucket(bucketName);
......@@ -328,6 +334,107 @@ public class OSSUtil {
return url.toString();
}
/**
* 删除单个
*
* @param objectName 文件名
*/
public void delSingleFile(String objectName) {
// // Endpoint以杭州为例,其它Region请按实际情况填写。
// String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
// // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
// String accessKeyId = "<yourAccessKeyId>";
// String accessKeySecret = "<yourAccessKeySecret>";
// String bucketName = "<yourBucketName>";
// String objectName = "<yourObjectName>";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 删除文件。如需删除文件夹,请将ObjectName设置为对应的文件夹名称。如果文件夹非空,则需要将文件夹下的所有object删除后才能删除该文件夹。
ossClient.deleteObject(bucketName, objectName);
// 关闭OSSClient。
ossClient.shutdown();
}
/**
* 删除多个文件
* @param keys 需要删除的文件。
* @param quiet 返回模式。true表示简单模式,false表示详细模式。默认为详细模式。
* @return 删除结果。详细模式下为删除成功的文件列表,简单模式下为删除失败的文件列表。
*/
public List<String> delFiles(List<String> keys, boolean quiet) {
// // Endpoint以杭州为例,其它Region请按实际情况填写。
// String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
// // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
// String accessKeyId = "<yourAccessKeyId>";
// String accessKeySecret = "<yourAccessKeySecret>";
// String bucketName = "<yourBucketName>";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 删除文件。key等同于ObjectName,表示删除OSS文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。
// List<String> keys = new ArrayList<String>();
// keys.add("key0");
// keys.add("key1");
// keys.add("key2");
DeleteObjectsResult deleteObjectsResult = ossClient
.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys).withQuiet(quiet));
List<String> deletedObjects = deleteObjectsResult.getDeletedObjects();
// 关闭OSSClient。
ossClient.shutdown();
return deletedObjects;
}
/**
* 删除指定前缀(prefix)的文件
* @param prefix
*/
public void delPrefixWith(String prefix) {
// // Endpoint以杭州为例,其它Region请按实际情况填写。
// String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
// // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录
// // https://ram.console.aliyun.com 创建RAM账号。
// String accessKeyId = "<yourAccessKeyId>";
// String accessKeySecret = "<yourAccessKeySecret>";
// String bucketName = "<yourBucketName>";
//
// // 指定前缀。
// final String prefix = "<yourkeyPrefix>";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 列举所有包含指定前缀的文件并删除。
String nextMarker = null;
ObjectListing objectListing = null;
do {
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName).withPrefix(prefix)
.withMarker(nextMarker);
objectListing = ossClient.listObjects(listObjectsRequest);
if (objectListing.getObjectSummaries().size() > 0) {
List<String> keys = new ArrayList<String>();
for (OSSObjectSummary s : objectListing.getObjectSummaries()) {
System.out.println("key name: " + s.getKey());
keys.add(s.getKey());
}
DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucketName).withKeys(keys);
ossClient.deleteObjects(deleteObjectsRequest);
}
nextMarker = objectListing.getNextMarker();
} while (objectListing.isTruncated());
// 关闭OSSClient。
ossClient.shutdown();
}
/*
* (跨域资源) // Endpoint以杭州为例,其它Region请按实际情况填写。 String endpoint =
* "http://oss-cn-hangzhou.aliyuncs.com"; //
......
......@@ -166,11 +166,11 @@ config-8timer:
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://smlopenapi.esign.cn
# host: https://smlopenapi.esign.cn
# test: https://smlopenapi.esign.cn
# pro: https://openapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
# PROJECT_ID: 4438775940
# PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
......
......@@ -140,9 +140,9 @@ config-8timer:
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://openapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
# host: https://openapi.esign.cn
# PROJECT_ID: 4438775940
# PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
......
......@@ -140,9 +140,9 @@ config-8timer:
expirationTime: 3153600000000L
expirationTime_pri: 600000L
esign: # e签宝
host: https://smlopenapi.esign.cn
PROJECT_ID: 4438775940
PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
# host: https://smlopenapi.esign.cn
# PROJECT_ID: 4438775940
# PROJECT_SECRET: 7b100813cca2746081c57837855ac5af
remind: #合同提醒时间 默认小于等于1天会提醒+三个配置项
one: 3
two: 7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment