|
|
@@ -1,68 +1,21 @@
|
|
|
package com.zhongzheng.controller.common;
|
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
-import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
-import com.zhongzheng.common.annotation.Log;
|
|
|
import com.zhongzheng.common.config.RuoYiConfig;
|
|
|
import com.zhongzheng.common.constant.Constants;
|
|
|
import com.zhongzheng.common.core.controller.BaseController;
|
|
|
import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
-import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
-import com.zhongzheng.common.enums.BusinessType;
|
|
|
-import com.zhongzheng.common.type.EncryptHandler;
|
|
|
-import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.file.FileUploadUtils;
|
|
|
import com.zhongzheng.common.utils.file.FileUtils;
|
|
|
-import com.zhongzheng.common.utils.poi.ExcelUtil;
|
|
|
import com.zhongzheng.framework.config.ServerConfig;
|
|
|
-import com.zhongzheng.framework.web.service.WxLoginService;
|
|
|
-import com.zhongzheng.modules.activity.vo.ActivityGoodsPriceVo;
|
|
|
-import com.zhongzheng.modules.base.bo.ConfigQueryBo;
|
|
|
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsQueryBo;
|
|
|
-import com.zhongzheng.modules.distribution.bo.DistributionCashWithdrawalPayBo;
|
|
|
-import com.zhongzheng.modules.distribution.service.IDistributionActivityGoodsService;
|
|
|
-import com.zhongzheng.modules.distribution.service.IDistributionCashWithdrawalService;
|
|
|
-import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
|
|
|
-import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
|
|
|
-import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
|
|
|
-import com.zhongzheng.modules.goods.bo.GoodsStudyUrlBo;
|
|
|
-import com.zhongzheng.modules.goods.bo.UserGoodsListBo;
|
|
|
-import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
-import com.zhongzheng.modules.goods.vo.GoodsJzsVo;
|
|
|
-import com.zhongzheng.modules.goods.vo.UserGoodsListVo;
|
|
|
-import com.zhongzheng.modules.grade.bo.*;
|
|
|
-import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
-import com.zhongzheng.modules.grade.service.IUserPeriodService;
|
|
|
-import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
|
|
|
-import com.zhongzheng.modules.order.domain.Order;
|
|
|
-import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
-import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
-import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
-import com.zhongzheng.modules.system.bo.SysTenantAdminBo;
|
|
|
-import com.zhongzheng.modules.system.bo.SysTenantAdminOldBo;
|
|
|
-import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
|
|
|
-import com.zhongzheng.modules.system.domain.SysTenant;
|
|
|
-import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
-import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
|
-import com.zhongzheng.modules.system.service.ISysWebService;
|
|
|
-import com.zhongzheng.modules.system.vo.SysTenantVo;
|
|
|
-import com.zhongzheng.modules.top.user.bo.TopSysTenantRegisterAddBo;
|
|
|
-import com.zhongzheng.modules.top.user.service.ITopSysTenantRegisterService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserService;
|
|
|
-import com.zhongzheng.modules.wx.bo.WxShareGoodsBo;
|
|
|
-import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
+import com.zhongzheng.modules.alioss.bo.FileHandleBo;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -71,10 +24,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
+import java.io.File;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -83,59 +35,22 @@ import java.util.stream.Collectors;
|
|
|
* @author zhongzheng
|
|
|
*/
|
|
|
@RestController
|
|
|
-public class CommonController extends BaseController
|
|
|
-{
|
|
|
+public class CommonController extends BaseController {
|
|
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ServerConfig serverConfig;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IGoodsService iGoodsService;
|
|
|
- @Autowired
|
|
|
- private IUserPeriodService iUserPeriodService;
|
|
|
- @Autowired
|
|
|
- private IOrderService iOrderService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WxLoginService wxLoginService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IOrderGoodsService iOrderGoodsService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IWxPayService iWxPayService;
|
|
|
- @Autowired
|
|
|
- private IClassGradeService iClassGradeService;
|
|
|
- @Autowired
|
|
|
- private ISysTenantService iSysTenantService;
|
|
|
- @Autowired
|
|
|
- private IUserService iUserService;
|
|
|
- @Autowired
|
|
|
- private ITopSysTenantRegisterService iTopSysTenantRegisterService;
|
|
|
- @Autowired
|
|
|
- private ISysWebService webService;
|
|
|
- @Autowired
|
|
|
- private ISysConfigService configService;
|
|
|
- @Autowired
|
|
|
- private IDistributionCashWithdrawalService iDistributionCashWithdrawalService;
|
|
|
- @Autowired
|
|
|
- private IDistributionSellerService iDistributionSellerService;
|
|
|
- @Autowired
|
|
|
- private IDistributionActivityGoodsService iDistributionActivityGoodsService;
|
|
|
/**
|
|
|
* 通用下载请求
|
|
|
*
|
|
|
* @param fileName 文件名称
|
|
|
- * @param delete 是否删除
|
|
|
+ * @param delete 是否删除
|
|
|
*/
|
|
|
@GetMapping("common/download")
|
|
|
- public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- if (!FileUtils.checkAllowDownload(fileName))
|
|
|
- {
|
|
|
+ public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
|
|
+ try {
|
|
|
+ if (!FileUtils.checkAllowDownload(fileName)) {
|
|
|
throw new Exception(StrUtil.format("文件名称({})非法,不允许下载。 ", fileName));
|
|
|
}
|
|
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
|
|
@@ -149,9 +64,7 @@ public class CommonController extends BaseController
|
|
|
FileUtils.deleteFile(filePath);
|
|
|
}*/
|
|
|
FileUtils.deleteFile(filePath);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("下载文件失败", e);
|
|
|
}
|
|
|
}
|
|
|
@@ -160,10 +73,8 @@ public class CommonController extends BaseController
|
|
|
* 通用上传请求
|
|
|
*/
|
|
|
@PostMapping("/common/upload")
|
|
|
- public AjaxResult uploadFile(MultipartFile file) throws Exception
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
+ public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
|
|
+ try {
|
|
|
// 上传文件路径
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
// 上传并返回新文件名称
|
|
|
@@ -173,357 +84,95 @@ public class CommonController extends BaseController
|
|
|
ajax.put("fileName", fileName);
|
|
|
ajax.put("url", url);
|
|
|
return ajax;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
+ } catch (Exception e) {
|
|
|
return AjaxResult.error(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 本地资源通用下载
|
|
|
+ * 文件分片处理
|
|
|
*/
|
|
|
- @GetMapping("/common/download/resource")
|
|
|
- public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
|
|
- throws Exception
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- if (!FileUtils.checkAllowDownload(resource))
|
|
|
- {
|
|
|
- throw new Exception(StrUtil.format("资源文件({})非法,不允许下载。 ", resource));
|
|
|
- }
|
|
|
- // 本地资源路径
|
|
|
- String localPath = RuoYiConfig.getProfile();
|
|
|
- // 数据库资源地址
|
|
|
- String downloadPath = localPath + StrUtil.subAfter(resource, Constants.RESOURCE_PREFIX,false);
|
|
|
- // 下载名称
|
|
|
- String downloadName = StrUtil.subAfter(downloadPath, "/",true);
|
|
|
- response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
- FileUtils.setAttachmentResponseHeader(response, downloadName);
|
|
|
- FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- log.error("下载文件失败", e);
|
|
|
- }
|
|
|
+ @PostMapping("/common/decompression")
|
|
|
+ public AjaxResult<List<String>> uploadDecompression(MultipartFile file, String param) throws Exception {
|
|
|
+ String zhiyuan = System.getProperty("user.dir");
|
|
|
+ String path = zhiyuan + "/zhongzheng-admin/src/main/resources/fenpian";
|
|
|
+ FileHandleBo bo = JSONObject.parseObject(param, FileHandleBo.class);
|
|
|
+ String[] split = bo.getName().split("\\.");
|
|
|
+ String fileName = bo.getFileMd5() + "_" + bo.getIndex()+"."+ split[split.length - 1];
|
|
|
+ FileUploadUtils.uploadFragment(path, file, fileName);
|
|
|
+ File file2 = new File(path);
|
|
|
+ List<String> fileNameList = Arrays.stream(file2.listFiles()).map(File::getName).collect(Collectors.toList());
|
|
|
+ return AjaxResult.success(fileNameList);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("获取继教二建的商品结构列表")
|
|
|
- @GetMapping("common/jzs/goodsList")
|
|
|
- public AjaxResult<GoodsJzsVo> goodsList()
|
|
|
- {
|
|
|
- GoodsQueryBo queryBo = new GoodsQueryBo();
|
|
|
- List<SyncGoodsExport> goodsJzsVoList = iGoodsService.selectRjJzsList(queryBo);
|
|
|
- ExcelUtil<SyncGoodsExport> util = new ExcelUtil<SyncGoodsExport>(SyncGoodsExport.class);
|
|
|
- // ExcelUtil<SyncGoodsExport> util = new ExcelUtil<>(SyncGoodsExport.class);
|
|
|
- return util.exportEasyExcel(util.exportEasyData(goodsJzsVoList), "继建商品");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("测试列表")
|
|
|
- @PostMapping("common/jzs/test")
|
|
|
- public AjaxResult<Void> testList(@RequestBody UserPeriodEditBo bo)
|
|
|
- {
|
|
|
- UserPeriodEditBo queryBo = new UserPeriodEditBo();
|
|
|
- queryBo.setGoodsId(1085L);
|
|
|
- queryBo.setGradeId(978L);
|
|
|
- queryBo.setUserId(114L);
|
|
|
- iUserPeriodService.syncStudyLogToOld(bo);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("旧系统打回重审")
|
|
|
- @PostMapping("common/rollback/period")
|
|
|
- public AjaxResult<Void> rollbackPeriod(@RequestBody RollBackPeriodBo bo)
|
|
|
- {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- UserPeriodEditBo queryBo = new UserPeriodEditBo();
|
|
|
- queryBo.setRollBackPlat(2);
|
|
|
- queryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
- iUserPeriodService.confirmRollbackPeriod(queryBo);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("旧系统获取用户商品信息")
|
|
|
- @PostMapping("common/get/goods")
|
|
|
- public AjaxResult getUserGoodsList(@RequestBody UserGoodsListBo bo)
|
|
|
- {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- List<UserGoodsListVo> voList = iGoodsService.getUserGoodsList(bo);
|
|
|
-
|
|
|
- return AjaxResult.success(voList);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("旧系统获取商品学习中心路径")
|
|
|
- @PostMapping("common/get/goods/studyUrl")
|
|
|
- public AjaxResult getGoodsStudyUrl(@RequestBody GoodsStudyUrlBo bo)
|
|
|
- {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- String studyUrl = iGoodsService.getGoodsStudyUrl(bo);
|
|
|
- return AjaxResult.success(studyUrl);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("批量查询官方班级人数")
|
|
|
- @PostMapping("common/free/batch/officialGradeCount")
|
|
|
- public AjaxResult batchOfficialGradeCount(@RequestBody ClassGradeBatchQueryBo bo)
|
|
|
- {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- String[] list = bo.getOfficialNameStr().split(",");
|
|
|
- List<Map<String,Object>> numList = new ArrayList<>();
|
|
|
- for(String officialName : list){
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- ClassGradeQueryBo queryBo = new ClassGradeQueryBo();
|
|
|
- queryBo.setOfficialName(officialName);
|
|
|
- map.put("officialName",officialName);
|
|
|
- Integer num = iClassGradeService.queryOfficialGradeCount(queryBo);
|
|
|
- map.put("num",num);
|
|
|
- numList.add(map);
|
|
|
- }
|
|
|
- return AjaxResult.success(numList);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("查询官方班级详情")
|
|
|
- @PostMapping("common/free/officialGradeDetail")
|
|
|
- public AjaxResult officialGradeDetail(@RequestBody ClassNpUserInfoBo bo) {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- return AjaxResult.success(iClassGradeService.officialGradeDetail(bo));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("查询预开班官方班级编号")
|
|
|
- @PostMapping("common/free/officialGrade/num")
|
|
|
- public AjaxResult getOfficialGradeNum(@RequestBody ClassOfficialNumBo bo) {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- return AjaxResult.success(iClassGradeService.getOfficialGradeNum(bo));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("预报名班级开班")
|
|
|
- @PostMapping("common/free/open/class")
|
|
|
- public AjaxResult openOfficialGrade(@RequestBody ClassGradeOpenBo bo) {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
+ /**
|
|
|
+ * 文件分片处理
|
|
|
+ */
|
|
|
+ @PostMapping("/common/merge/file")
|
|
|
+ public AjaxResult uploadDecompression(@RequestBody FileHandleBo bo) throws Exception {
|
|
|
+ String zhiyuan = System.getProperty("user.dir");
|
|
|
+ String path = zhiyuan + "/zhongzheng-admin/src/main/resources/fenpian";
|
|
|
+ //全部上传完成 合并文件返回文件名称
|
|
|
+ String toPath = zhiyuan + "/zhongzheng-admin/src/main/resources/zhiyuan";
|
|
|
+ File file1 = new File(toPath);
|
|
|
+ if (!file1.exists()) {
|
|
|
+ file1.mkdirs();
|
|
|
+ }
|
|
|
+ File ToFile = new File(toPath + "/" + bo.getName());
|
|
|
+ if (ToFile.createNewFile()) {
|
|
|
+ FileUploadUtils.merge(bo.getFileMd5(), path, ToFile.getPath());
|
|
|
+ //校验文件MD5值
|
|
|
+ if (!bo.getFileMd5().equals(FileUtils.md5HashCode(ToFile.getPath()))) {
|
|
|
+ //文件不一致,删除文件
|
|
|
+ ToFile.delete();
|
|
|
+ //删除分片资源
|
|
|
+ FileUtils.deleteFilePackage(zhiyuan + "/zhongzheng-admin/src/main/resources/fenpian");
|
|
|
+ throw new CustomException("文件上传失败!请重新上传");
|
|
|
+ }
|
|
|
}
|
|
|
- iClassGradeService.openOfficialGrade(bo);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("测试分班")
|
|
|
- @GetMapping("common/jzs/grade")
|
|
|
- public AjaxResult<Void> testGrade()
|
|
|
- {
|
|
|
- // iClassGradeService.checkEjjjPeopleNumLimit(195L,984L);
|
|
|
- // iUserService.batchUpdateTelId();
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("获取商品分享码")
|
|
|
- @PostMapping("/shareGoodsCode")
|
|
|
- public AjaxResult getWxSmallAccessToken(@RequestBody WxShareGoodsBo bo)
|
|
|
- {
|
|
|
- String token = wxLoginService.shareGoodsCode(bo);
|
|
|
- return AjaxResult.success(token);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("推送分销商品")
|
|
|
- @PostMapping("/toshareGoods")
|
|
|
- public AjaxResult toshareGoods(@RequestBody WxShareGoodsBo bo)
|
|
|
- {
|
|
|
- String out_trade_no = "22110210122554298238";
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("order_sn", out_trade_no);
|
|
|
- List<OrderGoods> goodsList = iOrderGoodsService.listByMap(map);
|
|
|
- Order order = iOrderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, out_trade_no));
|
|
|
- iWxPayService.shareToOldSys(order,goodsList);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("创建新机构后台")
|
|
|
- @PostMapping("common/create/tenant/admin")
|
|
|
- public AjaxResult createTenantAdmin(@RequestBody SysTenantAdminBo bo) {
|
|
|
- iSysTenantService.createTenantAdmin(bo);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("创建新机构后台(旧系统)")
|
|
|
- @PostMapping("common/create/tenant/admin/old")
|
|
|
- public AjaxResult createTenantAdminOld(@RequestBody SysTenantAdminOldBo bo) {
|
|
|
- iSysTenantService.createTenantAdminOld(bo);
|
|
|
+ //删除分片资源
|
|
|
+ FileUtils.deleteFilePackage(zhiyuan + "/zhongzheng-admin/src/main/resources/fenpian");
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("同步其他机构角色菜单")
|
|
|
- @PostMapping("common/update/role")
|
|
|
- public AjaxResult updateRoleTenant(@RequestBody List<Long> tenantIds) {
|
|
|
- iSysTenantService.updateRoleTenant(tenantIds);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("同步其他机构字典")
|
|
|
- @PostMapping("common/update/dict")
|
|
|
- public AjaxResult updateDictTenant(@RequestBody List<Long> tenantIds) {
|
|
|
- iSysTenantService.updateDictTenant(tenantIds);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("获取企业列表")
|
|
|
- @GetMapping("common/tenant/list")
|
|
|
- public AjaxResult<List<SysTenantVo>> getTenantList() {
|
|
|
- String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
- List<SysTenant> list = iSysTenantService.list();
|
|
|
- if (CollectionUtils.isEmpty(list)){
|
|
|
- return AjaxResult.success(new ArrayList<>());
|
|
|
- }
|
|
|
- List<SysTenantVo> collect = list.stream().filter(x -> !x.getTenantId().equals(Long.valueOf(tenant)))
|
|
|
- .map(item -> BeanUtil.toBean(item, SysTenantVo.class)).collect(Collectors.toList());
|
|
|
- return AjaxResult.success(collect);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("机构注册开通")
|
|
|
- @PostMapping("common/free/tenant/register")
|
|
|
- public AjaxResult tenantRegister(@RequestBody TopSysTenantRegisterAddBo bo) {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- return AjaxResult.success("成功",iTopSysTenantRegisterService.insertByAddBo(bo) ? 1 : 0);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("重启服务restart")
|
|
|
- @PostMapping("common/free/webRestart")
|
|
|
- public AjaxResult<Void> webRestart(@RequestBody ConfigQueryBo bo) {
|
|
|
- if(!ToolsUtils.checkSignFromOldSys(bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
+ @PostMapping("/common/delete/file")
|
|
|
+ public AjaxResult deleteDecompression(@RequestBody FileHandleBo bo) throws Exception {
|
|
|
+ //删除合并文件
|
|
|
+ String zhiyuan = System.getProperty("user.dir");
|
|
|
+ String toPath = zhiyuan + "/zhongzheng-admin/src/main/resources/zhiyuan";
|
|
|
+ File file = new File(toPath);
|
|
|
+ List<File> files = Arrays.stream(file.listFiles()).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(files)){
|
|
|
+ files.stream().filter(item -> item.getName().equals(bo.getName())).forEach(x -> {
|
|
|
+ x.delete();
|
|
|
+ });
|
|
|
}
|
|
|
- webService.restartWebService();
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
- /* @ApiOperation("nginx配置")
|
|
|
- @PostMapping("common/free/configNginxFile")
|
|
|
- public AjaxResult<Void> configNginxFile(@RequestBody SysNginxConfigAddBo bo) {
|
|
|
- iTopSysTenantRegisterService.test(new TopSysTenantRegisterAddBo());
|
|
|
- return AjaxResult.success();
|
|
|
- }*/
|
|
|
-
|
|
|
- @ApiOperation("登录双重验证")
|
|
|
- @GetMapping("common/free/dual_auth")
|
|
|
- public AjaxResult<String> dual_auth() {
|
|
|
- String dualAuth = configService.selectConfigByKey("login.dual.auth");
|
|
|
- return AjaxResult.success("成功",dualAuth);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("decodeTel")
|
|
|
- @GetMapping("common/free/decodeTel")
|
|
|
- public AjaxResult<String> decodeTel(String key) {
|
|
|
- return AjaxResult.success("成功", EncryptHandler.decrypt(key));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("分销打款结果回调")
|
|
|
- @PreAuthorize("@ss.hasPermi('system:withdrawal:add')")
|
|
|
- @Log(title = "打款", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping("/common/free/payCashCallBack")
|
|
|
- public AjaxResult payCashCallBack(@RequestBody DistributionCashWithdrawalPayBo bo) {
|
|
|
- if(!ToolsUtils.checkSignCwSnFromOldSys(bo.getCwSn(),bo.getStamp().toString(),bo.getSign())){
|
|
|
- return AjaxResult.error("签名错误");
|
|
|
- }
|
|
|
- return AjaxResult.success("成功", iDistributionCashWithdrawalService.payCashCallBack(bo) ? 1 : 0);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
- * 获取企业ID
|
|
|
+ * 本地资源通用下载
|
|
|
*/
|
|
|
- @ApiOperation("获取企业ID")
|
|
|
- @GetMapping("common/free/findTenantId")
|
|
|
- public AjaxResult<String> findTenantId(SysTenantQueryBo bo) {
|
|
|
- Long tenantId = iSysTenantService.findTenantId(bo);
|
|
|
- if(Validator.isNotEmpty(tenantId)){
|
|
|
- return AjaxResult.success("成功",tenantId.toString());
|
|
|
- }else{
|
|
|
- if(Validator.isNotEmpty(bo.getHostH5())&&bo.getHostH5().equals("120.79.166.78:19012")){
|
|
|
- return AjaxResult.success("成功","867735392558919680");
|
|
|
- }
|
|
|
- if(Validator.isNotEmpty(bo.getHostLive())&&bo.getHostLive().equals("120.79.166.78:19012")){
|
|
|
- return AjaxResult.success("成功","867735392558919680");
|
|
|
- }
|
|
|
- if(Validator.isNotEmpty(bo.getHostPc())&&bo.getHostPc().equals("120.79.166.78:19012")){
|
|
|
- return AjaxResult.success("成功","867735392558919680");
|
|
|
- }
|
|
|
- if(Validator.isNotEmpty(bo.getHostAdmin())&&bo.getHostAdmin().equals("120.79.166.78:19012")){
|
|
|
- return AjaxResult.success("成功","867735392558919680");
|
|
|
- }
|
|
|
- if(Validator.isNotEmpty(bo.getHostH5Seller())&&bo.getHostH5Seller().equals("120.79.166.78:19012")){
|
|
|
- return AjaxResult.success("成功","867735392558919680");
|
|
|
+ @GetMapping("/common/download/resource")
|
|
|
+ public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
|
|
+ throws Exception {
|
|
|
+ try {
|
|
|
+ if (!FileUtils.checkAllowDownload(resource)) {
|
|
|
+ throw new Exception(StrUtil.format("资源文件({})非法,不允许下载。 ", resource));
|
|
|
}
|
|
|
- return AjaxResult.error(511,"失败",null);
|
|
|
+ // 本地资源路径
|
|
|
+ String localPath = RuoYiConfig.getProfile();
|
|
|
+ // 数据库资源地址
|
|
|
+ String downloadPath = localPath + StrUtil.subAfter(resource, Constants.RESOURCE_PREFIX, false);
|
|
|
+ // 下载名称
|
|
|
+ String downloadName = StrUtil.subAfter(downloadPath, "/", true);
|
|
|
+ response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
+ FileUtils.setAttachmentResponseHeader(response, downloadName);
|
|
|
+ FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("下载文件失败", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取企业ID
|
|
|
- */
|
|
|
- @ApiOperation("获取系统配置")
|
|
|
- @GetMapping("common/free/config")
|
|
|
- public AjaxResult<Map<String,Object>> findConfig(SysTenantQueryBo bo) {
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- String jsonStr = configService.selectConfigByKey("home.header");
|
|
|
- JSONObject objectJson = JSON.parseObject(jsonStr);
|
|
|
- map.put("companyName",String.valueOf(objectJson.get("companyName")));
|
|
|
- return AjaxResult.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("获取微信参数")
|
|
|
- @GetMapping("app/common/wx/config")
|
|
|
- public AjaxResult<Map<String,Object>> wxConfig() {
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- String smallAppId = configService.selectConfigByKey("wx.small.appid");
|
|
|
- String gzhAppId = configService.selectConfigByKey("wx.gzh.appid");
|
|
|
- map.put("smallAppId",smallAppId);
|
|
|
- map.put("gzhAppId",gzhAppId);
|
|
|
- return AjaxResult.success(map);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("移动端配置参数")
|
|
|
- @GetMapping("app/common/mobileConfig")
|
|
|
- public AjaxResult<Map<String,Object>> mobileConfig(ConfigQueryBo bo) {
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- String json = configService.selectConfigByKey("home.mobile");
|
|
|
- map.put("mobileConfig",json);
|
|
|
- return AjaxResult.success(map);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("通过分享code查询业务员用户信息")
|
|
|
- @GetMapping("app/common/distribution/getInfoByShareCode")
|
|
|
- public AjaxResult<DistributionSellerVo> getInfoByShareCode(String shareCode)
|
|
|
- {
|
|
|
- DistributionSellerVo vo = iDistributionSellerService.queryByShareCode(shareCode);
|
|
|
- vo.setNull();
|
|
|
- String jsonStr = configService.selectConfigByKey("home.header");
|
|
|
- JSONObject objectJson = JSON.parseObject(jsonStr);
|
|
|
- vo.setTenantName(String.valueOf(objectJson.get("companyName")));
|
|
|
- return AjaxResult.success(vo);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("获取分销活动商品列表")
|
|
|
- @GetMapping("app/common/distribution/getGoodsList")
|
|
|
- public TableDataInfo<ActivityGoodsPriceVo> distributionGoodsList(DistributionActivityGoodsQueryBo bo)
|
|
|
- {
|
|
|
- startPage();
|
|
|
- List<ActivityGoodsPriceVo> list = iDistributionActivityGoodsService.getGoodsList(bo);
|
|
|
- return getDataTable(list);
|
|
|
- }
|
|
|
}
|