| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- package top.lvzhiqiang.controller;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.multipart.MultipartFile;
- import top.lvzhiqiang.dto.R;
- import top.lvzhiqiang.exception.ParameterException;
- import top.lvzhiqiang.service.BgService;
- import top.lvzhiqiang.util.StringUtils;
- import javax.annotation.Resource;
- import java.io.IOException;
- /**
- * BG Controller
- *
- * @author lvzhiqiang
- * 2022/4/16 16:10
- */
- @Controller
- @RequestMapping("/bg")
- public class BgController {
- @Resource
- private BgService bgService;
- /**
- * 初始化骑兵数据
- *
- * @author lvzhiqiang
- * 2022/4/16 16:10
- */
- @RequestMapping("/initQibingData")
- @ResponseBody
- public R initQibingData() {
- bgService.initQibingData();
- return R.ok();
- }
- @RequestMapping("/ftlIndex")
- public String ftlIndex(Model model) {
- return "ftlIndex";
- }
- /**
- * 上传识别码文件
- *
- * @author lvzhiqiang
- * 2022/4/16 16:10
- */
- @RequestMapping("/uploadFile4IdentificationCode")
- @ResponseBody
- public R uploadFile4IdentificationCode(MultipartFile file, Integer isDel) throws IOException {
- if (StringUtils.isEmpty(file.getOriginalFilename())) {
- throw new ParameterException("文件为空!");
- } else {
- if (!file.getOriginalFilename().toLowerCase().endsWith("txt")) {
- throw new ParameterException("文件格式不正确!!");
- }
- }
- if (null == isDel) {
- isDel = 2;
- }
- bgService.uploadFile4IdentificationCode(file.getInputStream(), isDel);
- return R.ok();
- }
- /**
- * 上传识别码文件
- *
- * @author lvzhiqiang
- * 2022/4/16 16:10
- */
- @RequestMapping("/single4IdentificationCode")
- @ResponseBody
- public R single4IdentificationCode(String identificationCode) {
- if (StringUtils.isEmpty(identificationCode)) {
- throw new ParameterException("identificationCode为空!");
- }
- bgService.single4IdentificationCode(identificationCode);
- return R.ok();
- }
- /**
- * Jsoup IcodePool
- *
- * @author lvzhiqiang
- * 2022/4/16 16:10
- */
- @RequestMapping("/jsoupIcodePool")
- @ResponseBody
- public R jsoupIcodePool(Integer status, Integer isDel) {
- if (null == status) {
- status = 1;
- }
- if (null == isDel) {
- isDel = 2;
- }
- bgService.jsoupIcodePool(status, isDel);
- return R.ok();
- }
- /**
- * findDicCode
- *
- * @author lvzhiqiang
- * 2022/5/3 17:37
- */
- @RequestMapping("/findDicCode")
- @ResponseBody
- public String findDicCode(String codeDesc, String order) throws IllegalAccessException {
- return bgService.findDicCode(codeDesc, order);
- }
- /**
- * findIcodePool
- *
- * @author lvzhiqiang
- * 2022/5/3 17:37
- */
- @RequestMapping("/findIcodePool")
- @ResponseBody
- public String findIcodePool(String identificationCode, Integer status, String order) throws IllegalAccessException {
- if (StringUtils.isNotEmpty(identificationCode)) {
- identificationCode = identificationCode.toUpperCase();
- }
- return bgService.findIcodePool(identificationCode, status, order);
- }
- /**
- * findVideoSitePool
- *
- * @author lvzhiqiang
- * 2022/5/3 17:37
- */
- @RequestMapping("/findVideoSitePool")
- @ResponseBody
- public String findVideoSitePool(String url, String order) throws IllegalAccessException {
- return bgService.findVideoSitePool(url, order);
- }
- /**
- * findVideoInfoPool
- *
- * @author lvzhiqiang
- * 2022/5/3 17:37
- */
- @RequestMapping("/findVideoInfoPool")
- @ResponseBody
- public String findVideoInfoPool(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException {
- if (StringUtils.isNotEmpty(identificationCode)) {
- identificationCode = identificationCode.toUpperCase();
- }
- if (StringUtils.isEmpty(crudT)) {
- crudT = "1";
- }
- return bgService.findVideoInfoPool(identificationCode, type, order, crudT);
- }
- /**
- * findVideoInfo
- *
- * @author lvzhiqiang
- * 2022/5/3 17:37
- */
- @RequestMapping("/findVideoInfo")
- @ResponseBody
- public String findVideoInfo(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException {
- if (StringUtils.isNotEmpty(identificationCode)) {
- identificationCode = identificationCode.toUpperCase();
- }
- if (StringUtils.isEmpty(crudT)) {
- crudT = "1";
- }
- return bgService.findVideoInfo(identificationCode, type, order, crudT);
- }
- /**
- * insetOrupdateScoreOrComment
- *
- * @author lvzhiqiang
- * 2022/5/4 9:54
- */
- @RequestMapping("/insertOrUpdateScoreOrComment")
- @ResponseBody
- public String insertOrUpdateScoreOrComment(String identificationCode, String score, String comment) throws IllegalAccessException {
- if (StringUtils.isEmpty(identificationCode)) {
- throw new ParameterException("identificationCode为空!");
- }
- if (StringUtils.isEmpty(score) && StringUtils.isEmpty(comment)) {
- throw new ParameterException("score和comment不能都为空!");
- }
- return bgService.insertOrUpdateScoreOrComment(identificationCode.toUpperCase(), score, comment);
- }
- }
|