From 7ccaca977e1c96a502249845ca4c1cc212197368 Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Mon, 9 Dec 2024 08:23:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/util/SFTPUtil.java | 12 +- .../SynchronizationService/SyncKcktStat.java | 8 + .../SynchronizationService/SyncTJzgXskc.java | 7 +- .../kc/ktgl/mapper/KcKetangbiaoMapper.java | 1 + .../kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml | 7 + .../kc/ktgl/service/IKcKetangbiaoService.java | 1 + .../service/impl/KcKetangbiaoServiceImpl.java | 5 + .../service/impl/WjxWjxxServiceImpl.java | 63 +++-- .../service/impl/ZyInfoServiceImpl.java | 1 + .../controller/ZyInfoStudentController.java | 39 ++- .../zyInfoStudent/entity/ZyInfoStudent.java | 1 + .../mapper/ZyInfoStudentMapper.java | 2 + .../mapper/xml/ZyInfoStudentMapper.xml | 5 + .../service/IZyInfoStudentService.java | 8 + .../impl/ZyInfoStudentServiceImpl.java | 168 +++++++++++-- .../wps/controller/HttpClientPOSTExample.java | 62 +++++ .../wps/controller/HttpsPostRequest.java | 48 ++++ .../jeecg/modules/wps/controller/KsoSign.java | 184 ++++++++++++++ .../modules/wps/controller/WpsController.java | 224 ++++++++++++++++++ .../modules/wps/controller/WpsToken.java | 51 ++++ .../org/jeecg/modules/wps/entity/WpsEnti.java | 19 ++ .../modules/wps/entity/WpsUploadEnti.java | 26 ++ 22 files changed, 876 insertions(+), 66 deletions(-) create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpClientPOSTExample.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpsPostRequest.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/KsoSign.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsToken.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsEnti.java create mode 100644 jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsUploadEnti.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java index 18be395b..7f689370 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java @@ -733,7 +733,13 @@ public class SFTPUtil { // } - + /** + * ftp上传文件 + * @param sftpConfig ftp配置 + * @param localFile 本地存储地址 + * @param sftpFile sftp存储地址 + * @return + */ public static Map upload(SftpConfig sftpConfig, String localFile, String sftpFile) { Map map = new HashMap(); map.put("code","0"); @@ -750,7 +756,7 @@ public class SFTPUtil { mkdirs(sftpConfig.getFullpath()); } catch (SftpException e2) { map.put("code", "1"); - map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败"); + map.put("msg", "sftp创建" + sftpConfig.getFullpath() + "文件路径失败"); } } try { @@ -774,9 +780,9 @@ public class SFTPUtil { String aaa[] = sftpFile.split("/"); String wwqName = aaa[aaa.length -1]; for(int i=0;i outUserDataList = Lists.newArrayList(); Map outUserDataMap = Maps.newHashMap(); - //List outExportConfigTpkwcqkjzglxDataList = Lists.newArrayList(); -// Map outExportConfigTpkwcqkjzglxDataMap = Lists.newArrayList(); - //清洗数据 inDataList.forEach(x -> { String timestamps = DateUtil.format(x.getTimestamps(), DatePattern.NORM_DATETIME_PATTERN); @@ -89,8 +86,6 @@ public class SyncTJzgXskc extends BaseSync { Xxhbuser xxhbuser = BeanUtil.toBean(x, Xxhbuser.class); xxhbuser.setTimestamps(timestamps); outUserDataMap.put(xxhbuser.getGh(),xxhbuser); - //outExportConfigTpkwcqkjzglxDataList.add(BeanUtil.toBean(x, KcExportConfigTpkwcqkjzglx.class)); - }); //保存到胃 @@ -140,6 +135,7 @@ public class SyncTJzgXskc extends BaseSync { // String endSj = DateUtil.format(endSjDate,DatePattern.NORM_DATETIME_FORMAT); xqxn = common.getTitle(); ectQw.eq("xqxn",xqxn); + ectQw.in("zt","在职","退休"); } else { xqxn = null; } @@ -151,7 +147,6 @@ public class SyncTJzgXskc extends BaseSync { Map saveMap = Maps.newHashMap(); - //outExportConfigTpkwcqkjzglxDataList oldExportConfigTpkwcqkjzglxList.forEach(x -> { if(outUserDataMap.containsKey(x.getGh())){ Xxhbuser data = outUserDataMap.get(x.getGh()); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java index 598f5f57..5d1ac1df 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKetangbiaoMapper.java @@ -72,4 +72,5 @@ public interface KcKetangbiaoMapper extends BaseMapper { List getKccountExportList(KcKetangbiaoNum kcKetangbiao); + void updateKechengbiaoid( @Param("skrq") String skrq); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml index 9214a067..d6b38e7c 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKetangbiaoMapper.xml @@ -807,4 +807,11 @@ ) t GROUP BY xqxn,kkdw + + + + update kc_ketangbiao a + LEFT JOIN kc_kechengbiao b on a.kcmc = b.kcmc and a.rwbh = b.rwbh and a.skjs = b.skjs and a.hh = b.hh + set a.kechengbiao1 = b.id , a.kechengbiaoid = b.id where skrq = #{skrq} and b.flag = 0 + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKetangbiaoService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKetangbiaoService.java index 321afe07..1d250d17 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKetangbiaoService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKetangbiaoService.java @@ -74,4 +74,5 @@ public interface IKcKetangbiaoService extends IService { List getKccountExportList(KcKetangbiaoNum object); + void updateKechengbiaoid(String skrq); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java index 6c97550d..2e3f68a0 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKetangbiaoServiceImpl.java @@ -186,4 +186,9 @@ public class KcKetangbiaoServiceImpl extends ServiceImpl impl @Autowired private IXxhbbksService xxhbbksService; + @Autowired + private IZyDbtxService zyDbtxService; + + @Autowired + private IKcKechengbiaoService kcKechengbiaoService; @Override public Page findPage(WjxWjxx wjxWjxx, Page page){ List list = baseMapper.findPage(page,wjxWjxx); @@ -467,27 +476,39 @@ public class WjxWjxxServiceImpl extends ServiceImpl impl for(WjxWjxx wjxWjxx : list){ fbwj(wjxWjxx.getId(),wjxWjxx.getAtype()); -// QueryWrapper queryWrapper2 = new QueryWrapper<>(); -// queryWrapper2.apply("a.xh = b.xh"); -// queryWrapper2.eq("b.KCAPZBBH",wjxWjxx.getRwbh()); -// List list2 = xxhbbksService.getXsxkbAllList(queryWrapper2); -// String type = ""; -// String content = ""; -// -//// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); -// content = "教师发起了["+wjxWjxx.getKcmc()+"]课程“"+wjxWjxx.getTitle()+"”测验,该测验完成时间: "+DateUtils.formatDate(wjxWjxx.getStartTime(),"yyyy-MM-dd")+" ~ "+DateUtils.formatDate(wjxWjxx.getEndTime(),"yyyy-MM-dd")+",请及时完成"; -// for(Xxhbbks xxhbbks:list2){ -// -// try { -// KcWechatSendLog kcWechatSendLog = new KcWechatSendLog(); -// kcWechatSendLog.setOpenid(xxhbbks.getXh()); -// // kcWechatSendLog.setOpenid("2016900057");//指定曹老师账号 -// kcWechatSendLog.setYtkcs(content); -//// sendWxmessage(kcWechatSendLog); -// }catch (Exception e){ -// e.printStackTrace(); -// } -// } + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.apply("a.xh = b.xh"); + queryWrapper2.eq("b.KCAPZBBH",wjxWjxx.getRwbh()); + List list2 = xxhbbksService.getXsxkbAllList(queryWrapper2); + + + + + QueryWrapper kcKechengbiaoQueryWrapper = new QueryWrapper<>(); + kcKechengbiaoQueryWrapper.eq("rwbh",wjxWjxx.getRwbh()); + kcKechengbiaoQueryWrapper.eq("jgh",wjxWjxx.getCreateBy()); + kcKechengbiaoQueryWrapper.eq("xqxn",wjxWjxx.getXqxn()); + kcKechengbiaoQueryWrapper.last("limit 1"); + KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper); + + String content = kcKechengbiao.getSkjs()+"教师发起了["+wjxWjxx.getKcmc()+"]课程“"+wjxWjxx.getTitle()+"”测验,该测验完成时间: "+DateUtils.formatDate(wjxWjxx.getStartTime(),"yyyy-MM-dd")+" ~ "+DateUtils.formatDate(wjxWjxx.getEndTime(),"yyyy-MM-dd")+",请及时完成"; + for(Xxhbbks xxhbbks:list2){ + try { + //作业代办提醒 + ZyDbtx zyDbtx = new ZyDbtx(); + zyDbtx.setCreateBy(xxhbbks.getXh()); + zyDbtx.setType("2");//0发布作业 1评分 2测验 3问卷 4讨论 5学生提交作业 6学生提交测验 7学生提交问卷 + zyDbtx.setMainId(wjxWjxx.getId()); + zyDbtx.setRwbh(wjxWjxx.getRwbh()); + zyDbtx.setContent(content); + zyDbtx.setFlag("0"); + zyDbtx.setFbr(wjxWjxx.getCreateBy()); + zyDbtxService.save(zyDbtx); + + }catch (Exception e){ + e.printStackTrace(); + } + } } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/impl/ZyInfoServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/impl/ZyInfoServiceImpl.java index a19aa645..1828ee22 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/impl/ZyInfoServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/impl/ZyInfoServiceImpl.java @@ -96,6 +96,7 @@ public class ZyInfoServiceImpl extends ServiceImpl impleme QueryWrapper zyDbtxQueryWrapper = new QueryWrapper<>(); zyDbtxQueryWrapper.eq("type",zyInfo.getZyLeixing());//发送作业 zyDbtxQueryWrapper.eq("rwbh",zyInfo.getRwbh()); + zyDbtxQueryWrapper.eq("main_id",zyInfo.getId()); List dbtxlist = zyDbtxService.list(zyDbtxQueryWrapper); String xharrs[] = new String[dbtxlist.size()]; for(int i=0;i uploadSckhcl2(@RequestParam(name="ids",required=true) String ids) { - try { - zyInfoStudentService.batchZyinfoKhcl(ids); - }catch (Exception e) { - e.printStackTrace(); - } - - return Result.OK("上传成功!"); + return Result.OK("考核材料上传成功!"); } @@ -1209,4 +1199,29 @@ public class ZyInfoStudentController extends JeecgController cxtjByJccsbz(HttpServletResponse response) { + List list =zyInfoStudentService.cxtjByJccsbz(); + for(ZyInfoStudent zyInfoStudent:list){ + zyInfoStudentService.sysWpKsjc(zyInfoStudent, response); + } + return Result.OK("提交成功!"); + } + + + /** + * 获取维普查重次数 + * @return + */ + @GetMapping(value = "/getWpSycccs") + public Result> queryById() { + List zyInfoStudent = zyInfoStudentService.getWpSycccs(); + return Result.OK(zyInfoStudent); + } + } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java index c5a56523..8489fb02 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java @@ -127,6 +127,7 @@ public class ZyInfoStudent implements Serializable { private String pyFilePath;//批阅附件 private String sfsckhcl;//是否上传考核材料(0否 1是) private String fwqPath;//文件服务器存储地址 + private String pyFwqFilePath;//评阅附件存储地址 @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @Excel(name = "考核材料提交时间", width = 15,format = "yyyy-MM-dd HH:mm:ss") diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java index 53ecf2fc..ad451aaf 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java @@ -48,4 +48,6 @@ public interface ZyInfoStudentMapper extends BaseMapper { List getDocNoPdfList(); List cxccByZyId(@Param("zyInfoStudent") ZyInfoStudent zyInfoStudent2); + + List cxtjByJccsbz(); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml index fc99bc3a..cab71b51 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml @@ -174,4 +174,9 @@ where a.main_id = #{zyInfoStudent.mainId} and a.file_path is not null and b.id is null + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java index 783cd5ed..1f4dd3ef 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java @@ -1,5 +1,6 @@ package org.jeecg.modules.kc.zyInfoStudent.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -10,6 +11,7 @@ import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudentSys; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; /** * @Description: 学生提交作业 @@ -54,4 +56,10 @@ public interface IZyInfoStudentService extends IService { ZyInfoStudent scccjg(ZyInfoStudent zyInfoStudent, HttpServletRequest req, HttpServletResponse response); void batchZyinfoKhcl(String ids); + + List cxtjByJccsbz(); + + void sysWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response); + + List getWpSycccs(); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java index d139d497..8adfe39a 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.SFTPUtil; import org.jeecg.common.util.SftpConfig; import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao; @@ -278,10 +279,13 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl0){ for(String zyId:idsList){ ZyInfo zyInfo = zyInfoService.getById(zyId); @@ -295,34 +299,45 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("main_id",zyId); - queryWrapper.isNotNull("file_path"); + queryWrapper.eq("a.main_id",zyId); + queryWrapper.isNotNull("a.file_path"); List list = baseMapper.selectList(queryWrapper); for(ZyInfoStudent zyInfoStudentPar2:list){ if(StringUtils.isNotEmpty(zyInfoStudentPar2.getFilePath())){ - //上传文件 - Map uploadMap = SFTPUtil.upload(sftpConfig,upLoadPath+"/"+zyInfoStudentPar2.getFilePath(),zyInfoStudentPar2.getFilePath()); - zyInfoStudentPar2.setSfsckhcl("1"); - zyInfoStudentPar2.setFwqPath(uploadMap.get("data")); - zyInfoStudentPar2.setKhclTime(new Date()); - baseMapper.updateById(zyInfoStudentPar2); + //上传作业文件 + Map uploadMap = SFTPUtil.upload(sftpConfig,upLoadPath+"/"+zyInfoStudentPar2.getFilePath(),yyyy+"/"+mm+"/"+zyInfo.getRwbh()+"/"+zyInfoStudentPar2.getFilePath().replace("temp/","/")); - ZyInfoScjl zyInfoScjl = new ZyInfoScjl(); - zyInfoScjl.setZyId(zyInfo.getId()); - zyInfoScjl.setZyName(zyInfo.getTitle()); - zyInfoScjl.setZyLeixing(zyInfo.getZyLeixing()); - zyInfoScjl.setZyZb(zyInfo.getScore()); - zyInfoScjl.setJgh(kcKechengbiao.getJgh()); - zyInfoScjl.setSkjs(kcKechengbiao.getSkjs()); - zyInfoScjl.setSkdd(kcKechengbiao.getSkdd()); - zyInfoScjl.setKkdw(kcKechengbiao.getKkdw()); - zyInfoScjl.setKkdwid(kcKechengbiao.getKkdwid()); - zyInfoScjl.setKcxz(kcKechengbiao.getKcxz()); - zyInfoScjl.setXnxq(zyInfo.getXnxq()); - zyInfoScjl.setFilePath(zyInfoStudentPar2.getFwqPath()); - zyInfoScjl.setStudentNo(zyInfoStudentPar2.getCreateBy()); - zyInfoScjl.setStudentName(zyInfoStudentPar2.getStudentName()); - zyInfoScjlService.save(zyInfoScjl); + if(StringUtils.isNotEmpty(zyInfoStudentPar2.getPyFilePath())){ + //上传评阅附件 + Map uploadMap2 = SFTPUtil.upload(sftpConfig,upLoadPath+"/"+zyInfoStudentPar2.getPyFilePath(),yyyy+"/"+mm+"/"+zyInfo.getRwbh()+"/"+zyInfoStudentPar2.getPyFilePath().replace("temp/","/")); + if(StringUtils.equals(uploadMap2.get("code"),"0")){ + zyInfoStudentPar2.setPyFwqFilePath(uploadMap2.get("data")); + } + } + + if(StringUtils.equals(uploadMap.get("code"),"0")){ + zyInfoStudentPar2.setSfsckhcl("1"); + zyInfoStudentPar2.setFwqPath(uploadMap.get("data")); + zyInfoStudentPar2.setKhclTime(new Date()); + baseMapper.updateById(zyInfoStudentPar2); + + ZyInfoScjl zyInfoScjl = new ZyInfoScjl(); + zyInfoScjl.setZyId(zyInfo.getId()); + zyInfoScjl.setZyName(zyInfo.getTitle()); + zyInfoScjl.setZyLeixing(zyInfo.getZyLeixing()); + zyInfoScjl.setZyZb(zyInfo.getScore()); + zyInfoScjl.setJgh(kcKechengbiao.getJgh()); + zyInfoScjl.setSkjs(kcKechengbiao.getSkjs()); + zyInfoScjl.setSkdd(kcKechengbiao.getSkdd()); + zyInfoScjl.setKkdw(kcKechengbiao.getKkdw()); + zyInfoScjl.setKkdwid(kcKechengbiao.getKkdwid()); + zyInfoScjl.setKcxz(kcKechengbiao.getKcxz()); + zyInfoScjl.setXnxq(zyInfo.getXnxq()); + zyInfoScjl.setFilePath(zyInfoStudentPar2.getFwqPath()); + zyInfoScjl.setStudentNo(zyInfoStudentPar2.getCreateBy()); + zyInfoScjl.setStudentName(zyInfoStudentPar2.getStudentName()); + zyInfoScjlService.save(zyInfoScjl); + } } } } @@ -332,6 +347,79 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl cxtjByJccsbz() { + return baseMapper.cxtjByJccsbz(); + } + + @Override + public void sysWpKsjc(ZyInfoStudent zyInfoStudent, HttpServletResponse response) { + String fileName = getFileName(zyInfoStudent.getFilePath(),response); + zyInfoStudent.setFilePath(fileName); + + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + + + String cateid = zyInfo.getId()+""+zyInfo.getTitle(); + String catename = zyInfo.getTitle(); + zyInfoStudent.setCateid(cateid); + zyInfoStudent.setCatename(catename); + + //删除维普已经提交的文档 + delSysweipulunwen(zyInfoStudent, response); + + + //外网查重及提交检测 + if(StringUtils.equals(zyInfo.getWwcc(),"true")){ + wwccSave(zyInfoStudent,response); + } +// //内网查重及提交检测 +// if(StringUtils.equals(zyInfo.getNwcc(),"true")){ +// nwccSave(zyInfoStudent,response); +// } + //aigc查重及提交检测 + if(StringUtils.equals(zyInfo.getAigccc(),"true")){ + aigcSave(zyInfoStudent,response); + } +// //校内查重及提交检测 +// if(StringUtils.equals(zyInfo.getXncc(),"true")){ +// zyInfoStudent.setCateid("DBSDQXZYBDK001"); +// zyInfoStudent.setCatename("东北师大全校作业比对库"); +// xnccSave(zyInfoStudent,"1",response);//提交比对 +// } + } + + @Override + public List getWpSycccs() { + + List list = new ArrayList<>(); + + String url = "https://vims.fanyu.com/toole/jianceorgan/papercheckcount.aspx"; + JSONObject object= getSycs(url,"1"); + object.put("name","外网检测"); + + JSONObject object2= getSycs(url,"3"); + object2.put("name","AIGC检测"); + + list.add(object); + list.add(object2); + return list; + } + + public JSONObject getSycs(String url,String type){ + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("sign", sign); + textMap.put("userid", weipuId); + textMap.put("type", type); + String contentType = "";//image/png + String ret = formUpload(url, textMap, null,contentType); + log.error("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + return object; + } + private void delweipulunwen(ZyInfoStudent zyInfoStudent, HttpServletResponse response) { zyInfoStudent.setQueryType("0");//外网查重数据 String paperids = baseMapper.getWpFile(zyInfoStudent); @@ -364,6 +452,38 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl paperids1 = baseMapper.getXfwWpFile(zyInfoStudent); +// if(paperids1 != null){ +// String dataids = paperids1.get("paperid"); +// String bdkbs = paperids1.get("bdkbs"); +// String url = "https://vims.fanyu.com/toole/smallcheck/delData"; +// delXfwWpFile(url,bdkbs,dataids, response); +// } +// zyInfoStudent.setQueryType("3");//内网查重数据-全校内比对 +// Map paperids3 = baseMapper.getXfwWpFile(zyInfoStudent); +// if(paperids3 != null){ +// String dataids = paperids3.get("paperid"); +// String bdkbs = paperids3.get("bdkbs"); +// String url = "https://vims.fanyu.com/toole/smallcheck/delData"; +// delXfwWpFile(url,bdkbs,dataids, response); +// } + zyInfoStudent.setQueryType("2");//aigc查重数据 + String paperids2 = baseMapper.getWpFile(zyInfoStudent); + if(StringUtils.isNotEmpty(paperids2)){ + String url = "https://vims.fanyu.com/tool/AIGCCheck/paperDel"; + delWpFile(url,paperids2, response); + } + zyCcjgMapper.deleteByZystuid(zyInfoStudent.getId()); + } + //aigc提交 private void aigcSave(ZyInfoStudent zyInfoStudent,HttpServletResponse response) { String url = "https://vims.fanyu.com/tool/AIGCCheck/paperSubmit"; diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpClientPOSTExample.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpClientPOSTExample.java new file mode 100644 index 00000000..eea0d70a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpClientPOSTExample.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.wps.controller; + +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +public class HttpClientPOSTExample { + + public static void main(String[] args) { + try { + String drive_id = "test1111"; + String parent_id = "test1112"; + URL url = new URL("https://openapi.wps.cn/v7/drives/"+drive_id+"/files/"+parent_id+"/create"); + + // 打开连接 + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法为POST + connection.setRequestMethod("POST"); + + // 设置请求头,例如内容类型和认证信息 + Map map = KsoSign.getAuthorization(); +// String credentials = apiKey + ":" + secretKey; +// String basicAuth = "Basic " + new String(Base64.getEncoder().encode(credentials.getBytes())); + connection.setRequestProperty("Authorization", map.get("authorization")); + connection.setRequestProperty("Content-Type", "application/json"); + + // 发送POST请求的数据 + String postData = "{\"key1\":\"value1\",\"key2\":\"value2\"}"; + byte[] outputInBytes = postData.getBytes(StandardCharsets.UTF_8); + connection.setDoOutput(true); + + // 写入数据到请求体 + try (OutputStream out = connection.getOutputStream()) { + out.write(outputInBytes); + } + + // 获取响应码 + int responseCode = connection.getResponseCode(); + System.out.println("Response Code: " + responseCode); + + // 读取响应内容 + if (responseCode == HttpURLConnection.HTTP_OK) { + // 处理响应内容 +// String response = new String(connection.getInputStream(), StandardCharsets.UTF_8); +// System.out.println(response); + } else { + // 处理错误响应 +// String errorResponse = new String(connection.getErrorStream().readAllBytes(), StandardCharsets.UTF_8); +// System.out.println("Error Response: " + errorResponse); + } + + // 关闭连接 + connection.disconnect(); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpsPostRequest.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpsPostRequest.java new file mode 100644 index 00000000..5e69456e --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/HttpsPostRequest.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.wps.controller; + +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Base64; + +public class HttpsPostRequest { + public static void main(String[] args) throws Exception { + String targetURL = "https://openapi.wps.cn/oauth2/token"; + URL url = new URL(targetURL); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法为POST + connection.setRequestMethod("POST"); + + // 设置通用请求属性 + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + + // 如果需要,添加认证 +// String authentication = "username:password"; +// String encodedAuthentication = new String(Base64.getEncoder().encode(authentication.getBytes())); +// connection.setRequestProperty ("Authorization", "Basic " + encodedAuthentication); + + // 发送POST请求必须设置如下两行 + connection.setDoOutput(true); + connection.setDoInput(true); + + // 发送请求参数 + String jsonInputString = "{\"grant_type\":\"client_credentials\",\"client_id\":\"SX20241118WSUGQN\",\"client_secret\":\"IbRfANAvtsOoSAeKASHfiOMYlBpeVTqg\"}"; + try(OutputStream os = connection.getOutputStream()) { + byte[] input = jsonInputString.getBytes(); + os.write(input, 0, input.length); + } + + // 获取响应码 + int responseCode = connection.getResponseCode(); + System.out.println("POST Response Code :: " + responseCode); + + // 根据需要处理响应内容 + if (responseCode == HttpURLConnection.HTTP_OK) { + // 处理响应 + } + + // 关闭连接 + connection.disconnect(); + } +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/KsoSign.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/KsoSign.java new file mode 100644 index 00000000..ec834374 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/KsoSign.java @@ -0,0 +1,184 @@ +package org.jeecg.modules.wps.controller; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import com.alibaba.fastjson.JSONObject; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import java.util.*; + +public class KsoSign { + private final String accessKey; + private final String secretKey; + + public KsoSign(String accessKey, String secretKey) { + this.accessKey = accessKey; + this.secretKey = secretKey; + } + + public static final class Out { + private final String date; // X-Kso-Date + private final String authorization; // X-Kso-Authorization + + public Out(String date, String authorization) { + this.date = date; + this.authorization = authorization; + } + + public String getDate() { + return date; + } + + public String getAuthorization() { + return authorization; + } + } + + public Out kso1Sign(String method, String uri, String contentType, String ksoDate, byte[] requestBody) throws NoSuchAlgorithmException, InvalidKeyException { + String ksoSignature = getKso1Signature(method, uri, contentType, ksoDate, requestBody); + String authorization = String.format("KSO-1 %s:%s", accessKey, ksoSignature); + return new Out(ksoDate, authorization); + } + + private String getKso1Signature(String method, String uri, String contentType, String ksoDate, byte[] requestBody) throws NoSuchAlgorithmException, InvalidKeyException { + String sha256Hex = ""; + if (requestBody != null && requestBody.length > 0) { + MessageDigest digest = MessageDigest.getInstance("SHA-256"); + byte[] hash = digest.digest(requestBody); + sha256Hex = bytesToHex(hash); + } + + System.out.println("sha256: " + sha256Hex); + + String dataToSign = "KSO-1" + method + uri + contentType + ksoDate + sha256Hex; + Mac mac = Mac.getInstance("HmacSHA256"); + SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + mac.init(secretKeySpec); + byte[] macBytes = mac.doFinal(dataToSign.getBytes(StandardCharsets.UTF_8)); + return bytesToHex(macBytes); + } + + private String bytesToHex(byte[] bytes) { + StringBuilder result = new StringBuilder(); + for (byte b : bytes) { + result.append(String.format("%02x", b)); + } + return result.toString(); + } + + + /** + * 获取签名 + * @return + */ + public static Map getAuthorization(){ + Map map = new HashMap<>(); +// final String accessKey = "SX20241118WSUGQN"; +// final String secretKey = "IbRfANAvtsOoSAeKASHfiOMYlBpeVTqg"; + final String accessKey = "AK20241118LLGJYF"; + final String secretKey = "ce3e6d90a27c1ef238ce1b0b81a8d902"; + final String method = "POST"; + final String uri = "/v7/test/body"; + final String contentType = "application/json"; + final String contentDate = new Date().toString(); + final byte[] requestBody = "{\"key\": \"value\"}".getBytes(StandardCharsets.UTF_8); + + KsoSign kso = new KsoSign(accessKey, secretKey); + try { + KsoSign.Out out = kso.kso1Sign(method, uri, contentType, contentDate, requestBody); + System.out.println(out.getDate()); + System.out.println(out.getAuthorization()); + String data = out.getDate(); + String authorization = out.getAuthorization(); + map.put("data",data); + map.put("authorization",authorization); + return map; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 获取token + * @return + * @throws IOException + */ + public static Map getToken() throws IOException { + String httpsURL = "https://openapi.wps.cn/oauth2/token"; + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(httpsURL); + + // 设置请求头 + httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); + + // 创建请求内容 + List params = new ArrayList<>(); + params.add(new BasicNameValuePair("grant_type", "client_credentials")); + params.add(new BasicNameValuePair("client_id", "AK20241118LLGJYF")); + params.add(new BasicNameValuePair("client_secret", "ce3e6d90a27c1ef238ce1b0b81a8d902")); + HttpEntity entity = new UrlEncodedFormEntity(params,"UTF-8"); + System.out.println("entity : "+entity.toString()); + httpPost.setEntity(entity); + + // 发送请求并获取响应 + CloseableHttpResponse response = httpClient.execute(httpPost); + + // 打印响应状态 + System.out.println("Response Code : " + response.getStatusLine().getStatusCode()); + + // 获取响应内容并关闭 + String responseBody = EntityUtils.toString(response.getEntity()); + System.out.println("responseBody : "+responseBody); + + // 关闭HttpClient和response + httpClient.close(); + response.close(); + Map map = new HashMap<>(); + if(response.getStatusLine().getStatusCode() == 200){ + JSONObject jsonObject = JSONObject.parseObject(responseBody); + map.put("code","200"); + map.put("access_token",jsonObject.getString("access_token")); + map.put("msg","获取token成功"); + }else{ + map.put("code","500"); + map.put("msg","获取token失败"); + } + return map; + } + + + + + public static void main(String[] args) throws Exception { + //------------------获取token---------------------------- + Map mapToken = getToken();//获取token + System.out.println("code---" + mapToken.get("code")); + System.out.println("access_token---" + mapToken.get("access_token")); + //------------------获取token---------------------------- + + //------------------获取Authorization---------------------------- + Map mapAuthorization = getAuthorization(); + //------------------获取Authorization---------------------------- + + } + +} + + + diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java new file mode 100644 index 00000000..4efcd795 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java @@ -0,0 +1,224 @@ +package org.jeecg.modules.wps.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.kc.kcCasusers.entity.KcCasusers; +import org.jeecg.modules.kc.kcCasusers.service.IKcCasusersService; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; +import org.jeecg.modules.kc.zyZyxx.entity.ZyZyxx; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.wps.entity.WpsEnti; +import org.jeecg.modules.wps.entity.WpsUploadEnti; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +/** +* @Description: kc_casusers +* @Author: jeecg-boot +* @Date: 2023-05-22 +* @Version: V1.0 +*/ +@RestController +@RequestMapping("/v3/3rd") +@Slf4j +public class WpsController extends JeecgController { + @Autowired + private IZyInfoStudentService zyInfoStudentService; + + @Autowired + private ISysUserService sysUserService; + + /** + * 文档预览 + * @param fileId + * @return + */ + @RequestMapping(value = "/files/{fileId}", method = {RequestMethod.GET}) + public Map files(@PathVariable("fileId") String fileId) { + + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + WpsEnti map = new WpsEnti(); + map.setId(zyInfoStudent.getId()); + map.setName(zyInfoStudent.getFilePath()); + map.setVersion(1); + map.setSize(1); + map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1)); + Long createTime = zyInfoStudent.getCreateTime().getTime()/1000; + Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000; + map.setCreate_time(Integer.parseInt(createTime+"")); + map.setModify_time(Integer.parseInt(updateTime+"")); + map.setCreator_id(zyInfoStudent.getCreateBy()); + map.setModifier_id(zyInfoStudent.getUpdateBy()); + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + mapRet.put("data",map); + return mapRet; + } + + /** + * 文件下载地址 + * @param fileId + * @return + */ + @RequestMapping(value = "/files/{fileId}/download", method = {RequestMethod.GET}) + public Map download(@PathVariable("fileId") String fileId) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + Map mapRet2 = new HashMap<>(); +// https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/temp/QA%E4%BD%9C%E4%B8%9A%E7%B3%BB%E7%BB%9F%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98_1733101749150.docx + mapRet2.put("url","https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/"+zyInfoStudent.getFilePath()); + mapRet.put("code",0); + mapRet.put("data",mapRet2); + return mapRet; + } + + + /** + * 获取文档用户权限 + * @param fileId + * @return + */ + @RequestMapping(value = "/files/{fileId}/permission", method = {RequestMethod.GET}) + public Map permission(@PathVariable("fileId") String fileId) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + Map mapRet2 = new HashMap<>(); + mapRet.put("code",0); + mapRet2.put("comment",1); +// mapRet2.put("copy",1); + mapRet2.put("download",1); + mapRet2.put("history",1); + mapRet2.put("print",1); + mapRet2.put("read",1); +// mapRet2.put("rename",1); +// mapRet2.put("saveas",1); + mapRet2.put("update",1); + mapRet2.put("user_id",zyInfoStudent.getCreateBy()); + + mapRet.put("data",mapRet2); + return mapRet; + } + + + /** + * 文档预览 + * @param fileId + * @return + */ + @RequestMapping(value = "/files/{fileId}/versions", method = {RequestMethod.GET}) + public Map versions(@PathVariable("fileId") String fileId) { + + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + WpsEnti map = new WpsEnti(); + map.setId(zyInfoStudent.getId()); + map.setName(zyInfoStudent.getFilePath()); + map.setVersion(1); + map.setSize(1); + map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1)); + Long createTime = zyInfoStudent.getCreateTime().getTime()/1000; + Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000; + map.setCreate_time(Integer.parseInt(createTime+"")); + map.setModify_time(Integer.parseInt(updateTime+"")); + map.setCreator_id(zyInfoStudent.getCreateBy()); + map.setModifier_id(zyInfoStudent.getUpdateBy()); + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + mapRet.put("data",map); + return mapRet; + } + + + @GetMapping(value = "/users") + public Map users(@RequestParam(name="user_ids",required=true) String user_ids) { + System.out.println("user_ids : " + user_ids); + String userIds[] = user_ids.split(","); + List> list = new ArrayList<>(); + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + for(String userId : userIds){ + SysUser sysUser = sysUserService.getUserByName(userId); + System.out.println("sysUser : " + sysUser); + Map map = new HashMap<>(); + map.put("id",sysUser.getUsername()); + map.put("name",sysUser.getRealname()); + list.add(map); + } + + mapRet.put("data",list); + return mapRet; + } + + + /** + * 准备上传阶段 + * @param fileId + * @return + */ + @RequestMapping(value = "/files/{fileId}/upload/prepare", method = {RequestMethod.GET}) + public Map prepare(@PathVariable("fileId") String fileId) { + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + Map mapRet2 = new HashMap<>(); + String jmArr[] = {"sha1"}; + mapRet2.put("digest_types",jmArr); + mapRet.put("data",mapRet2); + mapRet.put("message",""); + return mapRet; + } + + + @RequestMapping(value = "/files/{fileId}/upload/address", method = {RequestMethod.POST}) + public Map address(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + Map mapRet2 = new HashMap<>(); + mapRet2.put("url","https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/"+zyInfoStudent.getFilePath()); + mapRet2.put("method","POST"); + mapRet.put("data",mapRet2); + mapRet.put("message",""); + return mapRet; + } + + @RequestMapping(value = "/files/{fileId}/upload/complete", method = {RequestMethod.POST}) + public Map complete(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti,HttpServletRequest request, HttpServletResponse response) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + mapRet.put("code",0); + WpsEnti map = new WpsEnti(); + map.setId(zyInfoStudent.getId()); + map.setName(zyInfoStudent.getFilePath()); + map.setVersion(2); + map.setSize(1); + map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1)); + Long createTime = zyInfoStudent.getCreateTime().getTime()/1000; + Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000; + map.setCreate_time(Integer.parseInt(createTime+"")); + map.setModify_time(Integer.parseInt(updateTime+"")); + map.setCreator_id(zyInfoStudent.getCreateBy()); + map.setModifier_id(zyInfoStudent.getUpdateBy()); + mapRet.put("data",map); + mapRet.put("message",""); + return mapRet; + } + + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsToken.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsToken.java new file mode 100644 index 00000000..da5b4897 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsToken.java @@ -0,0 +1,51 @@ +package org.jeecg.modules.wps.controller; + + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import java.util.*; + + +public class WpsToken { + + + public static void main(String[] args) throws Exception { + String httpsURL = "https://openapi.wps.cn/oauth2/token"; + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(httpsURL); + + // 设置请求头 + httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); + + // 创建请求内容 + List params = new ArrayList<>(); + params.add(new BasicNameValuePair("grant_type", "client_credentials")); + params.add(new BasicNameValuePair("client_id", "AK20241118LLGJYF")); + params.add(new BasicNameValuePair("client_secret", "ce3e6d90a27c1ef238ce1b0b81a8d902")); + HttpEntity entity = new UrlEncodedFormEntity(params,"UTF-8"); + System.out.println("entity : "+entity.toString()); + httpPost.setEntity(entity); + + // 发送请求并获取响应 + CloseableHttpResponse response = httpClient.execute(httpPost); + + // 打印响应状态 + System.out.println("Response Code : " + response.getStatusLine().getStatusCode()); + + // 获取响应内容并关闭 + String responseBody = EntityUtils.toString(response.getEntity()); + System.out.println("responseBody : "+responseBody); + + // 关闭HttpClient和response + httpClient.close(); + response.close(); + } + +} \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsEnti.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsEnti.java new file mode 100644 index 00000000..2022785e --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsEnti.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wps.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class WpsEnti { + private String id; + private String name; + private Integer version; + private Integer size; + private Integer create_time; + private Integer modify_time; + private String creator_id; + private String modifier_id; +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsUploadEnti.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsUploadEnti.java new file mode 100644 index 00000000..25569c95 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/entity/WpsUploadEnti.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.wps.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Map; + +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class WpsUploadEnti { + private String file_id; + private String name; + private Integer size; + private Map digest; + private boolean is_manual; + private Integer attachment_size; + private String content_type; + private Object request; + private Object response; + private Integer status_code; + private Map headers; + private byte body; + private Map send_back_params; +}