diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyCcjg.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyCcjg.java new file mode 100644 index 00000000..f8cba355 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncZyCcjg.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.kc.grab.SynchronizationService; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; +import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Map; + +/** + * 作业查重接口 + */ +@Slf4j +public class SyncZyCcjg extends BaseSync { + + @Autowired + private IZyCcjgService zyCcjgService; + + + /** + * 若参数变量名修改 QuartzJobController中也需对应修改 + */ + + @Override + public void execute(JobExecutionContext jobExecutionContext) { + start(); + run(getParamMap()); + end(); + } + + + /** + * 有参定时任务实现 + * @param param + */ + public void run(Map param){ + zyCcjgService.getCcjg(); + } + + /** + * 无参定时任务实现 + */ + public void run(){ + run(null); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcEvaluationsHisrecord/entity/KcEvaluationsHisrecord.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcEvaluationsHisrecord/entity/KcEvaluationsHisrecord.java index ae01f03c..3bcb5bdf 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcEvaluationsHisrecord/entity/KcEvaluationsHisrecord.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/kcEvaluationsHisrecord/entity/KcEvaluationsHisrecord.java @@ -32,6 +32,7 @@ import lombok.experimental.Accessors; public class KcEvaluationsHisrecord implements Serializable { private static final long serialVersionUID = 1L; + private String id; /**学年学期*/ @Excel(name = "学年学期", width = 15) @ApiModelProperty(value = "学年学期") diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java index f29be00e..57bdf71b 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java @@ -257,7 +257,7 @@ public class KcKechengbiaoController extends JeecgController page = new Page(pageNo, pageSize); - IPage pageList = kcKechengbiaoService.page(page, queryWrapper); + IPage pageList = kcKechengbiaoService.getKechengbiaolist(page, queryWrapper); return Result.OK(pageList); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKechengbiaoMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKechengbiaoMapper.java index a8ea97db..f757ea74 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKechengbiaoMapper.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/KcKechengbiaoMapper.java @@ -39,4 +39,6 @@ public interface KcKechengbiaoMapper extends BaseMapper { void updateAllFlag(KcKechengbiao kcKechengbiao); void updateYxByXxhbkckb(KcKechengbiao kcbAll); + + IPage getKechengbiaolist(Page page,@Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKechengbiaoMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKechengbiaoMapper.xml index e05c422a..90e23c2f 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKechengbiaoMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/mapper/xml/KcKechengbiaoMapper.xml @@ -54,7 +54,7 @@ + SELECT + kcbh, + kcmc, + kkdw, + kcxz, + szkc, + xqxn, + rwbh, + skdd, + xkrs, + func_jc(GROUP_CONCAT( sksj + )) AS sksj + FROM + ( + SELECT DISTINCT + kcbh, + kcmc, + kkdw, + kcxz, + szkc, + xqxn, + rwbh, + skdd, + xkrs, + concat ( + WEEK, + REPLACE ( hh, '、', '' )) + AS sksj + FROM + kc_kechengbiao + ${ew.customSqlSegment} + ) t + GROUP BY + kcbh, + kcmc, + kkdw, + kcxz, + szkc, + xqxn + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKechengbiaoService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKechengbiaoService.java index ac77367c..7b70fc01 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKechengbiaoService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/IKcKechengbiaoService.java @@ -37,4 +37,6 @@ public interface IKcKechengbiaoService extends IService { void updateAllFlag(KcKechengbiao kcKechengbiao); void updateYxByXxhbkckb(KcKechengbiao kcbAll); + + IPage getKechengbiaolist(Page page, QueryWrapper queryWrapper); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKechengbiaoServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKechengbiaoServiceImpl.java index 665c1945..d4e09757 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKechengbiaoServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/service/impl/KcKechengbiaoServiceImpl.java @@ -75,4 +75,9 @@ public class KcKechengbiaoServiceImpl extends ServiceImpl getKechengbiaolist(Page page, QueryWrapper queryWrapper) { + return baseMapper.getKechengbiaolist(page,queryWrapper); + } + } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/controller/ZyCcjgController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/controller/ZyCcjgController.java new file mode 100644 index 00000000..a5d2712f --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/controller/ZyCcjgController.java @@ -0,0 +1,178 @@ +package org.jeecg.modules.kc.zyCcjg.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.kc.zyCcjg.entity.ZyCcjg; +import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 查重结果 + * @Author: jeecg-boot + * @Date: 2024-05-07 + * @Version: V1.0 + */ +@Api(tags="查重结果") +@RestController +@RequestMapping("/zyCcjg/zyCcjg") +@Slf4j +public class ZyCcjgController extends JeecgController { + @Autowired + private IZyCcjgService zyCcjgService; + + /** + * 分页列表查询 + * + * @param zyCcjg + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "查重结果-分页列表查询") + @ApiOperation(value="查重结果-分页列表查询", notes="查重结果-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ZyCcjg zyCcjg, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyCcjg, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyCcjgService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyCcjg + * @return + */ + @AutoLog(value = "查重结果-添加") + @ApiOperation(value="查重结果-添加", notes="查重结果-添加") + @RequiresPermissions("zyCcjg:zy_ccjg:add") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyCcjg zyCcjg) { + zyCcjgService.save(zyCcjg); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyCcjg + * @return + */ + @AutoLog(value = "查重结果-编辑") + @ApiOperation(value="查重结果-编辑", notes="查重结果-编辑") + @RequiresPermissions("zyCcjg:zy_ccjg:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ZyCcjg zyCcjg) { + zyCcjgService.updateById(zyCcjg); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "查重结果-通过id删除") + @ApiOperation(value="查重结果-通过id删除", notes="查重结果-通过id删除") + @RequiresPermissions("zyCcjg:zy_ccjg:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyCcjgService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "查重结果-批量删除") + @ApiOperation(value="查重结果-批量删除", notes="查重结果-批量删除") + @RequiresPermissions("zyCcjg:zy_ccjg:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyCcjgService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "查重结果-通过id查询") + @ApiOperation(value="查重结果-通过id查询", notes="查重结果-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyCcjg zyCcjg = zyCcjgService.getById(id); + if(zyCcjg==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyCcjg); + } + + /** + * 导出excel + * + * @param request + * @param zyCcjg + */ + @RequiresPermissions("zyCcjg:zy_ccjg:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyCcjg zyCcjg) { + return super.exportXls(request, zyCcjg, ZyCcjg.class, "查重结果"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("zyCcjg:zy_ccjg:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyCcjg.class); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/entity/ZyCcjg.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/entity/ZyCcjg.java new file mode 100644 index 00000000..ca365a98 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/entity/ZyCcjg.java @@ -0,0 +1,146 @@ +package org.jeecg.modules.kc.zyCcjg.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 查重结果 + * @Author: jeecg-boot + * @Date: 2024-05-07 + * @Version: V1.0 + */ +@Data +@TableName("zy_ccjg") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_ccjg对象", description="查重结果") +public class ZyCcjg implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**学生作业*/ + @Excel(name = "学生作业", width = 15) + @ApiModelProperty(value = "学生作业") + private java.lang.String zyStuId; + /**文档id +*/ + @Excel(name = "文档id", width = 15) + @ApiModelProperty(value = "文档id") + private java.lang.String paperid; + /**报告编号*/ + @Excel(name = "报告编号", width = 15) + @ApiModelProperty(value = "报告编号") + private java.lang.String paperguid; + /**文件名 +*/ + @Excel(name = "文件名", width = 15) + @ApiModelProperty(value = "文件名") + private java.lang.String papertitle; + /**检测状态(1:检测中,2:检测完成,3:检测失败,0:未检测) +*/ + @Excel(name = "检测状态(1:检测中,2:检测完成,3:检测失败,0:未检测)", width = 15) + @ApiModelProperty(value = "检测状态(1:检测中,2:检测完成,3:检测失败,0:未检测)") + private java.lang.String filestateid; + /**检测进度*/ + @Excel(name = "检测进度", width = 15) + @ApiModelProperty(value = "检测进度") + private java.lang.String detectprogress; + /**相似率 +*/ + @Excel(name = "相似率", width = 15) + @ApiModelProperty(value = "相似率") + private java.lang.String percentage; + /**引用率*/ + @Excel(name = "引用率", width = 15) + @ApiModelProperty(value = "引用率") + private java.lang.String quotepercentage; + /**复写率*/ + @Excel(name = "复写率", width = 15) + @ApiModelProperty(value = "复写率") + private java.lang.String duplicatepercentage; + /**自写率*/ + @Excel(name = "自写率", width = 15) + @ApiModelProperty(value = "自写率") + private java.lang.String ownpercentage; + /**文档检测完成时间 +*/ + @Excel(name = "文档检测完成时间", width = 15) + @ApiModelProperty(value = "文档检测完成时间") + private java.lang.String checkdate; + /**论文字数 +*/ + @Excel(name = "论文字数", width = 15) + @ApiModelProperty(value = "论文字数") + private java.lang.String paperword; + /**在线报告查看地址*/ + @Excel(name = "在线报告查看地址", width = 15) + @ApiModelProperty(value = "在线报告查看地址") + private java.lang.String paperviewurl; + /**报告下载地址 +*/ + @Excel(name = "报告下载地址", width = 15) + @ApiModelProperty(value = "报告下载地址") + private java.lang.String paperdownurl; + /**他引率 +*/ + @Excel(name = "他引率", width = 15) + @ApiModelProperty(value = "他引率") + private java.lang.String otherquoterate; + /**自引率 +*/ + @Excel(name = "自引率", width = 15) + @ApiModelProperty(value = "自引率") + private java.lang.String selfquoterate; + /**专业术语率 +*/ + @Excel(name = "专业术语率", width = 15) + @ApiModelProperty(value = "专业术语率") + private java.lang.String proWordRate; + /**查重类型(0外网 1内网 2aigc)*/ + @Excel(name = "查重类型(0外网 1内网 2aigc)", width = 15) + @ApiModelProperty(value = "查重类型(0外网 1内网 2aigc)") + private java.lang.String ccType; + + private java.lang.String bdkbs;//比对库标识 + private java.lang.String aiRate;//疑似ai全文占比 + private java.lang.String humanRate;//人工占比 + private java.lang.String message;// + private java.lang.String paichupercentage;//他引率 + private java.lang.String authorpercentage;//专业术语率 + + + @TableField(exist = false) + private String cateid; +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/ZyCcjgMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/ZyCcjgMapper.java new file mode 100644 index 00000000..28876ca0 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/ZyCcjgMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.kc.zyCcjg.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.kc.zyCcjg.entity.ZyCcjg; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 查重结果 + * @Author: jeecg-boot + * @Date: 2024-05-07 + * @Version: V1.0 + */ +public interface ZyCcjgMapper extends BaseMapper { + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/xml/ZyCcjgMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/xml/ZyCcjgMapper.xml new file mode 100644 index 00000000..b7adf37f --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/mapper/xml/ZyCcjgMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/IZyCcjgService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/IZyCcjgService.java new file mode 100644 index 00000000..8983a16c --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/IZyCcjgService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.kc.zyCcjg.service; + +import org.jeecg.modules.kc.zyCcjg.entity.ZyCcjg; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 查重结果 + * @Author: jeecg-boot + * @Date: 2024-05-07 + * @Version: V1.0 + */ +public interface IZyCcjgService extends IService { + + void getCcjg(); +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/impl/ZyCcjgServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/impl/ZyCcjgServiceImpl.java new file mode 100644 index 00000000..2ea55a64 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyCcjg/service/impl/ZyCcjgServiceImpl.java @@ -0,0 +1,485 @@ +package org.jeecg.modules.kc.zyCcjg.service.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.kc.blZycc.entity.BlZycc; +import org.jeecg.modules.kc.zyCcjg.entity.ZyCcjg; +import org.jeecg.modules.kc.zyCcjg.mapper.ZyCcjgMapper; +import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import javax.activation.MimetypesFileTypeMap; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @Description: 查重结果 + * @Author: jeecg-boot + * @Date: 2024-05-07 + * @Version: V1.0 + */ +@Service +public class ZyCcjgServiceImpl extends ServiceImpl implements IZyCcjgService { + + private static String uploadpath; + + @Value("${jeecg.path.upload}") + public void setUploadPath(String uploadPath) { + this.uploadpath = uploadPath; + } + + private static String weipuId; + + @Value("${weipu.userId}") + public void setWeipuId(String weipuId) { + this.weipuId = weipuId; + } + + + private static String weipuKey; + @Value("${weipu.userKey}") + public void setWeipuKey(String weipuKey) { + this.weipuKey = weipuKey; + } + + + + + @Autowired + private IZyInfoService zyInfoService; + + @Autowired + private IZyInfoStudentService zyInfoStudentService; + + + + @Override + public void getCcjg() { + QueryWrapper zyCcjgQueryWrapper = new QueryWrapper<>(); + zyCcjgQueryWrapper.in("filestateid",0,1,3);//检测状态(1:检测中,2:检测完成,3:检测失败,0:未检测) + List list = baseMapper.selectList(zyCcjgQueryWrapper); + for(ZyCcjg par : list){ + //查重类型(0外网 1内网 2aigc) + if(StringUtils.equals(par.getCcType(), "0")){ + wwCxjcjg(par); + }else if(StringUtils.equals(par.getCcType(), "1")){ + xfwbdCxjcjg(par); + }else if(StringUtils.equals(par.getCcType(), "2")){ + aigcCxjcjg(par); + } + } + } + + + + public Map aigcCxjcjg(ZyCcjg zyCcjg) { + String url = "https://vims.fanyu.com/tool/AIGCCheck/searchPaper"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + textMap.put("paperids", paperid);//资源id,可多个,用逗号分割 + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + System.out.println("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + //{"success":true,"message":"查询成功", "datalist":[{"dataid":568,"message":"","paperguid":"5c384d6bd69y9ba9","papertitle":"","filestateid":2,"paperword":1958,"percentage":0,"duplicatepercentage":0,"quotepercentage":0,"paichupercentage":0,"selfyypercentage":0,"ownpercentage":100,"authorpercentage":0,"checkdate":"2024-04-13 13:51:51","paperviewurl":"https://vims.fanyu.com/toole/smallcheck/getonlineurl?guid=5c384d6bd69y9ba9","paperdownurl":"https://vims.fanyu.com/toole/smallcheck/getdownloadurl?guid=5c384d6bd69y9ba9"}]} + //filestateid 检测状态{0未检测,1检测中,2检测完成, 3检测失败} + String listpaper = object.getString("listpaper"); + JSONArray jsonArray = (JSONArray) JSONArray.parse(listpaper); + JSONObject object2= jsonArray.getJSONObject(0); + String filestateid = object2.getString("filestateid"); + if(StringUtils.equals(filestateid,"0")){ + System.out.println(paperid+":未检测"); + }else if(StringUtils.equals(filestateid,"1")){ + System.out.println(paperid+":检测中"); + }else if(StringUtils.equals(filestateid,"2")){ + System.out.println(paperid+":检测完成"); + }else if(StringUtils.equals(filestateid,"3")){ + System.out.println(paperid+":检测失败;"+object2.getString("message")); + }else{ + System.out.println(paperid+":当前状态:"+filestateid+";"+object2.getString("message")); + } + System.out.println("listpaper----->"+listpaper);//结果结合 + System.out.println("object2----->"+object2);//实际单挑数据结果 + Map map = new HashMap(); + + zyCcjg.setPaperguid(object2.getString("paperguid"));//报告编号 + zyCcjg.setPapertitle(object2.getString("papertitle"));//论文标题 + zyCcjg.setFilestateid(object2.getString("filestateid"));//检测状态0:未检测;1:检测中;2:检测完成;3:检测失败; + zyCcjg.setCheckdate(object2.getString("checkdate"));//检测时间 + zyCcjg.setPaperword(object2.getString("paperword"));//论文字数 + zyCcjg.setAiRate(object2.getString("aiRate"));//疑似ai全文占比 + zyCcjg.setHumanRate(object2.getString("humanRate"));//人工占比 + zyCcjg.setPaperviewurl(object2.getString("paperviewurl"));//报告在线查看地址 + zyCcjg.setPaperdownurl(object2.getString("paperdownurl"));//报告下载地址 + zyCcjg.setMessage(object2.getString("message")); + baseMapper.updateById(zyCcjg); + + //----------计算通过率-------------- + if(StringUtils.equals("2",object2.getString("filestateid"))){ + String stuId = zyCcjg.getZyStuId(); + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(stuId); + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + Double tgl = 0.0; + if(zyInfo.getAigctgl()>0){ + tgl = zyInfo.getAigctgl(); + } + Double cctgl = 0.0; + if(StringUtils.isNotEmpty(object2.getString("aiRate"))){ + cctgl = Double.parseDouble(object2.getString("aiRate")); + } + if(tgl > cctgl || tgl == 0){ + zyInfoStudent.setAigcsftg("通过"); + }else{ + zyInfoStudent.setAigcsftg("未通过"); + } + zyInfoStudent.setAigcxsl(cctgl+""); + zyInfoStudentService.updateById(zyInfoStudent); + } + + //----------计算通过率-------------- + + + map.put("success","true"); + map.put("message",object.getString("message")); + return map; + }else{ + System.out.println("3-------->"); + Map map = new HashMap(); + map.put("success","false"); + map.put("message",object.getString("message")); + return map; + } + } + + + public Map wwCxjcjg(ZyCcjg zyCcjg) { + String url = "https://vims.fanyu.com/toole/jianceorgan/paperlist.aspx"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + textMap.put("paperids", paperid);//资源id,可多个,用逗号分割 + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + System.out.println("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + //{"success":true,"message":"查询成功", "datalist":[{"dataid":568,"message":"","paperguid":"5c384d6bd69y9ba9","papertitle":"","filestateid":2,"paperword":1958,"percentage":0,"duplicatepercentage":0,"quotepercentage":0,"paichupercentage":0,"selfyypercentage":0,"ownpercentage":100,"authorpercentage":0,"checkdate":"2024-04-13 13:51:51","paperviewurl":"https://vims.fanyu.com/toole/smallcheck/getonlineurl?guid=5c384d6bd69y9ba9","paperdownurl":"https://vims.fanyu.com/toole/smallcheck/getdownloadurl?guid=5c384d6bd69y9ba9"}]} + //filestateid 检测状态{0未检测,1检测中,2检测完成, 3检测失败} + String listpaper = object.getString("listpaper"); + JSONArray jsonArray = (JSONArray) JSONArray.parse(listpaper); + JSONObject object2= jsonArray.getJSONObject(0); + String filestateid = object2.getString("filestateid"); + if(StringUtils.equals(filestateid,"0")){ + System.out.println(paperid+":未检测"); + }else if(StringUtils.equals(filestateid,"1")){ + System.out.println(paperid+":检测中"); + }else if(StringUtils.equals(filestateid,"2")){ + System.out.println(paperid+":检测完成"); + }else if(StringUtils.equals(filestateid,"3")){ + System.out.println(paperid+":检测失败;"+object2.getString("message")); + }else{ + System.out.println(paperid+":当前状态:"+filestateid+";"+object2.getString("message")); + } + System.out.println("listpaper----->"+listpaper);//结果结合 + System.out.println("object2----->"+object2);//实际单挑数据结果 + Map map = new HashMap(); + + + zyCcjg.setPaperguid(object2.getString("paperguid"));//报告编号 + zyCcjg.setPapertitle(object2.getString("papertitle"));//论文标题 + zyCcjg.setFilestateid(object2.getString("filestateid"));//检测状态0:未检测;1:检测中;2:检测完成;3:检测失败; + zyCcjg.setCheckdate(object2.getString("checkdate"));//检测时间 + zyCcjg.setPaperword(object2.getString("paperword"));//论文字数 + zyCcjg.setPaperviewurl(object2.getString("paperviewurl"));//报告在线查看地址 + zyCcjg.setPaperdownurl(object2.getString("paperdownurl"));//报告下载地址 + zyCcjg.setMessage(object2.getString("message")); + zyCcjg.setDuplicatepercentage(object2.getString("duplicatepercentage"));//复写率 + zyCcjg.setPaichupercentage(object2.getString("paichupercentage"));//他引率 + zyCcjg.setOwnpercentage(object2.getString("ownpercentage"));//自写率 + zyCcjg.setPercentage(object2.getString("percentage"));//相似率 + zyCcjg.setQuotepercentage(object2.getString("quotepercentage"));//引用率 + zyCcjg.setSelfquoterate(object2.getString("selfyypercentage"));//自引率 + zyCcjg.setAuthorpercentage(object2.getString("authorpercentage"));//专业术语率 + baseMapper.updateById(zyCcjg); + + //----------计算通过率-------------- + if(StringUtils.equals("2",object2.getString("filestateid"))) { + String stuId = zyCcjg.getZyStuId(); + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(stuId); + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + Double tgl = 0.0; + if (zyInfo.getWwtgl() > 0) { + tgl = zyInfo.getWwtgl(); + } + Double cctgl = 0.0; + if (StringUtils.isNotEmpty(object2.getString("percentage"))) { + cctgl = Double.parseDouble(object2.getString("percentage")); + } + if (tgl > cctgl || tgl == 0) { + zyInfoStudent.setWwsftg("通过"); + } else { + zyInfoStudent.setWwsftg("未通过"); + } + zyInfoStudent.setWwxsl(cctgl + ""); + zyInfoStudentService.updateById(zyInfoStudent); + } + //----------计算通过率-------------- + + map.put("success","true"); + map.put("message",object.getString("message")); + + return map; + }else{ + System.out.println("3-------->"); + Map map = new HashMap(); + map.put("success","false"); + map.put("message",object.getString("message")); + return map; + } + } + + //小范围比对查询检测结果 + public Map xfwbdCxjcjg(ZyCcjg zyCcjg) { + String url = "https://vims.fanyu.com/toole/smallcheck/searchCheckStatus"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + textMap.put("cateid", zyCcjg.getBdkbs());//比对库的id + textMap.put("dataids", paperid);//资源id + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + System.out.println("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + //{"success":true,"message":"查询成功", "datalist":[{"dataid":568,"message":"","paperguid":"5c384d6bd69y9ba9","papertitle":"","filestateid":2,"paperword":1958,"percentage":0,"duplicatepercentage":0,"quotepercentage":0,"paichupercentage":0,"selfyypercentage":0,"ownpercentage":100,"authorpercentage":0,"checkdate":"2024-04-13 13:51:51","paperviewurl":"https://vims.fanyu.com/toole/smallcheck/getonlineurl?guid=5c384d6bd69y9ba9","paperdownurl":"https://vims.fanyu.com/toole/smallcheck/getdownloadurl?guid=5c384d6bd69y9ba9"}]} + //filestateid 检测状态{0未检测,1检测中,2检测完成, 3检测失败} + String listpaper = object.getString("datalist"); + JSONArray jsonArray = (JSONArray) JSONArray.parse(listpaper); + JSONObject object2= jsonArray.getJSONObject(0); + String filestateid = object2.getString("filestateid"); + if(StringUtils.equals(filestateid,"0")){ + System.out.println(paperid+":未检测"); + }else if(StringUtils.equals(filestateid,"1")){ + System.out.println(paperid+":检测中"); + }else if(StringUtils.equals(filestateid,"2")){ + System.out.println(paperid+":检测完成"); + }else if(StringUtils.equals(filestateid,"3")){ + System.out.println(paperid+":检测失败;"+object2.getString("message")); + }else{ + System.out.println(paperid+":当前状态:"+filestateid+";"+object2.getString("message")); + } + System.out.println("listpaper----->"+listpaper);//结果结合 + System.out.println("object2----->"+object2);//实际单挑数据结果 + Map map = new HashMap(); + + + zyCcjg.setPaperguid(object2.getString("paperguid"));//报告编号 + zyCcjg.setPapertitle(object2.getString("papertitle"));//论文标题 + zyCcjg.setFilestateid(object2.getString("filestateid"));//检测状态0:未检测;1:检测中;2:检测完成;3:检测失败; + zyCcjg.setCheckdate(object2.getString("checkdate"));//检测时间 + zyCcjg.setPaperword(object2.getString("paperword"));//论文字数 + zyCcjg.setPaperviewurl(object2.getString("paperviewurl"));//报告在线查看地址 + zyCcjg.setPaperdownurl(object2.getString("paperdownurl"));//报告下载地址 + zyCcjg.setMessage(object2.getString("message")); + zyCcjg.setDuplicatepercentage(object2.getString("duplicatepercentage"));//复写率 + zyCcjg.setPaichupercentage(object2.getString("paichupercentage"));//他引率 + zyCcjg.setOwnpercentage(object2.getString("ownpercentage"));//自写率 + zyCcjg.setPercentage(object2.getString("percentage"));//相似率 + zyCcjg.setQuotepercentage(object2.getString("quotepercentage"));//引用率 + zyCcjg.setSelfquoterate(object2.getString("selfyypercentage"));//自引率 + zyCcjg.setAuthorpercentage(object2.getString("authorpercentage"));//专业术语率 + + baseMapper.updateById(zyCcjg); + //----------计算通过率-------------- + if(StringUtils.equals("2",object2.getString("filestateid"))) { + String stuId = zyCcjg.getZyStuId(); + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(stuId); + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + Double tgl = 0.0; + if (zyInfo.getNwtgl() > 0) { + tgl = zyInfo.getNwtgl(); + } + Double cctgl = 0.0; + if (StringUtils.isNotEmpty(object2.getString("percentage"))) { + cctgl = Double.parseDouble(object2.getString("percentage")); + } + if (tgl > cctgl || tgl == 0) { + zyInfoStudent.setNwsftg("通过"); + } else { + zyInfoStudent.setNwsftg("未通过"); + } + zyInfoStudent.setNwxsl(cctgl + ""); + zyInfoStudentService.updateById(zyInfoStudent); + } + //----------计算通过率-------------- + + map.put("success","true"); + map.put("message",object.getString("message")); + + return map; + }else{ + System.out.println("3-------->"); + Map map = new HashMap(); + map.put("success","false"); + map.put("message",object.getString("message")); + return map; + } + } + + //生成sign + public static String getSign() { + String userid = weipuId; + String key = weipuKey; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH"); + String time = sdf.format( new Date()); + String md5Text = userid + key + time; + String sign = org.springframework.util.DigestUtils.md5DigestAsHex((md5Text).getBytes()).toLowerCase(); + return sign; + } + + /** + * 上传图片 + * @param urlStr + * @param textMap + * @param fileMap + * @param contentType 没有传入文件类型默认采用application/octet-stream + * contentType非空采用filename匹配默认的图片类型 + * @return 返回response数据 + */ + @SuppressWarnings("rawtypes") + public static String formUpload(String urlStr, Map textMap, + Map fileMap,String contentType) { + String res = ""; + HttpURLConnection conn = null; + // boundary就是request头和上传文件内容的分隔符 + String BOUNDARY = "---------------------------123821742118716"; + try { + URL url = new URL(urlStr); + conn = (HttpURLConnection) url.openConnection(); + conn.setConnectTimeout(5000); + conn.setReadTimeout(30000); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Connection", "Keep-Alive"); + conn.setRequestProperty("Content-Type","multipart/form-data; boundary=" + BOUNDARY); + OutputStream out = new DataOutputStream(conn.getOutputStream()); + // text + if (textMap != null) { + StringBuffer strBuf = new StringBuffer(); + Iterator iter = textMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + String inputName = (String) entry.getKey(); + String inputValue = (String) entry.getValue(); + if (inputValue == null) { + continue; + } + strBuf.append("\r\n").append("--").append(BOUNDARY).append("\r\n"); + strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"\r\n\r\n"); + strBuf.append(inputValue); + } + out.write(strBuf.toString().getBytes(StandardCharsets.UTF_8)); + } + // file + if (fileMap != null) { + Iterator iter = fileMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + String inputName = (String) entry.getKey(); + String inputValue = (String) entry.getValue(); + if (inputValue == null) { + continue; + } + File file = new File(inputValue); + String filename = file.getName(); + + //没有传入文件类型,同时根据文件获取不到类型,默认采用application/octet-stream + contentType = new MimetypesFileTypeMap().getContentType(file); + //contentType非空采用filename匹配默认的图片类型 + if(!"".equals(contentType)){ + if (filename.endsWith(".png")) { + contentType = "image/png"; + }else if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".jpe")) { + contentType = "image/jpeg"; + }else if (filename.endsWith(".gif")) { + contentType = "image/gif"; + }else if (filename.endsWith(".ico")) { + contentType = "image/image/x-icon"; + } + } + if (contentType == null || "".equals(contentType)) { + contentType = "application/octet-stream"; + } + StringBuffer strBuf = new StringBuffer(); + strBuf.append("\r\n").append("--").append(BOUNDARY).append("\r\n"); + strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"; filename=\"" + filename + "\"\r\n"); + strBuf.append("Content-Type:" + contentType + "\r\n\r\n"); + out.write(strBuf.toString().getBytes()); + DataInputStream in = new DataInputStream(new FileInputStream(file)); + int bytes = 0; + byte[] bufferOut = new byte[1024]; + while ((bytes = in.read(bufferOut)) != -1) { + out.write(bufferOut, 0, bytes); + } + in.close(); + } + } + byte[] endData = ("\r\n--" + BOUNDARY + "--\r\n").getBytes(); + out.write(endData); + out.flush(); + out.close(); + // 读取返回数据 + StringBuffer strBuf = new StringBuffer(); + BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line = null; + while ((line = reader.readLine()) != null) { + strBuf.append(line).append("\n"); + } + res = strBuf.toString(); + reader.close(); + reader = null; + } catch (Exception e) { + System.out.println("发送POST请求出错。" + urlStr); + e.printStackTrace(); + } finally { + if (conn != null) { + conn.disconnect(); + conn = null; + } + } + return res; + } +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/controller/ZyInfoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/controller/ZyInfoController.java new file mode 100644 index 00000000..84456379 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/controller/ZyInfoController.java @@ -0,0 +1,184 @@ +package org.jeecg.modules.kc.zyInfo.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig; +import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService; +import org.jeecg.modules.kc.kcXqxnHistory.entity.KcXqxnHistory; +import org.jeecg.modules.kc.kcXqxnHistory.service.IKcXqxnHistoryService; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 作业发布 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Api(tags="作业发布") +@RestController +@RequestMapping("/zyInfo/zyInfo") +@Slf4j +public class ZyInfoController extends JeecgController { + @Autowired + private IZyInfoService zyInfoService; + + @Autowired + private IKcSysConfigService kcSysConfigService; + /** + * 分页列表查询 + * + * @param zyInfo + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "作业发布-分页列表查询") + @ApiOperation(value="作业发布-分页列表查询", notes="作业发布-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ZyInfo zyInfo, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyInfo, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyInfoService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyInfo + * @return + */ + @AutoLog(value = "作业发布-添加") + @ApiOperation(value="作业发布-添加", notes="作业发布-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyInfo zyInfo) { + KcSysConfig kcSysConfig = kcSysConfigService.getById("1"); + zyInfo.setXnxq( kcSysConfig.getFlag1()); + zyInfo.setZyStatus("0"); + zyInfoService.save(zyInfo); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyInfo + * @return + */ + @AutoLog(value = "作业发布-编辑") + @ApiOperation(value="作业发布-编辑", notes="作业发布-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ZyInfo zyInfo) { + zyInfoService.updateById(zyInfo); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "作业发布-通过id删除") + @ApiOperation(value="作业发布-通过id删除", notes="作业发布-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyInfoService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "作业发布-批量删除") + @ApiOperation(value="作业发布-批量删除", notes="作业发布-批量删除") + @RequiresPermissions("zyInfo:zy_info:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyInfoService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "作业发布-通过id查询") + @ApiOperation(value="作业发布-通过id查询", notes="作业发布-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyInfo zyInfo = zyInfoService.getById(id); + if(zyInfo==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyInfo); + } + + /** + * 导出excel + * + * @param request + * @param zyInfo + */ + @RequiresPermissions("zyInfo:zy_info:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyInfo zyInfo) { + return super.exportXls(request, zyInfo, ZyInfo.class, "作业发布"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("zyInfo:zy_info:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyInfo.class); + } + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/entity/ZyInfo.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/entity/ZyInfo.java new file mode 100644 index 00000000..130ac8ef --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/entity/ZyInfo.java @@ -0,0 +1,119 @@ +package org.jeecg.modules.kc.zyInfo.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 作业发布 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Data +@TableName("zy_info") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_info对象", description="作业发布") +public class ZyInfo implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**作业名称*/ + @Excel(name = "作业名称", width = 15) + @ApiModelProperty(value = "作业名称") + private java.lang.String title; + /**类型*/ + @Excel(name = "类型", width = 15, dicCode = "zy_type") + @Dict(dicCode = "zy_type") + @ApiModelProperty(value = "类型") + private java.lang.String zyType; + /**描述*/ + @Excel(name = "描述", width = 15) + @ApiModelProperty(value = "描述") + private java.lang.String content; + /**开始时间*/ + @Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "开始时间") + private java.util.Date startTime; + /**结束时间*/ + @Excel(name = "结束时间", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "结束时间") + private java.util.Date endTime; + /**状态*/ + @Excel(name = "状态", width = 15) + @ApiModelProperty(value = "状态") + @Dict(dicCode = "zy_status") + private java.lang.String zyStatus; + /**学年学期*/ + @Excel(name = "学年学期", width = 15) + @ApiModelProperty(value = "学年学期") + private java.lang.String xnxq; + /**外网是否查重*/ + @Excel(name = "外网是否查重", width = 15, dicCode = "yn") + @Dict(dicCode = "yn") + @ApiModelProperty(value = "外网是否查重") + private java.lang.String wwcc; + /**外网通过率*/ + @Excel(name = "外网通过率", width = 15) + @ApiModelProperty(value = "外网通过率") + private java.lang.Double wwtgl; + /**内网查重*/ + @Excel(name = "内网查重", width = 15, dicCode = "yn") + @Dict(dicCode = "yn") + @ApiModelProperty(value = "内网查重") + private java.lang.String nwcc; + /**内网通过率*/ + @Excel(name = "内网通过率", width = 15) + @ApiModelProperty(value = "内网通过率") + private java.lang.Double nwtgl; + /**aigc查重*/ + @Excel(name = "aigc查重", width = 15, dicCode = "yn") + @Dict(dicCode = "yn") + @ApiModelProperty(value = "aigc查重") + private java.lang.String aigccc; + /**aigc通过率*/ + @Excel(name = "aigc通过率", width = 15) + @ApiModelProperty(value = "aigc通过率") + private java.lang.Double aigctgl; + + private java.lang.String rwbh; + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/ZyInfoMapper.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/ZyInfoMapper.java new file mode 100644 index 00000000..951e1ebd --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/ZyInfoMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.kc.zyInfo.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 作业发布 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +public interface ZyInfoMapper extends BaseMapper { + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/xml/ZyInfoMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/xml/ZyInfoMapper.xml new file mode 100644 index 00000000..96dff835 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/mapper/xml/ZyInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/IZyInfoService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/IZyInfoService.java new file mode 100644 index 00000000..32871008 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/IZyInfoService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.kc.zyInfo.service; + +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 作业发布 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +public interface IZyInfoService extends IService { + +} 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 new file mode 100644 index 00000000..66421609 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfo/service/impl/ZyInfoServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.kc.zyInfo.service.impl; + +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfo.mapper.ZyInfoMapper; +import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 作业发布 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Service +public class ZyInfoServiceImpl extends ServiceImpl implements IZyInfoService { + +} diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java new file mode 100644 index 00000000..0bc00e77 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java @@ -0,0 +1,175 @@ +package org.jeecg.modules.kc.zyInfoStudent.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 学生提交作业 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Api(tags="学生提交作业") +@RestController +@RequestMapping("/zyInfoStudent/zyInfoStudent") +@Slf4j +public class ZyInfoStudentController extends JeecgController { + @Autowired + private IZyInfoStudentService zyInfoStudentService; + + /** + * 分页列表查询 + * + * @param zyInfoStudent + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "学生提交作业-分页列表查询") + @ApiOperation(value="学生提交作业-分页列表查询", notes="学生提交作业-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ZyInfoStudent zyInfoStudent, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(zyInfoStudent, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = zyInfoStudentService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param zyInfoStudent + * @return + */ + @AutoLog(value = "学生提交作业-添加") + @ApiOperation(value="学生提交作业-添加", notes="学生提交作业-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ZyInfoStudent zyInfoStudent) { + zyInfoStudentService.save(zyInfoStudent); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param zyInfoStudent + * @return + */ + @AutoLog(value = "学生提交作业-编辑") + @ApiOperation(value="学生提交作业-编辑", notes="学生提交作业-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ZyInfoStudent zyInfoStudent) { + zyInfoStudentService.updateById(zyInfoStudent); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "学生提交作业-通过id删除") + @ApiOperation(value="学生提交作业-通过id删除", notes="学生提交作业-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + zyInfoStudentService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "学生提交作业-批量删除") + @ApiOperation(value="学生提交作业-批量删除", notes="学生提交作业-批量删除") + @RequiresPermissions("zyInfoStudent:zy_info_student:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.zyInfoStudentService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "学生提交作业-通过id查询") + @ApiOperation(value="学生提交作业-通过id查询", notes="学生提交作业-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(id); + if(zyInfoStudent==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(zyInfoStudent); + } + + /** + * 导出excel + * + * @param request + * @param zyInfoStudent + */ + @RequiresPermissions("zyInfoStudent:zy_info_student:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ZyInfoStudent zyInfoStudent) { + return super.exportXls(request, zyInfoStudent, ZyInfoStudent.class, "学生提交作业"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("zyInfoStudent:zy_info_student:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ZyInfoStudent.class); + } + +} 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 new file mode 100644 index 00000000..ca4608b0 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/entity/ZyInfoStudent.java @@ -0,0 +1,93 @@ +package org.jeecg.modules.kc.zyInfoStudent.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 学生提交作业 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Data +@TableName("zy_info_student") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="zy_info_student对象", description="学生提交作业") +public class ZyInfoStudent implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.String id; + /**createBy*/ + @ApiModelProperty(value = "createBy") + private java.lang.String createBy; + /**createTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "createTime") + private java.util.Date createTime; + /**updateBy*/ + @ApiModelProperty(value = "updateBy") + private java.lang.String updateBy; + /**updateTime*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "updateTime") + private java.util.Date updateTime; + /**作业名称*/ + @Excel(name = "作业名称", width = 15) + @ApiModelProperty(value = "作业名称") + private java.lang.String mainId; + /**作业附件*/ + @Excel(name = "作业附件", width = 15) + @ApiModelProperty(value = "作业附件") + private java.lang.String filePath; + /**外网相似律*/ + @Excel(name = "外网相似律", width = 15) + @ApiModelProperty(value = "外网相似律") + private java.lang.String wwxsl; + /**内网相似律*/ + @Excel(name = "内网相似律", width = 15) + @ApiModelProperty(value = "内网相似律") + private java.lang.String nwxsl; + /**aigc相似律*/ + @Excel(name = "aigc相似律", width = 15) + @ApiModelProperty(value = "aigc相似律") + private java.lang.String aigcxsl; + /**外网是否通过*/ + @Excel(name = "外网是否通过", width = 15) + @ApiModelProperty(value = "外网是否通过") + private java.lang.String wwsftg; + /**内网是否通过*/ + @Excel(name = "内网是否通过", width = 15) + @ApiModelProperty(value = "内网是否通过") + private java.lang.String nwsftg; + /**aigc是否通过*/ + @Excel(name = "aigc是否通过", width = 15) + @ApiModelProperty(value = "aigc是否通过") + private java.lang.String aigcsftg; + private java.lang.String studentName; + + @TableField(exist = false) + private String catename; + @TableField(exist = false) + private String cateid; + + +} 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 new file mode 100644 index 00000000..9145a55f --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/ZyInfoStudentMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.kc.zyInfoStudent.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 学生提交作业 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +public interface ZyInfoStudentMapper extends BaseMapper { + +} 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 new file mode 100644 index 00000000..ec0ca56a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml @@ -0,0 +1,5 @@ + + + + + \ 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 new file mode 100644 index 00000000..27aa2f1a --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.kc.zyInfoStudent.service; + +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 学生提交作业 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +public interface IZyInfoStudentService extends IService { + + public boolean save(ZyInfoStudent zyInfoStudent); +} 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 new file mode 100644 index 00000000..01c594b9 --- /dev/null +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java @@ -0,0 +1,431 @@ +package org.jeecg.modules.kc.zyInfoStudent.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.kc.blZycc.entity.BlZycc; +import org.jeecg.modules.kc.kcSysConfig.entity.KcSysConfig; +import org.jeecg.modules.kc.kcSysConfig.service.IKcSysConfigService; +import org.jeecg.modules.kc.ktgl.entity.KcKechengbiao; +import org.jeecg.modules.kc.ktgl.service.IKcKechengbiaoService; +import org.jeecg.modules.kc.zyCcjg.entity.ZyCcjg; +import org.jeecg.modules.kc.zyCcjg.mapper.ZyCcjgMapper; +import org.jeecg.modules.kc.zyInfo.entity.ZyInfo; +import org.jeecg.modules.kc.zyInfo.service.IZyInfoService; +import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; +import org.jeecg.modules.kc.zyInfoStudent.mapper.ZyInfoStudentMapper; +import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import javax.activation.MimetypesFileTypeMap; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * @Description: 学生提交作业 + * @Author: jeecg-boot + * @Date: 2024-05-06 + * @Version: V1.0 + */ +@Service +public class ZyInfoStudentServiceImpl extends ServiceImpl implements IZyInfoStudentService { + + @Autowired + private IZyInfoService zyInfoService; + + @Autowired + private ZyCcjgMapper zyCcjgMapper; + + @Autowired + private IKcKechengbiaoService kcKechengbiaoService; + + private static String uploadpath; + + @Value("${jeecg.path.upload}") + public void setUploadPath(String uploadPath) { + this.uploadpath = uploadPath; + } + + private static String weipuId; + + @Value("${weipu.userId}") + public void setWeipuId(String weipuId) { + this.weipuId = weipuId; + } + + + private static String weipuKey; + @Value("${weipu.userKey}") + public void setWeipuKey(String weipuKey) { + this.weipuKey = weipuKey; + } + + + @Override + public boolean save(ZyInfoStudent zyInfoStudent) { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + zyInfoStudent.setStudentName(sysUser.getRealname()); + baseMapper.insert(zyInfoStudent); + + ZyInfo zyInfo = zyInfoService.getById(zyInfoStudent.getMainId()); + + String rwbh = zyInfo.getRwbh(); +// KcSysConfig kcSysConfig = kcSysConfigService.getById("1"); + QueryWrapper kcKechengbiaoQueryWrapper = new QueryWrapper<>(); + kcKechengbiaoQueryWrapper.eq("xqxn",zyInfo.getXnxq()); + kcKechengbiaoQueryWrapper.eq("rwbh",rwbh); + kcKechengbiaoQueryWrapper.last("limit 1"); + KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper); + String cateid = kcKechengbiao.getKcbh()+""+kcKechengbiao.getKcmc(); + String catename = kcKechengbiao.getKcmc(); + zyInfoStudent.setCateid(cateid); + zyInfoStudent.setCatename(catename); + //外网查重及提交检测 + if(StringUtils.equals(zyInfo.getWwcc(),"1")){ + wwccSave(zyInfoStudent); + } + //内网查重及提交检测 + if(StringUtils.equals(zyInfo.getNwcc(),"1")){ + nwccSave(zyInfoStudent); + } + //aigc查重及提交检测 + if(StringUtils.equals(zyInfo.getAigccc(),"1")){ + aigcSave(zyInfoStudent); + } + return true; + } + + //aigc提交 + private void aigcSave(ZyInfoStudent zyInfoStudent) { + String url = "https://vims.fanyu.com/tool/AIGCCheck/paperSubmit"; + //文件路径,文件存在,不存在的话需要先下载下来 + String fileName = uploadpath+"/"+ zyInfoStudent.getFilePath(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + String titlePar =fileName.substring(fileName.lastIndexOf("/")+1,fileName.length()); + String title = titlePar.split("_")[0]; + textMap.put("title", title); + textMap.put("number", "202405112244"); + textMap.put("author", "测试作者B"); + //设置file的name,路径 + Map fileMap = new HashMap(); + fileMap.put("file", fileName); + String contentType = "";//image/png + String ret = formUpload(url, textMap, fileMap,contentType); + System.out.println("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + + + String listpaper = object.getString("listPaper"); + JSONArray jsonArray = (JSONArray) JSONArray.parse(listpaper); + JSONObject object2= jsonArray.getJSONObject(0); + String paperid = object2.getString("paperid"); + System.out.println("2-------->"+paperid); + + ZyCcjg zyCcjg = new ZyCcjg(); + zyCcjg.setZyStuId(zyInfoStudent.getId()); + zyCcjg.setPaperid(paperid); + zyCcjg.setCcType("2");//查重类型(0外网 1内网 2aigc) + zyCcjg.setFilestateid("1"); + zyCcjgMapper.insert(zyCcjg); + + //提交后直接开始检测 + String message = aigcKsjc(zyCcjg); + System.out.println("21-------->"+message); + }else{ + System.out.println("3-------->"); + } + } + + //aigc开始检测 + public String aigcKsjc(ZyCcjg zyCcjg) { + + String url = "https://vims.fanyu.com/tool/AIGCCheck/paperBeginCheck\n"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + textMap.put("paperids", paperid);//资源id + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + JSONObject object= JSONObject.parseObject(ret); + String message = object.getString("message"); + return message; + } + + //小范围提交(校园内网提交) + private void nwccSave(ZyInfoStudent zyInfoStudent) { + String url = "https://vims.fanyu.com/toole/smallcheck/submitData"; + //文件路径,文件存在,不存在的话需要先下载下来 + String fileName = uploadpath+"/"+ zyInfoStudent.getFilePath(); + Map textMap = new HashMap(); + String titlePar =fileName.substring(fileName.lastIndexOf("/")+1,fileName.length()); + String title = titlePar.split("_")[0]; + //可以设置多个input的name,value + String sign = getSign(); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + textMap.put("sign", sign); + textMap.put("userid", weipuId); + textMap.put("title", title);//标题 + textMap.put("author", sysUser.getRealname());//作者 + textMap.put("cateid", zyInfoStudent.getCateid());//范围库唯一标识 + textMap.put("catename", zyInfoStudent.getCatename());//范围库名称 + textMap.put("number", sysUser.getUsername());//学号 + //设置file的name,路径 + Map fileMap = new HashMap(); + fileMap.put("file", fileName); + String contentType = "";//image/png + String ret = formUpload(url, textMap, fileMap,contentType); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + String listpaper = object.getString("datainfo"); + JSONObject object2= JSON.parseObject(listpaper); + String dataid = object2.getString("dataid");//资源id 后续提交比对/删除文档会试用 + + ZyCcjg zyCcjg = new ZyCcjg(); + zyCcjg.setZyStuId(zyInfoStudent.getId()); + zyCcjg.setPaperid(dataid); + zyCcjg.setCcType("1");//查重类型(0外网 1内网 2aigc) + zyCcjg.setFilestateid("1"); + zyCcjgMapper.insert(zyCcjg); + zyCcjg.setCateid(zyInfoStudent.getCateid()); + + //提交后直接开始检测 + String message = xfwbdKsjc(zyCcjg); + System.out.println("21-------->"+message); + }else{ + System.out.println("3-------->"); + } + } + + //小范围对比开始检测 + public String xfwbdKsjc(ZyCcjg zyCcjg) { + String url = "https://vims.fanyu.com/toole/smallcheck/beginCheck"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("sign", sign); + textMap.put("userid", weipuId); + textMap.put("cateid", zyCcjg.getCateid());//比对库的id + textMap.put("dataids", paperid);//资源id + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + JSONObject object= JSONObject.parseObject(ret); + String message = object.getString("message"); + return message; + } + + //外网查重提交方法 + private String wwccSave(ZyInfoStudent zyInfoStudent) { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String url = "https://vims.fanyu.com/toole/jianceorgan/papersubmit.aspx"; + //文件路径,文件存在,不存在的话需要先下载下来 + String fileName = uploadpath+"/"+ zyInfoStudent.getFilePath(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("sign", sign); + textMap.put("userid", weipuId); + String titlePar =fileName.substring(fileName.lastIndexOf("/")+1,fileName.length()); + String title = titlePar.split("_")[0]; + textMap.put("title", title); + textMap.put("number", sysUser.getUsername()); + textMap.put("author", sysUser.getRealname()); + //设置file的name,路径 + Map fileMap = new HashMap(); + fileMap.put("file", fileName); + String contentType = "";//image/png + String ret = formUpload(url, textMap, fileMap,contentType); + System.out.println("1-------->"+ret); + JSONObject object= JSONObject.parseObject(ret); + if("true".equals(object.getString("success"))){ + String listpaper = object.getString("listpaper"); + JSONArray jsonArray = (JSONArray) JSONArray.parse(listpaper); + JSONObject object2= jsonArray.getJSONObject(0); + String paperid = object2.getString("paperid"); + System.out.println("2-------->"+paperid); + + + ZyCcjg zyCcjg = new ZyCcjg(); + zyCcjg.setZyStuId(zyInfoStudent.getId()); + zyCcjg.setPaperid(paperid); + zyCcjg.setCcType("0");//查重类型(0外网 1内网 2aigc) + zyCcjg.setFilestateid("1"); + zyCcjgMapper.insert(zyCcjg); + //提交后直接开始检测 + String message = wwKsjc(zyCcjg); + System.out.println("21-------->"+message); + return message; + }else{ + System.out.println("3-------->"); + return "false"; + } + } + + + + //外网开始检测 + public String wwKsjc(ZyCcjg zyCcjg) { + String url = "https://vims.fanyu.com/toole/jianceorgan/paperbegincheck.aspx"; + //文件路径,文件存在,不存在的话需要先下载下来 + String paperid = zyCcjg.getPaperid(); + Map textMap = new HashMap(); + //可以设置多个input的name,value + String sign = getSign(); + textMap.put("userid", weipuId); + textMap.put("sign", sign); + textMap.put("paperids", paperid);//资源id + String contentType = "";//image/png + Map fileMap = new HashMap(); + String ret = formUpload(url, textMap, fileMap,contentType); + JSONObject object= JSONObject.parseObject(ret); + String message = object.getString("message"); + return message; + } + + + + + + //生成sign + public static String getSign() { + String userid = weipuId; + String key = weipuKey; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH"); + String time = sdf.format( new Date()); + String md5Text = userid + key + time; + String sign = org.springframework.util.DigestUtils.md5DigestAsHex((md5Text).getBytes()).toLowerCase(); + return sign; + } + + //推送轻求 + public static String formUpload(String urlStr, Map textMap, Map fileMap,String contentType) { + String res = ""; + HttpURLConnection conn = null; + // boundary就是request头和上传文件内容的分隔符 + String BOUNDARY = "---------------------------123821742118716"; + try { + URL url = new URL(urlStr); + conn = (HttpURLConnection) url.openConnection(); + conn.setConnectTimeout(5000); + conn.setReadTimeout(30000); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Connection", "Keep-Alive"); + conn.setRequestProperty("Content-Type","multipart/form-data; boundary=" + BOUNDARY); + OutputStream out = new DataOutputStream(conn.getOutputStream()); + // text + if (textMap != null) { + StringBuffer strBuf = new StringBuffer(); + Iterator iter = textMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + String inputName = (String) entry.getKey(); + String inputValue = (String) entry.getValue(); + if (inputValue == null) { + continue; + } + strBuf.append("\r\n").append("--").append(BOUNDARY).append("\r\n"); + strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"\r\n\r\n"); + strBuf.append(inputValue); + } + out.write(strBuf.toString().getBytes(StandardCharsets.UTF_8)); + } + // file + if (fileMap != null) { + Iterator iter = fileMap.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + String inputName = (String) entry.getKey(); + String inputValue = (String) entry.getValue(); + if (inputValue == null) { + continue; + } + File file = new File(inputValue); + String filename = file.getName(); + + //没有传入文件类型,同时根据文件获取不到类型,默认采用application/octet-stream + contentType = new MimetypesFileTypeMap().getContentType(file); + //contentType非空采用filename匹配默认的图片类型 + if(!"".equals(contentType)){ + if (filename.endsWith(".png")) { + contentType = "image/png"; + }else if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".jpe")) { + contentType = "image/jpeg"; + }else if (filename.endsWith(".gif")) { + contentType = "image/gif"; + }else if (filename.endsWith(".ico")) { + contentType = "image/image/x-icon"; + } + } + if (contentType == null || "".equals(contentType)) { + contentType = "application/octet-stream"; + } + StringBuffer strBuf = new StringBuffer(); + strBuf.append("\r\n").append("--").append(BOUNDARY).append("\r\n"); + strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"; filename=\"" + filename + "\"\r\n"); + strBuf.append("Content-Type:" + contentType + "\r\n\r\n"); + out.write(strBuf.toString().getBytes()); + DataInputStream in = new DataInputStream(new FileInputStream(file)); + int bytes = 0; + byte[] bufferOut = new byte[1024]; + while ((bytes = in.read(bufferOut)) != -1) { + out.write(bufferOut, 0, bytes); + } + in.close(); + } + } + byte[] endData = ("\r\n--" + BOUNDARY + "--\r\n").getBytes(); + out.write(endData); + out.flush(); + out.close(); + // 读取返回数据 + StringBuffer strBuf = new StringBuffer(); + BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line = null; + while ((line = reader.readLine()) != null) { + strBuf.append(line).append("\n"); + } + res = strBuf.toString(); + reader.close(); + reader = null; + } catch (Exception e) { + System.out.println("发送POST请求出错。" + urlStr); + e.printStackTrace(); + } finally { + if (conn != null) { + conn.disconnect(); + conn = null; + } + } + return res; + } +}