diff --git a/laws-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java b/laws-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java index 11beae92..d1dab0ea 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/controller/OnlCgformCollectionController.java @@ -1,171 +1,171 @@ -package com.jero.modules.collection.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.common.system.base.controller.JeroController; -import com.jero.modules.collection.entity.OnlCgformCollection; -import com.jero.modules.collection.service.IOnlCgformCollectionService; -import com.jero.modules.document.controller.BussDocumentLibraryEOController; -import com.jero.modules.phone.service.ISearchCenterService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -@Api(tags="我的收藏") -@RestController -@RequestMapping("/collection/onlCgformCollection") -@Slf4j -public class OnlCgformCollectionController extends JeroController { - @Autowired - private IOnlCgformCollectionService onlCgformCollectionService; - @Autowired - BussDocumentLibraryEOController bussDocumentLibraryEOService; - @Autowired - private ISearchCenterService searchCenterService; - - /** - * 分页列表查询 - * - * @param params - * @return - */ - @AutoLog(value = "我的收藏-分页列表查询") - @ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询") - @PostMapping(value = "/page") - public Result queryPageList(@RequestBody Map params){ - IPage pageList = onlCgformCollectionService.queryPageList(params); - return Result.OK(pageList); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "我的收藏-列表查询") - @ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询") - @GetMapping(value = "/list") - public Result> queryList(OnlCgformCollection onlCgformCollection) { - List list = onlCgformCollectionService.queryList(onlCgformCollection); - return Result.OK(list); - } - - /** - * 添加 - * - * @param onlCgformCollection - * @return - */ - @AutoLog(value = "我的收藏-添加") - @ApiOperation(value="我的收藏-添加", notes="我的收藏-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) { - LambdaQueryWrapper lambdaQueryWrapper= new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId()) - .eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId()); - int count=onlCgformCollectionService.count(lambdaQueryWrapper); - if(count==0){ - onlCgformCollectionService.add(onlCgformCollection); - return Result.OK("添加成功!"); - } - else{ - return Result.error("该值不可重复添加,系统中已存在!"); - } - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "我的收藏-通过id删除") - @ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除") - @PostMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - onlCgformCollectionService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "我的收藏-批量删除") - @ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除") - @PostMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.onlCgformCollectionService.deleteByIds(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) { - OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id); - if(onlCgformCollection==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(onlCgformCollection); - } - - /** - * 表头中英文切换 - * - * @return - */ - @AutoLog(value = "我的收藏-表头中英文切换") - @ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换") - @GetMapping(value = "/getHeader") - public Result>> getHeader(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list =onlCgformCollectionService.getHeader(flag, cut); - return Result.OK(list); - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @AutoLog(value = "我的收藏-查询条件中英文切换") - @ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换") - @GetMapping(value = "/queryCondition") - public Result>> queryCondition(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = onlCgformCollectionService.queryCondition(flag, cut); - return Result.OK(list); - } - - @AutoLog(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息") - @ApiOperation(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息", notes = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息") - @GetMapping(value = "/getWdkCollectAndSubscribeInfoByUser") - public Result> getWdkCollectAndSubscribeInfoByUser(@RequestParam Map params) { - return this.searchCenterService.getWdkCollectAndSubscribeInfoByUser(params); - } -} +//package com.jero.modules.collection.controller; +// +//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.common.system.base.controller.JeroController; +//import com.jero.modules.collection.entity.OnlCgformCollection; +//import com.jero.modules.collection.service.IOnlCgformCollectionService; +//import com.jero.modules.document.controller.BussDocumentLibraryEOController; +//import com.jero.modules.phone.service.ISearchCenterService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.validation.annotation.Validated; +//import org.springframework.web.bind.annotation.*; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.Map; +// +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//@Api(tags="我的收藏") +//@RestController +//@RequestMapping("/collection/onlCgformCollection") +//@Slf4j +//public class OnlCgformCollectionController extends JeroController { +// @Autowired +// private IOnlCgformCollectionService onlCgformCollectionService; +// @Autowired +// BussDocumentLibraryEOController bussDocumentLibraryEOService; +// @Autowired +// private ISearchCenterService searchCenterService; +// +// /** +// * 分页列表查询 +// * +// * @param params +// * @return +// */ +// @AutoLog(value = "我的收藏-分页列表查询") +// @ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询") +// @PostMapping(value = "/page") +// public Result queryPageList(@RequestBody Map params){ +// IPage pageList = onlCgformCollectionService.queryPageList(params); +// return Result.OK(pageList); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-列表查询") +// @ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList(OnlCgformCollection onlCgformCollection) { +// List list = onlCgformCollectionService.queryList(onlCgformCollection); +// return Result.OK(list); +// } +// +// /** +// * 添加 +// * +// * @param onlCgformCollection +// * @return +// */ +// @AutoLog(value = "我的收藏-添加") +// @ApiOperation(value="我的收藏-添加", notes="我的收藏-添加") +// @PostMapping(value = "/add") +// public Result add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) { +// LambdaQueryWrapper lambdaQueryWrapper= new LambdaQueryWrapper<>(); +// lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId()) +// .eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId()); +// int count=onlCgformCollectionService.count(lambdaQueryWrapper); +// if(count==0){ +// onlCgformCollectionService.add(onlCgformCollection); +// return Result.OK("添加成功!"); +// } +// else{ +// return Result.error("该值不可重复添加,系统中已存在!"); +// } +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "我的收藏-通过id删除") +// @ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除") +// @PostMapping(value = "/delete") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// onlCgformCollectionService.deleteById(id); +// return Result.OK("删除成功!"); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "我的收藏-批量删除") +// @ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除") +// @PostMapping(value = "/deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { +// this.onlCgformCollectionService.deleteByIds(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) { +// OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id); +// if(onlCgformCollection==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(onlCgformCollection); +// } +// +// /** +// * 表头中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-表头中英文切换") +// @ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换") +// @GetMapping(value = "/getHeader") +// public Result>> getHeader(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list =onlCgformCollectionService.getHeader(flag, cut); +// return Result.OK(list); +// } +// +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-查询条件中英文切换") +// @ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换") +// @GetMapping(value = "/queryCondition") +// public Result>> queryCondition(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = onlCgformCollectionService.queryCondition(flag, cut); +// return Result.OK(list); +// } +// +// @AutoLog(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息") +// @ApiOperation(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息", notes = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息") +// @GetMapping(value = "/getWdkCollectAndSubscribeInfoByUser") +// public Result> getWdkCollectAndSubscribeInfoByUser(@RequestParam Map params) { +// return this.searchCenterService.getWdkCollectAndSubscribeInfoByUser(params); +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/collection/controller/PhoneOnlCgformCollectionController.java b/laws-modules/src/main/java/com/jero/modules/collection/controller/PhoneOnlCgformCollectionController.java index 88756680..8bd6be01 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/controller/PhoneOnlCgformCollectionController.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/controller/PhoneOnlCgformCollectionController.java @@ -1,161 +1,161 @@ -package com.jero.modules.collection.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.common.system.base.controller.JeroController; -import com.jero.modules.collection.entity.OnlCgformCollection; -import com.jero.modules.collection.service.IOnlCgformCollectionService; -import com.jero.modules.document.controller.BussDocumentLibraryEOController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -@Api(tags="我的收藏") -@RestController -@RequestMapping("/phone/collection/onlCgformCollection") -@Slf4j -public class PhoneOnlCgformCollectionController extends JeroController { - @Autowired - private IOnlCgformCollectionService onlCgformCollectionService; - @Autowired - BussDocumentLibraryEOController bussDocumentLibraryEOService; - - /** - * 分页列表查询 - * - * @param params - * @return - */ - @AutoLog(value = "我的收藏-分页列表查询") - @ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询") - @PostMapping(value = "/page") - public Result queryPageList(@RequestBody Map params){ - IPage pageList = onlCgformCollectionService.queryPageList(params); - return Result.OK(pageList); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "我的收藏-列表查询") - @ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询") - @GetMapping(value = "/list") - public Result> queryList(OnlCgformCollection onlCgformCollection) { - List list = onlCgformCollectionService.queryList(onlCgformCollection); - return Result.OK(list); - } - - /** - * 添加 - * - * @param onlCgformCollection - * @return - */ - @AutoLog(value = "我的收藏-添加") - @ApiOperation(value="我的收藏-添加", notes="我的收藏-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) { - LambdaQueryWrapper lambdaQueryWrapper= new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId()) - .eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId()); - int count=onlCgformCollectionService.count(lambdaQueryWrapper); - if(count==0){ - onlCgformCollectionService.add(onlCgformCollection); - return Result.OK("添加成功!"); - } - else{ - return Result.error("该值不可重复添加,系统中已存在!"); - } - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "我的收藏-通过id删除") - @ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除") - @PostMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - onlCgformCollectionService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "我的收藏-批量删除") - @ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除") - @PostMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.onlCgformCollectionService.deleteByIds(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) { - OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id); - if(onlCgformCollection==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(onlCgformCollection); - } - - /** - * 表头中英文切换 - * - * @return - */ - @AutoLog(value = "我的收藏-表头中英文切换") - @ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换") - @GetMapping(value = "/getHeader") - public Result>> getHeader(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list =onlCgformCollectionService.getHeader(flag, cut); - return Result.OK(list); - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @AutoLog(value = "我的收藏-查询条件中英文切换") - @ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换") - @GetMapping(value = "/queryCondition") - public Result>> queryCondition(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = onlCgformCollectionService.queryCondition(flag, cut); - return Result.OK(list); - } -} +//package com.jero.modules.collection.controller; +// +//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.common.system.base.controller.JeroController; +//import com.jero.modules.collection.entity.OnlCgformCollection; +//import com.jero.modules.collection.service.IOnlCgformCollectionService; +//import com.jero.modules.document.controller.BussDocumentLibraryEOController; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.validation.annotation.Validated; +//import org.springframework.web.bind.annotation.*; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.Map; +// +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//@Api(tags="我的收藏") +//@RestController +//@RequestMapping("/phone/collection/onlCgformCollection") +//@Slf4j +//public class PhoneOnlCgformCollectionController extends JeroController { +// @Autowired +// private IOnlCgformCollectionService onlCgformCollectionService; +// @Autowired +// BussDocumentLibraryEOController bussDocumentLibraryEOService; +// +// /** +// * 分页列表查询 +// * +// * @param params +// * @return +// */ +// @AutoLog(value = "我的收藏-分页列表查询") +// @ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询") +// @PostMapping(value = "/page") +// public Result queryPageList(@RequestBody Map params){ +// IPage pageList = onlCgformCollectionService.queryPageList(params); +// return Result.OK(pageList); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-列表查询") +// @ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList(OnlCgformCollection onlCgformCollection) { +// List list = onlCgformCollectionService.queryList(onlCgformCollection); +// return Result.OK(list); +// } +// +// /** +// * 添加 +// * +// * @param onlCgformCollection +// * @return +// */ +// @AutoLog(value = "我的收藏-添加") +// @ApiOperation(value="我的收藏-添加", notes="我的收藏-添加") +// @PostMapping(value = "/add") +// public Result add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) { +// LambdaQueryWrapper lambdaQueryWrapper= new LambdaQueryWrapper<>(); +// lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId()) +// .eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId()); +// int count=onlCgformCollectionService.count(lambdaQueryWrapper); +// if(count==0){ +// onlCgformCollectionService.add(onlCgformCollection); +// return Result.OK("添加成功!"); +// } +// else{ +// return Result.error("该值不可重复添加,系统中已存在!"); +// } +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "我的收藏-通过id删除") +// @ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除") +// @PostMapping(value = "/delete") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// onlCgformCollectionService.deleteById(id); +// return Result.OK("删除成功!"); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "我的收藏-批量删除") +// @ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除") +// @PostMapping(value = "/deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { +// this.onlCgformCollectionService.deleteByIds(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) { +// OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id); +// if(onlCgformCollection==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(onlCgformCollection); +// } +// +// /** +// * 表头中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-表头中英文切换") +// @ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换") +// @GetMapping(value = "/getHeader") +// public Result>> getHeader(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list =onlCgformCollectionService.getHeader(flag, cut); +// return Result.OK(list); +// } +// +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "我的收藏-查询条件中英文切换") +// @ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换") +// @GetMapping(value = "/queryCondition") +// public Result>> queryCondition(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = onlCgformCollectionService.queryCondition(flag, cut); +// return Result.OK(list); +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java b/laws-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java index d424e5a5..d6609133 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/entity/OnlCgformCollection.java @@ -1,67 +1,67 @@ -package com.jero.modules.collection.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.jero.common.aspect.annotation.Dict; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; - - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -@Data -@TableName("onl_cgform_collection") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="onl_cgform_collection对象", description="我的收藏") -public class OnlCgformCollection implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**收藏人*/ - @ApiModelProperty(value = "收藏人") - private String createBy; - - /**收藏日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "收藏日期") - private java.util.Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private java.util.Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**文档库id*/ - @Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id") - @Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id") - @ApiModelProperty(value = "文档库id") - private String documentId; -} +//package com.jero.modules.collection.entity; +// +//import com.baomidou.mybatisplus.annotation.IdType; +//import com.baomidou.mybatisplus.annotation.TableId; +//import com.baomidou.mybatisplus.annotation.TableName; +//import com.fasterxml.jackson.annotation.JsonFormat; +//import com.jero.common.aspect.annotation.Dict; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +//import lombok.experimental.Accessors; +//import org.jeecgframework.poi.excel.annotation.Excel; +//import org.springframework.format.annotation.DateTimeFormat; +// +//import java.io.Serializable; +// +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//@Data +//@TableName("onl_cgform_collection") +//@Accessors(chain = true) +//@EqualsAndHashCode(callSuper = false) +//@ApiModel(value="onl_cgform_collection对象", description="我的收藏") +//public class OnlCgformCollection implements Serializable { +// private static final long serialVersionUID = 1L; +// +// /**主键*/ +// @TableId(type = IdType.ASSIGN_ID) +// @ApiModelProperty(value = "主键") +// private String id; +// +// /**收藏人*/ +// @ApiModelProperty(value = "收藏人") +// private String createBy; +// +// /**收藏日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "收藏日期") +// private java.util.Date createTime; +// +// /**更新人*/ +// @ApiModelProperty(value = "更新人") +// private String updateBy; +// +// /**更新日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "更新日期") +// private java.util.Date updateTime; +// +// /**所属部门*/ +// @ApiModelProperty(value = "所属部门") +// private String sysOrgCode; +// +// /**文档库id*/ +// @Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id") +// @Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id") +// @ApiModelProperty(value = "文档库id") +// private String documentId; +//} diff --git a/laws-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java b/laws-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java index ff3a85cc..0afd6e19 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/mapper/OnlCgformCollectionMapper.java @@ -1,27 +1,27 @@ -package com.jero.modules.collection.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.jero.modules.collection.entity.OnlCgformCollection; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -import java.util.List; -import java.util.Map; - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -public interface OnlCgformCollectionMapper extends BaseMapper { - - @Select("select * from buss_document_library as document LEFT JOIN onl_cgform_collection as collection\n" + - " on document.id= collection.document_id;") - List queryListByDocumentId(@Param("document_id") String document_id); - - IPage queryPageList(IPage page,@Param("params") Map params); - - List> infoList(@Param("params") Map params); -} +//package com.jero.modules.collection.mapper; +// +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.jero.modules.collection.entity.OnlCgformCollection; +//import org.apache.ibatis.annotations.Param; +//import org.apache.ibatis.annotations.Select; +// +//import java.util.List; +//import java.util.Map; +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//public interface OnlCgformCollectionMapper extends BaseMapper { +// +// @Select("select * from buss_document_library as document LEFT JOIN onl_cgform_collection as collection\n" + +// " on document.id= collection.document_id;") +// List queryListByDocumentId(@Param("document_id") String document_id); +// +// IPage queryPageList(IPage page,@Param("params") Map params); +// +// List> infoList(@Param("params") Map params); +//} diff --git a/laws-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml b/laws-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml deleted file mode 100644 index 2cca02b0..00000000 --- a/laws-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/laws-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java b/laws-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java index 4c4898c2..c942873e 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/service/IOnlCgformCollectionService.java @@ -1,79 +1,79 @@ -package com.jero.modules.collection.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.modules.collection.entity.OnlCgformCollection; - -import java.util.List; -import java.util.Map; - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -public interface IOnlCgformCollectionService extends IService { - - /** - * 保存 - * - * @param onlCgformCollection - * @return - */ - void add(OnlCgformCollection onlCgformCollection); - - /** - * 通过id删除 - * - * @param id - * @return - */ - void deleteById(String id); - - /** - * 批量删除 - * - * @param ids - * @return - */ - void deleteByIds(List ids); - - /** - * 通过id查询 - * - * @param id - * @return - */ - OnlCgformCollection queryById(String id); - - /** - * 列表查询 - * - * @return - */ - List queryList(OnlCgformCollection onlCgformCollection); - - /** - * 列表表头中英文切换 - * @param flag - * @param cut - * @return - */ - public List> getHeader(String flag, String cut); - - /** - * 查询条件中英文切换 - * @param flag - * @param cut - * @return - */ - public List> queryCondition(String flag, String cut); - - /** - * 分页查询 - * @param params - * @return - */ - IPage queryPageList(Map params); -} +//package com.jero.modules.collection.service; +// +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.baomidou.mybatisplus.extension.service.IService; +//import com.jero.modules.collection.entity.OnlCgformCollection; +// +//import java.util.List; +//import java.util.Map; +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//public interface IOnlCgformCollectionService extends IService { +// +// /** +// * 保存 +// * +// * @param onlCgformCollection +// * @return +// */ +// void add(OnlCgformCollection onlCgformCollection); +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// void deleteById(String id); +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// void deleteByIds(List ids); +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// OnlCgformCollection queryById(String id); +// +// /** +// * 列表查询 +// * +// * @return +// */ +// List queryList(OnlCgformCollection onlCgformCollection); +// +// /** +// * 列表表头中英文切换 +// * @param flag +// * @param cut +// * @return +// */ +// public List> getHeader(String flag, String cut); +// +// /** +// * 查询条件中英文切换 +// * @param flag +// * @param cut +// * @return +// */ +// public List> queryCondition(String flag, String cut); +// +// /** +// * 分页查询 +// * @param params +// * @return +// */ +// IPage queryPageList(Map params); +//} diff --git a/laws-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java index b2d97aa9..b0273215 100644 --- a/laws-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java @@ -1,372 +1,372 @@ -package com.jero.modules.collection.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.common.constant.enums.LanguageEnum; -import com.jero.common.constant.enums.YesOrNoEnum; -import com.jero.common.exception.JeroBootException; -import com.jero.common.system.vo.LoginUser; -import com.jero.generater.modules.online.cgform.entity.OnlCgformField; -import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; -import com.jero.modules.collection.entity.OnlCgformCollection; -import com.jero.modules.collection.mapper.OnlCgformCollectionMapper; -import com.jero.modules.collection.service.IOnlCgformCollectionService; -import com.jero.modules.document.enums.LawsStateEnum; -import com.jero.modules.ocr.util.LineHumpUtil; -import com.jero.modules.system.entity.SysDictItem; -import com.jero.modules.system.service.impl.SysDictItemServiceImpl; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Description: 我的收藏 - * @Author: jero-boot - * @Date: 2022-02-15 - * @Version: V1.0 - */ -@Service -public class OnlCgformCollectionServiceImpl extends ServiceImpl implements IOnlCgformCollectionService { - @Autowired - private OnlCgformFieldServiceImpl onlCgformFieldService; - @Autowired - OnlCgformCollectionMapper onlCgformCollectionMapper; - @Autowired - private SysDictItemServiceImpl sysDictItemServiceImpl; - - /** - * 保存 - * - * @param onlCgformCollection - * @return - */ - @Override - public void add(OnlCgformCollection onlCgformCollection) { - Date now = new Date(); - onlCgformCollection.setCreateTime(now); - save(onlCgformCollection); - } - - - /** - * 通过id删除 - * - * @param id - * @return - */ - @Override - @Transactional - public void deleteById(String id) { - boolean checkData = checkData(id); - if(!checkData){ - throw new JeroBootException("该用户没有权限!"); - } - try { - OnlCgformCollection onlCgformCollection = super.baseMapper.selectById(id); - List documentIdList = new ArrayList<>(); - documentIdList.add(onlCgformCollection.getDocumentId()); - - //删除订阅 - //deleteSubscribe(documentIdList); - - removeById(id); - }catch (Exception ex){ - log.error("取消收藏失败:" + ex.getMessage()); - throw new JeroBootException("取消收藏失败!"); - } - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @Override - @Transactional - public void deleteByIds(List ids) { - for (String id : ids) { - boolean checkData = checkData(id); - if(!checkData){ - throw new JeroBootException("该用户没有权限!"); - } - } - try { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().in(OnlCgformCollection::getId,ids); - List onlCgformCollections = super.baseMapper.selectList(queryWrapper); - List documentIdList = onlCgformCollections.stream().map(OnlCgformCollection::getDocumentId).distinct().collect(Collectors.toList()); - - //删除订阅 - //deleteSubscribe(documentIdList); - - removeByIds(ids); - }catch (Exception ex){ - log.error("批量取消收藏失败:" + ex.getMessage()); - throw new JeroBootException("批量取消收藏失败!"); - } - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @Override - public OnlCgformCollection queryById(String id) { - boolean checkData = checkData(id); - if(!checkData){ - throw new JeroBootException("该用户没有权限!"); - } - return getById(id); - } - - /** - * 列表查询 - * - * @return - */ - @Override - public List queryList(OnlCgformCollection onlCgformCollection) { - List list = onlCgformCollectionMapper.queryListByDocumentId(onlCgformCollection.getDocumentId()); - return list; - } - - /** - * 列表表头中英文切换 - * - * @return - */ - @Override - public List> getHeader(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是) 过滤出需要的表头字段 - fieldList = fieldList.stream().filter( - e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList())) - && ( - e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title") - ||e.getDbFieldEnName().equals("state") - ) - ).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - if ("file_name".equals(onlCgformField.getDbFieldName())) { - //跳转详情的标识 - map.put("click", "true"); - } - //单独处理发布日期和标准实施日期 - if ("update_time".equals(onlCgformField.getDbFieldName())) { - map.put("sort", "true");//列表排序标识 - } - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @Override - public List> queryCondition(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤出需要的搜索条件() - fieldList = fieldList.stream().filter( - e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery())) - && ( - e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title") - ||e.getDbFieldEnName().equals("state") - ) - ).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) - map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - @Override - public IPage queryPageList(Map params) { -// params.put("orderByField","serial_number"); -// params.put("orderBy","1"); - if(ObjectUtils.isEmpty(params.get("orderByField"))){ - params.put("orderBy",""); - } - Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); - Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); - IPage page = new Page(pageNo, pageSize); - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - params.put("createBy",sysUser.getUsername()); - IPage result = new Page(); - //表头排序(状态单独处理) - if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){ - List> infoList = onlCgformCollectionMapper.infoList(params); - result = stateSort(params,pageNo,pageSize,result,infoList); - }else{ - result = onlCgformCollectionMapper.queryPageList(page,params); - } - List> records = result.getRecords(); - dataDispose(records,params); - return result; - } - public IPage stateSort(Map parameter, int pageNo, int pageSize, IPage infoPage,List> infoList) { - List> list = new LinkedList<>(); - //状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止 - if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals((String) parameter.get("orderByField"))){ - List> active = infoList.stream() - .filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> theUpcoming = infoList.stream() - .filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> draft = infoList.stream() - .filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> beReplaced = infoList.stream() - .filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> abolish = infoList.stream() - .filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList()); - if ("1".equals((String) parameter.get("orderBy"))) { - //正序 - list.addAll(active); - list.addAll(theUpcoming); - list.addAll(draft); - list.addAll(beReplaced); - list.addAll(abolish); - - } else if ("2".equals((String) parameter.get("orderBy"))) { - //倒序 - list.addAll(abolish); - list.addAll(beReplaced); - list.addAll(draft); - list.addAll(theUpcoming); - list.addAll(active); - } - if(ObjectUtils.isNotEmpty(list)){ - infoPage = getPages(pageNo, pageSize, list); - } - } - return infoPage; - } - public IPage getPages(Integer currentPage, Integer pageSize, List> list){ - IPage page =new Page(); - if(list==null){ - return null; - } - int size = list.size(); - if(pageSize > size){ - pageSize = size; - } - if(pageSize!=0){ - //求出最⼤页数,防⽌currentPage越界 - int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1; - if(currentPage > maxPage){ - currentPage = maxPage; - } - } - //当前页第⼀条数据的下标 - int curIdx = currentPage >1?(currentPage -1)* pageSize :0; - List pageList =new ArrayList(); - //将当前页的数据放进pageList - for(int i =0; i < pageSize && curIdx + i < size; i++){ - pageList.add(list.get(curIdx + i)); - } - page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList); - return page; - } - - public void dataDispose(List> datas, Map params){ - if(CollectionUtils.isNotEmpty(datas)){ - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //获取所有文本状态数据字典 - List stateList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state")) - .collect(Collectors.toList()); - SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); - - String cut = (String) params.get("cut"); - for (Map data : datas) { - Date createTime = (Date) data.get("createTime"); - data.put("createTime",sdf.format(createTime)); - String state = (String) data.get("state"); - for (SysDictItem sysDictItem : stateList) { - if(StringUtils.equals(state,sysDictItem.getItemValue())){ - if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ - data.put("state",sysDictItem.getItemText()); - }else { - data.put("state",sysDictItem.getEnName()); - } - break; - } - } - //设置为已收藏 - data.put("collectFlag","1"); - } - } - } - - /** - * 验证数据 - * @param id - * @return - */ - public boolean checkData(String id){ - boolean result = false; - try { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(OnlCgformCollection::getId,id); - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - queryWrapper.lambda().eq(OnlCgformCollection::getCreateBy,sysUser.getUsername()); - Integer integer = onlCgformCollectionMapper.selectCount(queryWrapper); - if(integer>0){ - result = true; - } - }catch (Exception ex){ - log.error("验证我的收藏数据异常:" + ex.getMessage()); - throw new JeroBootException("验证我的收藏数据异常!"); - } - return result; - } - - /*public void deleteSubscribe(List docIdList){ - try { - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - QueryWrapper deleteWarpper = new QueryWrapper<>(); - deleteWarpper.lambda().in(OnlCgformSubscribe::getDocumentId,docIdList); - deleteWarpper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername()); - onlCgformSubscribeMapper.delete(deleteWarpper); - }catch (Exception ex){ - log.error("删除订阅信息失败:" + ex.getMessage()); - throw new JeroBootException("删除订阅信息失败!"); - } - }*/ -} +//package com.jero.modules.collection.service.impl; +// +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import com.jero.common.constant.enums.LanguageEnum; +//import com.jero.common.constant.enums.YesOrNoEnum; +//import com.jero.common.exception.JeroBootException; +//import com.jero.common.system.vo.LoginUser; +//import com.jero.generater.modules.online.cgform.entity.OnlCgformField; +//import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; +//import com.jero.modules.collection.entity.OnlCgformCollection; +//import com.jero.modules.collection.mapper.OnlCgformCollectionMapper; +//import com.jero.modules.collection.service.IOnlCgformCollectionService; +//import com.jero.modules.document.enums.LawsStateEnum; +//import com.jero.modules.ocr.util.LineHumpUtil; +//import com.jero.modules.system.entity.SysDictItem; +//import com.jero.modules.system.service.impl.SysDictItemServiceImpl; +//import org.apache.commons.collections4.CollectionUtils; +//import org.apache.commons.lang3.ObjectUtils; +//import org.apache.commons.lang3.StringUtils; +//import org.apache.shiro.SecurityUtils; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +//import org.springframework.transaction.annotation.Transactional; +// +//import java.text.SimpleDateFormat; +//import java.util.*; +//import java.util.stream.Collectors; +// +///** +// * @Description: 我的收藏 +// * @Author: jero-boot +// * @Date: 2022-02-15 +// * @Version: V1.0 +// */ +//@Service +//public class OnlCgformCollectionServiceImpl extends ServiceImpl implements IOnlCgformCollectionService { +// @Autowired +// private OnlCgformFieldServiceImpl onlCgformFieldService; +// @Autowired +// OnlCgformCollectionMapper onlCgformCollectionMapper; +// @Autowired +// private SysDictItemServiceImpl sysDictItemServiceImpl; +// +// /** +// * 保存 +// * +// * @param onlCgformCollection +// * @return +// */ +// @Override +// public void add(OnlCgformCollection onlCgformCollection) { +// Date now = new Date(); +// onlCgformCollection.setCreateTime(now); +// save(onlCgformCollection); +// } +// +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @Override +// @Transactional +// public void deleteById(String id) { +// boolean checkData = checkData(id); +// if(!checkData){ +// throw new JeroBootException("该用户没有权限!"); +// } +// try { +// OnlCgformCollection onlCgformCollection = super.baseMapper.selectById(id); +// List documentIdList = new ArrayList<>(); +// documentIdList.add(onlCgformCollection.getDocumentId()); +// +// //删除订阅 +// //deleteSubscribe(documentIdList); +// +// removeById(id); +// }catch (Exception ex){ +// log.error("取消收藏失败:" + ex.getMessage()); +// throw new JeroBootException("取消收藏失败!"); +// } +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @Override +// @Transactional +// public void deleteByIds(List ids) { +// for (String id : ids) { +// boolean checkData = checkData(id); +// if(!checkData){ +// throw new JeroBootException("该用户没有权限!"); +// } +// } +// try { +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().in(OnlCgformCollection::getId,ids); +// List onlCgformCollections = super.baseMapper.selectList(queryWrapper); +// List documentIdList = onlCgformCollections.stream().map(OnlCgformCollection::getDocumentId).distinct().collect(Collectors.toList()); +// +// //删除订阅 +// //deleteSubscribe(documentIdList); +// +// removeByIds(ids); +// }catch (Exception ex){ +// log.error("批量取消收藏失败:" + ex.getMessage()); +// throw new JeroBootException("批量取消收藏失败!"); +// } +// } +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @Override +// public OnlCgformCollection queryById(String id) { +// boolean checkData = checkData(id); +// if(!checkData){ +// throw new JeroBootException("该用户没有权限!"); +// } +// return getById(id); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @Override +// public List queryList(OnlCgformCollection onlCgformCollection) { +// List list = onlCgformCollectionMapper.queryListByDocumentId(onlCgformCollection.getDocumentId()); +// return list; +// } +// +// /** +// * 列表表头中英文切换 +// * +// * @return +// */ +// @Override +// public List> getHeader(String flag, String cut) { +// List fieldList = onlCgformFieldService.getFieldList(flag); +// if (fieldList.size() != 0) { +// //过滤列表字段(is_show_list-->列表是否显示0否 1是) 过滤出需要的表头字段 +// fieldList = fieldList.stream().filter( +// e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList())) +// && ( +// e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title") +// ||e.getDbFieldEnName().equals("state") +// ) +// ).collect(Collectors.toList()); +// } +// List> list = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// Map map = new HashMap<>(); +// if ("file_name".equals(onlCgformField.getDbFieldName())) { +// //跳转详情的标识 +// map.put("click", "true"); +// } +// //单独处理发布日期和标准实施日期 +// if ("update_time".equals(onlCgformField.getDbFieldName())) { +// map.put("sort", "true");//列表排序标识 +// } +// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 +// if (LanguageEnum.CN.getValue().equals(cut)) { +// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 +// } else { +// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 +// } +// list.add(map); +// } +// return list; +// } +// +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @Override +// public List> queryCondition(String flag, String cut) { +// List fieldList = onlCgformFieldService.getFieldList(flag); +// if (fieldList.size() != 0) { +// //过滤出需要的搜索条件() +// fieldList = fieldList.stream().filter( +// e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery())) +// && ( +// e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title") +// ||e.getDbFieldEnName().equals("state") +// ) +// ).collect(Collectors.toList()); +// } +// List> list = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// Map map = new HashMap<>(); +// map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) +// map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 +// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 +// if (LanguageEnum.CN.getValue().equals(cut)) { +// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 +// } else { +// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 +// } +// list.add(map); +// } +// return list; +// } +// +// @Override +// public IPage queryPageList(Map params) { +//// params.put("orderByField","serial_number"); +//// params.put("orderBy","1"); +// if(ObjectUtils.isEmpty(params.get("orderByField"))){ +// params.put("orderBy",""); +// } +// Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); +// Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); +// IPage page = new Page(pageNo, pageSize); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// params.put("createBy",sysUser.getUsername()); +// IPage result = new Page(); +// //表头排序(状态单独处理) +// if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){ +// List> infoList = onlCgformCollectionMapper.infoList(params); +// result = stateSort(params,pageNo,pageSize,result,infoList); +// }else{ +// result = onlCgformCollectionMapper.queryPageList(page,params); +// } +// List> records = result.getRecords(); +// dataDispose(records,params); +// return result; +// } +// public IPage stateSort(Map parameter, int pageNo, int pageSize, IPage infoPage,List> infoList) { +// List> list = new LinkedList<>(); +// //状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止 +// if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals((String) parameter.get("orderByField"))){ +// List> active = infoList.stream() +// .filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> theUpcoming = infoList.stream() +// .filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> draft = infoList.stream() +// .filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> beReplaced = infoList.stream() +// .filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> abolish = infoList.stream() +// .filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// if ("1".equals((String) parameter.get("orderBy"))) { +// //正序 +// list.addAll(active); +// list.addAll(theUpcoming); +// list.addAll(draft); +// list.addAll(beReplaced); +// list.addAll(abolish); +// +// } else if ("2".equals((String) parameter.get("orderBy"))) { +// //倒序 +// list.addAll(abolish); +// list.addAll(beReplaced); +// list.addAll(draft); +// list.addAll(theUpcoming); +// list.addAll(active); +// } +// if(ObjectUtils.isNotEmpty(list)){ +// infoPage = getPages(pageNo, pageSize, list); +// } +// } +// return infoPage; +// } +// public IPage getPages(Integer currentPage, Integer pageSize, List> list){ +// IPage page =new Page(); +// if(list==null){ +// return null; +// } +// int size = list.size(); +// if(pageSize > size){ +// pageSize = size; +// } +// if(pageSize!=0){ +// //求出最⼤页数,防⽌currentPage越界 +// int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1; +// if(currentPage > maxPage){ +// currentPage = maxPage; +// } +// } +// //当前页第⼀条数据的下标 +// int curIdx = currentPage >1?(currentPage -1)* pageSize :0; +// List pageList =new ArrayList(); +// //将当前页的数据放进pageList +// for(int i =0; i < pageSize && curIdx + i < size; i++){ +// pageList.add(list.get(curIdx + i)); +// } +// page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList); +// return page; +// } +// +// public void dataDispose(List> datas, Map params){ +// if(CollectionUtils.isNotEmpty(datas)){ +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //获取所有文本状态数据字典 +// List stateList = sysDictItems.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state")) +// .collect(Collectors.toList()); +// SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); +// +// String cut = (String) params.get("cut"); +// for (Map data : datas) { +// Date createTime = (Date) data.get("createTime"); +// data.put("createTime",sdf.format(createTime)); +// String state = (String) data.get("state"); +// for (SysDictItem sysDictItem : stateList) { +// if(StringUtils.equals(state,sysDictItem.getItemValue())){ +// if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ +// data.put("state",sysDictItem.getItemText()); +// }else { +// data.put("state",sysDictItem.getEnName()); +// } +// break; +// } +// } +// //设置为已收藏 +// data.put("collectFlag","1"); +// } +// } +// } +// +// /** +// * 验证数据 +// * @param id +// * @return +// */ +// public boolean checkData(String id){ +// boolean result = false; +// try { +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().eq(OnlCgformCollection::getId,id); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// queryWrapper.lambda().eq(OnlCgformCollection::getCreateBy,sysUser.getUsername()); +// Integer integer = onlCgformCollectionMapper.selectCount(queryWrapper); +// if(integer>0){ +// result = true; +// } +// }catch (Exception ex){ +// log.error("验证我的收藏数据异常:" + ex.getMessage()); +// throw new JeroBootException("验证我的收藏数据异常!"); +// } +// return result; +// } +// +// /*public void deleteSubscribe(List docIdList){ +// try { +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// QueryWrapper deleteWarpper = new QueryWrapper<>(); +// deleteWarpper.lambda().in(OnlCgformSubscribe::getDocumentId,docIdList); +// deleteWarpper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername()); +// onlCgformSubscribeMapper.delete(deleteWarpper); +// }catch (Exception ex){ +// log.error("删除订阅信息失败:" + ex.getMessage()); +// throw new JeroBootException("删除订阅信息失败!"); +// } +// }*/ +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/controller/BussDocumentLibraryEOController.java b/laws-modules/src/main/java/com/jero/modules/document/controller/BussDocumentLibraryEOController.java index 26b2083e..1d1ac16c 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/controller/BussDocumentLibraryEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/document/controller/BussDocumentLibraryEOController.java @@ -7,7 +7,7 @@ import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.query.QueryGenerator; -import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.entity.OSSFileForDocumentLibrary; import com.jero.modules.document.service.IBussDocumentLibraryEOService; import io.swagger.annotations.Api; @@ -36,134 +36,135 @@ import java.util.Map; @RestController @RequestMapping("/document/bussDocumentLibraryEO") @Slf4j -public class BussDocumentLibraryEOController extends JeroController { +@Deprecated +public class BussDocumentLibraryEOController extends JeroController { @Autowired private IBussDocumentLibraryEOService bussDocumentLibraryEOService; - /** - * 分页列表查询 - * @param parameter - * @return - */ - @AutoLog(value = "分页查询") - @ApiOperation(value="分页查询", notes="分页查询") - @PostMapping(value = "/queryPageInfo") - @ResponseBody - @RequiresPermissions("document:queryPageInfo") - public JSONObject queryPageInfo(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter); - Result ok = Result.OK(infoPage); - JSONObject jsonResult = JSONObject.fromObject(ok); - return jsonResult; - } +// /** +// * 分页列表查询 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "分页查询") +// @ApiOperation(value="分页查询", notes="分页查询") +// @PostMapping(value = "/queryPageInfo") +// @ResponseBody +// @RequiresPermissions("document:queryPageInfo") +// public JSONObject queryPageInfo(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter); +// Result ok = Result.OK(infoPage); +// JSONObject jsonResult = JSONObject.fromObject(ok); +// return jsonResult; +// } - /** - * 代替标准分页列表查询 - * @param parameter - * @return - */ - @AutoLog(value = "代替标准分页列表查询") - @ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询") - @PostMapping(value = "/replacePageInfo") - @ResponseBody - @RequiresPermissions("document:getInfoById") - public Result replacePageInfo(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter); - return Result.OK(infoPage); - } +// /** +// * 代替标准分页列表查询 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "代替标准分页列表查询") +// @ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询") +// @PostMapping(value = "/replacePageInfo") +// @ResponseBody +// @RequiresPermissions("document:getInfoById") +// public Result replacePageInfo(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter); +// return Result.OK(infoPage); +// } +// +// /** +// * ocr识别调取已入库文件 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "ocr识别调取已入库文件分页") +// @ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件") +// @PostMapping(value = "/ocrPageInfo") +// @ResponseBody +// @RequiresPermissions("document:ocrPageInfo") +// public Result>> ocrPageInfo(@RequestBody Map parameter) { +// IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); +// return Result.OK(infoPage); +// } - /** - * ocr识别调取已入库文件 - * @param parameter - * @return - */ - @AutoLog(value = "ocr识别调取已入库文件分页") - @ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件") - @PostMapping(value = "/ocrPageInfo") - @ResponseBody - @RequiresPermissions("document:ocrPageInfo") - public Result>> ocrPageInfo(@RequestBody Map parameter) { - IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); - return Result.OK(infoPage); - } +// /** +// * 文档翻译调取已入库文件 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "文档翻译调取已入库文件") +// @ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件") +// @PostMapping(value = "/transPageInfo") +// @ResponseBody +// @RequiresPermissions("documentTranslation:retrieval") +// public Result>> transPageInfo(@RequestBody Map parameter) { +// IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); +// return Result.OK(infoPage); +// } - /** - * 文档翻译调取已入库文件 - * @param parameter - * @return - */ - @AutoLog(value = "文档翻译调取已入库文件") - @ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件") - @PostMapping(value = "/transPageInfo") - @ResponseBody - @RequiresPermissions("documentTranslation:retrieval") - public Result>> transPageInfo(@RequestBody Map parameter) { - IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); - return Result.OK(infoPage); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "文档库信息表-列表查询") - @ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { - List list = bussDocumentLibraryEOService.queryList(); - return Result.OK(list); - } +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "文档库信息表-列表查询") +// @ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList() { +// List list = bussDocumentLibraryEOService.queryList(); +// return Result.OK(list); +// } - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "文档库信息表-通过id删除") - @ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除") - @GetMapping(value = "/delete") - @RequiresPermissions("document:deleteBatch") - public Result delete(@RequestParam(name="id",required=true) String id) { - bussDocumentLibraryEOService.deleteById(id); - return Result.OK("删除成功!"); - } +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库信息表-通过id删除") +// @ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除") +// @GetMapping(value = "/delete") +// @RequiresPermissions("document:deleteBatch") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// bussDocumentLibraryEOService.deleteById(id); +// return Result.OK("删除成功!"); +// } - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "文档库信息表-批量删除") - @ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除") - @GetMapping(value = "/deleteBatch") - @RequiresPermissions("document:deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) { - this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut); - return Result.OK("批量删除成功!"); - } +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "文档库信息表-批量删除") +// @ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除") +// @GetMapping(value = "/deleteBatch") +// @RequiresPermissions("document:deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) { +// this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut); +// return Result.OK("批量删除成功!"); +// } - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "文档库信息表-通过id查询") - @ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询") - @GetMapping(value = "/queryById") - @RequiresPermissions("document:queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id); - if(bussDocumentLibraryEO==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(bussDocumentLibraryEO); - } +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库信息表-通过id查询") +// @ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询") +// @GetMapping(value = "/queryById") +// @RequiresPermissions("document:queryById") +// public Result queryById(@RequestParam(name="id",required=true) String id) { +// BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id); +// if(bussDocumentLibraryEO==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(bussDocumentLibraryEO); +// } @@ -182,343 +183,341 @@ public class BussDocumentLibraryEOController extends JeroController用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-列表表头") - @ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头") - @GetMapping(value = "/getHeader") - @RequiresPermissions("document:queryPageInfo") - public Result>> getHeader(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeader(flag,cut,null); - return Result.OK(list); - } +// /** +// * 列表表头 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-列表表头") +// @ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头") +// @GetMapping(value = "/getHeader") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> getHeader(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeader(flag,cut,null); +// return Result.OK(list); +// } - /** - * 新增表单 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-新增表单") - @ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单") - @GetMapping(value = "/getAddForm") - @RequiresPermissions("document:queryPageInfo") - public Result>> getAddForm(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut, - @RequestParam(name="type",required=true) String type) { - List> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type); - return Result.OK(list); - } +// /** +// * 新增表单 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-新增表单") +// @ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单") +// @GetMapping(value = "/getAddForm") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> getAddForm(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut, +// @RequestParam(name="type",required=true) String type) { +// List> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type); +// return Result.OK(list); +// } /** * ocr识别调取已入库文件-中英文切换 * @param flag 标识传 1-->用于查询文档库字段属性 * @return */ - @AutoLog(value = "文档库信息表-ocr表头和查询条件") - @ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件") - @GetMapping(value = "/getHeaderOrConditionForOcr") - @RequiresPermissions("document:ocrPageInfo") - public Result>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut); - return Result.OK(list); - } - +// @AutoLog(value = "文档库信息表-ocr表头和查询条件") +// @ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件") +// @GetMapping(value = "/getHeaderOrConditionForOcr") +// @RequiresPermissions("document:ocrPageInfo") +// public Result>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut); +// return Result.OK(list); +// } +// +// /** +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") +// @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") +// @GetMapping(value = "/getHeaderOrConditionForSplitFile") +// @RequiresPermissions("split:sarFileSplitInfo:splitFile") +// public Result>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); +// return Result.OK(list); +// } +// /** * @param flag 标识传 1-->用于查询文档库字段属性 * @return */ @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") - @GetMapping(value = "/getHeaderOrConditionForSplitFile") - @RequiresPermissions("split:sarFileSplitInfo:splitFile") - public Result>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); - return Result.OK(list); - } - - /** - * ocr识别调取已入库文件-中英文切换 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") - @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") @GetMapping(value = "/getHeaderOrConditionForSplitResult") - @RequiresPermissions("split:sarFileSplitInfo:splitResult") public Result>> getHeaderOrConditionForSplitResult(@RequestParam(name="flag",required=true) String flag, @RequestParam(name="cut",required=true) String cut) { List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); return Result.OK(list); } +// +// /** +// * 编辑数据查询 +// * @param id +// * @return +// */ +//// @AutoLog(value = "编辑数据查询") +//// @ApiOperation(value="编辑数据查询", notes="编辑数据查询") +//// @GetMapping(value = "/getDocumentInfoById") +//// @RequiresPermissions("document:updateInfo") +//// public Result>> getDocumentInfoById(@RequestParam(name="id",required=true) String id, +//// @RequestParam(name="cut",required=true) String cut) { +//// List> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut); +//// return Result.OK(list); +//// } +// /** +// * 详情数据查询 +// * @param id +// * @return +// */ +//// @AutoLog(value = "详情数据查询") +//// @ApiOperation(value="详情数据查询", notes="详情数据查询") +//// @GetMapping(value = "/getInfoById") +//// @RequiresPermissions("document:queryPageInfo") +//// public Result>> getInfoById(@RequestParam(name="id",required=true) String id, +//// @RequestParam(name="cut",required=true) String cut) { +//// List> list = bussDocumentLibraryEOService.getInfoById(id,cut); +//// return Result.OK(list); +//// } +// +//// @ApiOperation(value="详情目录查询", notes="详情目录查询") +//// @GetMapping(value = "/getMenuList") +//// public Result>> getMenuList(@RequestParam(name="id",required=true) String id, +//// @RequestParam(name="cut",required=true) String cut) { +//// List> list = bussDocumentLibraryEOService.getMenuList(id,cut); +//// return Result.OK(list); +//// } +// +//// /** +//// * 新增数据 +//// * @param map +//// * @return +//// */ +//// @AutoLog(value = "新增数据") +//// @ApiOperation(value="新增数据", notes="新增数据") +//// @PostMapping(value = "/addInfo") +//// @RequiresPermissions("document:getInfoById") +//// public Result getInfoById(@RequestBody Map map) { +//// try { +//// bussDocumentLibraryEOService.addInfo(map); +//// } catch (Exception e) { +//// return Result.error(e.getMessage()); +//// } +//// return Result.OK("新增成功"); +//// } +//// /** +//// * 编辑数据 +//// * @param map +//// * @return +//// */ +//// @AutoLog(value = "编辑数据") +//// @ApiOperation(value="编辑数据", notes="编辑数据") +//// @PostMapping(value = "/updateInfo") +//// @RequiresPermissions("document:updateInfo") +//// public Result updateInfo(@RequestBody Map map) { +//// try { +//// bussDocumentLibraryEOService.updateInfo(map); +//// } catch (Exception e) { +//// return Result.error(e.getMessage()); +//// } +//// return Result.OK("编辑成功"); +//// } +// +// +//// /** +//// * 添加收藏 +//// * @param id +//// * @return +//// */ +//// @AutoLog(value = "添加收藏") +//// @ApiOperation(value="添加收藏", notes="添加收藏") +//// @GetMapping(value = "/addCollect") +//// @RequiresPermissions("document:addCollect") +//// public Result addCollect(String id) { +//// try { +//// bussDocumentLibraryEOService.addCollect(id); +//// } catch (Exception e) { +//// return Result.error("收藏失败"); +//// } +//// return Result.OK("收藏成功"); +//// } +// +//// /** +//// * 取消收藏 +//// * @param id +//// * @return +//// */ +//// @AutoLog(value = "取消收藏") +//// @ApiOperation(value="取消收藏", notes="取消收藏") +//// @GetMapping(value = "/cancelCollect") +//// @RequiresPermissions("document:addCollect") +//// public Result cancelCollect(String id) { +//// try { +//// bussDocumentLibraryEOService.cancelCollect(id); +//// } catch (Exception e) { +//// return Result.error("取消收藏失败"); +//// } +//// return Result.OK("取消收藏成功"); +//// } +// +//// /** +//// * 添加订阅 +//// * @param id +//// * @return +//// */ +//// @AutoLog(value = "添加订阅") +//// @ApiOperation(value="添加订阅", notes="添加订阅") +//// @GetMapping(value = "/addSubscribe") +//// @RequiresPermissions("document:addSubscribe") +//// public Result addSubscribe(String id) { +//// try { +//// bussDocumentLibraryEOService.addSubscribe(id); +//// } catch (Exception e) { +//// return Result.error("订阅失败"); +//// } +//// return Result.OK("订阅成功"); +//// } +//// +//// /** +//// * 取消订阅 +//// * @param id +//// * @return +//// */ +//// @AutoLog(value = "取消订阅") +//// @ApiOperation(value="取消订阅", notes="取消订阅") +//// @GetMapping(value = "/cancelSubscribe") +//// @RequiresPermissions("document:addSubscribe") +//// public Result cancelSubscribe(String id) { +//// try { +//// bussDocumentLibraryEOService.cancelSubscribe(id); +//// } catch (Exception e) { +//// return Result.error("取消订阅失败"); +//// } +//// return Result.OK("取消订阅成功"); +//// } +// +// +// @ApiOperation(value = "导出excel") +// @GetMapping(value = "/exportExcel") +// @RequiresPermissions("document:exportExcel") +// public void exportExcel(@RequestParam Map map, +// HttpServletResponse response, +// HttpServletRequest request){ +// bussDocumentLibraryEOService.exportExcel(map,response,request); +// } +// +// @ApiOperation(value = "带文件导出") +// @GetMapping(value = "/exportZip") +// @RequiresPermissions("document:exportZip") +// public void exportZip(@RequestParam Map map, +// HttpServletResponse response, +// HttpServletRequest request) throws Exception { +// bussDocumentLibraryEOService.exportZip(map,response,request); +// } +// +// +// @ApiOperation(value = "模板下载") +// @GetMapping(value = "/exportTemplate") +// @RequiresPermissions("document:exportTemplate") +// public void exportTemplate(@RequestParam Map map, HttpServletResponse response, HttpServletRequest request) throws Exception { +// bussDocumentLibraryEOService.exportTemplate(map,response,request); +// } +// +// +// @ApiOperation(value = "导入.zip") +// @PostMapping(value = "/importZip") +// @RequiresPermissions("document:importZip") +// public Result importZip(@RequestParam(value = "file", required = false) MultipartFile file, +// @RequestParam(value = "cut",required = false) String cut) { +// try { +// bussDocumentLibraryEOService.importZip(file,cut); +// } catch (Exception e) { +// log.error(null,e); +// return Result.error(e.getMessage()); +// } +// return Result.OK("导入成功"); +// } - /** - * 编辑数据查询 - * @param id - * @return - */ - @AutoLog(value = "编辑数据查询") - @ApiOperation(value="编辑数据查询", notes="编辑数据查询") - @GetMapping(value = "/getDocumentInfoById") - @RequiresPermissions("document:updateInfo") - public Result>> getDocumentInfoById(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut); - return Result.OK(list); - } - /** - * 详情数据查询 - * @param id - * @return - */ - @AutoLog(value = "详情数据查询") - @ApiOperation(value="详情数据查询", notes="详情数据查询") - @GetMapping(value = "/getInfoById") - @RequiresPermissions("document:queryPageInfo") - public Result>> getInfoById(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getInfoById(id,cut); - return Result.OK(list); - } - - @ApiOperation(value="详情目录查询", notes="详情目录查询") - @GetMapping(value = "/getMenuList") - public Result>> getMenuList(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getMenuList(id,cut); - return Result.OK(list); - } - - /** - * 新增数据 - * @param map - * @return - */ - @AutoLog(value = "新增数据") - @ApiOperation(value="新增数据", notes="新增数据") - @PostMapping(value = "/addInfo") - @RequiresPermissions("document:getInfoById") - public Result getInfoById(@RequestBody Map map) { - try { - bussDocumentLibraryEOService.addInfo(map); - } catch (Exception e) { - return Result.error(e.getMessage()); - } - return Result.OK("新增成功"); - } - /** - * 编辑数据 - * @param map - * @return - */ - @AutoLog(value = "编辑数据") - @ApiOperation(value="编辑数据", notes="编辑数据") - @PostMapping(value = "/updateInfo") - @RequiresPermissions("document:updateInfo") - public Result updateInfo(@RequestBody Map map) { - try { - bussDocumentLibraryEOService.updateInfo(map); - } catch (Exception e) { - return Result.error(e.getMessage()); - } - return Result.OK("编辑成功"); - } - - - /** - * 添加收藏 - * @param id - * @return - */ - @AutoLog(value = "添加收藏") - @ApiOperation(value="添加收藏", notes="添加收藏") - @GetMapping(value = "/addCollect") - @RequiresPermissions("document:addCollect") - public Result addCollect(String id) { - try { - bussDocumentLibraryEOService.addCollect(id); - } catch (Exception e) { - return Result.error("收藏失败"); - } - return Result.OK("收藏成功"); - } - - /** - * 取消收藏 - * @param id - * @return - */ - @AutoLog(value = "取消收藏") - @ApiOperation(value="取消收藏", notes="取消收藏") - @GetMapping(value = "/cancelCollect") - @RequiresPermissions("document:addCollect") - public Result cancelCollect(String id) { - try { - bussDocumentLibraryEOService.cancelCollect(id); - } catch (Exception e) { - return Result.error("取消收藏失败"); - } - return Result.OK("取消收藏成功"); - } - - /** - * 添加订阅 - * @param id - * @return - */ - @AutoLog(value = "添加订阅") - @ApiOperation(value="添加订阅", notes="添加订阅") - @GetMapping(value = "/addSubscribe") - @RequiresPermissions("document:addSubscribe") - public Result addSubscribe(String id) { - try { - bussDocumentLibraryEOService.addSubscribe(id); - } catch (Exception e) { - return Result.error("订阅失败"); - } - return Result.OK("订阅成功"); - } - - /** - * 取消订阅 - * @param id - * @return - */ - @AutoLog(value = "取消订阅") - @ApiOperation(value="取消订阅", notes="取消订阅") - @GetMapping(value = "/cancelSubscribe") - @RequiresPermissions("document:addSubscribe") - public Result cancelSubscribe(String id) { - try { - bussDocumentLibraryEOService.cancelSubscribe(id); - } catch (Exception e) { - return Result.error("取消订阅失败"); - } - return Result.OK("取消订阅成功"); - } - - - @ApiOperation(value = "导出excel") - @GetMapping(value = "/exportExcel") - @RequiresPermissions("document:exportExcel") - public void exportExcel(@RequestParam Map map, - HttpServletResponse response, - HttpServletRequest request){ - bussDocumentLibraryEOService.exportExcel(map,response,request); - } - - @ApiOperation(value = "带文件导出") - @GetMapping(value = "/exportZip") - @RequiresPermissions("document:exportZip") - public void exportZip(@RequestParam Map map, - HttpServletResponse response, - HttpServletRequest request) throws Exception { - bussDocumentLibraryEOService.exportZip(map,response,request); - } - - - @ApiOperation(value = "模板下载") - @GetMapping(value = "/exportTemplate") - @RequiresPermissions("document:exportTemplate") - public void exportTemplate(@RequestParam Map map, HttpServletResponse response, HttpServletRequest request) throws Exception { - bussDocumentLibraryEOService.exportTemplate(map,response,request); - } - - - @ApiOperation(value = "导入.zip") - @PostMapping(value = "/importZip") - @RequiresPermissions("document:importZip") - public Result importZip(@RequestParam(value = "file", required = false) MultipartFile file, - @RequestParam(value = "cut",required = false) String cut) { - try { - bussDocumentLibraryEOService.importZip(file,cut); - } catch (Exception e) { - log.error(null,e); - return Result.error(e.getMessage()); - } - return Result.OK("导入成功"); - } - - @ApiOperation(value = "推送") - @GetMapping(value = "/pullMessage") - @RequiresPermissions("document:pullMessage") - public Result pullMessage(String departIds, String userIds, String documentIds) { - - bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds); - - return Result.OK("推送成功"); - } +// @ApiOperation(value = "推送") +// @GetMapping(value = "/pullMessage") +// @RequiresPermissions("document:pullMessage") +// public Result pullMessage(String departIds, String userIds, String documentIds) { +// +// bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds); +// +// return Result.OK("推送成功"); +// } - /** - * 验证文档是否被其他的文档绑定 - * - * @param ids - * @return - */ - @AutoLog(value = "验证文档是否被其他的文档绑定") - @ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定") - @GetMapping(value = "/verifyBind") - public Result verifyBind(@RequestParam(name="ids",required=true) String ids) { - String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(","))); - return Result.OK(msg); - } +// /** +// * 验证文档是否被其他的文档绑定 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "验证文档是否被其他的文档绑定") +// @ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定") +// @GetMapping(value = "/verifyBind") +// public Result verifyBind(@RequestParam(name="ids",required=true) String ids) { +// String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(","))); +// return Result.OK(msg); +// } - @AutoLog(value = "虚拟中心添加调用文档库数据--分页") - @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") - @PostMapping(value = "/queryPageInfoDummy") - public Result> queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap()); - Page page = new Page(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize()); - IPage pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO); - return Result.OK(pageList); - } +// @AutoLog(value = "虚拟中心添加调用文档库数据--分页") +// @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") +// @PostMapping(value = "/queryPageInfoDummy") +// public Result> queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO, +// HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap()); +// Page page = new Page(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize()); +// IPage pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO); +// return Result.OK(pageList); +// } - @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") - @PostMapping(value = "/queryPageDummy") - @ResponseBody - public JSONObject queryPageDummy(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter); - Result ok = Result.OK(infoPage); - JSONObject jsonResult = JSONObject.fromObject(ok); - return jsonResult; - } +// @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") +// @PostMapping(value = "/queryPageDummy") +// @ResponseBody +// public JSONObject queryPageDummy(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter); +// Result ok = Result.OK(infoPage); +// JSONObject jsonResult = JSONObject.fromObject(ok); +// return jsonResult; +// } - /** - * 查看已上传的文件 - * @param id - * @return - */ - @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") - @GetMapping(value = "/getFileInfos") - @RequiresPermissions("document:queryPageInfo") - public Result> getFileInfos(String id) { - List fileInfos = bussDocumentLibraryEOService.getFileInfos(id); - return Result.OK(fileInfos); - } - /** - * 根据id查询编号和标题 - * @param id - * @return - */ - @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") - @GetMapping(value = "/getTitle") - public Result getTitle(String id, String cut) { - String title = bussDocumentLibraryEOService.getTitle(id, cut); - return Result.OK(title); - } - @ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)") - @GetMapping(value = "/updateES") - public Result getTitle() { - int count = bussDocumentLibraryEOService.updateES(); - return Result.OK(count); - } +// /** +// * 查看已上传的文件 +// * @param id +// * @return +// */ +// @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") +// @GetMapping(value = "/getFileInfos") +// @RequiresPermissions("document:queryPageInfo") +// public Result> getFileInfos(String id) { +// List fileInfos = bussDocumentLibraryEOService.getFileInfos(id); +// return Result.OK(fileInfos); +// } +// /** +// * 根据id查询编号和标题 +// * @param id +// * @return +// */ +// @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") +// @GetMapping(value = "/getTitle") +// public Result getTitle(String id, String cut) { +// String title = bussDocumentLibraryEOService.getTitle(id, cut); +// return Result.OK(title); +// } +// @ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)") +// @GetMapping(value = "/updateES") +// public Result getTitle() { +// int count = bussDocumentLibraryEOService.updateES(); +// return Result.OK(count); +// } } diff --git a/laws-modules/src/main/java/com/jero/modules/document/controller/PhasedImplementationDetailsEOController.java b/laws-modules/src/main/java/com/jero/modules/document/controller/PhasedImplementationDetailsEOController.java index 67c96dcc..b452ba81 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/controller/PhasedImplementationDetailsEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/document/controller/PhasedImplementationDetailsEOController.java @@ -1,173 +1,173 @@ -package com.jero.modules.document.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.common.system.base.controller.JeroController; -import com.jero.common.system.query.QueryGenerator; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; -import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.List; - - - /** - * @Description: 文档库-分阶段实施详情表 - * @Author: jero-boot - * @Date: 2023-02-22 - * @Version: V1.0 - */ -@Api(tags="文档库-分阶段实施详情表") -@RestController -@RequestMapping("/document/phasedImplementationDetailsEO") -@Slf4j -public class PhasedImplementationDetailsEOController extends JeroController { - @Autowired - private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService; - - /** - * 分页列表查询 - * - * @param phasedImplementationDetailsEO - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-分页列表查询") - @ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询") - @GetMapping(value = "/page") - public Result queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - @RequestParam(name="cut", defaultValue="cn") String cut, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = phasedImplementationDetailsEOService.page(page, queryWrapper); - this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut); - return Result.OK(pageList); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-列表查询") - @ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { - List list = phasedImplementationDetailsEOService.queryList(); - return Result.OK(list); - } - - /** - * 添加 - * - * @param phasedImplementationDetailsEO - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-添加") - @ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param phasedImplementationDetailsEO - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-编辑") - @ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑") - @PostMapping(value = "/edit") - public Result edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-通过id删除") - @ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除") - @PostMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - phasedImplementationDetailsEOService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-批量删除") - @ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除") - @PostMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.phasedImplementationDetailsEOService.deleteByIds(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) { - PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id); - if(phasedImplementationDetailsEO==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(phasedImplementationDetailsEO); - } - - /** - * 导出excel - * - * @param request - * @param phasedImplementationDetailsEO - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, PhasedImplementationDetailsEO.class); - } - -} +//package com.jero.modules.document.controller; +// +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.common.system.base.controller.JeroController; +//import com.jero.common.system.query.QueryGenerator; +//import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +//import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.validation.annotation.Validated; +//import org.springframework.web.bind.annotation.*; +//import org.springframework.web.servlet.ModelAndView; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.util.Arrays; +//import java.util.List; +// +// +// /** +// * @Description: 文档库-分阶段实施详情表 +// * @Author: jero-boot +// * @Date: 2023-02-22 +// * @Version: V1.0 +// */ +//@Api(tags="文档库-分阶段实施详情表") +//@RestController +//@RequestMapping("/document/phasedImplementationDetailsEO") +//@Slf4j +//public class PhasedImplementationDetailsEOController extends JeroController { +// @Autowired +// private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService; +// +// /** +// * 分页列表查询 +// * +// * @param phasedImplementationDetailsEO +// * @param pageNo +// * @param pageSize +// * @param req +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-分页列表查询") +// @ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询") +// @GetMapping(value = "/page") +// public Result queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO, +// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, +// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, +// @RequestParam(name="cut", defaultValue="cn") String cut, +// HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap()); +// Page page = new Page(pageNo, pageSize); +// IPage pageList = phasedImplementationDetailsEOService.page(page, queryWrapper); +// this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut); +// return Result.OK(pageList); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-列表查询") +// @ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList() { +// List list = phasedImplementationDetailsEOService.queryList(); +// return Result.OK(list); +// } +// +// /** +// * 添加 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-添加") +// @ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加") +// @PostMapping(value = "/add") +// public Result add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO); +// return Result.OK("添加成功!"); +// } +// +// /** +// * 编辑 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-编辑") +// @ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑") +// @PostMapping(value = "/edit") +// public Result edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO); +// return Result.OK("编辑成功!"); +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-通过id删除") +// @ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除") +// @PostMapping(value = "/delete") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// phasedImplementationDetailsEOService.deleteById(id); +// return Result.OK("删除成功!"); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-批量删除") +// @ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除") +// @PostMapping(value = "/deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { +// this.phasedImplementationDetailsEOService.deleteByIds(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) { +// PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id); +// if(phasedImplementationDetailsEO==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(phasedImplementationDetailsEO); +// } +// +// /** +// * 导出excel +// * +// * @param request +// * @param phasedImplementationDetailsEO +// */ +// @RequestMapping(value = "/exportXls") +// public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表"); +// } +// +// /** +// * 通过excel导入数据 +// * +// * @param request +// * @param response +// * @return +// */ +// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) +// public Result importExcel(HttpServletRequest request, HttpServletResponse response) { +// return super.importExcel(request, response, PhasedImplementationDetailsEO.class); +// } +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/controller/PhoneBussDocumentLibraryEOController.java b/laws-modules/src/main/java/com/jero/modules/document/controller/PhoneBussDocumentLibraryEOController.java index e95221c2..3bc48060 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/controller/PhoneBussDocumentLibraryEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/document/controller/PhoneBussDocumentLibraryEOController.java @@ -1,526 +1,526 @@ -package com.jero.modules.document.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.common.system.base.controller.JeroController; -import com.jero.common.system.query.QueryGenerator; -import com.jero.modules.document.entity.BussDocumentLibraryEO; -import com.jero.modules.document.entity.OSSFileForDocumentLibrary; -import com.jero.modules.document.service.IBussDocumentLibraryEOService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import net.sf.json.JSONObject; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - - -/** - * @Description: 文档库信息表 - * @Author: jero-boot - * @Date: 2022-01-21 - * @Version: V1.0 - */ -@Api(tags="文档库信息表") -@RestController -@RequestMapping("/phone/document/bussDocumentLibraryEO") -@Slf4j -public class PhoneBussDocumentLibraryEOController extends JeroController { - @Autowired - private IBussDocumentLibraryEOService bussDocumentLibraryEOService; - - - /** - * 分页列表查询 - * @param parameter - * @return - */ - @AutoLog(value = "分页查询") - @ApiOperation(value="分页查询", notes="分页查询") - @PostMapping(value = "/queryPageInfo") - @ResponseBody - @RequiresPermissions("document:queryPageInfo") - public JSONObject queryPageInfo(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter); - Result ok = Result.OK(infoPage); - JSONObject jsonResult = JSONObject.fromObject(ok); - return jsonResult; - } - - /** - * 代替标准分页列表查询 - * @param parameter - * @return - */ - @AutoLog(value = "代替标准分页列表查询") - @ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询") - @PostMapping(value = "/replacePageInfo") - @ResponseBody - @RequiresPermissions("document:getInfoById") - public Result replacePageInfo(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter); +//package com.jero.modules.document.controller; +// +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.common.system.base.controller.JeroController; +//import com.jero.common.system.query.QueryGenerator; +//import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.entity.OSSFileForDocumentLibrary; +//import com.jero.modules.document.service.IBussDocumentLibraryEOService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import net.sf.json.JSONObject; +//import org.apache.shiro.authz.annotation.RequiresPermissions; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.*; +//import org.springframework.web.multipart.MultipartFile; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.util.Arrays; +//import java.util.List; +//import java.util.Map; +// +// +///** +// * @Description: 文档库信息表 +// * @Author: jero-boot +// * @Date: 2022-01-21 +// * @Version: V1.0 +// */ +//@Api(tags="文档库信息表") +//@RestController +//@RequestMapping("/phone/document/bussDocumentLibraryEO") +//@Slf4j +//public class PhoneBussDocumentLibraryEOController extends JeroController { +// @Autowired +// private IBussDocumentLibraryEOService bussDocumentLibraryEOService; +// +// +// /** +// * 分页列表查询 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "分页查询") +// @ApiOperation(value="分页查询", notes="分页查询") +// @PostMapping(value = "/queryPageInfo") +// @ResponseBody +// @RequiresPermissions("document:queryPageInfo") +// public JSONObject queryPageInfo(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter); // Result ok = Result.OK(infoPage); // JSONObject jsonResult = JSONObject.fromObject(ok); - return Result.OK(infoPage); - } - - /** - * ocr识别调取已入库文件 - * @param parameter - * @return - */ - @AutoLog(value = "ocr识别调取已入库文件分页") - @ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件") - @PostMapping(value = "/ocrPageInfo") - @ResponseBody - @RequiresPermissions("document:ocrPageInfo") - public Result>> ocrPageInfo(@RequestBody Map parameter) { - IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); - return Result.OK(infoPage); - } - - /** - * 文档翻译调取已入库文件 - * @param parameter - * @return - */ - @AutoLog(value = "文档翻译调取已入库文件") - @ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件") - @PostMapping(value = "/transPageInfo") - @ResponseBody - @RequiresPermissions("documentTranslation:retrieval") - public Result>> transPageInfo(@RequestBody Map parameter) { - IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); - return Result.OK(infoPage); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "文档库信息表-列表查询") - @ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { - List list = bussDocumentLibraryEOService.queryList(); - return Result.OK(list); - } - - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "文档库信息表-通过id删除") - @ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除") - @GetMapping(value = "/delete") - @RequiresPermissions("document:deleteBatch") - public Result delete(@RequestParam(name="id",required=true) String id) { - bussDocumentLibraryEOService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "文档库信息表-批量删除") - @ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除") - @GetMapping(value = "/deleteBatch") - @RequiresPermissions("document:deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) { - this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "文档库信息表-通过id查询") - @ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询") - @GetMapping(value = "/queryById") - @RequiresPermissions("document:queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id); - if(bussDocumentLibraryEO==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(bussDocumentLibraryEO); - } - - - - /** - * 列表查询条件 标识传 1-->用于查询文档库字段属性 - * @param flag - * @return - */ - @AutoLog(value = "文档库信息表-查询条件") - @ApiOperation(value="文档库信息表-查询条件", notes="文档库信息表-查询条件") - @GetMapping(value = "/queryCondition") - @RequiresPermissions("document:queryPageInfo") - public Result>> queryCondition(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.queryCondition(flag,cut,null); - return Result.OK(list); - } - - /** - * 列表表头 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-列表表头") - @ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头") - @GetMapping(value = "/getHeader") - @RequiresPermissions("document:queryPageInfo") - public Result>> getHeader(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeader(flag,cut,null); - return Result.OK(list); - } - - /** - * 新增表单 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-新增表单") - @ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单") - @GetMapping(value = "/getAddForm") - @RequiresPermissions("document:queryPageInfo") - public Result>> getAddForm(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut, - @RequestParam(name="type",required=true) String type) { - List> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type); - return Result.OK(list); - } - - /** - * ocr识别调取已入库文件-中英文切换 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-ocr表头和查询条件") - @ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件") - @GetMapping(value = "/getHeaderOrConditionForOcr") - @RequiresPermissions("document:ocrPageInfo") - public Result>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut); - return Result.OK(list); - } - - /** - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") - @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") - @GetMapping(value = "/getHeaderOrConditionForSplitFile") - @RequiresPermissions("split:sarFileSplitInfo:splitFile") - public Result>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); - return Result.OK(list); - } - - /** - * ocr识别调取已入库文件-中英文切换 - * @param flag 标识传 1-->用于查询文档库字段属性 - * @return - */ - @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") - @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") - @GetMapping(value = "/getHeaderOrConditionForSplitResult") - @RequiresPermissions("split:sarFileSplitInfo:splitResult") - public Result>> getHeaderOrConditionForSplitResult(@RequestParam(name="flag",required=true) String flag, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); - return Result.OK(list); - } - - /** - * 编辑数据查询 - * @param id - * @return - */ - @AutoLog(value = "编辑数据查询") - @ApiOperation(value="编辑数据查询", notes="编辑数据查询") - @GetMapping(value = "/getDocumentInfoById") - @RequiresPermissions("document:updateInfo") - public Result>> getDocumentInfoById(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut); - return Result.OK(list); - } - /** - * 详情数据查询 - * @param id - * @return - */ - @AutoLog(value = "详情数据查询") - @ApiOperation(value="详情数据查询", notes="详情数据查询") - @GetMapping(value = "/getInfoById") - @RequiresPermissions("document:queryPageInfo") - public Result>> getInfoById(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getInfoById(id,cut); - return Result.OK(list); - } - - @ApiOperation(value="详情目录查询", notes="详情目录查询") - @GetMapping(value = "/getMenuList") - public Result>> getMenuList(@RequestParam(name="id",required=true) String id, - @RequestParam(name="cut",required=true) String cut) { - List> list = bussDocumentLibraryEOService.getMenuList(id,cut); - return Result.OK(list); - } - - /** - * 新增数据 - * @param map - * @return - */ - @AutoLog(value = "新增数据") - @ApiOperation(value="新增数据", notes="新增数据") - @PostMapping(value = "/addInfo") - @RequiresPermissions("document:getInfoById") - public Result getInfoById(@RequestBody Map map) { - try { - bussDocumentLibraryEOService.addInfo(map); - } catch (Exception e) { - return Result.error(e.getMessage()); - } - return Result.OK("新增成功"); - } - /** - * 编辑数据 - * @param map - * @return - */ - @AutoLog(value = "编辑数据") - @ApiOperation(value="编辑数据", notes="编辑数据") - @PostMapping(value = "/updateInfo") - @RequiresPermissions("document:updateInfo") - public Result updateInfo(@RequestBody Map map) { - try { - bussDocumentLibraryEOService.updateInfo(map); - } catch (Exception e) { - return Result.error(e.getMessage()); - } - return Result.OK("编辑成功"); - } - - - /** - * 添加收藏 - * @param id - * @return - */ - @AutoLog(value = "添加收藏") - @ApiOperation(value="添加收藏", notes="添加收藏") - @GetMapping(value = "/addCollect") - @RequiresPermissions("document:addCollect") - public Result addCollect(String id) { - try { - bussDocumentLibraryEOService.addCollect(id); - } catch (Exception e) { - return Result.error("收藏失败"); - } - return Result.OK("收藏成功"); - } - - /** - * 取消收藏 - * @param id - * @return - */ - @AutoLog(value = "取消收藏") - @ApiOperation(value="取消收藏", notes="取消收藏") - @GetMapping(value = "/cancelCollect") - @RequiresPermissions("document:addCollect") - public Result cancelCollect(String id) { - try { - bussDocumentLibraryEOService.cancelCollect(id); - } catch (Exception e) { - return Result.error("取消收藏失败"); - } - return Result.OK("取消收藏成功"); - } - - /** - * 添加订阅 - * @param id - * @return - */ - @AutoLog(value = "添加订阅") - @ApiOperation(value="添加订阅", notes="添加订阅") - @GetMapping(value = "/addSubscribe") - @RequiresPermissions("document:addSubscribe") - public Result addSubscribe(String id) { - try { - bussDocumentLibraryEOService.addSubscribe(id); - } catch (Exception e) { - return Result.error("订阅失败"); - } - return Result.OK("订阅成功"); - } - - /** - * 取消订阅 - * @param id - * @return - */ - @AutoLog(value = "取消订阅") - @ApiOperation(value="取消订阅", notes="取消订阅") - @GetMapping(value = "/cancelSubscribe") - @RequiresPermissions("document:addSubscribe") - public Result cancelSubscribe(String id) { - try { - bussDocumentLibraryEOService.cancelSubscribe(id); - } catch (Exception e) { - return Result.error("取消订阅失败"); - } - return Result.OK("取消订阅成功"); - } - - - @ApiOperation(value = "导出excel") - @GetMapping(value = "/exportExcel") - @RequiresPermissions("document:exportExcel") - public void exportExcel(@RequestParam Map map, - HttpServletResponse response, - HttpServletRequest request){ - bussDocumentLibraryEOService.exportExcel(map,response,request); - } - - @ApiOperation(value = "带文件导出") - @GetMapping(value = "/exportZip") - @RequiresPermissions("document:exportZip") - public void exportZip(@RequestParam Map map, - HttpServletResponse response, - HttpServletRequest request) throws Exception { - bussDocumentLibraryEOService.exportZip(map,response,request); - } - - - @ApiOperation(value = "模板下载") - @GetMapping(value = "/exportTemplate") - @RequiresPermissions("document:exportTemplate") - public void exportTemplate(@RequestParam Map map, HttpServletResponse response, HttpServletRequest request) throws Exception { - bussDocumentLibraryEOService.exportTemplate(map,response,request); - } - - - @ApiOperation(value = "导入.zip") - @PostMapping(value = "/importZip") - @RequiresPermissions("document:importZip") - public Result importZip(@RequestParam(value = "file", required = false) MultipartFile file, - @RequestParam(value = "cut",required = false) String cut) throws Exception { - try { - bussDocumentLibraryEOService.importZip(file,cut); - } catch (Exception e) { - e.printStackTrace(); - return Result.error(e.getMessage()); - } - return Result.OK("导入成功"); - } - - @ApiOperation(value = "推送") - @GetMapping(value = "/pullMessage") - @RequiresPermissions("document:pullMessage") - public Result pullMessage(String departIds, String userIds, String documentIds) { - - bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds); - - return Result.OK("推送成功"); - } - - - - /** - * 验证文档是否被其他的文档绑定 - * - * @param ids - * @return - */ - @AutoLog(value = "验证文档是否被其他的文档绑定") - @ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定") - @GetMapping(value = "/verifyBind") - public Result verifyBind(@RequestParam(name="ids",required=true) String ids) { - String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(","))); - return Result.OK(msg); - } - - @AutoLog(value = "虚拟中心添加调用文档库数据--分页") - @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") - @PostMapping(value = "/queryPageInfoDummy") - public Result queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap()); - Page page = new Page(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize()); - IPage pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO); - return Result.OK(pageList); - } - - - @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") - @PostMapping(value = "/queryPageDummy") - @ResponseBody - public JSONObject queryPageDummy(@RequestBody Map parameter) { - IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter); - Result ok = Result.OK(infoPage); - JSONObject jsonResult = JSONObject.fromObject(ok); - return jsonResult; - } - - /** - * 查看已上传的文件 - * @param id - * @return - */ - @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") - @GetMapping(value = "/getFileInfos") - @RequiresPermissions("document:queryPageInfo") - public Result getFileInfos(String id) { - List fileInfos = bussDocumentLibraryEOService.getFileInfos(id); - return Result.OK(fileInfos); - } - /** - * 根据id查询编号和标题 - * @param id - * @return - */ - @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") - @GetMapping(value = "/getTitle") - public Result getTitle(String id, String cut) { - String title = bussDocumentLibraryEOService.getTitle(id, cut); - return Result.OK(title); - } - @ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)") - @GetMapping(value = "/updateES") - public Result getTitle() { - int count = bussDocumentLibraryEOService.updateES(); - return Result.OK(count); - } -} +// return jsonResult; +// } +// +// /** +// * 代替标准分页列表查询 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "代替标准分页列表查询") +// @ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询") +// @PostMapping(value = "/replacePageInfo") +// @ResponseBody +// @RequiresPermissions("document:getInfoById") +// public Result replacePageInfo(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter); +//// Result ok = Result.OK(infoPage); +//// JSONObject jsonResult = JSONObject.fromObject(ok); +// return Result.OK(infoPage); +// } +// +// /** +// * ocr识别调取已入库文件 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "ocr识别调取已入库文件分页") +// @ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件") +// @PostMapping(value = "/ocrPageInfo") +// @ResponseBody +// @RequiresPermissions("document:ocrPageInfo") +// public Result>> ocrPageInfo(@RequestBody Map parameter) { +// IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); +// return Result.OK(infoPage); +// } +// +// /** +// * 文档翻译调取已入库文件 +// * @param parameter +// * @return +// */ +// @AutoLog(value = "文档翻译调取已入库文件") +// @ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件") +// @PostMapping(value = "/transPageInfo") +// @ResponseBody +// @RequiresPermissions("documentTranslation:retrieval") +// public Result>> transPageInfo(@RequestBody Map parameter) { +// IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); +// return Result.OK(infoPage); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "文档库信息表-列表查询") +// @ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList() { +// List list = bussDocumentLibraryEOService.queryList(); +// return Result.OK(list); +// } +// +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库信息表-通过id删除") +// @ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除") +// @GetMapping(value = "/delete") +// @RequiresPermissions("document:deleteBatch") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// bussDocumentLibraryEOService.deleteById(id); +// return Result.OK("删除成功!"); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "文档库信息表-批量删除") +// @ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除") +// @GetMapping(value = "/deleteBatch") +// @RequiresPermissions("document:deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) { +// this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut); +// return Result.OK("批量删除成功!"); +// } +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库信息表-通过id查询") +// @ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询") +// @GetMapping(value = "/queryById") +// @RequiresPermissions("document:queryById") +// public Result queryById(@RequestParam(name="id",required=true) String id) { +// BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id); +// if(bussDocumentLibraryEO==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(bussDocumentLibraryEO); +// } +// +// +// +// /** +// * 列表查询条件 标识传 1-->用于查询文档库字段属性 +// * @param flag +// * @return +// */ +// @AutoLog(value = "文档库信息表-查询条件") +// @ApiOperation(value="文档库信息表-查询条件", notes="文档库信息表-查询条件") +// @GetMapping(value = "/queryCondition") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> queryCondition(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.queryCondition(flag,cut,null); +// return Result.OK(list); +// } +// +// /** +// * 列表表头 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-列表表头") +// @ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头") +// @GetMapping(value = "/getHeader") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> getHeader(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeader(flag,cut,null); +// return Result.OK(list); +// } +// +// /** +// * 新增表单 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-新增表单") +// @ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单") +// @GetMapping(value = "/getAddForm") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> getAddForm(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut, +// @RequestParam(name="type",required=true) String type) { +// List> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type); +// return Result.OK(list); +// } +// +// /** +// * ocr识别调取已入库文件-中英文切换 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-ocr表头和查询条件") +// @ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件") +// @GetMapping(value = "/getHeaderOrConditionForOcr") +// @RequiresPermissions("document:ocrPageInfo") +// public Result>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut); +// return Result.OK(list); +// } +// +// /** +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") +// @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") +// @GetMapping(value = "/getHeaderOrConditionForSplitFile") +// @RequiresPermissions("split:sarFileSplitInfo:splitFile") +// public Result>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); +// return Result.OK(list); +// } +// +// /** +// * ocr识别调取已入库文件-中英文切换 +// * @param flag 标识传 1-->用于查询文档库字段属性 +// * @return +// */ +// @AutoLog(value = "文档库信息表-文档拆分表头和查询条件") +// @ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件") +// @GetMapping(value = "/getHeaderOrConditionForSplitResult") +// @RequiresPermissions("split:sarFileSplitInfo:splitResult") +// public Result>> getHeaderOrConditionForSplitResult(@RequestParam(name="flag",required=true) String flag, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut); +// return Result.OK(list); +// } +// +// /** +// * 编辑数据查询 +// * @param id +// * @return +// */ +// @AutoLog(value = "编辑数据查询") +// @ApiOperation(value="编辑数据查询", notes="编辑数据查询") +// @GetMapping(value = "/getDocumentInfoById") +// @RequiresPermissions("document:updateInfo") +// public Result>> getDocumentInfoById(@RequestParam(name="id",required=true) String id, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut); +// return Result.OK(list); +// } +// /** +// * 详情数据查询 +// * @param id +// * @return +// */ +// @AutoLog(value = "详情数据查询") +// @ApiOperation(value="详情数据查询", notes="详情数据查询") +// @GetMapping(value = "/getInfoById") +// @RequiresPermissions("document:queryPageInfo") +// public Result>> getInfoById(@RequestParam(name="id",required=true) String id, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getInfoById(id,cut); +// return Result.OK(list); +// } +// +// @ApiOperation(value="详情目录查询", notes="详情目录查询") +// @GetMapping(value = "/getMenuList") +// public Result>> getMenuList(@RequestParam(name="id",required=true) String id, +// @RequestParam(name="cut",required=true) String cut) { +// List> list = bussDocumentLibraryEOService.getMenuList(id,cut); +// return Result.OK(list); +// } +// +// /** +// * 新增数据 +// * @param map +// * @return +// */ +// @AutoLog(value = "新增数据") +// @ApiOperation(value="新增数据", notes="新增数据") +// @PostMapping(value = "/addInfo") +// @RequiresPermissions("document:getInfoById") +// public Result getInfoById(@RequestBody Map map) { +// try { +// bussDocumentLibraryEOService.addInfo(map); +// } catch (Exception e) { +// return Result.error(e.getMessage()); +// } +// return Result.OK("新增成功"); +// } +// /** +// * 编辑数据 +// * @param map +// * @return +// */ +// @AutoLog(value = "编辑数据") +// @ApiOperation(value="编辑数据", notes="编辑数据") +// @PostMapping(value = "/updateInfo") +// @RequiresPermissions("document:updateInfo") +// public Result updateInfo(@RequestBody Map map) { +// try { +// bussDocumentLibraryEOService.updateInfo(map); +// } catch (Exception e) { +// return Result.error(e.getMessage()); +// } +// return Result.OK("编辑成功"); +// } +// +// +// /** +// * 添加收藏 +// * @param id +// * @return +// */ +// @AutoLog(value = "添加收藏") +// @ApiOperation(value="添加收藏", notes="添加收藏") +// @GetMapping(value = "/addCollect") +// @RequiresPermissions("document:addCollect") +// public Result addCollect(String id) { +// try { +// bussDocumentLibraryEOService.addCollect(id); +// } catch (Exception e) { +// return Result.error("收藏失败"); +// } +// return Result.OK("收藏成功"); +// } +// +// /** +// * 取消收藏 +// * @param id +// * @return +// */ +// @AutoLog(value = "取消收藏") +// @ApiOperation(value="取消收藏", notes="取消收藏") +// @GetMapping(value = "/cancelCollect") +// @RequiresPermissions("document:addCollect") +// public Result cancelCollect(String id) { +// try { +// bussDocumentLibraryEOService.cancelCollect(id); +// } catch (Exception e) { +// return Result.error("取消收藏失败"); +// } +// return Result.OK("取消收藏成功"); +// } +// +// /** +// * 添加订阅 +// * @param id +// * @return +// */ +// @AutoLog(value = "添加订阅") +// @ApiOperation(value="添加订阅", notes="添加订阅") +// @GetMapping(value = "/addSubscribe") +// @RequiresPermissions("document:addSubscribe") +// public Result addSubscribe(String id) { +// try { +// bussDocumentLibraryEOService.addSubscribe(id); +// } catch (Exception e) { +// return Result.error("订阅失败"); +// } +// return Result.OK("订阅成功"); +// } +// +// /** +// * 取消订阅 +// * @param id +// * @return +// */ +// @AutoLog(value = "取消订阅") +// @ApiOperation(value="取消订阅", notes="取消订阅") +// @GetMapping(value = "/cancelSubscribe") +// @RequiresPermissions("document:addSubscribe") +// public Result cancelSubscribe(String id) { +// try { +// bussDocumentLibraryEOService.cancelSubscribe(id); +// } catch (Exception e) { +// return Result.error("取消订阅失败"); +// } +// return Result.OK("取消订阅成功"); +// } +// +// +// @ApiOperation(value = "导出excel") +// @GetMapping(value = "/exportExcel") +// @RequiresPermissions("document:exportExcel") +// public void exportExcel(@RequestParam Map map, +// HttpServletResponse response, +// HttpServletRequest request){ +// bussDocumentLibraryEOService.exportExcel(map,response,request); +// } +// +// @ApiOperation(value = "带文件导出") +// @GetMapping(value = "/exportZip") +// @RequiresPermissions("document:exportZip") +// public void exportZip(@RequestParam Map map, +// HttpServletResponse response, +// HttpServletRequest request) throws Exception { +// bussDocumentLibraryEOService.exportZip(map,response,request); +// } +// +// +// @ApiOperation(value = "模板下载") +// @GetMapping(value = "/exportTemplate") +// @RequiresPermissions("document:exportTemplate") +// public void exportTemplate(@RequestParam Map map, HttpServletResponse response, HttpServletRequest request) throws Exception { +// bussDocumentLibraryEOService.exportTemplate(map,response,request); +// } +// +// +// @ApiOperation(value = "导入.zip") +// @PostMapping(value = "/importZip") +// @RequiresPermissions("document:importZip") +// public Result importZip(@RequestParam(value = "file", required = false) MultipartFile file, +// @RequestParam(value = "cut",required = false) String cut) throws Exception { +// try { +// bussDocumentLibraryEOService.importZip(file,cut); +// } catch (Exception e) { +// e.printStackTrace(); +// return Result.error(e.getMessage()); +// } +// return Result.OK("导入成功"); +// } +// +// @ApiOperation(value = "推送") +// @GetMapping(value = "/pullMessage") +// @RequiresPermissions("document:pullMessage") +// public Result pullMessage(String departIds, String userIds, String documentIds) { +// +// bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds); +// +// return Result.OK("推送成功"); +// } +// +// +// +// /** +// * 验证文档是否被其他的文档绑定 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "验证文档是否被其他的文档绑定") +// @ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定") +// @GetMapping(value = "/verifyBind") +// public Result verifyBind(@RequestParam(name="ids",required=true) String ids) { +// String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(","))); +// return Result.OK(msg); +// } +// +// @AutoLog(value = "虚拟中心添加调用文档库数据--分页") +// @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") +// @PostMapping(value = "/queryPageInfoDummy") +// public Result queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO, +// HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap()); +// Page page = new Page(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize()); +// IPage pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO); +// return Result.OK(pageList); +// } +// +// +// @ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页") +// @PostMapping(value = "/queryPageDummy") +// @ResponseBody +// public JSONObject queryPageDummy(@RequestBody Map parameter) { +// IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter); +// Result ok = Result.OK(infoPage); +// JSONObject jsonResult = JSONObject.fromObject(ok); +// return jsonResult; +// } +// +// /** +// * 查看已上传的文件 +// * @param id +// * @return +// */ +// @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") +// @GetMapping(value = "/getFileInfos") +// @RequiresPermissions("document:queryPageInfo") +// public Result getFileInfos(String id) { +// List fileInfos = bussDocumentLibraryEOService.getFileInfos(id); +// return Result.OK(fileInfos); +// } +// /** +// * 根据id查询编号和标题 +// * @param id +// * @return +// */ +// @ApiOperation(value="查看已上传的文件", notes="查看已上传的文件") +// @GetMapping(value = "/getTitle") +// public Result getTitle(String id, String cut) { +// String title = bussDocumentLibraryEOService.getTitle(id, cut); +// return Result.OK(title); +// } +// @ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)") +// @GetMapping(value = "/updateES") +// public Result getTitle() { +// int count = bussDocumentLibraryEOService.updateES(); +// return Result.OK(count); +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/controller/PhonePhasedImplementationDetailsEOController.java b/laws-modules/src/main/java/com/jero/modules/document/controller/PhonePhasedImplementationDetailsEOController.java index 4ffddb46..affa4f2c 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/controller/PhonePhasedImplementationDetailsEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/document/controller/PhonePhasedImplementationDetailsEOController.java @@ -1,173 +1,173 @@ -package com.jero.modules.document.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.common.system.base.controller.JeroController; -import com.jero.common.system.query.QueryGenerator; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; -import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; -import java.util.List; - - -/** -* @Description: 文档库-分阶段实施详情表 -* @Author: jero-boot -* @Date: 2023-02-22 -* @Version: V1.0 -*/ -@Api(tags="文档库-分阶段实施详情表") -@RestController -@RequestMapping("/phone/document/phasedImplementationDetailsEO") -@Slf4j -public class PhonePhasedImplementationDetailsEOController extends JeroController { - @Autowired - private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService; - - /** - * 分页列表查询 - * - * @param phasedImplementationDetailsEO - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-分页列表查询") - @ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询") - @GetMapping(value = "/page") - public Result queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - @RequestParam(name="cut", defaultValue="cn") String cut, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = phasedImplementationDetailsEOService.page(page, queryWrapper); - this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut); - return Result.OK(pageList); - } - - /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-列表查询") - @ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { - List list = phasedImplementationDetailsEOService.queryList(); - return Result.OK(list); - } - - /** - * 添加 - * - * @param phasedImplementationDetailsEO - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-添加") - @ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param phasedImplementationDetailsEO - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-编辑") - @ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑") - @PostMapping(value = "/edit") - public Result edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-通过id删除") - @ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除") - @PostMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - phasedImplementationDetailsEOService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "文档库-分阶段实施详情表-批量删除") - @ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除") - @PostMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.phasedImplementationDetailsEOService.deleteByIds(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) { - PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id); - if(phasedImplementationDetailsEO==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(phasedImplementationDetailsEO); - } - - /** - * 导出excel - * - * @param request - * @param phasedImplementationDetailsEO - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表"); - } - - /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, PhasedImplementationDetailsEO.class); - } - -} +//package com.jero.modules.document.controller; +// +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.baomidou.mybatisplus.core.metadata.IPage; +//import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.common.system.base.controller.JeroController; +//import com.jero.common.system.query.QueryGenerator; +////import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +////import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.validation.annotation.Validated; +//import org.springframework.web.bind.annotation.*; +//import org.springframework.web.servlet.ModelAndView; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +//import java.util.Arrays; +//import java.util.List; +// +// +///** +//* @Description: 文档库-分阶段实施详情表 +//* @Author: jero-boot +//* @Date: 2023-02-22 +//* @Version: V1.0 +//*/ +//@Api(tags="文档库-分阶段实施详情表") +//@RestController +//@RequestMapping("/phone/document/phasedImplementationDetailsEO") +//@Slf4j +//public class PhonePhasedImplementationDetailsEOController extends JeroController { +// @Autowired +// private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService; +// +// /** +// * 分页列表查询 +// * +// * @param phasedImplementationDetailsEO +// * @param pageNo +// * @param pageSize +// * @param req +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-分页列表查询") +// @ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询") +// @GetMapping(value = "/page") +// public Result queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO, +// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, +// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, +// @RequestParam(name="cut", defaultValue="cn") String cut, +// HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap()); +// Page page = new Page(pageNo, pageSize); +// IPage pageList = phasedImplementationDetailsEOService.page(page, queryWrapper); +// this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut); +// return Result.OK(pageList); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-列表查询") +// @ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询") +// @GetMapping(value = "/list") +// public Result> queryList() { +// List list = phasedImplementationDetailsEOService.queryList(); +// return Result.OK(list); +// } +// +// /** +// * 添加 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-添加") +// @ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加") +// @PostMapping(value = "/add") +// public Result add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO); +// return Result.OK("添加成功!"); +// } +// +// /** +// * 编辑 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-编辑") +// @ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑") +// @PostMapping(value = "/edit") +// public Result edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO); +// return Result.OK("编辑成功!"); +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-通过id删除") +// @ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除") +// @PostMapping(value = "/delete") +// public Result delete(@RequestParam(name="id",required=true) String id) { +// phasedImplementationDetailsEOService.deleteById(id); +// return Result.OK("删除成功!"); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @AutoLog(value = "文档库-分阶段实施详情表-批量删除") +// @ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除") +// @PostMapping(value = "/deleteBatch") +// public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { +// this.phasedImplementationDetailsEOService.deleteByIds(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) { +// PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id); +// if(phasedImplementationDetailsEO==null) { +// return Result.error("未找到对应数据"); +// } +// return Result.OK(phasedImplementationDetailsEO); +// } +// +// /** +// * 导出excel +// * +// * @param request +// * @param phasedImplementationDetailsEO +// */ +// @RequestMapping(value = "/exportXls") +// public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表"); +// } +// +// /** +// * 通过excel导入数据 +// * +// * @param request +// * @param response +// * @return +// */ +// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) +// public Result importExcel(HttpServletRequest request, HttpServletResponse response) { +// return super.importExcel(request, response, PhasedImplementationDetailsEO.class); +// } +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/entity/BussDocumentLibraryEO.java b/laws-modules/src/main/java/com/jero/modules/document/entity/BussDocumentLibraryEO.java index d1718ec9..e2c4f9e9 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/entity/BussDocumentLibraryEO.java +++ b/laws-modules/src/main/java/com/jero/modules/document/entity/BussDocumentLibraryEO.java @@ -1,107 +1,107 @@ -package com.jero.modules.document.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.jero.common.aspect.annotation.Dict; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; - - -/** - * @Description: 文档库信息表 - * @Author: jero-boot - * @Date: 2022-01-21 - * @Version: V1.0 - */ -@Data -@TableName("buss_document_library") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="buss_document_library对象", description="文档库信息表") -public class BussDocumentLibraryEO implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**编号*/ - @ApiModelProperty(value = "编号") - private String serialNumber; - - /**标题*/ - @ApiModelProperty(value = "标题") - private String title; - - private String titleEn; - - /**适用范围*/ - @ApiModelProperty(value = "适用范围") - private String shi4Yong4Fan4Wei2; - - /**适用地区*/ - @ApiModelProperty(value = "适用地区") - private String region; - /**适用地区*/ - @ApiModelProperty(value = "类别") - private String lei4Bie2; - - /**状态*/ - @ApiModelProperty(value = "状态") - @Dict(dicCode ="state") - private String state; - - /**技术领域*/ - @ApiModelProperty(value = "技术领域") - @Dict(dicCode ="technology_territory") - private String technologyTerritory; - - /**新车型实施日期*/ - @ApiModelProperty(value = "新车型实施日期") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1; - - /**在产车实施日期*/ - @ApiModelProperty(value = "在产车实施日期") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - private java.util.Date implementTime; - - /**对应标准*/ - @ApiModelProperty(value = "对应标准") - private String correspondingStandard; - - - /**代替标准*/ - @ApiModelProperty(value = "代替标准") - @Dict(dicCode ="replace_standard") - private String replaceStandard; - - - /**被代替标准*/ - @ApiModelProperty(value = "被代替标准") - @Dict(dicCode ="replaced_standard") - private String replacedStandard; - - - - @TableField(exist = false) - private String cut; - - @TableField(exist = false) - private Integer pageNo; - @TableField(exist = false) - private Integer pageSize; - -} +//package com.jero.modules.document.entity; +// +//import com.baomidou.mybatisplus.annotation.IdType; +//import com.baomidou.mybatisplus.annotation.TableField; +//import com.baomidou.mybatisplus.annotation.TableId; +//import com.baomidou.mybatisplus.annotation.TableName; +//import com.fasterxml.jackson.annotation.JsonFormat; +//import com.jero.common.aspect.annotation.Dict; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +//import lombok.experimental.Accessors; +//import org.springframework.format.annotation.DateTimeFormat; +// +//import java.io.Serializable; +// +// +///** +// * @Description: 文档库信息表 +// * @Author: jero-boot +// * @Date: 2022-01-21 +// * @Version: V1.0 +// */ +//@Data +//@TableName("buss_document_library") +//@Accessors(chain = true) +//@EqualsAndHashCode(callSuper = false) +//@ApiModel(value="buss_document_library对象", description="文档库信息表") +//public class BussDocumentLibraryEO implements Serializable { +// private static final long serialVersionUID = 1L; +// +// /**主键*/ +// @TableId(type = IdType.ASSIGN_ID) +// @ApiModelProperty(value = "主键") +// private String id; +// +// /**编号*/ +// @ApiModelProperty(value = "编号") +// private String serialNumber; +// +// /**标题*/ +// @ApiModelProperty(value = "标题") +// private String title; +// +// private String titleEn; +// +// /**适用范围*/ +// @ApiModelProperty(value = "适用范围") +// private String shi4Yong4Fan4Wei2; +// +// /**适用地区*/ +// @ApiModelProperty(value = "适用地区") +// private String region; +// /**适用地区*/ +// @ApiModelProperty(value = "类别") +// private String lei4Bie2; +// +// /**状态*/ +// @ApiModelProperty(value = "状态") +// @Dict(dicCode ="state") +// private String state; +// +// /**技术领域*/ +// @ApiModelProperty(value = "技术领域") +// @Dict(dicCode ="technology_territory") +// private String technologyTerritory; +// +// /**新车型实施日期*/ +// @ApiModelProperty(value = "新车型实施日期") +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") +// @DateTimeFormat(pattern="yyyy-MM-dd") +// private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1; +// +// /**在产车实施日期*/ +// @ApiModelProperty(value = "在产车实施日期") +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") +// @DateTimeFormat(pattern="yyyy-MM-dd") +// private java.util.Date implementTime; +// +// /**对应标准*/ +// @ApiModelProperty(value = "对应标准") +// private String correspondingStandard; +// +// +// /**代替标准*/ +// @ApiModelProperty(value = "代替标准") +// @Dict(dicCode ="replace_standard") +// private String replaceStandard; +// +// +// /**被代替标准*/ +// @ApiModelProperty(value = "被代替标准") +// @Dict(dicCode ="replaced_standard") +// private String replacedStandard; +// +// +// +// @TableField(exist = false) +// private String cut; +// +// @TableField(exist = false) +// private Integer pageNo; +// @TableField(exist = false) +// private Integer pageSize; +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/entity/PhasedImplementationDetailsEO.java b/laws-modules/src/main/java/com/jero/modules/document/entity/PhasedImplementationDetailsEO.java index a1c7b022..3803b200 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/entity/PhasedImplementationDetailsEO.java +++ b/laws-modules/src/main/java/com/jero/modules/document/entity/PhasedImplementationDetailsEO.java @@ -1,98 +1,98 @@ -package com.jero.modules.document.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.util.Date; - - -/** - * @Description: 文档库-分阶段实施详情表 - * @Author: jero-boot - * @Date: 2023-02-22 - * @Version: V1.0 - */ -@Data -@TableName("phased_implementation_details") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="phased_implementation_details对象", description="文档库-分阶段实施详情表") -public class PhasedImplementationDetailsEO implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**创建人*/ - @ApiModelProperty(value = "创建人") - private String createBy; - - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建日期") - private Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**文档库id*/ - @Excel(name = "文档库id", width = 15) - @ApiModelProperty(value = "文档库id") - private String bussDocumentLibraryId; - - /**法规编号/条款*/ - @Excel(name = "法规编号/条款", width = 15) - @ApiModelProperty(value = "法规编号/条款") - private String standNumberOrClause; - - /**实施类型*/ - @Excel(name = "实施类型", width = 15) - @ApiModelProperty(value = "实施类型") - private String implementationType; - - /**实施类型展示文本**/ - @TableField(exist = false) - private String implementationTypeText; - - /**实施日期*/ - @Excel(name = "实施日期", width = 15, format = "yyyy-MM-dd") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "实施日期") - private Date implementationDate; - - /**备注*/ - @Excel(name = "备注", width = 15) - @ApiModelProperty(value = "备注") - private String remarks; - - /**排序号*/ - @Excel(name = "排序号", width = 15) - @ApiModelProperty(value = "排序号") - private Integer orderNum; -} +//package com.jero.modules.document.entity; +// +//import com.baomidou.mybatisplus.annotation.IdType; +//import com.baomidou.mybatisplus.annotation.TableField; +//import com.baomidou.mybatisplus.annotation.TableId; +//import com.baomidou.mybatisplus.annotation.TableName; +//import com.fasterxml.jackson.annotation.JsonFormat; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +//import lombok.experimental.Accessors; +//import org.jeecgframework.poi.excel.annotation.Excel; +//import org.springframework.format.annotation.DateTimeFormat; +// +//import java.io.Serializable; +//import java.util.Date; +// +// +///** +// * @Description: 文档库-分阶段实施详情表 +// * @Author: jero-boot +// * @Date: 2023-02-22 +// * @Version: V1.0 +// */ +//@Data +//@TableName("phased_implementation_details") +//@Accessors(chain = true) +//@EqualsAndHashCode(callSuper = false) +//@ApiModel(value="phased_implementation_details对象", description="文档库-分阶段实施详情表") +//public class PhasedImplementationDetailsEO implements Serializable { +// private static final long serialVersionUID = 1L; +// +// /**主键*/ +// @TableId(type = IdType.ASSIGN_ID) +// @ApiModelProperty(value = "主键") +// private String id; +// +// /**创建人*/ +// @ApiModelProperty(value = "创建人") +// private String createBy; +// +// /**创建日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "创建日期") +// private Date createTime; +// +// /**更新人*/ +// @ApiModelProperty(value = "更新人") +// private String updateBy; +// +// /**更新日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "更新日期") +// private Date updateTime; +// +// /**所属部门*/ +// @ApiModelProperty(value = "所属部门") +// private String sysOrgCode; +// +// /**文档库id*/ +// @Excel(name = "文档库id", width = 15) +// @ApiModelProperty(value = "文档库id") +// private String bussDocumentLibraryId; +// +// /**法规编号/条款*/ +// @Excel(name = "法规编号/条款", width = 15) +// @ApiModelProperty(value = "法规编号/条款") +// private String standNumberOrClause; +// +// /**实施类型*/ +// @Excel(name = "实施类型", width = 15) +// @ApiModelProperty(value = "实施类型") +// private String implementationType; +// +// /**实施类型展示文本**/ +// @TableField(exist = false) +// private String implementationTypeText; +// +// /**实施日期*/ +// @Excel(name = "实施日期", width = 15, format = "yyyy-MM-dd") +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") +// @DateTimeFormat(pattern="yyyy-MM-dd") +// @ApiModelProperty(value = "实施日期") +// private Date implementationDate; +// +// /**备注*/ +// @Excel(name = "备注", width = 15) +// @ApiModelProperty(value = "备注") +// private String remarks; +// +// /**排序号*/ +// @Excel(name = "排序号", width = 15) +// @ApiModelProperty(value = "排序号") +// private Integer orderNum; +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/mapper/BussDocumentLibraryEOMapper.java b/laws-modules/src/main/java/com/jero/modules/document/mapper/BussDocumentLibraryEOMapper.java index 4cfa302f..2dfd534a 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/mapper/BussDocumentLibraryEOMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/document/mapper/BussDocumentLibraryEOMapper.java @@ -2,7 +2,7 @@ package com.jero.modules.document.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.entity.BussDocumentLibraryEO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,89 +14,90 @@ import java.util.Map; * @Date: 2022-01-21 * @Version: V1.0 */ -public interface BussDocumentLibraryEOMapper extends BaseMapper { - - int insertInfo(@Param("insertField") String insertField, - @Param("insertValue") String insertValue); - - /** - * 分页查询 - * - * @param page - * @param field - * @param condition - * @return - */ - IPage> getInfoPage(@Param("page") IPage> page, - @Param("field") String field, - @Param("condition") String condition); - - - /** - * 列表查询 - * - * @param - * @param field - * @param condition - * @return - */ - List> getInfoList(@Param("field") String field, - @Param("condition") String condition); - - /** - * 代替标准分页 - * - * @param page - * @param field - * @param condition - * @return - */ - IPage> replacePageInfo(@Param("page") IPage page, - @Param("field") String field, - @Param("condition") String condition); - - /** - * ocr识别调取已入库文件分页 - * - * @param page - * @param field - * @param condition - * @return - */ - List> ocrPageInfo( - @Param("field") String field, - @Param("condition") String condition); - - - /** - * 根据代替标准列表查询 - * - * @param - * @param replaceStandard - * @return - */ - List> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard); - +@Deprecated +public interface BussDocumentLibraryEOMapper extends BaseMapper { +// int insertInfo(@Param("insertField") String insertField, +// @Param("insertValue") String insertValue); +// +// /** +// * 分页查询 +// * +// * @param page +// * @param field +// * @param condition +// * @return +// */ +// IPage> getInfoPage(@Param("page") IPage> page, +// @Param("field") String field, +// @Param("condition") String condition); +// +// +// /** +// * 列表查询 +// * +// * @param +// * @param field +// * @param condition +// * @return +// */ +// List> getInfoList(@Param("field") String field, +// @Param("condition") String condition); +// +// /** +// * 代替标准分页 +// * +// * @param page +// * @param field +// * @param condition +// * @return +// */ +// IPage> replacePageInfo(@Param("page") IPage page, +// @Param("field") String field, +// @Param("condition") String condition); +// +// /** +// * ocr识别调取已入库文件分页 +// * +// * @param page +// * @param field +// * @param condition +// * @return +// */ +// List> ocrPageInfo( +// @Param("field") String field, +// @Param("condition") String condition); +// +// +// /** +// * 根据代替标准列表查询 +// * +// * @param +// * @param replaceStandard +// * @return +// */ +// List> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard); +// +// List> getListBySerialNumber(@Param("serialNumbers") String serialNumbers); List getListBySerialNumberFuzzy(@Param("serialNumber") String serialNumber); - List> selectMapsAll(@Param("ids") String ids); - - List> selectMapsAllBySerialNumber(@Param("serialNumberList") String serialNumberList); - - List> getListInfo(@Param("condition") String condition); - - List> selectMapsByDeleteIds(@Param("id") String id); - - void updateByDeleteId(@Param("correspondingStandardStr") String correspondingStandardStr, - @Param("replaceStandardStr") String replaceStandardStr, - @Param("id") String id ); - List> queryListByIds(@Param("ids") String ids); - - BussDocumentLibraryEO getBySerialNumber(@Param("serialNumber") String serialNumber); +// List> selectMapsAll(@Param("ids") String ids); +// +// List> selectMapsAllBySerialNumber(@Param("serialNumberList") String serialNumberList); +// +// List> getListInfo(@Param("condition") String condition); +// +// List> selectMapsByDeleteIds(@Param("id") String id); +// +// void updateByDeleteId(@Param("correspondingStandardStr") String correspondingStandardStr, +// @Param("replaceStandardStr") String replaceStandardStr, +// @Param("id") String id ); +// List> queryListByIds(@Param("ids") String ids); +// +// BussDocumentLibraryEO getBySerialNumber(@Param("serialNumber") String serialNumber); } diff --git a/laws-modules/src/main/java/com/jero/modules/document/mapper/PhasedImplementationDetailsEOMapper.java b/laws-modules/src/main/java/com/jero/modules/document/mapper/PhasedImplementationDetailsEOMapper.java index 9bceb74c..da3fb512 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/mapper/PhasedImplementationDetailsEOMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/document/mapper/PhasedImplementationDetailsEOMapper.java @@ -1,14 +1,14 @@ -package com.jero.modules.document.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; - -/** - * @Description: 文档库-分阶段实施详情表 - * @Author: jero-boot - * @Date: 2023-02-22 - * @Version: V1.0 - */ -public interface PhasedImplementationDetailsEOMapper extends BaseMapper { - -} +//package com.jero.modules.document.mapper; +// +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +// +///** +// * @Description: 文档库-分阶段实施详情表 +// * @Author: jero-boot +// * @Date: 2023-02-22 +// * @Version: V1.0 +// */ +//public interface PhasedImplementationDetailsEOMapper extends BaseMapper { +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/BussDocumentLibraryEOMapper.xml b/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/BussDocumentLibraryEOMapper.xml index 90d9be49..1887359b 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/BussDocumentLibraryEOMapper.xml +++ b/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/BussDocumentLibraryEOMapper.xml @@ -1,123 +1,123 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - insert into buss_document_library(${insertField}) - values (${insertValue}) - + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - - + + + + + + + + + + + - + + + + + + + + + + - + + + + - + + + + + - - update buss_document_library set - corresponding_standard =#{correspondingStandardStr},replace_standard=#{replaceStandardStr} - where id=#{id} - + + + + + - + + + + + + + - + + + + diff --git a/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/PhasedImplementationDetailsEOMapper.xml b/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/PhasedImplementationDetailsEOMapper.xml deleted file mode 100644 index dde0b329..00000000 --- a/laws-modules/src/main/java/com/jero/modules/document/mapper/xml/PhasedImplementationDetailsEOMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/IBussDocumentLibraryEOService.java b/laws-modules/src/main/java/com/jero/modules/document/service/IBussDocumentLibraryEOService.java index 5254dc61..d787162d 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/IBussDocumentLibraryEOService.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/IBussDocumentLibraryEOService.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.entity.OSSFileForDocumentLibrary; import com.jero.modules.document.vo.QueryConditionVO; import com.jero.modules.oss.entity.OSSFile; @@ -21,38 +21,39 @@ import java.util.Map; * @Date: 2022-01-21 * @Version: V1.0 */ -public interface IBussDocumentLibraryEOService extends IService { +@Deprecated +public interface IBussDocumentLibraryEOService extends IService { - /** - * 通过id删除 - * - * @param id - * @return - */ - void deleteById(String id); - - /** - * 批量删除 - * - * @param ids - * @return - */ - void deleteByIds(List ids,String cut); - - /** - * 通过id查询 - * - * @param id - * @return - */ - BussDocumentLibraryEO queryById(String id); - - /** - * 列表查询 - * - * @return - */ - List queryList(); +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// void deleteById(String id); +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// void deleteByIds(List ids,String cut); +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// BussDocumentLibraryEO queryById(String id); +// +// /** +// * 列表查询 +// * +// * @return +// */ +// List queryList(); /** * 查询条件 @@ -61,176 +62,176 @@ public interface IBussDocumentLibraryEOService extends IService> queryCondition(String flag, String cut,String searchFlag); - /** - * 查询条件(法规清单或虚拟清单高级搜索需要的数据) - * - * @return - */ - List> queryConditionInventory(String flag, String cut); +// /** +// * 查询条件(法规清单或虚拟清单高级搜索需要的数据) +// * +// * @return +// */ +// List> queryConditionInventory(String flag, String cut); - /** - * 列表表头 - * - * @return - */ - List> getHeader(String flag, String cut,String searchFlag); +// /** +// * 列表表头 +// * +// * @return +// */ +// List> getHeader(String flag, String cut,String searchFlag); +// +// /** +// * 新增表单 +// * +// * @return +// */ +// List> getAddForm(String flag, String cut, String type); +// +// /** +// * 编辑数据查询 +// * +// * @param id +// * @return +// */ +// List> getDocumentInfoById(String id, String cut); - /** - * 新增表单 - * - * @return - */ - List> getAddForm(String flag, String cut, String type); +// /** +// * 详情数据查询 +// * +// * @param id +// * @return +// */ +// List> getInfoById(String id, String cut); +// +// List> getMenuList(String id, String cut); +// /** +// * 新增数据 +// * +// * @param map +// */ +// void addInfo(Map map); +// +// /** +// * 编辑数据 +// * +// * @param map +// */ +// void updateInfo(Map map); - /** - * 编辑数据查询 - * - * @param id - * @return - */ - List> getDocumentInfoById(String id, String cut); +// /** +// * 分页 +// * +// * @param parameter +// * @return +// */ +// IPage getInfoPage(Map parameter); +// +// /** +// * 代替标准分页 +// * +// * @param parameter +// * @return +// */ +// IPage replacePageInfo(Map parameter); - /** - * 详情数据查询 - * - * @param id - * @return - */ - List> getInfoById(String id, String cut); +// /** +// * ocr识别调取已入库文件分页 +// * +// * @param parameter +// * @return +// */ +// IPage> ocrPageInfo(Map parameter); - List> getMenuList(String id, String cut); - /** - * 新增数据 - * - * @param map - */ - void addInfo(Map map); +// /** +// * 添加收藏 +// * +// * @param id +// */ +// void addCollect(String id); +// +// /** +// * 取消收藏 +// * +// * @param id +// */ +// void cancelCollect(String id); +// +// /** +// * 添加订阅 +// * +// * @param id +// */ +// void addSubscribe(String id); +// +// /** +// * 取消订阅 +// * +// * @param id +// */ +// void cancelSubscribe(String id); +// +// +// /** +// * 导出excel +// * +// * @param map +// * @param response +// * @param request +// */ +// void exportExcel(Map map, +// HttpServletResponse response, +// HttpServletRequest request); +// +// void exportZip(Map map, +// HttpServletResponse response, +// HttpServletRequest request); - /** - * 编辑数据 - * - * @param map - */ - void updateInfo(Map map); - - /** - * 分页 - * - * @param parameter - * @return - */ - IPage getInfoPage(Map parameter); - - /** - * 代替标准分页 - * - * @param parameter - * @return - */ - IPage replacePageInfo(Map parameter); - - /** - * ocr识别调取已入库文件分页 - * - * @param parameter - * @return - */ - IPage> ocrPageInfo(Map parameter); - - /** - * 添加收藏 - * - * @param id - */ - void addCollect(String id); - - /** - * 取消收藏 - * - * @param id - */ - void cancelCollect(String id); - - /** - * 添加订阅 - * - * @param id - */ - void addSubscribe(String id); - - /** - * 取消订阅 - * - * @param id - */ - void cancelSubscribe(String id); - - - /** - * 导出excel - * - * @param map - * @param response - * @param request - */ - void exportExcel(Map map, - HttpServletResponse response, - HttpServletRequest request); - - void exportZip(Map map, - HttpServletResponse response, - HttpServletRequest request); - - /** - * 模板下载 - * - * @param response - * @param request - */ - void exportTemplate(Map map, HttpServletResponse response, HttpServletRequest request); - - /** - * ocr识别调取已入库文件-中英文切换 - * - * @param flag - * @param cut - * @return - */ - List> getHeaderOrConditionForOcr(String flag, String cut); +// /** +// * 模板下载 +// * +// * @param response +// * @param request +// */ +// void exportTemplate(Map map, HttpServletResponse response, HttpServletRequest request); +// +// /** +// * ocr识别调取已入库文件-中英文切换 +// * +// * @param flag +// * @param cut +// * @return +// */ +// List> getHeaderOrConditionForOcr(String flag, String cut); List> getHeaderOrConditionForSplit(String flag, String cut); - String pullMessage(String departIds, String ids, String documentIds); - - void importZip(MultipartFile file,String cut); - - String verifyBind(List ids); - - List> queryListByIds(String ids); +// String pullMessage(String departIds, String ids, String documentIds); +// +// void importZip(MultipartFile file,String cut); +// +// String verifyBind(List ids); +// +// List> queryListByIds(String ids); List> getListBySerialNumber(String serialNumbers); List getListBySerialNumberFuzzy(String serialNumber); - List getFileInfos(String id); - - - IPage queryPageInfoDummy(Page page, QueryWrapper queryWrapper,BussDocumentLibraryEO bussDocumentLibraryEO); - - IPage getPageDummy(Map parameter); - - void isModifyForOcrAndSplit(Map parameter); - - String getTitle(String id,String cut); - - String sqlJoint(List queryConditionVOList); - - int updateES(); - - /** - * 根据serialNumber获取BussDumentLibrar对象 - * @param serialNumber - * @return - */ - BussDocumentLibraryEO getBySerialNumber(String serialNumber); +// List getFileInfos(String id); +// +// +// IPage queryPageInfoDummy(Page page, QueryWrapper queryWrapper,BussDocumentLibraryEO bussDocumentLibraryEO); +// +// IPage getPageDummy(Map parameter); +// +// void isModifyForOcrAndSplit(Map parameter); +// +// String getTitle(String id,String cut); +// +// String sqlJoint(List queryConditionVOList); +// +// int updateES(); +// +// /** +// * 根据serialNumber获取BussDumentLibrar对象 +// * @param serialNumber +// * @return +// */ +// BussDocumentLibraryEO getBySerialNumber(String serialNumber); } diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/IPhasedImplementationDetailsEOService.java b/laws-modules/src/main/java/com/jero/modules/document/service/IPhasedImplementationDetailsEOService.java index d8d03030..50411784 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/IPhasedImplementationDetailsEOService.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/IPhasedImplementationDetailsEOService.java @@ -1,66 +1,66 @@ -package com.jero.modules.document.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; - -import java.util.List; - -/** - * @Description: 文档库-分阶段实施详情表 - * @Author: jero-boot - * @Date: 2023-02-22 - * @Version: V1.0 - */ -public interface IPhasedImplementationDetailsEOService extends IService { - - /** - * 保存 - * - * @param phasedImplementationDetailsEO - * @return - */ - void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO); - - /** - * 更新 - * - * @param phasedImplementationDetailsEO - * @return - */ - void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO); - - /** - * 通过id删除 - * - * @param id - * @return - */ - void deleteById(String id); - - /** - * 批量删除 - * - * @param ids - * @return - */ - void deleteByIds(List ids); - - /** - * 通过id查询 - * - * @param id - * @return - */ - PhasedImplementationDetailsEO queryById(String id); - - /** - * 列表查询 - * - * @return - */ - List queryList(); - - boolean insertBatch(List phasedImplDetailsEOList); - - void disposeData(List datas, String cut); -} +//package com.jero.modules.document.service; +// +//import com.baomidou.mybatisplus.extension.service.IService; +//import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +// +//import java.util.List; +// +///** +// * @Description: 文档库-分阶段实施详情表 +// * @Author: jero-boot +// * @Date: 2023-02-22 +// * @Version: V1.0 +// */ +//public interface IPhasedImplementationDetailsEOService extends IService { +// +// /** +// * 保存 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO); +// +// /** +// * 更新 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO); +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// void deleteById(String id); +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// void deleteByIds(List ids); +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// PhasedImplementationDetailsEO queryById(String id); +// +// /** +// * 列表查询 +// * +// * @return +// */ +// List queryList(); +// +// boolean insertBatch(List phasedImplDetailsEOList); +// +// void disposeData(List datas, String cut); +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index 717b06c7..41345879 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -23,18 +23,14 @@ import com.jero.common.util.DateUtils; import com.jero.common.util.MinioUtil; import com.jero.generater.modules.online.cgform.entity.OnlCgformField; import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; -import com.jero.modules.collection.entity.OnlCgformCollection; -import com.jero.modules.collection.service.IOnlCgformCollectionService; -import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.entity.OSSFileForDocumentLibrary; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; import com.jero.modules.document.enums.FieldTypeEnum; import com.jero.modules.document.enums.ImplementationTypeEnum; import com.jero.modules.document.enums.LawsStateEnum; import com.jero.modules.document.enums.SearchEnum; import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper; import com.jero.modules.document.service.IBussDocumentLibraryEOService; -import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; import com.jero.modules.document.utils.ReadPdfUtil; import com.jero.modules.document.utils.ReadWordUtil; import com.jero.modules.document.vo.QueryConditionVO; @@ -104,7 +100,8 @@ import java.util.stream.Collectors; */ @Service @Transactional -public class BussDocumentLibraryEOServiceImpl extends ServiceImpl implements IBussDocumentLibraryEOService { +@Deprecated +public class BussDocumentLibraryEOServiceImpl extends ServiceImpl implements IBussDocumentLibraryEOService { @Autowired private OnlCgformFieldServiceImpl onlCgformFieldService; @@ -117,8 +114,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl ids,String cut) { - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - //字段属性 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - //文件类型字段 - List fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @Override +// public void deleteByIds(List ids,String cut) { +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// //字段属性 +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); +// //文件类型字段 +// List fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// +// //删除文件 +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(StringUtils.join(ids, ",")); +// +// List dictItemList = sysDictItemServiceImpl.selectItemsAll(); +// +// +// +// List connectIdList = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldFileList) { +// for (Map map : mapList) { +// String connectId = (String) map.get(onlCgformField.getDbFieldName()); +// if (StringUtils.isNotBlank(connectId)) { +// connectIdList.add(connectId); +// } +// } +// } +// List files = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); +// List fileIdList = files.stream().map(OSSFile::getId).collect(Collectors.toList()); +// //删除文件 +// iOSSFileService.deleteByConnectIdList(connectIdList); +// //删除文档库数据 +// removeByIds(ids); +// //修改对应标准,代替标准中已删除的标准 +// updateDeletedDate(ids); +// ////订阅的文档id +// //List documentIds = onlCgformSubscribeList.stream().map(OnlCgformSubscribe::getDocumentId).collect(Collectors.toList()); +// List serialNumberList = new ArrayList<>(); +// List serialNumberListTemp = new ArrayList<>(); +// List serialNumberListTempCn = new ArrayList<>(); +// StringBuilder sb = new StringBuilder(); +// StringBuilder sbTemp = new StringBuilder(); +// for (Map map : mapList) { +// String id = (String) map.get("id"); +// String serialNumber = (String) map.get("serial_number"); +// String titleEn = (String) map.get("title_en"); +// String title = (String) map.get("title"); +// //文档动态------------------- +// String hrefTemp ="" + serialNumber + "" + " " + titleEn + ","; +// sbTemp.append(hrefTemp); +// serialNumberListTemp.add(serialNumber + " " + titleEn); +// serialNumberListTempCn.add(serialNumber + " " + title); +// //--------------------------- +// //if (documentIds.size() != 0 && documentIds.contains((String) map.get("id"))) { +// // serialNumberList.add(serialNumber); +// // String href = "" + serialNumber + "" + " " + titleEn + ","; - sbTemp.append(hrefTemp); - serialNumberListTemp.add(serialNumber + " " + titleEn); - serialNumberListTempCn.add(serialNumber + " " + title); - //--------------------------- - //if (documentIds.size() != 0 && documentIds.contains((String) map.get("id"))) { - // serialNumberList.add(serialNumber); - // String href = " fieldFile = null; +// try { +// fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) { +// String valueTemp = UUID.randomUUID().toString().replace("-", ""); +// stringObjectMap.put(key,valueTemp); +// // value = valueTemp; +// //修改文件表关联信息connect_id +// List oSSFileList = new ArrayList<>(); +// for (String fileId : value.toString().split(",")) { +// OSSFile ossFile = new OSSFile(); +// ossFile.setId(fileId); +// ossFile.setConnectId(valueTemp); +// oSSFileList.add(ossFile); +// } +// if (oSSFileList.size() != 0) { +// oSSFileAll.addAll(oSSFileList); +// } +// iOSSFileService.updateFileInfo(oSSFileList); +// +// valuesBuilder.append("," + "'" + valueTemp + "'"); +// } else { +// valuesBuilder.append("," + "'" + value + "'"); +// } +// } +// fieldsBuilder.append("," + key); +// } +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// // 将用户选择、输入的新车型实施日期、在产车实施日期备份出来。如果不处理的话,插入ES时会报 解析失败 错误。 +// String implement_time = (String) map.get("implement_time"); +// String xin1_che1_xing2_shi2_shi1_ri4_qi1 = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); +// +// map.put("id", idTemp); +// // 批量添加分阶段实施明细信息 +// this.insertBatchPhasedImplementationDetailsInfo(map); +// +// +// //sbCn sbEn 这两个字段作为es中英文切换 +// StringBuilder sbCn = new StringBuilder(); +// StringBuilder sbEn = new StringBuilder(); +// for (Map.Entry entry : map.entrySet()) { +// //es全文新增数据(数据转换) +// esFullText(cut, fieldList, categoryList, dictItemList, mapList, sbCn,sbEn, entry); +// } +// +// // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 +// map.put("implement_time",implement_time); +// map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); +// +// +// //多文件es +// List fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList()); +// List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); +// +// //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) +// List ossFileList = fileSort(fieldFileList, fileInfos, stringObjectMap); +// +// List> mapListTempCn = new ArrayList<>(); +// List> mapListTempEn = new ArrayList<>(); +// StringBuilder fileTextAll = new StringBuilder(); +// try { +// String cutCn = LanguageEnum.CN.getValue(); +// String cutEn = LanguageEnum.EN.getValue(); +// if (ossFileList.size() != 0) { +// Map mapBaseDateCn = new HashMap<>(); +// Map mapBaseDateEn = new HashMap<>(); +// for (OSSFile ossFile : ossFileList) { +// Map stringMapCn = new HashMap<>(); +// Map stringMapEn = new HashMap<>(); +// stringMapCn.put("create_time",new Date()); +// stringMapEn.put("create_time",new Date()); +// String fileText = ""; +// if (ossFile.getFileName().endsWith(".doc") +// || ossFile.getFileName().endsWith(".docx") +// || ossFile.getFileName().endsWith(".DOC") +// || ossFile.getFileName().endsWith(".DOCX")) { +// +// String wordContent = null; +// try { +// wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); +// } catch (Exception e) { +// log.error("文档库: 读取word内容失败"); +// } +// if (StringUtils.isNotBlank(wordContent)) { +// fileText = wordContent; +// fileTextAll.append(fileText+","); +// } +// } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { +// String pdfContent = null; +// try { +// pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); +// } catch (Exception e) { +// log.error("文档库: 读取PDF文件内容失败"); +// } +// if (StringUtils.isNotBlank(pdfContent)) { +// fileText = pdfContent; +// fileTextAll.append(fileText+","); +// } +// } +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); +// if(StringUtils.isNotBlank(s)){ +// stringMapCn.put(onlCgformField.getDbFieldName(), s); +// stringMapEn.put(onlCgformField.getDbFieldName(), s); +// } +// } +// +// //文件相关封装中文的全文内容(es) +// putMapCn(idTemp + ossFile.getId(), MyStringUtils.valueOf(map.get("serial_number")), "文档库", +// sbCn.toString(), MyStringUtils.valueOf(map.get("title")), fileText, +// ossFile.getFileName(), cutCn, stringMapCn, null); +// //文件相关封装英文的全文内容(es) +// putMapCn(idTemp + ossFile.getId(), MyStringUtils.valueOf(map.get("serial_number")), "document library", +// sbEn.toString(), MyStringUtils.valueOf(map.get("title")), fileText, +// ossFile.getFileName(), cutEn, stringMapEn, null); +// +// mapListTempCn.add(stringMapCn); +// mapListTempEn.add(stringMapEn); +// int a = 1; +// int b = 1; +// for (Map objectMap : mapListTempCn) { +// a++; +// objectMap.put("file_sort",idTemp+"_"+a); +// } +// for (Map objectMap : mapListTempEn) { +// b++; +// objectMap.put("file_sort",idTemp+"_"+b); +// } +// } +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); +// if(StrUtil.isNotBlank(s)){ +// mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); +// mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); +// } +// } +// //基础数据(中文) +// putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "文档库", +// sbCn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", +// cutCn, mapBaseDateCn,SEARCH_FLAG); +// mapBaseDateCn.put("file_sort",idTemp+"_"+1); +// //基础数据(英文) +// putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "document library", +// sbEn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", +// cutEn, mapBaseDateEn,SEARCH_FLAG); +// mapBaseDateEn.put("file_sort",idTemp+"_"+1); +// mapListTempCn.add(mapBaseDateCn); +// mapListTempEn.add(mapBaseDateEn); +// } else { +// Map stringMapCn = new HashMap<>(); +// Map stringMapEn = new HashMap<>(); +// Map mapBaseDateCn = new HashMap<>(); +// Map mapBaseDateEn = new HashMap<>(); +// stringMapCn.put("create_time",new Date()); +// stringMapEn.put("create_time",new Date()); +// mapBaseDateCn.put("create_time",new Date()); +// mapBaseDateEn.put("create_time",new Date()); +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); +// if(StringUtils.isNotBlank(s)){ +// stringMapCn.put(onlCgformField.getDbFieldName(), s); +// stringMapEn.put(onlCgformField.getDbFieldName(), s); +// mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); +// mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); +// } +// } +// //封装中文的全文内容(es) +// putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutCn, stringMapCn, SEARCH_FLAG); +// stringMapCn.put("file_sort",idTemp+"_"+1); +// //封装英文的全文内容(es) +// putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutEn, stringMapEn,SEARCH_FLAG); +// stringMapEn.put("file_sort",idTemp+"_"+1); +// +// //用于全文带条件查询----------------------------- +// //封装中文的全文内容(es) +// putMapCn(idTemp+"1", MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutCn, mapBaseDateCn, null); +// mapBaseDateCn.put("file_sort",idTemp+"_"+1); +// //封装英文的全文内容(es) +// putMapCn(idTemp+"2", MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutEn, mapBaseDateEn,null); +// stringMapEn.put("file_sort",idTemp+"_"+1); +// //用于全文带条件查询----------------------------- +// mapListTempCn.add(stringMapCn); +// mapListTempEn.add(stringMapEn); +// mapListTempCn.add(mapBaseDateCn); +// mapListTempEn.add(mapBaseDateEn); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// log.error("文档库新增es错误"); +// } +// +// +// String insertField = mustFields + fieldsBuilder; +// String insertValue = mustValues + valuesBuilder; +// bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue); +// //处理代替标准和被代替标准逻辑 +// Object repObj = map.get("replace_standard_id"); +// if(null != repObj) { +// String[] replace_standard_list = repObj.toString().split(","); +// for (String rs : replace_standard_list) { +// BussDocumentLibraryEO bl = bussDocumentLibraryEOMapper.selectById(rs); +// if (null != bl) { +// String repStr = bl.getReplacedStandard(); +// if (StringUtils.isNotBlank(repStr)) { +// if (!repStr.contains(MyStringUtils.valueOf(map.get("serial_number")))) { +// repStr = repStr + "," + MyStringUtils.valueOf(map.get("serial_number")); +// } +// } else { +// repStr = MyStringUtils.valueOf(map.get("serial_number")); +// } +// bl.setReplacedStandard(repStr); +// bussDocumentLibraryEOMapper.updateById(bl); +// } +// } +// } +// +// String replaceStandard = MyStringUtils.valueOf(map.get("replace_standard")); +// if (StringUtils.isNotBlank(replaceStandard)) { +// //新增时如果填写代替标准,需要向填写的代替标准的负责人发消息 +// replaceStandardSend(Arrays.asList(replaceStandard.split(","))); +// } +// //添加es +// map.put("module_type", "文档库"); +// map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); +// map.put("create_time", new Date()); +// map.put("file_text",fileTextAll); +// JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map)); +// JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn)); +// JSONArray arrayEn = JSONArray.parseArray(JSON.toJSONString(mapListTempEn)); +// try { +// jeroElasticsearchTemplate.saveOrUpdate(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), idTemp, jsonObject); +// //全部 +// jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), arrayCn); +// jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), arrayEn); +// } catch (Exception e) { +// log.error("文档库添加es失败"); +// } +// } - List> Results = new ArrayList<>(); // 要返回的结果 - if (dataList.isEmpty()){ - // 取不到数据,直接返回空结果 - return Results; - } - //查询所有 - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); +// /** +// * //读取word或PDF文件内容 +// * +// * @param oSSFileList +// */ +// public List readFileContent(List oSSFileList) { +// //查询文件详细信息 +// List fileIdList = oSSFileList.stream().map(OSSFile::getId).collect(Collectors.toList()); +// oSSFileList = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); +// List Results = new ArrayList<>(); +// for (OSSFile ossFile : oSSFileList) { +// if (ossFile.getFileName().endsWith(".doc") +// || ossFile.getFileName().endsWith(".docx") +// || ossFile.getFileName().endsWith(".DOC") +// || ossFile.getFileName().endsWith(".DOCX")) { +// String wordContent = null; +// try { +// wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); +// } catch (Exception e) { +// log.error("文档库:读取word内容失败"); +// } +// if (StringUtils.isNotBlank(wordContent)) { +// Results.add(wordContent); +// } +// } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { +// String pdfContent = null; +// try { +// pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); +// } catch (Exception e) { +// log.error("文档库:读取pdf内容失败"); +// } +// if (StringUtils.isNotBlank(pdfContent)) { +// Results.add(pdfContent); +// } +// } +// } +// return Results; +// } - //区域管理 - LawsArea lawsArea = new LawsArea(); - lawsArea.setIsModel(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - List areaList = onlCgformAreaServiceImpl.queryList(lawsArea); +// private void esFullText(String cut, List fieldList, +// List categoryList, +// List dictItemList, +// List> mapList, +// StringBuilder sbCn, StringBuilder sbEn, +// Map.Entry entry) { +// try { +// List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// for (OnlCgformField onlCgformField : fieldList) { +// String fieldNameCn = onlCgformField.getDbFieldTxt(); +// String fieldNameEn = onlCgformField.getDbFieldEnName(); +// //输入框 +// if ((FieldTypeEnum.TEXT_STRING.getValue().equals(onlCgformField.getFieldShowType()) +// || FieldTypeEnum.TEXT_NUMBER.getValue().equals(onlCgformField.getFieldShowType())) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// sbCn.append(fieldNameCn + ":" + entry.getValue() + " "); +// sbEn.append(fieldNameEn + ":" + entry.getValue() + " "); +// } +// } +// //下拉框 +// if ((FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// List dictItems = dictItemList.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) +// .collect(Collectors.toList()); +// StringBuilder sbTextCn = new StringBuilder(); +// StringBuilder sbTextEn = new StringBuilder(); +// //处理数据字典 +// for (String item : entry.getValue().toString().split(",")) { +// if (dictItems.size() != 0) { +// List itemValue = dictItems.stream().filter(e -> item.equals(e.getItemValue())).collect(Collectors.toList()); +// if (itemValue.size() != 0) { +// sbTextCn.append(itemValue.get(0).getItemText() + ","); +// sbTextEn.append(itemValue.get(0).getEnName() + ","); +// } +// } +// } +// if (StringUtils.isNotBlank(sbTextCn)) { +// String substring = sbTextCn.substring(0, sbTextCn.length() - 1); +// sbCn.append(fieldNameCn + ":" + substring + " "); +// } +// if (StringUtils.isNotBlank(sbTextEn)) { +// String substring = sbTextEn.substring(0, sbTextEn.length() - 1); +// sbEn.append(fieldNameEn + ":" + substring + " "); +// } +// } +// } +// } +// //树形 +// if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType()) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// StringBuilder sbTreeCn = new StringBuilder(); +// StringBuilder sbTreeEn = new StringBuilder(); +// List idList = Arrays.asList(entry.getValue().toString().split(",")); +// List sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList()); +// List nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); +// List nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); +// sbTreeCn.append(StringUtils.join(nameList, ",")); +// sbTreeEn.append(StringUtils.join(nameEnList, ",")); +// sbCn.append(fieldNameCn + ":" + sbTreeCn + " "); +// sbEn.append(fieldNameEn + ":" + sbTreeEn + " "); +// } +// } +// +// //日期 +// if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// sbCn.append(fieldNameCn + ":" + entry.getValue().toString().split(" ")[0] + " "); +// sbEn.append(fieldNameEn + ":" + entry.getValue().toString().split(" ")[0] + " "); +// } +// } +// //标准选择 +// if (FieldTypeEnum.STANDARD.getValue().equals(onlCgformField.getFieldShowType()) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// StringBuilder standSb = new StringBuilder(); +// if ("replaced_standard".equals(entry.getKey())) { +// //被代替标准 +// for (Map stringObjectMap : mapList) { +// String replaceStandard = (String) stringObjectMap.get("replace_standard"); +// if (StringUtils.isNotBlank(replaceStandard) && replaceStandard.contains((String) entry.getValue())) { +// standSb.append(stringObjectMap.get("serial_number") + ","); +// } +// } +// } else { +// //对应标准,代替标准 +// standSb.append(entry.getValue().toString() + ","); +//// for (String valueTemp : entry.getValue().toString().split(",")) { +//// if (isId(valueTemp)) { +//// //是id +//// for (Map stringObjectMap : mapList) { +//// if (stringObjectMap.get("id").equals(valueTemp)) { +//// standSb.append(stringObjectMap.get("serial_number") + ","); +//// } +//// } +//// } else { +//// //不是id +//// standSb.append(valueTemp + ","); +//// } +//// } +// } +// +// if (StringUtils.isNotBlank(standSb)) { +// String substring = standSb.substring(0, standSb.length() - 1); +// sbCn.append(fieldNameCn + ":" + substring + " "); +// sbEn.append(fieldNameEn + ":" + substring + " "); +// } +// } +// } +// +// //文件 +// if (FieldTypeEnum.FILE.getValue().equals(onlCgformField.getFieldShowType()) +// && onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (ObjectUtils.isEmpty(entry.getValue())) { +// sbCn.append(fieldNameCn + ":" + "-- "); +// sbEn.append(fieldNameEn + ":" + "-- "); +// } else { +// List fileInfos = iOSSFileService.getFileInfos((String) entry.getValue()); +// List fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// sbCn.append(fieldNameCn + ":" + StringUtils.join(fileNameList, ",") + " "); +// sbEn.append(fieldNameEn + ":" + StringUtils.join(fileNameList, ",") + " "); +// } +// } +// } +// } catch (Exception e) { +// e.printStackTrace(); +// log.error("es全文转换失败"); +// } +// } - //过滤出下拉选 - List onlCgformFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); +// /** +// * 编辑数据 +// * +// * @param map +// */ +// @Override +// public void updateInfo(Map map) { +// String cut = (String) map.get("cut"); +// List list = this.list(); +// List serialNumberList = list.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); +// String serialNumber = MyStringUtils.valueOf(map.get("serial_number")); +// String id = MyStringUtils.valueOf(map.get("id")); +// String title = MyStringUtils.valueOf(map.get("title")); +// String titleEn = MyStringUtils.valueOf(map.get("title_en")); +// +// +// //通过id查询数据 +// List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); +// if(dataList.size() != 0){ +// String serialNumberTemp = MyStringUtils.valueOf(dataList.get(0).get("serial_number")); +// if(!serialNumberTemp.equals(serialNumber) && serialNumberList.contains(serialNumber)){ +// throw new JeroBootException("编号已存在不能重复添加"); +// } +// } +// //字段属性 +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); +// //普通数据字典 +// List dictItemList = sysDictItemServiceImpl.selectItemsAll(); +// //编辑时处理首页文档动态 1. 标准XXXX的状态改为 2. 标准XXXX的适用车型改为 3. 标准XXXX删除了XXXX文件 4. 标准XXXX上传了XXXX文件 +// homeDocumentDynamic(cut,map, serialNumber, id, title, dataList, fieldList,dictItemList,titleEn); +// +// +// try { +// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); +// String issueTime = ""; +// if(ObjectUtils.isNotEmpty(map.get("es_update_flag")) && ObjectUtils.isNotEmpty(map.get("issue_time"))){ +// map.put("issue_time",df.format(map.get("issue_time"))); +// }else{ +// issueTime = (String) map.get("issue_time"); +// } +// Date issueTimeDate = null; +// if(StringUtils.isNotBlank(issueTime)){ +// issueTimeDate = df.parse(issueTime); +// } +// if(ObjectUtils.isNotEmpty(map.get("es_update_flag"))){ +// if(ObjectUtils.isNotEmpty(map.get("implement_time"))){ +// map.put("implement_time",df.format(map.get("implement_time"))); +// } +// if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){ +// map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",df.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))); +// } +// } +// String implementTime = (String) map.get("implement_time");//在产车实施日期 +// String newCarimplementTime = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1");//新车型实施日期 +// if (StringUtils.isNotBlank(implementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { +// Date implementTimeDate = df.parse(implementTime); +// if (issueTimeDate.after(implementTimeDate)) { +// throw new JeroBootException("发布日期不能大于在产车实施日期"); +// } +// } +// if (StringUtils.isNotBlank(newCarimplementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { +// Date newCarimplementTimeDate = df.parse(newCarimplementTime); +// if (issueTimeDate.after(newCarimplementTimeDate)) { +// throw new JeroBootException("发布日期不能大于新车型实施日期"); +// } +// } +// +// } catch (ParseException e) { +// e.printStackTrace(); +// throw new JeroBootException(e.getMessage()); +// } +// +// +// +// map.remove("cut"); +// //获取搜索中心字段 +// List searchFieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(e.getIsShowSearch())).collect(Collectors.toList()); +// //时间类型字段 +// List fieldDateList = fieldList.stream() +// .filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// List dateSingleList = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //文件类型字段 +// List fieldFileList = fieldList.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// //下拉单选或下拉多选 +// List fieldPullList = fieldList.stream() +// .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// +// +// +// Map mapTemp = new HashMap<>(); +// mapCopy(map, mapTemp); +// +// List> dataListTemp = new ArrayList<>(); +// for (Map stringObjectMap : dataList) { +// Map mapT = new HashMap<>(); +// mapCopy(stringObjectMap, mapT); +// dataListTemp.add(mapT); +// } +// //编辑ES(更新搜索中心的历史数据,不需要发消息) +// if(ObjectUtils.isEmpty(map.get("es_update_flag"))){ +// //更新log +// updateLog(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut); +// //处理修改代替标准,发送通知 +// sendMessageUpdate(mapTemp, dataListTemp, fieldList, fieldDateList, fieldFileList, fieldPullList, cut); +// } +// +// +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //查询所有 +// List> listMap = bussDocumentLibraryEOMapper.selectMapsAll(null); +// +// //字段 +// StringBuilder fieldsBuilder = new StringBuilder(); +// //数据值 +// StringBuilder valuesBuilder = new StringBuilder(); +// +// +// //调整map中字段的顺序和新增表单中字段顺序一致 +// Map mapNew = new LinkedHashMap<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// for (Map.Entry entry : map.entrySet()) { +// //固定字段 +// if ("create_by".equals(entry.getKey()) +// || "create_time".equals(entry.getKey()) +// || "update_by".equals(entry.getKey()) +// || "update_time".equals(entry.getKey()) +// || "sys_org_code".equals(entry.getKey())) { +// mapNew.put(entry.getKey(), entry.getValue()); +// } else if (onlCgformField.getDbFieldName().equals(entry.getKey())) { +// mapNew.put(entry.getKey(), entry.getValue()); +// break; +// } +// } +// } +// List oSSFileAll = new ArrayList<>(); +// Map stringObjectMap = new HashMap<>(); +// for (Map.Entry entry : mapNew.entrySet()) { +// String key = entry.getKey(); +// Object value = entry.getValue(); +// //es全文新增数据(数据转换) +// // esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); +// +// if (ObjectUtils.isNotEmpty(value)) { +// //处理修改人和修改时间 +// if ("update_by".equals(key)) { +// //编辑ES时不处理(修改搜索中心历史数据) +// if(ObjectUtils.isEmpty(map.get("es_update_flag"))){ +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// value = sysUser.getUsername(); +// } +// } +// List fieldDate = fieldDateList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// //处理时间类型 +// if (fieldDate.size() != 0) { +// if (ObjectUtils.isNotEmpty(value)) { +// value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')"; +// } +// valuesBuilder.append(value + ","); +// } else { +// //处理文件类型 +// List fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) { +// +// //判断文件是否修改 +// if ((ObjectUtils.isNotEmpty(dataList.get(0).get(key)) && !dataList.get(0).get(key).equals(value)) +// || (ObjectUtils.isEmpty(dataList.get(0).get(key)) && ObjectUtils.isNotEmpty(value))) { +// String valueTemp = UUID.randomUUID().toString().replace("-", ""); +// stringObjectMap.put(key,valueTemp); +// //修改文件表关联信息connect_id +// List oSSFileList = new ArrayList<>(); +// for (String fileId : value.toString().split(",")) { +// OSSFile ossFile = new OSSFile(); +// ossFile.setId(fileId); +// ossFile.setConnectId(valueTemp); +// oSSFileList.add(ossFile); +// } +// if (oSSFileList.size() != 0) { +// oSSFileAll.addAll(oSSFileList); +// } +// iOSSFileService.updateFileInfo(oSSFileList); +// valuesBuilder.append("'" + valueTemp + "'" + ","); +// } else { +// List oSSFileList = new ArrayList<>(); +// OSSFile ossFile = new OSSFile(); +// ossFile.setId((String) value); +// oSSFileList.add(ossFile); +// valuesBuilder.append("'" + value + "'" + ","); +// } +// } else { +// //编辑时replaced_standard被代替标准不存值,通过查询得到 +// if ("replaced_standard".equals(key)) { +// valuesBuilder.append("'" + "" + "'" + ","); +// } else { +// valuesBuilder.append("'" + value + "'" + ","); +// } +// } +// } +// fieldsBuilder.append(key + ","); +// } +// } +// List fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList()); +// List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); +// +// //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) +// List ossFileList = fileSort(fieldFileList, fileInfos, stringObjectMap); +// +// // 将用户选择、输入的新车型实施日期、在产车实施日期备份出来。如果不处理的话,插入ES时会报 解析失败 错误。 +// String implement_time = (String) map.get("implement_time"); +// String xin1_che1_xing2_shi2_shi1_ri4_qi1 = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); +// +// // 批量添加分阶段实施明细信息 +// this.insertBatchPhasedImplementationDetailsInfo(map); +// +// // 备份出来插入搜索中心-文档库模块的新车型、在产车实施日期 (该参数是文档库原有新车型、在产车 与分阶段实施日期中的 时间组合。) +// String implementTime = (String) map.get("implement_time"); +// String xinCheXingShiShiRiQi = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); +// +// StringBuilder sbCn = new StringBuilder(); +// StringBuilder sbEn = new StringBuilder(); +// for (Map.Entry entry : map.entrySet()) { +// //es全文新增数据(数据转换) +// esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); +// } +// +// // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 +// map.put("implement_time",implement_time); +// map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); +// +// List> mapListTempCn = new ArrayList<>(); +// List> mapListTempEn = new ArrayList<>(); +// String fileTextAll = ""; +// try { +// String cutCn = LanguageEnum.CN.getValue(); +// String cutEn = LanguageEnum.EN.getValue(); +// if (fileInfos.size() != 0) { +// //编辑时,有修改文件的情况 +// fileTextAll = updateEsInfo(map, searchFieldList, sbCn, sbEn, fileInfos, mapListTempCn, mapListTempEn, cutCn, cutEn); +// } else { +// //没有修改文件,获取之前上传过的文件 +// List fieldFileListTemp = fieldList.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// List fileFieldList = fieldFileListTemp.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// List connectIdList = new ArrayList<>(); +// for (Map.Entry entry : map.entrySet()) { +// String key = entry.getKey(); +// String value = MyStringUtils.valueOf(entry.getValue()); +// if(fileFieldList.contains(key)){ +// if(!"null".equals(value) && StringUtils.isNotBlank(value)){ +// connectIdList.add(value); +// } +// } +// } +// if(connectIdList.size()!= 0){ +// List oSSFileListTemp = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); +// //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) +// List files = fileSort(fieldFileList, oSSFileListTemp, map); +// fileTextAll = updateEsInfo(map, searchFieldList, sbCn, sbEn, files, mapListTempCn, mapListTempEn, cutCn, cutEn); +// +// }else{ +// //之前没有上传过文件 +// Map stringMapCn = new HashMap<>(); +// Map stringMapEn = new HashMap<>(); +// Map mapBaseDateCn = new HashMap<>(); +// Map mapBaseDateEn = new HashMap<>(); +// stringMapCn.put("create_time",new Date()); +// stringMapEn.put("create_time",new Date()); +// mapBaseDateCn.put("create_time",new Date()); +// mapBaseDateEn.put("create_time",new Date()); +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = (String) map.get(onlCgformField.getDbFieldName()); +// if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ +// s = s.split(" ")[0]; +// } +// if(StringUtils.isNotBlank(s)){ +// stringMapCn.put(onlCgformField.getDbFieldName(), s); +// stringMapEn.put(onlCgformField.getDbFieldName(), s); +// mapBaseDateCn.put(onlCgformField.getDbFieldName(),s); +// mapBaseDateEn.put(onlCgformField.getDbFieldName(),s); +// } +// } +// +// //封装中文的全文内容(es) +// putMapCn(MyStringUtils.valueOf(map.get("id")), MyStringUtils.valueOf(map.get("serial_number")), "文档库", +// sbCn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", +// cutCn, stringMapCn,SEARCH_FLAG); +// stringMapCn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); +// //封装英文的全文内容(es) +// putMapCn(MyStringUtils.valueOf(map.get("id")), MyStringUtils.valueOf(map.get("serial_number")), "document library", +// sbEn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", +// cutEn, stringMapEn,SEARCH_FLAG); +// stringMapEn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); +// +// //用于全文带条件查询----------------------------- +// //封装中文的全文内容(es) +// putMapCn(MyStringUtils.valueOf(map.get("id"))+"1", MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutCn, mapBaseDateCn, null); +// mapBaseDateCn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); +// //封装英文的全文内容(es) +// putMapCn(MyStringUtils.valueOf(map.get("id"))+"2", MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), +// MyStringUtils.valueOf(map.get("title")), "", "", +// cutEn, mapBaseDateEn,null); +// stringMapEn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); +// //用于全文带条件查询----------------------------- +// +// mapListTempCn.add(stringMapCn); +// mapListTempEn.add(stringMapEn); +// mapListTempCn.add(mapBaseDateCn); +// mapListTempEn.add(mapBaseDateEn); +// } +// } +// +// } catch (Exception e) { +// e.printStackTrace(); +// log.error("文档库新增es错误"); +// } +// +// String insertField = fieldsBuilder.substring(0, fieldsBuilder.length() - 1); +// String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1); +// +// isModifyForOcrAndSplit(map); +// //编辑数据采用先删除在新增的方法 +// //删除文件 +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll((String) map.get("id")); +// +// List connectIdList = new ArrayList<>();//已删除的文件关联id +// for (OnlCgformField onlCgformField : fieldFileList) { +// String connectId = MyStringUtils.valueOf(mapList.get(0).get(onlCgformField.getDbFieldName())); +// //如果文件没有修改则不用删除 +// if (StringUtils.isNotBlank(connectId) && !connectId.equals(map.get(onlCgformField.getDbFieldName()))) { +// connectIdList.add(connectId); +// } +// } +// //查询已删除的文件id(用于es删除) +// List fileIdListDelete = new ArrayList<>(); +// if(connectIdList.size() != 0){ +// List fileInfosByConnectId = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); +// fileIdListDelete = fileInfosByConnectId.stream().map(OSSFile::getId).collect(Collectors.toList()); +// } +// //删除文件 +// iOSSFileService.deleteByConnectIdList(connectIdList); +// //删除文档库数据 +// bussDocumentLibraryEOMapper.deleteById((String) map.get("id")); +// bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue); +// //处理代替标准和被代替标准逻辑 +// String docId = MyStringUtils.valueOf(map.get("serial_number")); +// Object repObj = map.get("replace_standard_id"); +// if(null != repObj){ +// String[] replace_standard_list = repObj.toString().split(","); +// for (String rs : replace_standard_list) { +// BussDocumentLibraryEO bl = bussDocumentLibraryEOMapper.selectById(rs); +// if (null != bl) { +// String repStr = bl.getReplacedStandard(); +// if (StringUtils.isNotBlank(repStr)) { +// if (!repStr.contains(docId)) { +// repStr = repStr + "," + docId; +// } +// } else { +// repStr = docId; +// } +// bl.setReplacedStandard(repStr); +// bussDocumentLibraryEOMapper.updateById(bl); +// } +// } +// } +// //开始更新ES +// map.put("module_type", "文档库"); +// map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); +// map.put("create_time", new Date()); +// map.put("file_text", fileTextAll); +// Map objectMapTemp = new HashMap<>(); +// for (Map.Entry entry : map.entrySet()) { +// Object value = entry.getValue(); +// if(ObjectUtils.isNotEmpty(entry.getValue())){ +// if(dateSingleList.contains(entry.getKey())){ +// value = value.toString().split(" ")[0]; +// }else if("create_time".equals(entry.getKey()) || "update_time".equals(entry.getKey())){ +//// value = value.toString().split(" ")[0]; +// } +// objectMapTemp.put(entry.getKey(),value); +// } +// } +// // 将分阶段实施时间,存放到搜索中心文档库模块中 +//// objectMapTemp.put("implement_time",implementTime);// 在产车 +//// objectMapTemp.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xinCheXingShiShiRiQi);// 新车型 +// JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(objectMapTemp)); +// JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn)); +// JSONArray arrayEn = JSONArray.parseArray(JSON.toJSONString(mapListTempEn)); +// //修改es +// try { +// //删除文档库和全部 +// jeroElasticsearchTemplate.delete(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), (String) map.get("id")); +// //删除全部中文 +// for (Map objectMap : mapListTempCn) { +// jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), (String) objectMap.get("id")); +// } +// //删除全部中文 +// for (Map objectMap : mapListTempEn) { +// jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), (String) objectMap.get("id")); +// } +// //处理编辑时已删除的文件(在es中同步删除文件单独生成的一条数据) +// if(fileIdListDelete.size() != 0){ +// for (String fileId : fileIdListDelete) { +// jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), +// SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), +// map.get("id") +fileId); +// jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), +// SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), +// map.get("id") +fileId); +// } +// } +// jeroElasticsearchTemplate.saveOrUpdate(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), (String) map.get("id"), jsonObject); +// //添加全文 +// jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), arrayCn); +// jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), arrayEn); +// } catch (Exception e) { +// log.error("文档库编辑es失败"); +// } +// } - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); +// private void homeDocumentDynamic(String cut, +// Map map, +// String serialNumber, +// String id, String title, +// List> dataList, +// List fieldList, +// List dictItemList, +// String titleEn) { +// //文件类型字段 +// List onlCgformFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// +// List fileFieldList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// StringBuilder sbTemp = new StringBuilder(); +// StringBuilder sbContent = new StringBuilder(); +// StringBuilder sbContentInfo = new StringBuilder(); +// StringBuilder sbField = new StringBuilder(); +// StringBuilder sbNew = new StringBuilder(); +// StringBuilder sbFieldCn = new StringBuilder(); +// StringBuilder sbNewCn = new StringBuilder(); +// dataList.get(0).entrySet().forEach(entry -> { +// String keyTemp = entry.getKey(); +// if(fileFieldList.contains(keyTemp)) { +// String valueTemp = (String) entry.getValue(); +// List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(keyTemp)).collect(Collectors.toList()); +// List fileInfosTemp = iOSSFileService.getFileInfos(valueTemp); +// //之前的文件 +// List fileNameList = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// String value = (String) map.get(keyTemp); +// List fileInfosTempNew = iOSSFileService.getFileInfos(value); +// //现在的文件 +// List fileNameListNew = fileInfosTempNew.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListNew); +// if (!checkDiffrent && fileNameListNew.size() != 0) { +// //消息 +// sbField.append(fields.get(0).getDbFieldEnName() + ","); +// sbFieldCn.append(fields.get(0).getDbFieldTxt() + ","); +// +// for (String s : fileNameListNew) { +// if (!fileNameList.contains(s)) { +// //消息详情 +// sbNew.append(fields.get(0).getDbFieldEnName() + " " + s + ","); +// sbNewCn.append(fields.get(0).getDbFieldTxt() + " " + s + ","); +// } +// } +// } +// } +// }); +// +// String href = "" + serialNumber + "" + " " + titleEn; +// String hrefCn = "" + serialNumber + "" + " " + title; +// String contentFile = ""; +// String contentInfoFile = ""; +// String contentFileCn = ""; +// String contentInfoFileCn = ""; +// if(StringUtils.isNotBlank(sbField)){ +// contentFile = serialNumber + " " + titleEn + " uploaded " + sbField; +// contentFileCn = serialNumber + " " + title + " 中上传了 " + sbFieldCn; +// } +// if(StringUtils.isNotBlank(sbNew)){ +// contentInfoFile = href + " uploaded " + sbNew; +// contentInfoFileCn = hrefCn + " 中上传了" + sbNewCn; +// } +// +// StringBuilder msgContentSb = new StringBuilder(); +// StringBuilder msgContentInfoSb = new StringBuilder(); +// StringBuilder msgContentSbCn = new StringBuilder(); +// StringBuilder msgContentInfoSbCn = new StringBuilder(); +// //适用车型 +// StringBuilder msgContentSbCarType = new StringBuilder("Vehicle Type of the " + serialNumber + " " + titleEn); +// StringBuilder msgContentInfoSbCarType = new StringBuilder("Vehicle Type of the " + href); +// StringBuilder msgContentSbCarTypeCn = new StringBuilder(serialNumber + " " + title+" 的适用车型改为"); +// StringBuilder msgContentInfoSbCarTypeCn = new StringBuilder(hrefCn+" 的适用车型改为"); +// //状态 +// StringBuilder msgContentSbStatus = new StringBuilder("The Status of the " + serialNumber + " " + titleEn); +// StringBuilder msgContentInfoSbStatus = new StringBuilder("The Status of the " + href); +// StringBuilder msgContentSbStatusCn = new StringBuilder(serialNumber + " " + title+" 的状态改为"); +// StringBuilder msgContentInfoSbStatusCn = new StringBuilder(hrefCn+" 的状态改为"); +// +// +// List fileIdLIstTemp = new ArrayList<>(); +// for (Map.Entry entry : dataList.get(0).entrySet()) { +// String key = entry.getKey(); +// String value = MyStringUtils.valueOf(entry.getValue()); +// //文件 +// if(fileFieldList.contains(key)&& !"null".equals(value) && StringUtils.isNotBlank(value)){ +// fileIdLIstTemp.addAll(Arrays.asList(value.split(","))); +// } +// } +// int count = 0; +// for (Map.Entry entry : map.entrySet()) { +// String key = entry.getKey(); +// String value = MyStringUtils.valueOf(entry.getValue()); +// +// if (value == null){ +// continue; +// } +// +// //状态 +// if("state".equals(key) && !value.equals(MyStringUtils.valueOf(dataList.get(0).get("state")))){ +// count++; +// //数据字典转换 dictItemList +// String finalValue = value; +// String valueCn = ""; +// List stateDictItemList = dictItemList.stream() +// .filter(e -> "state".equals(e.getDictCode()) && finalValue.equals(e.getItemValue())) +// .collect(Collectors.toList()); +// if(stateDictItemList.size() != 0){ +// value = stateDictItemList.get(0).getEnName(); +// valueCn = stateDictItemList.get(0).getItemText(); +// } +// // +// if(StringUtils.isBlank(value)){ +// msgContentSbStatus.append(" has been modified to be null,"); +// msgContentInfoSbStatus.append(" has been modified to be null,"); +// msgContentSb.append(msgContentSbStatus); +// msgContentInfoSb.append(msgContentInfoSbStatus); +// }else{ +// msgContentSbStatus.append(" has been modified to " + value + ","); +// msgContentInfoSbStatus.append(" has been modified to " + value + ","); +// msgContentSb.append(msgContentSbStatus); +// msgContentInfoSb.append(msgContentInfoSbStatus); +// msgContentSbCn.append(msgContentSbStatusCn + valueCn+ ","); +// msgContentInfoSbCn.append(msgContentInfoSbStatusCn + valueCn+ ","); +// } +// +// } +// //适用车型 car_type +// if("shi4_yong4_che1_xing2".equals(key) && !value.equals(MyStringUtils.valueOf(dataList.get(0).get("shi4_yong4_che1_xing2"))) && !"null".equals(value)){ +// count++; +// //数据字典转换 dictItemList +// List stateDictItemList = dictItemList.stream() +// .filter(e -> "car_type".equals(e.getDictCode())) +// .collect(Collectors.toList()); +// +// StringBuilder sb = new StringBuilder(); +// for (String s : value.split(",")) { +// List collect = stateDictItemList.stream().filter(e -> s.equals(e.getItemValue())).collect(Collectors.toList()); +// if(collect.size() != 0){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// sb.append(collect.get(0).getItemText()+","); +// }else{ +// sb.append(collect.get(0).getEnName()+","); +// } +// } +// } +// if(StringUtils.isNotBlank(sb)){ +// String substring = sb.substring(0, sb.length() - 1); +// value = substring; +// } +// if(StringUtils.isBlank(value)){ +// msgContentSbCarType.append(" has been modified to be null,"); +// msgContentInfoSbCarType.append(" has been modified to be null,"); +// msgContentSb.append(msgContentSbCarType); +// msgContentInfoSb.append(msgContentInfoSbCarType); +// msgContentSbCn.append(msgContentSbCarTypeCn + "空,"); +// msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + "空,"); +// }else{ +// msgContentSbCarType.append(" has been modified to " + value + ","); +// msgContentInfoSbCarType.append(" has been modified to " + value + ","); +// msgContentSb.append(msgContentSbCarType); +// msgContentInfoSb.append(msgContentInfoSbCarType); +// msgContentSbCn.append(msgContentSbCarTypeCn + value+ ","); +// msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + value+ ","); +// } +// +// } +// } +// if(StringUtils.isNotBlank(contentFile)){ +// count ++; +// msgContentSb.append(contentFile); +// msgContentSbCn.append(contentFileCn); +// } +// if(StringUtils.isNotBlank(contentInfoFile)){ +// msgContentInfoSb.append(contentInfoFile); +// msgContentInfoSbCn.append(contentInfoFileCn); +// } +// if(count > 0){ +// String msgContent = msgContentSb.substring(0, msgContentSb.length() - 1) + "."; +// String msgContentInfo = msgContentInfoSb.substring(0, msgContentInfoSb.length() - 1) + "."; +// String msgContentCn = msgContentSbCn.substring(0, msgContentSbCn.length() - 1) + "."; +// String msgContentInfoCn = msgContentInfoSbCn.substring(0, msgContentInfoSbCn.length() - 1) + "."; +// HomeDocumentDynamicEO homeDocumentDynamicEO = new HomeDocumentDynamicEO(); +// homeDocumentDynamicEO.setMsgContent(msgContent); +// homeDocumentDynamicEO.setMsgContentInfo(msgContentInfo); +// homeDocumentDynamicEO.setMsgContentCn(msgContentCn); +// homeDocumentDynamicEO.setMsgContentInfoCn(msgContentInfoCn); +// homeDocumentDynamicEOService.save(homeDocumentDynamicEO); +// } +// } - //下拉选字段 - List fieldPullList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// private String updateEsInfo(Map map, List searchFieldList, StringBuilder sbCn, StringBuilder sbEn, List fileInfos, List> mapListTempCn, List> mapListTempEn, String cutCn, String cutEn) { +// Map mapBaseDateCn = new HashMap<>(); +// Map mapBaseDateEn = new HashMap<>(); +// StringBuilder fileTextAll = new StringBuilder(); +// for (OSSFile ossFile : fileInfos) { +// Map stringMapCn = new HashMap<>(); +// Map stringMapEn = new HashMap<>(); +// String fileText = ""; +// if (ossFile.getFileName().endsWith(".doc") +// || ossFile.getFileName().endsWith(".docx") +// || ossFile.getFileName().endsWith(".DOC") +// || ossFile.getFileName().endsWith(".DOCX")) { +// String wordContent = null; +// try { +// wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); +// } catch (Exception e) { +// log.error("文档库:读取word文件内容失败"); +// } +// if (StringUtils.isNotBlank(wordContent)) { +// fileText = wordContent; +// fileTextAll.append(fileText+","); +// } +// } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { +// String pdfContent = null; +// try { +// pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); +// } catch (Exception e) { +// log.error("文档库读取PDF文件内容失败"); +// } +// if (StringUtils.isNotBlank(pdfContent)) { +// fileText = pdfContent; +// fileTextAll.append(fileText+","); +// } +// } +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = (String) map.get(onlCgformField.getDbFieldName()); +// if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ +// s = s.split(" ")[0]; +// } +// if(StringUtils.isNotBlank(s)){ +// stringMapCn.put(onlCgformField.getDbFieldName(), s); +// stringMapEn.put(onlCgformField.getDbFieldName(), s); +// } +// } +// +// //封装中文的全文内容(es) +// putMapCn(map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "文档库", +// sbCn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(), +// cutCn, stringMapCn,null); +// //封装英文的全文内容(es) +// putMapCn(map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "document library", +// sbEn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(), +// cutEn, stringMapEn,null); +// +// mapListTempCn.add(stringMapCn); +// mapListTempEn.add(stringMapEn); +// int a = 1; +// int b = 1; +// for (Map objectMap : mapListTempCn) { +// a++; +// objectMap.put("file_sort", map.get("id") +"_"+a); +// } +// for (Map objectMap : mapListTempEn) { +// b++; +// objectMap.put("file_sort", map.get("id") +"_"+b); +// } +// } +// +// for (OnlCgformField onlCgformField : searchFieldList) { +// String s = (String) map.get(onlCgformField.getDbFieldName()); +// if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ +// s = s.split(" ")[0]; +// } +// if(StringUtils.isNotBlank(s)){ +// mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); +// mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); +// } +// } +// //基础数据中文(es) +// putMapCn((String) map.get("id"), (String) map.get("serial_number"), "文档库", +// sbCn.toString(), (String) map.get("title"), "", "", +// cutCn, mapBaseDateCn,SEARCH_FLAG); +// mapBaseDateCn.put("file_sort", map.get("id") +"_"+1); +// //基础数据英文(es) +// putMapCn((String) map.get("id"), (String) map.get("serial_number"), "document library", +// sbEn.toString(), (String) map.get("title"), "", "", +// cutEn, mapBaseDateEn,SEARCH_FLAG); +// mapBaseDateEn.put("file_sort", map.get("id") +"_"+1); +// mapListTempCn.add(mapBaseDateCn); +// mapListTempEn.add(mapBaseDateEn); +// return fileTextAll.toString(); +// +// } - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// /** +// * 更新log +// * +// * @param map +// */ +// private void updateLog(Map map, +// List> dataList, +// List fieldList, +// List fieldDateList, +// List fieldFileList, +// List fieldPullList, +// String cut) { +// StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut,null); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// if (StringUtils.isNotBlank(sb)) { +// String content = sb.substring(0, sb.length() - 1); +// BussLogEO bussLogEO = new BussLogEO(); +// bussLogEO.setDocumentId((String) map.get("id")); +// bussLogEO.setContent(content); +// bussLogEO.setCreateBy(sysUser.getUsername()); +// iBussLogEOService.add(bussLogEO); +// } +// } - //树形数据字典 - List categoryList = sysCategoryService.list(); - //处理树形数据字典 - dataList.get(0).entrySet().forEach(entry -> { - //下拉选处理数据字典 - treeDictItem(categoryList, entry, treeFieldList, cut,null); - }); - - //下拉单选和下拉多选数据字典处理 - List finalFieldList = fieldList; - dataList.get(0).entrySet().forEach(entry -> { - if (fieldPullList.contains(entry.getKey())) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, finalFieldList,null); - } - }); - - if (fieldList.size() != 0) { - //过滤出表单字段(is_show_form-->表单是否显示0否 1是) - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); - } - for (LawsArea lawsAreaTemp : areaList) { - String areaName = ""; - if (LanguageEnum.CN.getValue().equals(cut)) { - areaName = lawsAreaTemp.getShowArea(); - } else { - areaName = lawsAreaTemp.getEnName(); - } - Map mapTemp = new HashMap<>(); - List> resultTemp = new ArrayList<>(); - List fieldListTemp = fieldList.stream().filter(e -> lawsAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList()); - if(LanguageEnum.CN.getValue().equals(cut)){ - fieldListTemp.removeIf(new Predicate() { - @Override - public boolean test(OnlCgformField onlCgformField) { - return onlCgformField.getDbFieldName().equals("title_en");// - } - }); - List collect = fieldListTemp.stream().filter(e -> "title".equals(e.getDbFieldName())).collect(Collectors.toList()); - if(collect.size() != 0){ - collect.get(0).setDbFieldTxt("标题"); - } - }else{ - fieldListTemp.removeIf(new Predicate() { - @Override - public boolean test(OnlCgformField onlCgformField) { - return onlCgformField.getDbFieldName().equals("title");// - } - }); - List collect = fieldListTemp.stream().filter(e -> "title_en".equals(e.getDbFieldName())).collect(Collectors.toList()); - if(collect.size() != 0){ - collect.get(0).setDbFieldEnName("Title"); - } - } - for (OnlCgformField onlCgformField : fieldListTemp) { - //字段 - String dbFieldName = onlCgformField.getDbFieldName(); - //字段类型 - String fieldShowType = onlCgformField.getFieldShowType(); - String value = ""; - if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - if (ObjectUtils.isNotEmpty(dataList.get(0).get(dbFieldName))) { - value = sdf.format(dataList.get(0).get(dbFieldName)); - } - } else { - value = MyStringUtils.valueOf(dataList.get(0).get(dbFieldName)); - if("null".equals(value)){ - value = ""; - } - } - Map map = new HashMap<>(); - //处理文件 - if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { - //处理文本信息和关联信息区域之外的区域中文件类型字段返归结果格式 - if(!"文本信息".equals(lawsAreaTemp.getShowArea()) && !"关联信息".equals(lawsAreaTemp.getShowArea())){ - List fileInfos = iOSSFileService.getFileInfosByConnectId(value); - List fileIdList = fileInfos.stream().map(OSSFile::getId).collect(Collectors.toList()); - Map mapNew = new HashMap<>(); - mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); - mapNew.put("value",fileIdList); - resultTemp.add(mapNew); - }else{ - - if (StringUtils.isNotBlank(value)) { - Map mapNew = new HashMap<>(); - List> listVal = new ArrayList<>(); - List fileInfos = iOSSFileService.getFileInfosByConnectId(value); - //多文件处理 - if(ObjectUtils.isNotEmpty(fileInfos)){ - mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); - for (OSSFile fileInfo : fileInfos) { - Map mapValue = new HashMap<>(); - mapValue.put("id",fileInfo.getId()); - mapValue.put("fileName",fileInfo.getFileName()); - List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfo.getId()); - // 添加标准分解单跳转 - if (CollectionUtil.isNotEmpty(infoEOList)) { - mapValue.put("splitFlag", 1); - mapValue.put("splitInfoId", infoEOList.get(0).getId()); - } else{ - mapValue.put("splitFlag", 0); - } - listVal.add(mapValue); - } - } - mapNew.put("value", listVal); - resultTemp.add(mapNew); - } else { - Map mapNew = new HashMap<>(); - mapNew.put("value", ""); - mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); - resultTemp.add(mapNew); - } - } - } else { - //处理字段类型为文件之外的字段 - if (dataList.size() != 0) { - List standardNameList = new ArrayList<>();//对应标准编码 - List> listStandard = new ArrayList<>(); - String finalValue = value; - dataList.get(0).entrySet().forEach(entry -> { - if (onlCgformField.getDbFieldName().equals(entry.getKey())) { - //标准类型字段处理 - if(standFieldList.contains(entry.getKey())){ - if(ObjectUtils.isNotEmpty(entry.getValue())){ - for (Map map1 : mapList) { - //对应标准处理 - if (ObjectUtils.isNotEmpty(entry.getValue())) { - for (String s : entry.getValue().toString().split(",")) { - Map mapTemp1 = new HashMap<>(); - if (s.equals(MyStringUtils.valueOf(map1.get("serial_number")))) { - standardNameList.add(MyStringUtils.valueOf(map1.get("serial_number"))); - mapTemp1.put("title", MyStringUtils.valueOf(map1.get("serial_number"))); - mapTemp1.put("id", MyStringUtils.valueOf(map1.get("id"))); - if (ObjectUtils.isNotEmpty(mapTemp1)) { - listStandard.add(mapTemp1); - } - } - } - } - } - map.put("value", entry.getValue().toString()); - map.put("list", listStandard); - } - }else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { - map.put("value", finalValue); - } else { - map.put("value", entry.getValue()); - } - } - }); - } - mapPut(cut, map, "field_show_type", - onlCgformField.getFieldShowType(), "dict_field", - onlCgformField.getDictField(), "db_field_name", - onlCgformField.getDbFieldName(), "db_field_txt", - onlCgformField.getDbFieldTxt(), "db_field_en_name", - onlCgformField.getDbFieldEnName(), "area", areaName, null); - } - if (map.size() != 0) { - resultTemp.add(map); - } - } - if (LanguageEnum.CN.getValue().equals(cut)) { - areaName = lawsAreaTemp.getShowArea(); - mapTemp.put(areaName, resultTemp); - } else { - areaName = lawsAreaTemp.getEnName(); - mapTemp.put(areaName, resultTemp); - } - Results.add(mapTemp); - } - return Results; - } - - private void mapPut(String cut, Map map, String field_show_type, - String fieldShowType2, String dict_field, String dictField, - String db_field_name, String dbFieldName2, String db_field_txt, - String dbFieldTxt, String db_field_en_name, String dbFieldEnName, - String area, String showArea, List sysCategoryTreeVOS) { - if(FieldTypeEnum.TEXT_LINK.getValue().equals(fieldShowType2)){ - map.put("urlClick", "true"); - } - map.put(field_show_type, fieldShowType2);//类型(判断是下拉还是输入框,等等) - map.put(dict_field, dictField); - map.put(db_field_name, dbFieldName2);//字段 - if (StringUtils.isNotBlank(cut)) { - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put(db_field_txt, dbFieldTxt);//字段中文名 - } else { - map.put(db_field_txt, dbFieldEnName);//字段中文名 - } - } else { - map.put(db_field_txt, dbFieldTxt);//字段中文名 - } - map.put(area, showArea);//区域 - map.put("tree", sysCategoryTreeVOS);//区域 - } - - /** - * 新增数据 - * - * @param map - */ - @Override - public void addInfo(Map map) { - String cut = (String) map.get("cut"); - try { - String serialNumber = MyStringUtils.valueOf(map.get("serial_number")); - - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); - String issueTime = (String) (map.get("issue_time")); - Date issueTimeDate = null; - if(StringUtils.isNotBlank(issueTime)){ - issueTimeDate = df.parse(issueTime); - } - String implementTime = (String) map.get("implement_time");//在产车实施日期 - String newCarimplementTime = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1");//新车型实施日期 - if (StringUtils.isNotBlank(implementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { - Date implementTimeDate = df.parse(implementTime); - if (issueTimeDate.after(implementTimeDate)) { - throw new JeroBootException("发布日期不能大于在产车实施日期"); - } - } - if (StringUtils.isNotBlank(newCarimplementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { - Date newCarimplementTimeDate = df.parse(newCarimplementTime); - if (issueTimeDate.after(newCarimplementTimeDate)) { - throw new JeroBootException("发布日期不能大于新车型实施日期"); - } - } - } catch (Exception e) { - e.printStackTrace(); - throw new JeroBootException(e.getMessage()); - } - - //字段属性 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - - //过滤所有人员选择类型的字段 - List personnelOnlCgformFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - - if(personnelOnlCgformFieldList.size() != 0){ - List collect = personnelOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - List personnelList = new ArrayList<>(); - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - if(collect.contains(key)){ - personnelList.add(key); - } - } - if(personnelList.size() != 0){ - for (String personnel : personnelList) { -// map.put(personnel, map.get(personnel+"_id")); - map.remove(personnel+"_id"); - } - } - } - - //代替标准不为空,需要向被替代标准的法规工程师发送站内通知和飞书信息,提醒内容:"新标准编号"已实施,请注意更新“替代标准编号”状态 - map.remove("cut"); - //获取搜索中心字段 - List searchFieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(e.getIsShowSearch())).collect(Collectors.toList()); - //文件类型字段 - List fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - //日期类型字段 - List onlCgformFieldList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldDateList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //树形数据字典 - List categoryList = sysCategoryService.list(); - //普通数据字典 - List dictItemList = sysDictItemServiceImpl.selectItemsAll(); - //查询所有文档库信息 - //查询所有 - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); - - String mustFields = "id,create_by,create_time,update_by,update_time,sys_org_code"; - String idTemp = UUID.randomUUID().toString().replace("-", ""); - String mustValues = getMustValues(idTemp); - //字段 - StringBuilder fieldsBuilder = new StringBuilder(); - //数据值 - StringBuilder valuesBuilder = new StringBuilder(); - - List> fileTextList = new ArrayList<>(); - List oSSFileAll = new ArrayList<>(); - Map stringObjectMap = new HashMap<>(); - try { - for (Map.Entry entry : map.entrySet()) { - - String key = entry.getKey(); - if(StringUtils.equals(key,"phasedImplementationDetailsEOList")){ - continue; - } - Object value = entry.getValue(); - if(key.equals("replace_standard_id")){ - continue; - } - if(key.equals("corresponding_standard_id")){ - continue; - } - //es全文新增数据(数据转换) - // esFullText(cut, fieldList, categoryList, dictItemList, mapList, sbCn,sbEn, entry); - - if (ObjectUtils.isNotEmpty(value)) { - //处理日期格式 - if (fieldDateList.contains(key)) { - if (ObjectUtils.isNotEmpty(value)) { - value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')"; - } else { - value = null; - } - valuesBuilder.append("," + value); - } else { - //处理文件类型 - List fieldFile = null; - try { - fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - } catch (Exception e) { - e.printStackTrace(); - } - if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) { - String valueTemp = UUID.randomUUID().toString().replace("-", ""); - stringObjectMap.put(key,valueTemp); - // value = valueTemp; - //修改文件表关联信息connect_id - List oSSFileList = new ArrayList<>(); - for (String fileId : value.toString().split(",")) { - OSSFile ossFile = new OSSFile(); - ossFile.setId(fileId); - ossFile.setConnectId(valueTemp); - oSSFileList.add(ossFile); - } - if (oSSFileList.size() != 0) { - oSSFileAll.addAll(oSSFileList); - } - iOSSFileService.updateFileInfo(oSSFileList); - - valuesBuilder.append("," + "'" + valueTemp + "'"); - } else { - valuesBuilder.append("," + "'" + value + "'"); - } - } - fieldsBuilder.append("," + key); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - - // 将用户选择、输入的新车型实施日期、在产车实施日期备份出来。如果不处理的话,插入ES时会报 解析失败 错误。 - String implement_time = (String) map.get("implement_time"); - String xin1_che1_xing2_shi2_shi1_ri4_qi1 = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); - - map.put("id", idTemp); - // 批量添加分阶段实施明细信息 - this.insertBatchPhasedImplementationDetailsInfo(map); - - - //sbCn sbEn 这两个字段作为es中英文切换 - StringBuilder sbCn = new StringBuilder(); - StringBuilder sbEn = new StringBuilder(); - for (Map.Entry entry : map.entrySet()) { - //es全文新增数据(数据转换) - esFullText(cut, fieldList, categoryList, dictItemList, mapList, sbCn,sbEn, entry); - } - - // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 - map.put("implement_time",implement_time); - map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); - - - //多文件es - List fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList()); - List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); - - //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) - List ossFileList = fileSort(fieldFileList, fileInfos, stringObjectMap); - - List> mapListTempCn = new ArrayList<>(); - List> mapListTempEn = new ArrayList<>(); - StringBuilder fileTextAll = new StringBuilder(); - try { - String cutCn = LanguageEnum.CN.getValue(); - String cutEn = LanguageEnum.EN.getValue(); - if (ossFileList.size() != 0) { - Map mapBaseDateCn = new HashMap<>(); - Map mapBaseDateEn = new HashMap<>(); - for (OSSFile ossFile : ossFileList) { - Map stringMapCn = new HashMap<>(); - Map stringMapEn = new HashMap<>(); - stringMapCn.put("create_time",new Date()); - stringMapEn.put("create_time",new Date()); - String fileText = ""; - if (ossFile.getFileName().endsWith(".doc") - || ossFile.getFileName().endsWith(".docx") - || ossFile.getFileName().endsWith(".DOC") - || ossFile.getFileName().endsWith(".DOCX")) { - - String wordContent = null; - try { - wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); - } catch (Exception e) { - log.error("文档库: 读取word内容失败"); - } - if (StringUtils.isNotBlank(wordContent)) { - fileText = wordContent; - fileTextAll.append(fileText+","); - } - } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { - String pdfContent = null; - try { - pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); - } catch (Exception e) { - log.error("文档库: 读取PDF文件内容失败"); - } - if (StringUtils.isNotBlank(pdfContent)) { - fileText = pdfContent; - fileTextAll.append(fileText+","); - } - } - for (OnlCgformField onlCgformField : searchFieldList) { - String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); - if(StringUtils.isNotBlank(s)){ - stringMapCn.put(onlCgformField.getDbFieldName(), s); - stringMapEn.put(onlCgformField.getDbFieldName(), s); - } - } - - //文件相关封装中文的全文内容(es) - putMapCn(idTemp + ossFile.getId(), MyStringUtils.valueOf(map.get("serial_number")), "文档库", - sbCn.toString(), MyStringUtils.valueOf(map.get("title")), fileText, - ossFile.getFileName(), cutCn, stringMapCn, null); - //文件相关封装英文的全文内容(es) - putMapCn(idTemp + ossFile.getId(), MyStringUtils.valueOf(map.get("serial_number")), "document library", - sbEn.toString(), MyStringUtils.valueOf(map.get("title")), fileText, - ossFile.getFileName(), cutEn, stringMapEn, null); - - mapListTempCn.add(stringMapCn); - mapListTempEn.add(stringMapEn); - int a = 1; - int b = 1; - for (Map objectMap : mapListTempCn) { - a++; - objectMap.put("file_sort",idTemp+"_"+a); - } - for (Map objectMap : mapListTempEn) { - b++; - objectMap.put("file_sort",idTemp+"_"+b); - } - } - for (OnlCgformField onlCgformField : searchFieldList) { - String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); - if(StrUtil.isNotBlank(s)){ - mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); - mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); - } - } - //基础数据(中文) - putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "文档库", - sbCn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", - cutCn, mapBaseDateCn,SEARCH_FLAG); - mapBaseDateCn.put("file_sort",idTemp+"_"+1); - //基础数据(英文) - putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "document library", - sbEn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", - cutEn, mapBaseDateEn,SEARCH_FLAG); - mapBaseDateEn.put("file_sort",idTemp+"_"+1); - mapListTempCn.add(mapBaseDateCn); - mapListTempEn.add(mapBaseDateEn); - } else { - Map stringMapCn = new HashMap<>(); - Map stringMapEn = new HashMap<>(); - Map mapBaseDateCn = new HashMap<>(); - Map mapBaseDateEn = new HashMap<>(); - stringMapCn.put("create_time",new Date()); - stringMapEn.put("create_time",new Date()); - mapBaseDateCn.put("create_time",new Date()); - mapBaseDateEn.put("create_time",new Date()); - for (OnlCgformField onlCgformField : searchFieldList) { - String s = MyStringUtils.valueOf(map.get(onlCgformField.getDbFieldName())); - if(StringUtils.isNotBlank(s)){ - stringMapCn.put(onlCgformField.getDbFieldName(), s); - stringMapEn.put(onlCgformField.getDbFieldName(), s); - mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); - mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); - } - } - //封装中文的全文内容(es) - putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutCn, stringMapCn, SEARCH_FLAG); - stringMapCn.put("file_sort",idTemp+"_"+1); - //封装英文的全文内容(es) - putMapCn(idTemp, MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutEn, stringMapEn,SEARCH_FLAG); - stringMapEn.put("file_sort",idTemp+"_"+1); - - //用于全文带条件查询----------------------------- - //封装中文的全文内容(es) - putMapCn(idTemp+"1", MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutCn, mapBaseDateCn, null); - mapBaseDateCn.put("file_sort",idTemp+"_"+1); - //封装英文的全文内容(es) - putMapCn(idTemp+"2", MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutEn, mapBaseDateEn,null); - stringMapEn.put("file_sort",idTemp+"_"+1); - //用于全文带条件查询----------------------------- - mapListTempCn.add(stringMapCn); - mapListTempEn.add(stringMapEn); - mapListTempCn.add(mapBaseDateCn); - mapListTempEn.add(mapBaseDateEn); - } - } catch (Exception e) { - e.printStackTrace(); - log.error("文档库新增es错误"); - } - - - String insertField = mustFields + fieldsBuilder; - String insertValue = mustValues + valuesBuilder; - bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue); - //处理代替标准和被代替标准逻辑 - Object repObj = map.get("replace_standard_id"); - if(null != repObj) { - String[] replace_standard_list = repObj.toString().split(","); - for (String rs : replace_standard_list) { - BussDocumentLibraryEO bl = bussDocumentLibraryEOMapper.selectById(rs); - if (null != bl) { - String repStr = bl.getReplacedStandard(); - if (StringUtils.isNotBlank(repStr)) { - if (!repStr.contains(MyStringUtils.valueOf(map.get("serial_number")))) { - repStr = repStr + "," + MyStringUtils.valueOf(map.get("serial_number")); - } - } else { - repStr = MyStringUtils.valueOf(map.get("serial_number")); - } - bl.setReplacedStandard(repStr); - bussDocumentLibraryEOMapper.updateById(bl); - } - } - } - - String replaceStandard = MyStringUtils.valueOf(map.get("replace_standard")); - if (StringUtils.isNotBlank(replaceStandard)) { - //新增时如果填写代替标准,需要向填写的代替标准的负责人发消息 - replaceStandardSend(Arrays.asList(replaceStandard.split(","))); - } - //添加es - map.put("module_type", "文档库"); - map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); - map.put("create_time", new Date()); - map.put("file_text",fileTextAll); - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map)); - JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn)); - JSONArray arrayEn = JSONArray.parseArray(JSON.toJSONString(mapListTempEn)); - try { - jeroElasticsearchTemplate.saveOrUpdate(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), idTemp, jsonObject); - //全部 - jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), arrayCn); - jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), arrayEn); - } catch (Exception e) { - log.error("文档库添加es失败"); - } - } - - /** - * //读取word或PDF文件内容 - * - * @param oSSFileList - */ - public List readFileContent(List oSSFileList) { - //查询文件详细信息 - List fileIdList = oSSFileList.stream().map(OSSFile::getId).collect(Collectors.toList()); - oSSFileList = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); - List Results = new ArrayList<>(); - for (OSSFile ossFile : oSSFileList) { - if (ossFile.getFileName().endsWith(".doc") - || ossFile.getFileName().endsWith(".docx") - || ossFile.getFileName().endsWith(".DOC") - || ossFile.getFileName().endsWith(".DOCX")) { - String wordContent = null; - try { - wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); - } catch (Exception e) { - log.error("文档库:读取word内容失败"); - } - if (StringUtils.isNotBlank(wordContent)) { - Results.add(wordContent); - } - } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { - String pdfContent = null; - try { - pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); - } catch (Exception e) { - log.error("文档库:读取pdf内容失败"); - } - if (StringUtils.isNotBlank(pdfContent)) { - Results.add(pdfContent); - } - } - } - return Results; - } - - private void esFullText(String cut, List fieldList, - List categoryList, - List dictItemList, - List> mapList, - StringBuilder sbCn, StringBuilder sbEn, - Map.Entry entry) { - try { - List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - for (OnlCgformField onlCgformField : fieldList) { - String fieldNameCn = onlCgformField.getDbFieldTxt(); - String fieldNameEn = onlCgformField.getDbFieldEnName(); - //输入框 - if ((FieldTypeEnum.TEXT_STRING.getValue().equals(onlCgformField.getFieldShowType()) - || FieldTypeEnum.TEXT_NUMBER.getValue().equals(onlCgformField.getFieldShowType())) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - sbCn.append(fieldNameCn + ":" + entry.getValue() + " "); - sbEn.append(fieldNameEn + ":" + entry.getValue() + " "); - } - } - //下拉框 - if ((FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - List dictItems = dictItemList.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) - .collect(Collectors.toList()); - StringBuilder sbTextCn = new StringBuilder(); - StringBuilder sbTextEn = new StringBuilder(); - //处理数据字典 - for (String item : entry.getValue().toString().split(",")) { - if (dictItems.size() != 0) { - List itemValue = dictItems.stream().filter(e -> item.equals(e.getItemValue())).collect(Collectors.toList()); - if (itemValue.size() != 0) { - sbTextCn.append(itemValue.get(0).getItemText() + ","); - sbTextEn.append(itemValue.get(0).getEnName() + ","); - } - } - } - if (StringUtils.isNotBlank(sbTextCn)) { - String substring = sbTextCn.substring(0, sbTextCn.length() - 1); - sbCn.append(fieldNameCn + ":" + substring + " "); - } - if (StringUtils.isNotBlank(sbTextEn)) { - String substring = sbTextEn.substring(0, sbTextEn.length() - 1); - sbEn.append(fieldNameEn + ":" + substring + " "); - } - } - } - } - //树形 - if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType()) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - StringBuilder sbTreeCn = new StringBuilder(); - StringBuilder sbTreeEn = new StringBuilder(); - List idList = Arrays.asList(entry.getValue().toString().split(",")); - List sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList()); - List nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); - List nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); - sbTreeCn.append(StringUtils.join(nameList, ",")); - sbTreeEn.append(StringUtils.join(nameEnList, ",")); - sbCn.append(fieldNameCn + ":" + sbTreeCn + " "); - sbEn.append(fieldNameEn + ":" + sbTreeEn + " "); - } - } - - //日期 - if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - sbCn.append(fieldNameCn + ":" + entry.getValue().toString().split(" ")[0] + " "); - sbEn.append(fieldNameEn + ":" + entry.getValue().toString().split(" ")[0] + " "); - } - } - //标准选择 - if (FieldTypeEnum.STANDARD.getValue().equals(onlCgformField.getFieldShowType()) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - StringBuilder standSb = new StringBuilder(); - if ("replaced_standard".equals(entry.getKey())) { - //被代替标准 - for (Map stringObjectMap : mapList) { - String replaceStandard = (String) stringObjectMap.get("replace_standard"); - if (StringUtils.isNotBlank(replaceStandard) && replaceStandard.contains((String) entry.getValue())) { - standSb.append(stringObjectMap.get("serial_number") + ","); - } - } - } else { - //对应标准,代替标准 - standSb.append(entry.getValue().toString() + ","); -// for (String valueTemp : entry.getValue().toString().split(",")) { -// if (isId(valueTemp)) { -// //是id -// for (Map stringObjectMap : mapList) { -// if (stringObjectMap.get("id").equals(valueTemp)) { -// standSb.append(stringObjectMap.get("serial_number") + ","); +// @NotNull +// private StringBuilder getUpdateInfo(Map map, List> dataList, +// List fieldList, List fieldDateList, +// List fieldFileList, List fieldPullList, +// String cut,String flag) { +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// //调整dataList中map中字段顺序与表单中的一致 +// Map mapNew = new LinkedHashMap<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// for (Map.Entry entry : dataList.get(0).entrySet()) { +// if (onlCgformField.getDbFieldName().equals(entry.getKey())) { +// mapNew.put(entry.getKey(), entry.getValue()); +// break; +// } +// } +// } +// dataList.remove(0); +// dataList.add(mapNew); +// Map mapTemp = new HashMap<>(); +// mapCopy(map, mapTemp); +// //时间类型的字段 +// List fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //文件类型的字段 +// List fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //下拉类型的字段 +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //下拉选处理数据字典 +// for (Map.Entry entry : dataList.get(0).entrySet()) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, fieldList,flag); +// treeDictItem(categoryList, entry, treeFieldList, cut,flag); +// } +// for (Map.Entry entry : mapTemp.entrySet()) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, fieldList,flag); +// treeDictItem(categoryList, entry, treeFieldList, cut,flag); +// } +// +// StringBuilder sb = new StringBuilder(); +// dataList.get(0).entrySet().forEach(entry -> { +// String key = entry.getKey(); +// Object value = entry.getValue(); +// //字段中文名 +// List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList()); +// +// if (fields.size() != 0) { +// String dbFieldTxt = fields.get(0).getDbFieldTxt(); +// if("1".equals(flag)){ +// dbFieldTxt = fields.get(0).getDbFieldEnName(); +// }else{ +// dbFieldTxt = fields.get(0).getDbFieldTxt(); +// } +// dbFieldTxt = "" + dbFieldTxt + ""; +// if (value == null) { +// value = ""; +// } +// for (Map.Entry entryTemp : mapTemp.entrySet()) { +// String keyTemp = entryTemp.getKey(); +// Object valueTemp = entryTemp.getValue(); +// if (valueTemp == null) { +// valueTemp = ""; +// } +// if (!"create_time".equals(key) && !"update_time".equals(key)) { +// if (key.equals(keyTemp)) { +// if (fieldDate.contains(key)) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// if (ObjectUtils.isNotEmpty(value)) { +// value = sdf.format(value); +// } +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// try { +// valueTemp = sdf.format(sdf.parse((String) valueTemp)); +// } catch (ParseException e) { +// } +// } +// //处理时间类型字段 +// if (ObjectUtils.isNotEmpty(value)) { +// if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); +// } +// } else if (ObjectUtils.isEmpty(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); // } // } // } else { -// //不是id -// standSb.append(valueTemp + ","); +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// } +// +// } +// } +// +// } else if (fieldFile.contains(key)) { +// //处理文件类型字段 +// List fileNameList = new ArrayList<>(); +// List fileNameListTemp = new ArrayList<>(); +// //之前的文件 +// if (ObjectUtils.isNotEmpty(value)) { +// List fileInfos = iOSSFileService.getFileInfosByConnectId((String) value); +// fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// } +// //修改的文件 +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// List fileInfosTemp = iOSSFileService.getFileInfos((String) valueTemp); +// fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// } +// +// if (ObjectUtils.isNotEmpty(value)) { +// boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp); +// +// if (fileNameListTemp.size() != 0 && !checkDiffrent) { +// if("1".equals(flag)){ +// //sysUser +// sb.append(dbFieldTxt +" was changed from \""+ StringUtils.join(fileNameList, ",") + "\" to \"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// } +// } else if (fileNameListTemp.size() == 0) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from \""+ StringUtils.join(fileNameList, ",") + "\" to null " + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); +// } +// +// } +// } else { +// if (fileNameListTemp.size() != 0) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from null to \"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// } +// +// } +// } +// } else { +//// if ("replace_standard".equals(key) || "corresponding_standard".equals(key)) { +//// if (ObjectUtils.isNotEmpty(value)) { +//// value = getReplaceStandardName(value); +//// } +//// if (ObjectUtils.isNotEmpty(valueTemp)) { +//// valueTemp = getReplaceStandardName(valueTemp); +//// } +//// } +// //其他类型(被代替标准不处理) +// if (!"replaced_standard".equals(key)) { +// if (ObjectUtils.isNotEmpty(value)) { +// if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); +// } +// } else if (ObjectUtils.isEmpty(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); +// } +// } +// } else { +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// if("1".equals(flag)){ +// sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// } +// } +// } // } // } - } - - if (StringUtils.isNotBlank(standSb)) { - String substring = standSb.substring(0, standSb.length() - 1); - sbCn.append(fieldNameCn + ":" + substring + " "); - sbEn.append(fieldNameEn + ":" + substring + " "); - } - } - } - - //文件 - if (FieldTypeEnum.FILE.getValue().equals(onlCgformField.getFieldShowType()) - && onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (ObjectUtils.isEmpty(entry.getValue())) { - sbCn.append(fieldNameCn + ":" + "-- "); - sbEn.append(fieldNameEn + ":" + "-- "); - } else { - List fileInfos = iOSSFileService.getFileInfos((String) entry.getValue()); - List fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - sbCn.append(fieldNameCn + ":" + StringUtils.join(fileNameList, ",") + " "); - sbEn.append(fieldNameEn + ":" + StringUtils.join(fileNameList, ",") + " "); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - log.error("es全文转换失败"); - } - } - - /** - * 编辑数据 - * - * @param map - */ - @Override - public void updateInfo(Map map) { - String cut = (String) map.get("cut"); - List list = this.list(); - List serialNumberList = list.stream().map(BussDocumentLibraryEO::getSerialNumber).collect(Collectors.toList()); - String serialNumber = MyStringUtils.valueOf(map.get("serial_number")); - String id = MyStringUtils.valueOf(map.get("id")); - String title = MyStringUtils.valueOf(map.get("title")); - String titleEn = MyStringUtils.valueOf(map.get("title_en")); - - - //通过id查询数据 - List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); - if(dataList.size() != 0){ - String serialNumberTemp = MyStringUtils.valueOf(dataList.get(0).get("serial_number")); - if(!serialNumberTemp.equals(serialNumber) && serialNumberList.contains(serialNumber)){ - throw new JeroBootException("编号已存在不能重复添加"); - } - } - //字段属性 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - //普通数据字典 - List dictItemList = sysDictItemServiceImpl.selectItemsAll(); - //编辑时处理首页文档动态 1. 标准XXXX的状态改为 2. 标准XXXX的适用车型改为 3. 标准XXXX删除了XXXX文件 4. 标准XXXX上传了XXXX文件 - homeDocumentDynamic(cut,map, serialNumber, id, title, dataList, fieldList,dictItemList,titleEn); - - - try { - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); - String issueTime = ""; - if(ObjectUtils.isNotEmpty(map.get("es_update_flag")) && ObjectUtils.isNotEmpty(map.get("issue_time"))){ - map.put("issue_time",df.format(map.get("issue_time"))); - }else{ - issueTime = (String) map.get("issue_time"); - } - Date issueTimeDate = null; - if(StringUtils.isNotBlank(issueTime)){ - issueTimeDate = df.parse(issueTime); - } - if(ObjectUtils.isNotEmpty(map.get("es_update_flag"))){ - if(ObjectUtils.isNotEmpty(map.get("implement_time"))){ - map.put("implement_time",df.format(map.get("implement_time"))); - } - if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){ - map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",df.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))); - } - } - String implementTime = (String) map.get("implement_time");//在产车实施日期 - String newCarimplementTime = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1");//新车型实施日期 - if (StringUtils.isNotBlank(implementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { - Date implementTimeDate = df.parse(implementTime); - if (issueTimeDate.after(implementTimeDate)) { - throw new JeroBootException("发布日期不能大于在产车实施日期"); - } - } - if (StringUtils.isNotBlank(newCarimplementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) { - Date newCarimplementTimeDate = df.parse(newCarimplementTime); - if (issueTimeDate.after(newCarimplementTimeDate)) { - throw new JeroBootException("发布日期不能大于新车型实施日期"); - } - } - - } catch (ParseException e) { - e.printStackTrace(); - throw new JeroBootException(e.getMessage()); - } - - - - map.remove("cut"); - //获取搜索中心字段 - List searchFieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(e.getIsShowSearch())).collect(Collectors.toList()); - //时间类型字段 - List fieldDateList = fieldList.stream() - .filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List dateSingleList = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //文件类型字段 - List fieldFileList = fieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - //下拉单选或下拉多选 - List fieldPullList = fieldList.stream() - .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - - - - Map mapTemp = new HashMap<>(); - mapCopy(map, mapTemp); - - List> dataListTemp = new ArrayList<>(); - for (Map stringObjectMap : dataList) { - Map mapT = new HashMap<>(); - mapCopy(stringObjectMap, mapT); - dataListTemp.add(mapT); - } - //编辑ES(更新搜索中心的历史数据,不需要发消息) - if(ObjectUtils.isEmpty(map.get("es_update_flag"))){ - //更新log - updateLog(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut); - //处理修改代替标准,发送通知 - sendMessageUpdate(mapTemp, dataListTemp, fieldList, fieldDateList, fieldFileList, fieldPullList, cut); - } - - - //树形数据字典 - List categoryList = sysCategoryService.list(); - //查询所有 - List> listMap = bussDocumentLibraryEOMapper.selectMapsAll(null); - - //字段 - StringBuilder fieldsBuilder = new StringBuilder(); - //数据值 - StringBuilder valuesBuilder = new StringBuilder(); - - - //调整map中字段的顺序和新增表单中字段顺序一致 - Map mapNew = new LinkedHashMap<>(); - for (OnlCgformField onlCgformField : fieldList) { - for (Map.Entry entry : map.entrySet()) { - //固定字段 - if ("create_by".equals(entry.getKey()) - || "create_time".equals(entry.getKey()) - || "update_by".equals(entry.getKey()) - || "update_time".equals(entry.getKey()) - || "sys_org_code".equals(entry.getKey())) { - mapNew.put(entry.getKey(), entry.getValue()); - } else if (onlCgformField.getDbFieldName().equals(entry.getKey())) { - mapNew.put(entry.getKey(), entry.getValue()); - break; - } - } - } - List oSSFileAll = new ArrayList<>(); - Map stringObjectMap = new HashMap<>(); - for (Map.Entry entry : mapNew.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - //es全文新增数据(数据转换) - // esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); - - if (ObjectUtils.isNotEmpty(value)) { - //处理修改人和修改时间 - if ("update_by".equals(key)) { - //编辑ES时不处理(修改搜索中心历史数据) - if(ObjectUtils.isEmpty(map.get("es_update_flag"))){ - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - value = sysUser.getUsername(); - } - } - List fieldDate = fieldDateList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - //处理时间类型 - if (fieldDate.size() != 0) { - if (ObjectUtils.isNotEmpty(value)) { - value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')"; - } - valuesBuilder.append(value + ","); - } else { - //处理文件类型 - List fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) { - - //判断文件是否修改 - if ((ObjectUtils.isNotEmpty(dataList.get(0).get(key)) && !dataList.get(0).get(key).equals(value)) - || (ObjectUtils.isEmpty(dataList.get(0).get(key)) && ObjectUtils.isNotEmpty(value))) { - String valueTemp = UUID.randomUUID().toString().replace("-", ""); - stringObjectMap.put(key,valueTemp); - //修改文件表关联信息connect_id - List oSSFileList = new ArrayList<>(); - for (String fileId : value.toString().split(",")) { - OSSFile ossFile = new OSSFile(); - ossFile.setId(fileId); - ossFile.setConnectId(valueTemp); - oSSFileList.add(ossFile); - } - if (oSSFileList.size() != 0) { - oSSFileAll.addAll(oSSFileList); - } - iOSSFileService.updateFileInfo(oSSFileList); - valuesBuilder.append("'" + valueTemp + "'" + ","); - } else { - List oSSFileList = new ArrayList<>(); - OSSFile ossFile = new OSSFile(); - ossFile.setId((String) value); - oSSFileList.add(ossFile); - valuesBuilder.append("'" + value + "'" + ","); - } - } else { - //编辑时replaced_standard被代替标准不存值,通过查询得到 - if ("replaced_standard".equals(key)) { - valuesBuilder.append("'" + "" + "'" + ","); - } else { - valuesBuilder.append("'" + value + "'" + ","); - } - } - } - fieldsBuilder.append(key + ","); - } - } - List fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList()); - List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ",")); - - //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) - List ossFileList = fileSort(fieldFileList, fileInfos, stringObjectMap); - - // 将用户选择、输入的新车型实施日期、在产车实施日期备份出来。如果不处理的话,插入ES时会报 解析失败 错误。 - String implement_time = (String) map.get("implement_time"); - String xin1_che1_xing2_shi2_shi1_ri4_qi1 = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); - - // 批量添加分阶段实施明细信息 - this.insertBatchPhasedImplementationDetailsInfo(map); - - // 备份出来插入搜索中心-文档库模块的新车型、在产车实施日期 (该参数是文档库原有新车型、在产车 与分阶段实施日期中的 时间组合。) - String implementTime = (String) map.get("implement_time"); - String xinCheXingShiShiRiQi = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); - - StringBuilder sbCn = new StringBuilder(); - StringBuilder sbEn = new StringBuilder(); - for (Map.Entry entry : map.entrySet()) { - //es全文新增数据(数据转换) - esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); - } - - // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 - map.put("implement_time",implement_time); - map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); - - List> mapListTempCn = new ArrayList<>(); - List> mapListTempEn = new ArrayList<>(); - String fileTextAll = ""; - try { - String cutCn = LanguageEnum.CN.getValue(); - String cutEn = LanguageEnum.EN.getValue(); - if (fileInfos.size() != 0) { - //编辑时,有修改文件的情况 - fileTextAll = updateEsInfo(map, searchFieldList, sbCn, sbEn, fileInfos, mapListTempCn, mapListTempEn, cutCn, cutEn); - } else { - //没有修改文件,获取之前上传过的文件 - List fieldFileListTemp = fieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fileFieldList = fieldFileListTemp.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - List connectIdList = new ArrayList<>(); - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - String value = MyStringUtils.valueOf(entry.getValue()); - if(fileFieldList.contains(key)){ - if(!"null".equals(value) && StringUtils.isNotBlank(value)){ - connectIdList.add(value); - } - } - } - if(connectIdList.size()!= 0){ - List oSSFileListTemp = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); - //处理文件排序(发布稿 增补件 报批稿 征求意见稿 测试程序) - List files = fileSort(fieldFileList, oSSFileListTemp, map); - fileTextAll = updateEsInfo(map, searchFieldList, sbCn, sbEn, files, mapListTempCn, mapListTempEn, cutCn, cutEn); - - }else{ - //之前没有上传过文件 - Map stringMapCn = new HashMap<>(); - Map stringMapEn = new HashMap<>(); - Map mapBaseDateCn = new HashMap<>(); - Map mapBaseDateEn = new HashMap<>(); - stringMapCn.put("create_time",new Date()); - stringMapEn.put("create_time",new Date()); - mapBaseDateCn.put("create_time",new Date()); - mapBaseDateEn.put("create_time",new Date()); - for (OnlCgformField onlCgformField : searchFieldList) { - String s = (String) map.get(onlCgformField.getDbFieldName()); - if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ - s = s.split(" ")[0]; - } - if(StringUtils.isNotBlank(s)){ - stringMapCn.put(onlCgformField.getDbFieldName(), s); - stringMapEn.put(onlCgformField.getDbFieldName(), s); - mapBaseDateCn.put(onlCgformField.getDbFieldName(),s); - mapBaseDateEn.put(onlCgformField.getDbFieldName(),s); - } - } - - //封装中文的全文内容(es) - putMapCn(MyStringUtils.valueOf(map.get("id")), MyStringUtils.valueOf(map.get("serial_number")), "文档库", - sbCn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", - cutCn, stringMapCn,SEARCH_FLAG); - stringMapCn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); - //封装英文的全文内容(es) - putMapCn(MyStringUtils.valueOf(map.get("id")), MyStringUtils.valueOf(map.get("serial_number")), "document library", - sbEn.toString(), MyStringUtils.valueOf(map.get("title")), "", "", - cutEn, stringMapEn,SEARCH_FLAG); - stringMapEn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); - - //用于全文带条件查询----------------------------- - //封装中文的全文内容(es) - putMapCn(MyStringUtils.valueOf(map.get("id"))+"1", MyStringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutCn, mapBaseDateCn, null); - mapBaseDateCn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); - //封装英文的全文内容(es) - putMapCn(MyStringUtils.valueOf(map.get("id"))+"2", MyStringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(), - MyStringUtils.valueOf(map.get("title")), "", "", - cutEn, mapBaseDateEn,null); - stringMapEn.put("file_sort", MyStringUtils.valueOf(map.get("id")+"_"+1)); - //用于全文带条件查询----------------------------- - - mapListTempCn.add(stringMapCn); - mapListTempEn.add(stringMapEn); - mapListTempCn.add(mapBaseDateCn); - mapListTempEn.add(mapBaseDateEn); - } - } - - } catch (Exception e) { - e.printStackTrace(); - log.error("文档库新增es错误"); - } - - String insertField = fieldsBuilder.substring(0, fieldsBuilder.length() - 1); - String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1); - - isModifyForOcrAndSplit(map); - //编辑数据采用先删除在新增的方法 - //删除文件 - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll((String) map.get("id")); - - List connectIdList = new ArrayList<>();//已删除的文件关联id - for (OnlCgformField onlCgformField : fieldFileList) { - String connectId = MyStringUtils.valueOf(mapList.get(0).get(onlCgformField.getDbFieldName())); - //如果文件没有修改则不用删除 - if (StringUtils.isNotBlank(connectId) && !connectId.equals(map.get(onlCgformField.getDbFieldName()))) { - connectIdList.add(connectId); - } - } - //查询已删除的文件id(用于es删除) - List fileIdListDelete = new ArrayList<>(); - if(connectIdList.size() != 0){ - List fileInfosByConnectId = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); - fileIdListDelete = fileInfosByConnectId.stream().map(OSSFile::getId).collect(Collectors.toList()); - } - //删除文件 - iOSSFileService.deleteByConnectIdList(connectIdList); - //删除文档库数据 - bussDocumentLibraryEOMapper.deleteById((String) map.get("id")); - bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue); - //处理代替标准和被代替标准逻辑 - String docId = MyStringUtils.valueOf(map.get("serial_number")); - Object repObj = map.get("replace_standard_id"); - if(null != repObj){ - String[] replace_standard_list = repObj.toString().split(","); - for (String rs : replace_standard_list) { - BussDocumentLibraryEO bl = bussDocumentLibraryEOMapper.selectById(rs); - if (null != bl) { - String repStr = bl.getReplacedStandard(); - if (StringUtils.isNotBlank(repStr)) { - if (!repStr.contains(docId)) { - repStr = repStr + "," + docId; - } - } else { - repStr = docId; - } - bl.setReplacedStandard(repStr); - bussDocumentLibraryEOMapper.updateById(bl); - } - } - } - //开始更新ES - map.put("module_type", "文档库"); - map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); - map.put("create_time", new Date()); - map.put("file_text", fileTextAll); - Map objectMapTemp = new HashMap<>(); - for (Map.Entry entry : map.entrySet()) { - Object value = entry.getValue(); - if(ObjectUtils.isNotEmpty(entry.getValue())){ - if(dateSingleList.contains(entry.getKey())){ - value = value.toString().split(" ")[0]; - }else if("create_time".equals(entry.getKey()) || "update_time".equals(entry.getKey())){ -// value = value.toString().split(" ")[0]; - } - objectMapTemp.put(entry.getKey(),value); - } - } - // 将分阶段实施时间,存放到搜索中心文档库模块中 -// objectMapTemp.put("implement_time",implementTime);// 在产车 -// objectMapTemp.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xinCheXingShiShiRiQi);// 新车型 - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(objectMapTemp)); - JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn)); - JSONArray arrayEn = JSONArray.parseArray(JSON.toJSONString(mapListTempEn)); - //修改es - try { - //删除文档库和全部 - jeroElasticsearchTemplate.delete(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), (String) map.get("id")); - //删除全部中文 - for (Map objectMap : mapListTempCn) { - jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), (String) objectMap.get("id")); - } - //删除全部中文 - for (Map objectMap : mapListTempEn) { - jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), (String) objectMap.get("id")); - } - //处理编辑时已删除的文件(在es中同步删除文件单独生成的一条数据) - if(fileIdListDelete.size() != 0){ - for (String fileId : fileIdListDelete) { - jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), - SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), - map.get("id") +fileId); - jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), - SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), - map.get("id") +fileId); - } - } - jeroElasticsearchTemplate.saveOrUpdate(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), (String) map.get("id"), jsonObject); - //添加全文 - jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), arrayCn); - jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), arrayEn); - } catch (Exception e) { - log.error("文档库编辑es失败"); - } - } - - private void homeDocumentDynamic(String cut, - Map map, - String serialNumber, - String id, String title, - List> dataList, - List fieldList, - List dictItemList, - String titleEn) { - //文件类型字段 - List onlCgformFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - - List fileFieldList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - StringBuilder sbTemp = new StringBuilder(); - StringBuilder sbContent = new StringBuilder(); - StringBuilder sbContentInfo = new StringBuilder(); - StringBuilder sbField = new StringBuilder(); - StringBuilder sbNew = new StringBuilder(); - StringBuilder sbFieldCn = new StringBuilder(); - StringBuilder sbNewCn = new StringBuilder(); - dataList.get(0).entrySet().forEach(entry -> { - String keyTemp = entry.getKey(); - if(fileFieldList.contains(keyTemp)) { - String valueTemp = (String) entry.getValue(); - List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(keyTemp)).collect(Collectors.toList()); - List fileInfosTemp = iOSSFileService.getFileInfos(valueTemp); - //之前的文件 - List fileNameList = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - String value = (String) map.get(keyTemp); - List fileInfosTempNew = iOSSFileService.getFileInfos(value); - //现在的文件 - List fileNameListNew = fileInfosTempNew.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListNew); - if (!checkDiffrent && fileNameListNew.size() != 0) { - //消息 - sbField.append(fields.get(0).getDbFieldEnName() + ","); - sbFieldCn.append(fields.get(0).getDbFieldTxt() + ","); - - for (String s : fileNameListNew) { - if (!fileNameList.contains(s)) { - //消息详情 - sbNew.append(fields.get(0).getDbFieldEnName() + " " + s + ","); - sbNewCn.append(fields.get(0).getDbFieldTxt() + " " + s + ","); - } - } - } - } - }); - - String href = "" + serialNumber + "" + " " + titleEn; - String hrefCn = "" + serialNumber + "" + " " + title; - String contentFile = ""; - String contentInfoFile = ""; - String contentFileCn = ""; - String contentInfoFileCn = ""; - if(StringUtils.isNotBlank(sbField)){ - contentFile = serialNumber + " " + titleEn + " uploaded " + sbField; - contentFileCn = serialNumber + " " + title + " 中上传了 " + sbFieldCn; - } - if(StringUtils.isNotBlank(sbNew)){ - contentInfoFile = href + " uploaded " + sbNew; - contentInfoFileCn = hrefCn + " 中上传了" + sbNewCn; - } - - StringBuilder msgContentSb = new StringBuilder(); - StringBuilder msgContentInfoSb = new StringBuilder(); - StringBuilder msgContentSbCn = new StringBuilder(); - StringBuilder msgContentInfoSbCn = new StringBuilder(); - //适用车型 - StringBuilder msgContentSbCarType = new StringBuilder("Vehicle Type of the " + serialNumber + " " + titleEn); - StringBuilder msgContentInfoSbCarType = new StringBuilder("Vehicle Type of the " + href); - StringBuilder msgContentSbCarTypeCn = new StringBuilder(serialNumber + " " + title+" 的适用车型改为"); - StringBuilder msgContentInfoSbCarTypeCn = new StringBuilder(hrefCn+" 的适用车型改为"); - //状态 - StringBuilder msgContentSbStatus = new StringBuilder("The Status of the " + serialNumber + " " + titleEn); - StringBuilder msgContentInfoSbStatus = new StringBuilder("The Status of the " + href); - StringBuilder msgContentSbStatusCn = new StringBuilder(serialNumber + " " + title+" 的状态改为"); - StringBuilder msgContentInfoSbStatusCn = new StringBuilder(hrefCn+" 的状态改为"); - - - List fileIdLIstTemp = new ArrayList<>(); - for (Map.Entry entry : dataList.get(0).entrySet()) { - String key = entry.getKey(); - String value = MyStringUtils.valueOf(entry.getValue()); - //文件 - if(fileFieldList.contains(key)&& !"null".equals(value) && StringUtils.isNotBlank(value)){ - fileIdLIstTemp.addAll(Arrays.asList(value.split(","))); - } - } - int count = 0; - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - String value = MyStringUtils.valueOf(entry.getValue()); - - if (value == null){ - continue; - } - - //状态 - if("state".equals(key) && !value.equals(MyStringUtils.valueOf(dataList.get(0).get("state")))){ - count++; - //数据字典转换 dictItemList - String finalValue = value; - String valueCn = ""; - List stateDictItemList = dictItemList.stream() - .filter(e -> "state".equals(e.getDictCode()) && finalValue.equals(e.getItemValue())) - .collect(Collectors.toList()); - if(stateDictItemList.size() != 0){ - value = stateDictItemList.get(0).getEnName(); - valueCn = stateDictItemList.get(0).getItemText(); - } - // - if(StringUtils.isBlank(value)){ - msgContentSbStatus.append(" has been modified to be null,"); - msgContentInfoSbStatus.append(" has been modified to be null,"); - msgContentSb.append(msgContentSbStatus); - msgContentInfoSb.append(msgContentInfoSbStatus); - }else{ - msgContentSbStatus.append(" has been modified to " + value + ","); - msgContentInfoSbStatus.append(" has been modified to " + value + ","); - msgContentSb.append(msgContentSbStatus); - msgContentInfoSb.append(msgContentInfoSbStatus); - msgContentSbCn.append(msgContentSbStatusCn + valueCn+ ","); - msgContentInfoSbCn.append(msgContentInfoSbStatusCn + valueCn+ ","); - } - - } - //适用车型 car_type - if("shi4_yong4_che1_xing2".equals(key) && !value.equals(MyStringUtils.valueOf(dataList.get(0).get("shi4_yong4_che1_xing2"))) && !"null".equals(value)){ - count++; - //数据字典转换 dictItemList - List stateDictItemList = dictItemList.stream() - .filter(e -> "car_type".equals(e.getDictCode())) - .collect(Collectors.toList()); - - StringBuilder sb = new StringBuilder(); - for (String s : value.split(",")) { - List collect = stateDictItemList.stream().filter(e -> s.equals(e.getItemValue())).collect(Collectors.toList()); - if(collect.size() != 0){ - if(LanguageEnum.CN.getValue().equals(cut)){ - sb.append(collect.get(0).getItemText()+","); - }else{ - sb.append(collect.get(0).getEnName()+","); - } - } - } - if(StringUtils.isNotBlank(sb)){ - String substring = sb.substring(0, sb.length() - 1); - value = substring; - } - if(StringUtils.isBlank(value)){ - msgContentSbCarType.append(" has been modified to be null,"); - msgContentInfoSbCarType.append(" has been modified to be null,"); - msgContentSb.append(msgContentSbCarType); - msgContentInfoSb.append(msgContentInfoSbCarType); - msgContentSbCn.append(msgContentSbCarTypeCn + "空,"); - msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + "空,"); - }else{ - msgContentSbCarType.append(" has been modified to " + value + ","); - msgContentInfoSbCarType.append(" has been modified to " + value + ","); - msgContentSb.append(msgContentSbCarType); - msgContentInfoSb.append(msgContentInfoSbCarType); - msgContentSbCn.append(msgContentSbCarTypeCn + value+ ","); - msgContentInfoSbCn.append(msgContentInfoSbCarTypeCn + value+ ","); - } - - } - } - if(StringUtils.isNotBlank(contentFile)){ - count ++; - msgContentSb.append(contentFile); - msgContentSbCn.append(contentFileCn); - } - if(StringUtils.isNotBlank(contentInfoFile)){ - msgContentInfoSb.append(contentInfoFile); - msgContentInfoSbCn.append(contentInfoFileCn); - } - if(count > 0){ - String msgContent = msgContentSb.substring(0, msgContentSb.length() - 1) + "."; - String msgContentInfo = msgContentInfoSb.substring(0, msgContentInfoSb.length() - 1) + "."; - String msgContentCn = msgContentSbCn.substring(0, msgContentSbCn.length() - 1) + "."; - String msgContentInfoCn = msgContentInfoSbCn.substring(0, msgContentInfoSbCn.length() - 1) + "."; - HomeDocumentDynamicEO homeDocumentDynamicEO = new HomeDocumentDynamicEO(); - homeDocumentDynamicEO.setMsgContent(msgContent); - homeDocumentDynamicEO.setMsgContentInfo(msgContentInfo); - homeDocumentDynamicEO.setMsgContentCn(msgContentCn); - homeDocumentDynamicEO.setMsgContentInfoCn(msgContentInfoCn); - homeDocumentDynamicEOService.save(homeDocumentDynamicEO); - } - } - - private String updateEsInfo(Map map, List searchFieldList, StringBuilder sbCn, StringBuilder sbEn, List fileInfos, List> mapListTempCn, List> mapListTempEn, String cutCn, String cutEn) { - Map mapBaseDateCn = new HashMap<>(); - Map mapBaseDateEn = new HashMap<>(); - StringBuilder fileTextAll = new StringBuilder(); - for (OSSFile ossFile : fileInfos) { - Map stringMapCn = new HashMap<>(); - Map stringMapEn = new HashMap<>(); - String fileText = ""; - if (ossFile.getFileName().endsWith(".doc") - || ossFile.getFileName().endsWith(".docx") - || ossFile.getFileName().endsWith(".DOC") - || ossFile.getFileName().endsWith(".DOCX")) { - String wordContent = null; - try { - wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath); - } catch (Exception e) { - log.error("文档库:读取word文件内容失败"); - } - if (StringUtils.isNotBlank(wordContent)) { - fileText = wordContent; - fileTextAll.append(fileText+","); - } - } else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) { - String pdfContent = null; - try { - pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl()); - } catch (Exception e) { - log.error("文档库读取PDF文件内容失败"); - } - if (StringUtils.isNotBlank(pdfContent)) { - fileText = pdfContent; - fileTextAll.append(fileText+","); - } - } - for (OnlCgformField onlCgformField : searchFieldList) { - String s = (String) map.get(onlCgformField.getDbFieldName()); - if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ - s = s.split(" ")[0]; - } - if(StringUtils.isNotBlank(s)){ - stringMapCn.put(onlCgformField.getDbFieldName(), s); - stringMapEn.put(onlCgformField.getDbFieldName(), s); - } - } - - //封装中文的全文内容(es) - putMapCn(map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "文档库", - sbCn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(), - cutCn, stringMapCn,null); - //封装英文的全文内容(es) - putMapCn(map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "document library", - sbEn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(), - cutEn, stringMapEn,null); - - mapListTempCn.add(stringMapCn); - mapListTempEn.add(stringMapEn); - int a = 1; - int b = 1; - for (Map objectMap : mapListTempCn) { - a++; - objectMap.put("file_sort", map.get("id") +"_"+a); - } - for (Map objectMap : mapListTempEn) { - b++; - objectMap.put("file_sort", map.get("id") +"_"+b); - } - } - - for (OnlCgformField onlCgformField : searchFieldList) { - String s = (String) map.get(onlCgformField.getDbFieldName()); - if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){ - s = s.split(" ")[0]; - } - if(StringUtils.isNotBlank(s)){ - mapBaseDateCn.put(onlCgformField.getDbFieldName(), s); - mapBaseDateEn.put(onlCgformField.getDbFieldName(), s); - } - } - //基础数据中文(es) - putMapCn((String) map.get("id"), (String) map.get("serial_number"), "文档库", - sbCn.toString(), (String) map.get("title"), "", "", - cutCn, mapBaseDateCn,SEARCH_FLAG); - mapBaseDateCn.put("file_sort", map.get("id") +"_"+1); - //基础数据英文(es) - putMapCn((String) map.get("id"), (String) map.get("serial_number"), "document library", - sbEn.toString(), (String) map.get("title"), "", "", - cutEn, mapBaseDateEn,SEARCH_FLAG); - mapBaseDateEn.put("file_sort", map.get("id") +"_"+1); - mapListTempCn.add(mapBaseDateCn); - mapListTempEn.add(mapBaseDateEn); - return fileTextAll.toString(); - - } - - /** - * 更新log - * - * @param map - */ - private void updateLog(Map map, - List> dataList, - List fieldList, - List fieldDateList, - List fieldFileList, - List fieldPullList, - String cut) { - StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut,null); - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - if (StringUtils.isNotBlank(sb)) { - String content = sb.substring(0, sb.length() - 1); - BussLogEO bussLogEO = new BussLogEO(); - bussLogEO.setDocumentId((String) map.get("id")); - bussLogEO.setContent(content); - bussLogEO.setCreateBy(sysUser.getUsername()); - iBussLogEOService.add(bussLogEO); - } - } - - @NotNull - private StringBuilder getUpdateInfo(Map map, List> dataList, - List fieldList, List fieldDateList, - List fieldFileList, List fieldPullList, - String cut,String flag) { - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - //调整dataList中map中字段顺序与表单中的一致 - Map mapNew = new LinkedHashMap<>(); - for (OnlCgformField onlCgformField : fieldList) { - for (Map.Entry entry : dataList.get(0).entrySet()) { - if (onlCgformField.getDbFieldName().equals(entry.getKey())) { - mapNew.put(entry.getKey(), entry.getValue()); - break; - } - } - } - dataList.remove(0); - dataList.add(mapNew); - Map mapTemp = new HashMap<>(); - mapCopy(map, mapTemp); - //时间类型的字段 - List fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //文件类型的字段 - List fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //下拉类型的字段 - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //树形数据字典 - List categoryList = sysCategoryService.list(); - //下拉选处理数据字典 - for (Map.Entry entry : dataList.get(0).entrySet()) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, fieldList,flag); - treeDictItem(categoryList, entry, treeFieldList, cut,flag); - } - for (Map.Entry entry : mapTemp.entrySet()) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, fieldList,flag); - treeDictItem(categoryList, entry, treeFieldList, cut,flag); - } - - StringBuilder sb = new StringBuilder(); - dataList.get(0).entrySet().forEach(entry -> { - String key = entry.getKey(); - Object value = entry.getValue(); - //字段中文名 - List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList()); - - if (fields.size() != 0) { - String dbFieldTxt = fields.get(0).getDbFieldTxt(); - if("1".equals(flag)){ - dbFieldTxt = fields.get(0).getDbFieldEnName(); - }else{ - dbFieldTxt = fields.get(0).getDbFieldTxt(); - } - dbFieldTxt = "" + dbFieldTxt + ""; - if (value == null) { - value = ""; - } - for (Map.Entry entryTemp : mapTemp.entrySet()) { - String keyTemp = entryTemp.getKey(); - Object valueTemp = entryTemp.getValue(); - if (valueTemp == null) { - valueTemp = ""; - } - if (!"create_time".equals(key) && !"update_time".equals(key)) { - if (key.equals(keyTemp)) { - if (fieldDate.contains(key)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - if (ObjectUtils.isNotEmpty(value)) { - value = sdf.format(value); - } - if (ObjectUtils.isNotEmpty(valueTemp)) { - try { - valueTemp = sdf.format(sdf.parse((String) valueTemp)); - } catch (ParseException e) { - } - } - //处理时间类型字段 - if (ObjectUtils.isNotEmpty(value)) { - if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); - } - } else if (ObjectUtils.isEmpty(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - } - } - } else { - if (ObjectUtils.isNotEmpty(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - } - - } - } - - } else if (fieldFile.contains(key)) { - //处理文件类型字段 - List fileNameList = new ArrayList<>(); - List fileNameListTemp = new ArrayList<>(); - //之前的文件 - if (ObjectUtils.isNotEmpty(value)) { - List fileInfos = iOSSFileService.getFileInfosByConnectId((String) value); - fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - } - //修改的文件 - if (ObjectUtils.isNotEmpty(valueTemp)) { - List fileInfosTemp = iOSSFileService.getFileInfos((String) valueTemp); - fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - } - - if (ObjectUtils.isNotEmpty(value)) { - boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp); - - if (fileNameListTemp.size() != 0 && !checkDiffrent) { - if("1".equals(flag)){ - //sysUser - sb.append(dbFieldTxt +" was changed from \""+ StringUtils.join(fileNameList, ",") + "\" to \"" + StringUtils.join(fileNameListTemp, ",") + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - } - } else if (fileNameListTemp.size() == 0) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from \""+ StringUtils.join(fileNameList, ",") + "\" to null " + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); - } - - } - } else { - if (fileNameListTemp.size() != 0) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from null to \"" + StringUtils.join(fileNameListTemp, ",") + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - } - - } - } - } else { -// if ("replace_standard".equals(key) || "corresponding_standard".equals(key)) { -// if (ObjectUtils.isNotEmpty(value)) { -// value = getReplaceStandardName(value); -// } -// if (ObjectUtils.isNotEmpty(valueTemp)) { -// valueTemp = getReplaceStandardName(valueTemp); +// } +// } +// } +// } +// }); +// return sb; +// } +// +// @NotNull +// private StringBuilder getUpdateInfoCn(Map map, List> dataList, +// List fieldList, List fieldDateList, +// List fieldFileList, List fieldPullList, +// String cut,String flagTemp) { +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// //调整dataList中map中字段顺序与表单中的一致 +// Map mapNew = new LinkedHashMap<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// for (Map.Entry entry : dataList.get(0).entrySet()) { +// if (onlCgformField.getDbFieldName().equals(entry.getKey())) { +// mapNew.put(entry.getKey(), entry.getValue()); +// break; +// } +// } +// } +// dataList.remove(0); +// dataList.add(mapNew); +// Map mapTemp = new HashMap<>(); +// mapCopy(map, mapTemp); +// //时间类型的字段 +// List fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //文件类型的字段 +// List fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //下拉类型的字段 +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //下拉选处理数据字典 +// for (Map.Entry entry : dataList.get(0).entrySet()) { +// //下拉选处理数据字典 +// dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp); +// treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp); +// } +// for (Map.Entry entry : mapTemp.entrySet()) { +// //下拉选处理数据字典 +// dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp); +// treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp); +// } +// +// StringBuilder sb = new StringBuilder(); +// dataList.get(0).entrySet().forEach(entry -> { +// String key = entry.getKey(); +// Object value = entry.getValue(); +// //字段中文名 +// List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList()); +// +// if (fields.size() != 0) { +// String dbFieldTxt = fields.get(0).getDbFieldTxt(); +// if("2".equals(flagTemp)){ +// dbFieldTxt = fields.get(0).getDbFieldTxt(); +// }else{ +// dbFieldTxt = fields.get(0).getDbFieldTxt(); +// } +// dbFieldTxt = "" + dbFieldTxt + ""; +// if (value == null) { +// value = ""; +// } +// for (Map.Entry entryTemp : mapTemp.entrySet()) { +// String keyTemp = entryTemp.getKey(); +// Object valueTemp = entryTemp.getValue(); +// if (valueTemp == null) { +// valueTemp = ""; +// } +// if (!"create_time".equals(key) && !"update_time".equals(key)) { +// if (key.equals(keyTemp)) { +// if (fieldDate.contains(key)) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// if (ObjectUtils.isNotEmpty(value)) { +// value = sdf.format(value); +// } +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// try { +// valueTemp = sdf.format(sdf.parse((String) valueTemp)); +// } catch (ParseException e) { // } // } - //其他类型(被代替标准不处理) - if (!"replaced_standard".equals(key)) { - if (ObjectUtils.isNotEmpty(value)) { - if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); - } - } else if (ObjectUtils.isEmpty(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - } - } - } else { - if (ObjectUtils.isNotEmpty(valueTemp)) { - if("1".equals(flag)){ - sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - } - } - } - } - } - } - } - } - } - }); - return sb; - } - - @NotNull - private StringBuilder getUpdateInfoCn(Map map, List> dataList, - List fieldList, List fieldDateList, - List fieldFileList, List fieldPullList, - String cut,String flagTemp) { - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - //调整dataList中map中字段顺序与表单中的一致 - Map mapNew = new LinkedHashMap<>(); - for (OnlCgformField onlCgformField : fieldList) { - for (Map.Entry entry : dataList.get(0).entrySet()) { - if (onlCgformField.getDbFieldName().equals(entry.getKey())) { - mapNew.put(entry.getKey(), entry.getValue()); - break; - } - } - } - dataList.remove(0); - dataList.add(mapNew); - Map mapTemp = new HashMap<>(); - mapCopy(map, mapTemp); - //时间类型的字段 - List fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //文件类型的字段 - List fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //下拉类型的字段 - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //树形数据字典 - List categoryList = sysCategoryService.list(); - //下拉选处理数据字典 - for (Map.Entry entry : dataList.get(0).entrySet()) { - //下拉选处理数据字典 - dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp); - treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp); - } - for (Map.Entry entry : mapTemp.entrySet()) { - //下拉选处理数据字典 - dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp); - treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp); - } - - StringBuilder sb = new StringBuilder(); - dataList.get(0).entrySet().forEach(entry -> { - String key = entry.getKey(); - Object value = entry.getValue(); - //字段中文名 - List fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList()); - - if (fields.size() != 0) { - String dbFieldTxt = fields.get(0).getDbFieldTxt(); - if("2".equals(flagTemp)){ - dbFieldTxt = fields.get(0).getDbFieldTxt(); - }else{ - dbFieldTxt = fields.get(0).getDbFieldTxt(); - } - dbFieldTxt = "" + dbFieldTxt + ""; - if (value == null) { - value = ""; - } - for (Map.Entry entryTemp : mapTemp.entrySet()) { - String keyTemp = entryTemp.getKey(); - Object valueTemp = entryTemp.getValue(); - if (valueTemp == null) { - valueTemp = ""; - } - if (!"create_time".equals(key) && !"update_time".equals(key)) { - if (key.equals(keyTemp)) { - if (fieldDate.contains(key)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - if (ObjectUtils.isNotEmpty(value)) { - value = sdf.format(value); - } - if (ObjectUtils.isNotEmpty(valueTemp)) { - try { - valueTemp = sdf.format(sdf.parse((String) valueTemp)); - } catch (ParseException e) { - } - } - //处理时间类型字段 - if (ObjectUtils.isNotEmpty(value)) { - if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); - } - } else if (ObjectUtils.isEmpty(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - } - } - } else { - if (ObjectUtils.isNotEmpty(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - } - - } - } - - } else if (fieldFile.contains(key)) { - //处理文件类型字段 - List fileNameList = new ArrayList<>(); - List fileNameListTemp = new ArrayList<>(); - //之前的文件 - if (ObjectUtils.isNotEmpty(value)) { - List fileInfos = iOSSFileService.getFileInfosByConnectId((String) value); - fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - } - //修改的文件 - if (ObjectUtils.isNotEmpty(valueTemp)) { - List fileInfosTemp = iOSSFileService.getFileInfos((String) valueTemp); - fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - } - - if (ObjectUtils.isNotEmpty(value)) { - boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp); - - if (fileNameListTemp.size() != 0 && !checkDiffrent) { - if("2".equals(flagTemp)){ - //sysUser - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - } - } else if (fileNameListTemp.size() == 0) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); - } - - } - } else { - if (fileNameListTemp.size() != 0) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); - } - - } - } - } else { -// if ("replace_standard".equals(key) || "corresponding_standard".equals(key)) { -// if (ObjectUtils.isNotEmpty(value)) { -// value = getReplaceStandardName(value); +// //处理时间类型字段 +// if (ObjectUtils.isNotEmpty(value)) { +// if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\","); +// } +// } else if (ObjectUtils.isEmpty(valueTemp)) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); +// } // } +// } else { // if (ObjectUtils.isNotEmpty(valueTemp)) { -// valueTemp = getReplaceStandardName(valueTemp); +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// } +// // } // } - //其他类型(被代替标准不处理) - if (!"replaced_standard".equals(key)) { - if (ObjectUtils.isNotEmpty(value)) { - if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); - } - } else if (ObjectUtils.isEmpty(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - }else{ - sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); - } - } - } else { - if (ObjectUtils.isNotEmpty(valueTemp)) { - if("2".equals(flagTemp)){ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - }else{ - sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); - } - } - } - } - } - } - } - } - } - }); - return sb; - } - - private Object getReplaceStandardName(Object value) { - String valueStr = (String) value; - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(valueStr); - List serialNumberList = new ArrayList<>(); - for (Map stringObjectMap : mapList) { - serialNumberList.add((String) stringObjectMap.get("serial_number")); - } - if (serialNumberList.size() != 0) { - value = StringUtils.join(serialNumberList, ","); - } - return value; - } - - /** - * 处理修改代替标准,发送通知 - * - * @param map - */ - private void sendMessageUpdate(Map map, - List> dataList, - List fieldList, - List fieldDateList, - List fieldFileList, - List fieldPullList, - String cut) { - List> dataListTemp = new ArrayList<>(); - for (Map stringObjectMap : dataList) { - Map mapT = new HashMap<>(); - mapCopy(stringObjectMap, mapT); - dataListTemp.add(mapT); - } - - String technologyTerritoryNew = (String) dataList.get(0).get("technology_territory"); - //1. 处理订阅的发送消息 - //修改的内容 - String flag ="1";//消息的标识(英文) - StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flag); - String flagTemp ="2";//消息的标识(中文--消息采用卡片型式发送, 消息内容包含中英文, 所以此处需要获取消息的中文) - StringBuilder sbCn = getUpdateInfoCn(map, dataListTemp, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flagTemp); - //树形数据字典 - List categoryList = sysCategoryService.list(); - String sbStr = ""; - if (ObjectUtils.isNotEmpty(sb)) { - sbStr = sb.substring(0, sb.length() - 1); - } - String sbStrCn = ""; - if (ObjectUtils.isNotEmpty(sbCn)) { - sbStrCn = sbCn.substring(0, sbCn.length() - 1); - } - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String serialNumber = (String) dataList.get(0).get("serial_number"); - String technologyTerritory = (String) map.get("technology_territory"); - //只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”) - //向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息 - // 只有技术领域变更为订阅的技术领域这一种情况发消息, 假如订阅了技术领域A,编辑的文档的技术领域也是A,这时编辑的是其他的字段,这种情况不发消息 - Map mapTemp = new HashMap<>(); - mapTemp.put("domainId", map.get("technology_territory")); - mapTemp.put("documentId", map.get("id")); - //订阅技术领域的人和订阅该条标准的人 - //订阅技术领域发消息 - List domainUserRelList = domainManageService.list(); - List thirdIdList = new ArrayList<>(); - List userList = new ArrayList<>(); - String technologyTerritoryNameEn = ""; - if(StringUtils.isNotBlank(technologyTerritory) && technologyTerritory.equals(technologyTerritoryNew) && domainUserRelList.size() != 0){ - List collect = domainUserRelList.stream() - .filter(e -> technologyTerritory.contains(e.getDomainId())) - .collect(Collectors.toList()); - if(collect.size() != 0){ - List userIdList = collect.stream().map(DomainUserRel::getUserId).collect(Collectors.toList()); - List domainIdList = collect.stream().map(DomainUserRel::getDomainId).distinct().collect(Collectors.toList()); - if(userIdList.size() != 0){ - List sysUsersFeishu = this.sysUserMapper.selectBatchIds(userIdList); - if(sysUsersFeishu.size() != 0){ - thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList()); - userList = sysUsersFeishu.stream().map(SysUser::getId).collect(Collectors.toList()); - } - } - if(domainIdList.size() != 0){ - StringBuilder sbTemp = new StringBuilder(); - for (String s : domainIdList) { - List collect1 = categoryList.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList()); - if(collect1.size() != 0){ - String enName = collect1.get(0).getEnName().trim(); - sbTemp.append(enName + ","); - } - } - if(StringUtils.isNotBlank(sbTemp)){ - technologyTerritoryNameEn = sbTemp.substring(0, sbTemp.length() - 1); - } - - } - } - } - //2. 处理修改代替标准的发送消息(法规负责人) - //处理修改代替标准,发送通知 - //修改时前端传参 - String replaceStandard = (String) map.get("replace_standard"); - if (dataList.size() != 0) { - //代替标准(根据id查询出来的) - String replaceStandardTemp = (String) dataList.get(0).get("replace_standard"); - - //(1)此种情况为编辑前代替标准就已经有数据了 - if (StringUtils.isNotBlank(replaceStandardTemp) && !replaceStandard.equals(replaceStandardTemp)) { - //需要向被替代标准的法规工程师发送站内通知和飞书信息,提醒内容:"新标准编号"已实施,请注意更新“替代标准编号”状态 - List list = Arrays.asList(replaceStandard.split(",")); - List listTemp = Arrays.asList(replaceStandardTemp.split(",")); - List listNew = list.stream().filter(e -> !listTemp.contains(e)).collect(Collectors.toList()); - //向listNew对应的工程师发飞书通知 - replaceStandardSend(listNew); - sendWebsocket((String) map.get("id"), (String) map.get("id")); - } else if (StringUtils.isBlank(replaceStandardTemp) && StringUtils.isNotBlank(replaceStandard)) { - //(2)此种情况为编辑前代替标准没有数据 - //向replaceStandard对应的工程师发飞书通知 - replaceStandardSend(Arrays.asList(replaceStandard.split(","))); - sendWebsocket((String) map.get("id"), (String) map.get("id")); - } - } - } - - public void sendWebsocket(String msgId, String msgTet) { - JSONObject obj = new JSONObject(); - obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC); - obj.put(WebsocketConst.MSG_ID, msgId); - obj.put(WebsocketConst.MSG_TXT, msgTet); - webSocket.sendMessage(obj.toJSONString()); - } - - private void replaceStandardSend(List serialNumberListTemp) { - List> mapList = bussDocumentLibraryEOMapper.selectMapsAllBySerialNumber(StringUtils.join(serialNumberListTemp, ",")); - List userNameListTemp = new ArrayList<>(); - List serialNumberList = new ArrayList<>(); - List urlList = new ArrayList<>(); - StringBuilder sb = new StringBuilder(); - for (Map stringObjectMap : mapList) { - String id = (String) stringObjectMap.get("id"); - String serialNumber = (String) stringObjectMap.get("serial_number"); - String title = (String) stringObjectMap.get("title"); - userNameListTemp.add((String) stringObjectMap.get("create_by")); - serialNumberList.add(serialNumber); - - String href = "" + serialNumber + ","; - sb.append(href); - String url = backUrl + "/docManage/library/detail?id=" + stringObjectMap.get("id"); - urlList.add(url); - } - String sbStr = ""; - if (ObjectUtils.isNotEmpty(sb)) { - sbStr = sb.substring(0, sb.length() - 1); - } - List userList = sysUserMapper.getUserListByNames(StringUtils.join(userNameListTemp, ",")); - List userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); - List thirdIdList = userList.stream().map(SysUser::getThirdId).collect(Collectors.toList()); - String content = "New numbering implemented, please note update status of alternate numbering " + StringUtils.join(serialNumberList, ","); - String contentInfo = "New numbering implemented, please note update status of alternate numbering " + sbStr; - String msgTitle = contentInfo; - //封装消息的实体类 - SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, - msgTitle, - content, - contentInfo,MessageTypeEnum.READ.getValue(), - MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), - null, - null); - sysAnnouncementService.saveAnnouncement(sysAnnouncement); - sendWebsocket(StringUtils.join(serialNumberListTemp, ","), contentInfo); - - } - - - @NotNull - public SysAnnouncement getSysAnnouncement(List userIdList, - String title, - String content, - String contentInfo, - String messageType, - String initiator, - String contentCn, - String contentInfoCn) { - SysAnnouncement sysAnnouncement = new SysAnnouncement(); - sysAnnouncement.setInitiator(initiator); - sysAnnouncement.setDelFlag("0"); - sysAnnouncement.setSendStatus("0"); - sysAnnouncement.setSendTime(new Date()); -// sysAnnouncement.setDocumentId((String) dataList.get(0).get("id")); - sysAnnouncement.setMsgCategory(messageType);//消息类型 - sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 - sysAnnouncement.setTitile(title); - sysAnnouncement.setMsgContent(content); - sysAnnouncement.setMsgContentInfo(contentInfo); - sysAnnouncement.setMsgContentCn(contentCn); - sysAnnouncement.setMsgContentInfoCn(contentInfoCn); - sysAnnouncement.setUserIds(StringUtils.join(userIdList, ",")); - return sysAnnouncement; - } - - private String getMustValues(String id) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String mustValue = "'" + id + "','" + sysUser.getUsername() + "'," - + "str_to_date('" + sdf.format(new Date()) + "','%Y-%m-%d %H:%i:%s')" + ",'" + sysUser.getUsername() + "'," - + "str_to_date('" + sdf.format(new Date()) + "','%Y-%m-%d %H:%i:%s')" + ",'" + sysUser.getOrgCode() + "'"; - return mustValue; - } - - /** - * 代替标准分页 - * - * @param parameter - * @return - */ - @Override - public IPage replacePageInfo(Map parameter) { - //查询内容 - String field = " id,serial_number,title,state"; - - //封装查询条件 - String condition = getConditionStr(parameter); - int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); - int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); - IPage> page = new Page>(pageNo, pageSize); - -// IPage infoPage = bussDocumentLibraryEOMapper.replacePageInfo(page, field, conditionSb.toString()); - IPage> infoPage = bussDocumentLibraryEOMapper.replacePageInfo(page, field, condition); - - - //树形数据字典 - List categoryList = sysCategoryService.list(); - //需要查询的字段 - List fieldList = onlCgformFieldService.getFieldList("1"); - - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //下拉选处理数据字典 - List> records = infoPage.getRecords(); - for (Map record : records) { - Map record1 = record; - for (Map.Entry entry : record1.entrySet()) { - treeDictItem(categoryList, entry, treeFieldList, (String) parameter.get("cut"),null); - if ("state".equals(entry.getKey())) { - List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - //状态数据字典 - if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - List stateList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) - .collect(Collectors.toList()); - List state = stateList.stream().filter(e -> e.getItemValue().equals(entry.getValue())).collect(Collectors.toList()); - if (state.size() != 0) { - entry.setValue(state.get(0).getItemText()); - } - } - } - } - } - return infoPage; - } - - /** - * ocr识别调取已入库文件分页 - * - * @param parameter - * @return - */ - @Override - public IPage> ocrPageInfo(Map parameter) { - //需要查询的字段 - List fieldList = onlCgformFieldService.getFieldList("1"); - List fileFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) - .map(OnlCgformField::getDbFieldName) - .collect(Collectors.toList()); - - //查询字段 - StringBuilder fieldSb = new StringBuilder(); - StringBuilder osfSql = new StringBuilder(); - StringBuilder join = new StringBuilder(); - int i = 1; - if (ObjectUtils.isNotEmpty(fileFieldList)) { - for (String fileField : fileFieldList) { - fieldSb.append("bdl." + fileField + ","); - if (i == 1) { - join.append(" on osf.connect_id = bdl." + fileField); - osfSql.append("(select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)"); - i++; - continue; - } else if (i == fileFieldList.size()) { - join.append(" or osf.connect_id = bdl." + fileField); - osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null))"); - - continue; - } - - join.append(" or osf.connect_id = bdl." + fileField); - osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)"); - i++; - - } - } - String fieldStr = fieldSb.substring(0, fieldSb.length() - 1); - - String field = " osf.id,bdl.id as \"buss_document_library_id\",bdl.serial_number,bdl.title,bdl.title_en,bdl.state,osf.file_name,osf.connect_id," + fieldStr - + " from " + osfSql + " osf join buss_document_library bdl" + join; - - //查询条件 - StringBuilder conditionSb = new StringBuilder("where 1 = 1"); - - String type = parameter.get("type").toString(); - if ("pdf".equals(type)) { - //查询条件 - conditionSb.append(" and osf.file_name like '%.pdf%'"); - } else if ("doc".equals(type)) { - //查询条件 - conditionSb.append(" and osf.file_name like '%.doc%'"); - }else if ("pdfdoc".equals(type)) { - //查询条件 - conditionSb.append(" and (osf.file_name like '%.doc%' or osf.file_name like '%.pdf%')"); - } - - - //编码 - String serialNumber = (String) parameter.get("serial_number"); - - //标题 - String title = (String) parameter.get("title"); - - //状态 - String stateTemp = (String) parameter.get("state"); - - if (StringUtils.isNotBlank(serialNumber)) { - conditionSb.append(" and " + "serial_number" + " like concat(concat('%','" + serialNumber + "'),'%')"); - } - if (StringUtils.isNotBlank(title)) { - if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { - conditionSb.append(" and " + "title" + " like concat(concat('%','" + title + "'),'%')"); - } else { - conditionSb.append(" and " + "title_en" + " like concat(concat('%','" + title + "'),'%')"); - } - } - - if (StringUtils.isNotBlank(stateTemp)) { - conditionSb.append(" and " + "state" + " ='" + stateTemp + "'"); - } - - conditionSb.append(" order by bdl.create_time desc"); - int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); - int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); - IPage> page = new Page<>(pageNo, pageSize); -// IPage infoPage = bussDocumentLibraryEOMapper.ocrPageInfo(page, field, conditionSb.toString()); -// List records = infoPage.getRecords(); - List> records = bussDocumentLibraryEOMapper.ocrPageInfo(field, conditionSb.toString()); - page.setTotal(records.size()); - - int subSize = pageSize; // 每页记录数 - int subCount = records.size(); // 总记录数 - int subPageTotal = (subCount / subSize) + ((subCount % subSize > 0) ? 1 : 0); //总页数 - - // 分页计算 - int fromIndex = (pageNo-1) * subSize; - int toIndex = ((pageNo == subPageTotal) ? subCount : (pageNo * subSize)); - if( fromIndex <= subCount && toIndex <= subCount) { - records = records.subList(fromIndex, toIndex); - } else { - records = new ArrayList(); - } - - - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //下拉选处理数据字典 - for (Object record : records) { - Map record1 = (Map) record; - String key = ""; - for (Map.Entry entry : record1.entrySet()) { - - //状态数据字典 - if ("state".equals(entry.getKey())) { - List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - List stateList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) - .collect(Collectors.toList()); - List state = stateList.stream().filter(e -> e.getItemValue().equals(entry.getValue())).collect(Collectors.toList()); - if (state.size() != 0) { - if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { - entry.setValue(state.get(0).getItemText()); - } else { - entry.setValue(state.get(0).getEnName()); - } - } - } - } - //添加文本信息 - String connectId = (String) record1.get("connect_id"); - if (connectId.equals(entry.getValue())) { - key = entry.getKey(); - } - } - String finalKey = key; - List onlCgformFieldList = fieldList.stream().filter(e -> e.getDbFieldName().equals(finalKey)).collect(Collectors.toList()); - record1.put("text_info_id", onlCgformFieldList.get(0).getId()); - if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { - record1.put("text_info", onlCgformFieldList.get(0).getDbFieldTxt()); - } else { - record1.put("text_info", onlCgformFieldList.get(0).getDbFieldEnName()); - } - } - - page.setRecords(records); - return page; - } - - @Override - public IPage getInfoPage(Map parameter) { - String cut = (String) parameter.get("cut");//中英文切换标识 - //需要查询的字段 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - //日期类型字段 - List onlCgformFieldList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldDateList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是) - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowList()))).collect(Collectors.toList()); - } - List fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - List fieldListNew = new ArrayList<>(); - fieldListNew.add("id"); - //转时间格式 - for (String field : fieldListTemp) { - String fieldTemp = null; - if (fieldDateList.contains(field)) { - String fieldNew = "date_format(" + field + ", '%Y-%m-%d')"; - fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field; - fieldListNew.add(fieldTemp); - } else { - fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field; - fieldListNew.add(fieldTemp); - } - } - //封装查询条件(包含高级搜索) - String condition = getConditionStr(parameter); - int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); - int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); - - - IPage> page = new Page<>(pageNo, pageSize); - IPage> infoPage = bussDocumentLibraryEOMapper.getInfoPage(page, " " + StringUtils.join(fieldListNew, ","), condition); - - infoPage = stateSort(parameter, fieldListNew, condition, pageNo, pageSize, infoPage); - - - //树形数据字典 - List categoryList = sysCategoryService.list(); - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - - //过滤出文件字段 - List onlCgformFieldFileList = fieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - List fileList = onlCgformFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - List> records = infoPage.getRecords(); - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //下拉选处理数据字典 - List idList = new ArrayList<>(); - List fileIdLidt = new ArrayList<>(); - for (Map record : records) { - //处理标题 - if(LanguageEnum.EN.getValue().equals(cut)){ - record.put("title",record.get("title_en")); - } - Map record1 = (Map) record; - idList.add((String) record1.get("id")); - for (Map.Entry entry : record1.entrySet()) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, fieldList,null); - treeDictItem(categoryList, entry, treeFieldList, cut,null); - if(fileList.contains(entry.getKey()) && StringUtils.isNotBlank((String)entry.getValue())){ - fileIdLidt.add((String)entry.getValue()); - } - } - } - - if(!fileIdLidt.isEmpty()){ - List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdLidt, ",")); - if(!fileInfos.isEmpty()){ - for (Map record : records) { - Map record1 = (Map) record; - idList.add((String) record1.get("id")); - for (Map.Entry entry : record1.entrySet()) { - String value = (String) entry.getValue(); - if(fileList.contains(entry.getKey()) && StringUtils.isNotBlank(value)){ - List ossFileList = fileInfos.stream().filter(e -> value.equals(e.getConnectId())).collect(Collectors.toList()); - if(!ossFileList.isEmpty()){ - List fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - entry.setValue(StringUtils.join(fileNameList,",")); - } - } - } - } - } - } - //收藏和订阅 - collectAndSubscribe(records, idList); - return infoPage; - } - - private IPage> stateSort(Map parameter, List fieldListNew, String condition, int pageNo, int pageSize, IPage> infoPage) { - List> list = new LinkedList<>(); - //状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止 - if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals(parameter.get("orderByField"))){ - List> infoList = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(fieldListNew, ","), condition); - List> active = infoList.stream() - .filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> theUpcoming = infoList.stream() - .filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> draft = infoList.stream() - .filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> beReplaced = infoList.stream() - .filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList()); - List> abolish = infoList.stream() - .filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList()); - if ("1".equals(parameter.get("orderBy"))) { - //正序 - list.addAll(active); - list.addAll(theUpcoming); - list.addAll(draft); - list.addAll(beReplaced); - list.addAll(abolish); - - } else if ("2".equals(parameter.get("orderBy"))) { - //倒序 - list.addAll(abolish); - list.addAll(beReplaced); - list.addAll(draft); - list.addAll(theUpcoming); - list.addAll(active); - } - if(ObjectUtils.isNotEmpty(list)){ - infoPage = getPages(pageNo, pageSize, list); - } - } - return infoPage; - } - - public IPage> getPages(Integer currentPage, Integer pageSize, List> list){ - IPage> page =new Page>(); - if(list==null){ - return null; - } - int size = list.size(); - if(pageSize > size){ - pageSize = size; - } - if(pageSize!=0){ - //求出最⼤页数,防⽌currentPage越界 - int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1; - if(currentPage > maxPage){ - currentPage = maxPage; - } - } - //当前页第⼀条数据的下标 - int curIdx = currentPage >1?(currentPage -1)* pageSize :0; - List> pageList =new ArrayList<>(); - //将当前页的数据放进pageList - for(int i =0; i < pageSize && curIdx + i < size; i++){ - pageList.add(list.get(curIdx + i)); - } - page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList); - return page; - } - - - @NotNull - public String getConditionStr(Map parameter) { - String cut = (String) parameter.get("cut"); - String flag = String.valueOf(parameter.get("flag")); - //查询条件 - StringBuilder conditionSb = new StringBuilder("where 1 = 1"); - - //过滤查询条件字段类型使用 - List> mapList = queryCondition("1", cut, null); - - //查询条件处理 - for (Map.Entry entry : parameter.entrySet()) { - String key = entry.getKey(); - if (!"pageNo".equals(key) && !"pageSize".equals(key)) { - String value = ""; - if(ObjectUtils.isNotEmpty(entry.getValue())){ - value = MyStringUtils.valueOf(entry.getValue()); - } - if (StringUtils.isNotBlank(value)) { - for (Map map : mapList) { - String fieldName = (String) map.get("db_field_name");//字段 - if (key.equals(fieldName)) { - //字段类型(判断是输入框还是下拉,等等) - String fieldType = (String) map.get("field_show_type");//字段类型 - if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldType) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldType)|| FieldTypeEnum.STANDARD.getValue().equals(fieldType)) { - //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' - if (value.contains("%")) { - value = value.replace("%", "/%"); - } -// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); - conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%')"); - } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldType) - || FieldTypeEnum.PULL_MORE.getValue().equals(fieldType) - || FieldTypeEnum.TREE.getValue().equals(fieldType)) { - StringBuilder valueSb = new StringBuilder(); - StringBuilder condition = new StringBuilder(); - for (String valueTemp : value.split(",")) { - valueSb.append("'" + valueTemp + "',"); - condition.append(" or " + key + " like binary concat(concat('%','" + valueTemp + "'),'%')"); - } - condition.append(")"); - String substring = valueSb.substring(0, valueSb.length() - 1); - //下拉单选或下拉多选 - conditionSb.append(" and (" + key + " in(" + substring + ")" + condition); - - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldType)) { - // 如果是查询实施日期,需要单独处理一下,刚加的分阶段实施详情需求 - if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key) || StringUtils.equals("implement_time",key)){ - //日期(区分单日期还时间范围) - if (value.contains(",")) { - conditionSb.append(" and ("); - conditionSb.append(" ("); - conditionSb.append("date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" - + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); - conditionSb.append(" )"); - conditionSb.append(" or id in ("); - conditionSb.append("select buss_document_library_id from phased_implementation_details"); - conditionSb.append(" where implementation_date >= '" + value.split(",")[0] + "' and implementation_date <= '" + value.split(",")[1] + "'"); - if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key)){ - conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue() + "'),'%')"); - }else if(StringUtils.equals("implement_time",key)){ - conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue() + "'),'%')"); - } - conditionSb.append(" )"); - conditionSb.append(" )"); - } else { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); - } - }else { - //日期(区分单日期还时间范围) - if (value.contains(",")) { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" - + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); - } else { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); - } - } - } else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) { - //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' - if (value.contains("%")) { - value = value.replace("%", "/%"); - } -// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); - conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%')"); - } - } - } - } - } - - } - - //处理法规预警模块预警时间查询条件 flag = 0(新车实施日期), flag = 1(在产车实施日期) - String warnTime = (String) parameter.get("WarnTime"); - if(ObjectUtils.isNotEmpty(parameter.get("queryConditionVOList"))){ - String queryConditionVOListStr = (String) parameter.get("queryConditionVOList"); - List queryConditionVOList = JSONObject.parseArray(queryConditionVOListStr, QueryConditionVO.class); - if(ObjectUtils.isNotEmpty(queryConditionVOList)){ - String queryCondition = sqlJoint(queryConditionVOList); - if(StringUtils.isNotBlank(queryCondition)){ - conditionSb.append(" and " + queryCondition); - } - } - } - //法规预警的排序与其他不同单独处理 - if(StringUtils.isNotBlank(warnTime)){ - //flag = 0(新车实施日期), flag = 1(在产车实施日期) - if("0".equals(flag)){ - conditionSb.append(" order by xin1_che1_xing2_shi2_shi1_ri4_qi1 asc"); - }else{ - conditionSb.append(" order by implement_time asc"); - } - }else{ - //处理列表表头排序 - if (StringUtils.isNotBlank((String) parameter.get("orderByField"))) { - String orderByField = (String) parameter.get("orderByField"); - if("serial_number".equals(orderByField) - || "title".equals(orderByField) - || "title_en".equals(orderByField) - || "region".equals(orderByField) - || "technology_territory".equals(orderByField)){ - - conditionSb.append(" order by " + "CONVERT("+orderByField +" USING gbk) COLLATE gbk_chinese_ci"); - orderBySort(parameter, conditionSb); - }else if("issue_time".equals(orderByField)){ - conditionSb.append(" order by " + parameter.get("orderByField")); - orderBySort(parameter, conditionSb); - } - } else { - conditionSb.append(" order by create_time desc"); - } - } - String condition = conditionSb.toString(); - return condition; - } - - private void orderBySort(Map parameter, StringBuilder conditionSb) { - if ("1".equals(parameter.get("orderBy"))) { - conditionSb.append(" asc");//正序 - } else if ("2".equals(parameter.get("orderBy"))) { - conditionSb.append(" desc");//倒序 - } - } - - - /** - * 收藏和订阅 - * - * @param records - * @param idList - */ - private void collectAndSubscribe(List> records, List idList) { - //收藏 - if (idList.size() == 0) { - return; - } - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(OnlCgformCollection::getDocumentId, idList); - wrapper.eq(OnlCgformCollection::getCreateBy, sysUser.getUsername()); - List collectList = iOnlCgformCollectionService.list(wrapper); - List collectIdList = collectList.stream().map(OnlCgformCollection::getDocumentId).collect(Collectors.toList()); - - for (Map record : records) { - Map record1 = record; - String id = (String) record1.get("id"); - //收藏标识(0-->未收藏 1-->已收藏) - if (collectIdList.contains(id)) { - record1.put("collectFlag", "1"); - } else { - record1.put("collectFlag", "0"); - } - } - } - - /** - * 下拉选处理数据字典 - * - * @param sysDictItems - * @param entry - */ - public void dictItem(List sysDictItems, Map.Entry entry, String cut, List fieldList,String flag) { - //通过dictField判断字段是否为下拉选(不为空则为下拉选) - List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - //数据字典中文 - List dictItemsCh = new ArrayList<>(); - List dictItemsEn = new ArrayList<>(); - for (OnlCgformField onlCgformField : onlCgformFieldList) { - if (FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) { - String value = (String) entry.getValue(); - if (StringUtils.isNotBlank(value) && onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - for (String itemValue : value.split(",")) { - //字段的数据字典 - List dictItemList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) - .collect(Collectors.toList()); - if (dictItemList.size() != 0) { - List dictItems = dictItemList.stream() - .filter(e -> itemValue.equals(e.getItemValue())) - .collect(Collectors.toList()); - if (dictItems.size() != 0) { - List itemText = new ArrayList<>(); - if (LanguageEnum.CN.getValue().equals(cut)) { - itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); - } else if(LanguageEnum.EN.getValue().equals(cut)) { - itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); - }else if("1".equals(flag)){ - itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); - } - dictItemsCh.addAll(itemText); - dictItemsEn.addAll(itemText); - } - } - } - } - } - } - - - if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - if(FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())){ - if (LanguageEnum.CN.getValue().equals(cut)) { - entry.setValue(StringUtils.join(dictItemsCh, ",")); - } else if(LanguageEnum.EN.getValue().equals(cut)){ - entry.setValue(StringUtils.join(dictItemsEn, ",")); - }else if("1".equals(flag)){ - entry.setValue(StringUtils.join(dictItemsEn, ",")); - } - } - } - } - /** - * 用于获取飞书消息中的中文消息 - * - * @param sysDictItems - * @param entry - */ - public void dictItemCn(List sysDictItems, Map.Entry entry, String cut, List fieldList,String flagTemp) { - //通过dictField判断字段是否为下拉选(不为空则为下拉选) - List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); - //数据字典中文 - List dictItemsCh = new ArrayList<>(); - List dictItemsEn = new ArrayList<>(); - for (OnlCgformField onlCgformField : onlCgformFieldList) { - if (FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) { - String value = (String) entry.getValue(); - if (StringUtils.isNotBlank(value) && onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - for (String itemValue : value.split(",")) { - //字段的数据字典 - List dictItemList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) - .collect(Collectors.toList()); - if (dictItemList.size() != 0) { - List dictItems = dictItemList.stream() - .filter(e -> itemValue.equals(e.getItemValue())) - .collect(Collectors.toList()); - if (dictItems.size() != 0) { - List itemText = new ArrayList<>(); - if (LanguageEnum.CN.getValue().equals(cut)) { - itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); - } else if(LanguageEnum.EN.getValue().equals(cut)) { - itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); - }else if("2".equals(flagTemp)){ - itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); - } - dictItemsCh.addAll(itemText); - dictItemsEn.addAll(itemText); - } - } - } - } - } - } - - - if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { - if(FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType()) - || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())){ - if (LanguageEnum.CN.getValue().equals(cut)) { - entry.setValue(StringUtils.join(dictItemsCh, ",")); - } else if(LanguageEnum.EN.getValue().equals(cut)){ - entry.setValue(StringUtils.join(dictItemsEn, ",")); - }else if("2".equals(flagTemp)){ - entry.setValue(StringUtils.join(dictItemsEn, ",")); - } - } - } - } - - - @Override - public void addCollect(String id) { - //收藏表中添加数据 - OnlCgformCollection onlCgformCollection = new OnlCgformCollection(); - onlCgformCollection.setDocumentId(id); - iOnlCgformCollectionService.add(onlCgformCollection); - - } - - @Override - public void cancelCollect(String id) { - //收藏表中删除数据 - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.in(OnlCgformCollection::getDocumentId, id); - iOnlCgformCollectionService.remove(lambdaQueryWrapper); - - } - - @Override - public void addSubscribe(String id) { - //订阅表中添加数据 - //OnlCgformSubscribe onlCgformSubscribe = new OnlCgformSubscribe(); - //onlCgformSubscribe.setDocumentId(id); - //iOnlCgformSubscribeService.add(onlCgformSubscribe); - } - - @Override - public void cancelSubscribe(String id) { - //订阅表中删除数据 - //LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - //lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId, id); - //iOnlCgformSubscribeService.remove(lambdaQueryWrapper); - } - - - /** - * 判断两个集合元素是否完全一致 - * - * @param list - * @param list1 - * @return - */ - private static boolean checkDiffrent(List list, List list1) { - if (list.size() != list1.size()) { - return false; - } else { - for (String str : list) { - if (!list1.contains(str)) { - return false; - } - } - } - return true; - } - - private static void mapCopy(Map map, Map mapResult) { - if (map == null) { - return; - } - Iterator> iterator = map.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - Object key = entry.getKey(); - mapResult.put(key, map.get(key) != null ? map.get(key) : ""); - } - } - - /** - * 导出excel - * - * @param map - * @param response - * @param request - */ - @Override - public void exportExcel(Map map, HttpServletResponse response, HttpServletRequest request) { - LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String cut = (String) map.get("cut"); - //String flag = "file"为带文件导出标识 - String flag = (String) map.get("flag"); -// String flag = "file"; - OutputStream os = null; - Workbook workbook = new XSSFWorkbook(); - try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String fileName = "文件库 " + sdf.format(new Date()) + ".xlsx"; - response.setHeader("Content-Disposition", - "attachment; filename=" + fileName); - response.setContentType("application/force-download"); - //需要查询的字段 - List fieldList = onlCgformFieldService.getFieldList("1"); - //表头 - List headerFieldList = new ArrayList<>(); - List fieldListTemp = new ArrayList<>(); - if (fieldList.size() != 0) { - //过滤掉系统默认的字段 - fieldListTemp = fieldList.stream().filter(e -> !"id".equals(e.getDbFieldName()) - && !"create_by".equals(e.getDbFieldName()) - && !"create_time".equals(e.getDbFieldName()) - && !"update_by".equals(e.getDbFieldName()) - && !"update_time".equals(e.getDbFieldName()) - && !"sys_org_code".equals(e.getDbFieldName()) - && YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowForm())) - && StringUtils.isNotBlank(e.getShowArea())).collect(Collectors.toList()); - - OnlCgformField phasedOnlCgformField = new OnlCgformField(); - phasedOnlCgformField.setId(UUID.randomUUID().toString().replace("-", "")); - phasedOnlCgformField.setDbFieldTxt("分阶段实施详情"); - phasedOnlCgformField.setDbFieldEnName("Details of the phased implementation"); - phasedOnlCgformField.setDbFieldName("phasedImplDetails"); - fieldListTemp.add(phasedOnlCgformField); - - //只导出数据时,过滤掉文件类型 - if (!"file".equals(flag)) { - fieldListTemp = fieldListTemp.stream().filter(e -> !FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - } - if (LanguageEnum.CN.getValue().equals(cut)) { - headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldTxt).collect(Collectors.toList()); - } else { - headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList()); - } - } - //查询字段 - List conditionFieldList = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //查询条件 - String condition = getConditionStr(map); - //导出数据(全部导出的数据) - List> datas = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(conditionFieldList, ","), condition); - //处理被代替标准(由id转中文) - getStandard(datas); - //部分导出 - String partId = (String) map.get("id"); - if (StringUtils.isNotBlank(partId)) { - //部门导出的数据 - datas = datas.stream().filter(entry -> partId.contains((String) entry.get("id"))).collect(Collectors.toList()); - } - //创建工作表对象 - Sheet sheet = workbook.createSheet(); - // 创建头部 - String header = StringUtils.join(headerFieldList, ","); - createHeader(workbook, sheet, header); - // 创建数据 - createDatas(workbook, sheet, datas, header, fieldListTemp, cut); - - if (!"file".equals(flag)) { - //不带文件导出 - os = response.getOutputStream(); - workbook.write(os); - os.flush(); - } else { - String path = uploadpath + "/tempZip"; - File fileTemp = new File(path); - if (fileTemp.exists()) { - fileTemp.delete(); - } - fileTemp.mkdirs(); - //excel - OutputStream excelOS = new FileOutputStream(path + File.separator + "文档库.xlsx"); - workbook.write(excelOS); - excelOS.flush(); - //带文件导出 - //过滤出文件字段 - List onlCgformFieldList = fieldListTemp.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - List fileFieldList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - - for (Map data : datas) { - if (StringUtils.isBlank(MyStringUtils.valueOf(data.get("serial_number")))) { - continue; - } - List valueList = new ArrayList<>(); - for (String field : fileFieldList) { - String value = MyStringUtils.valueOf(data.get(field)); - if (StringUtils.isNotBlank(value)) { - valueList.add(value); - } - } - String serialNumber = MyStringUtils.valueOf(data.get("serial_number")); - if (serialNumber.contains("/")) { - serialNumber = serialNumber.replace("/", "-"); - } - //每一个编号下的所有的文件 - if (valueList.size() != 0) { - List fileInfosList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(valueList, ",")); - if (fileInfosList.size() != 0) { - String fileNowPath = uploadpath + "/tempZip/" + serialNumber; - File file = new File(fileNowPath); - if (file.exists()) { - file.delete(); - } - file.mkdirs(); - for (OSSFile ossFile : fileInfosList) { - String url = ossFile.getUrl(); - //判断文件是否存在 - if(StringUtils.isNotBlank(url)){ - //判断文件是否存在 - boolean b = MinioUtil.doesObjectExist(url); - if(b){ - InputStream download = MinioUtil.download(url); - if(url.endsWith(".pdf") || url.endsWith(".PDF")){ - String currentTime = sdf.format(new Date()); - String waterContent = loginUser.getUsername() + " " + currentTime; - File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent); - download = new FileInputStream(newFile.getPath()); - } - copyFile(download, fileNowPath + File.separator + ossFile.getFileName()); - } - } - } - } - } - } - ZipUtil.zip(path, path + ".zip"); - //文件 - FileInputStream fis = new FileInputStream(path + ".zip"); - os = response.getOutputStream(); - - int len = 0; - while ((len = fis.read()) != -1) { - os.write(len); - } - os.flush(); - fis.close(); - } - } catch (IOException e) { - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("下载文件失败"); - }else{ - throw new JeroBootException("Failed to download file"); - } - } finally { - IOUtils.closeQuietly(os); - File file = new File(uploadpath + "/tempZip"); - FileUtil.deleteContents(file); - File fileTemp = new File(uploadpath + "/tempZip.zip"); - FileUtil.deleteContents(fileTemp); - } - } - - /** - * 处理对应标准,代替标准,被代替标准(由id转中文) - * - * @param datas - */ - private void getStandard(List> datas) { - List> datasTemp = new ArrayList<>(); - for (Map data : datas) { - Map mapTemp = new HashMap<>(); - mapCopy(data, mapTemp); - datasTemp.add(mapTemp); - } - for (Map data : datas) { - String idTemp = MyStringUtils.valueOf(data.get("serial_number")); - StringBuilder replacedStandardSb = new StringBuilder(); - datasTemp.forEach(entry -> { - String replaceStandardTemp = (String) entry.get("replace_standard"); - //被代替标准 - if (StringUtils.isNotBlank(replaceStandardTemp) && replaceStandardTemp.contains(idTemp)) { - replacedStandardSb.append(entry.get("serial_number") + ","); - } - }); - if (StringUtils.isNotBlank(replacedStandardSb)) { - String replacedStandardStr = replacedStandardSb.substring(0, replacedStandardSb.length() - 1); - data.put("replaced_standard", replacedStandardStr); - } - } - } - - public void createDatas(Workbook workbook, Sheet sheet, List> datas, String header, List fieldList, String cut) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象 - cellStyle.setAlignment(HorizontalAlignment.CENTER); - cellStyle.setWrapText(true);//自动换行 - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //文件字段 - List fileFieldList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - //过滤出所有文件字段对应的connect_id - List connectIdList = new ArrayList<>(); - List idList = datas.stream().map(data -> (String) data.get("id")).distinct().collect(Collectors.toList()); - - List phasedImplDetailsEOList = null; - if(CollectionUtils.isNotEmpty(idList)){ - QueryWrapper phasedImplDetailsQueryWrap = new QueryWrapper<>(); - phasedImplDetailsQueryWrap.lambda().in(PhasedImplementationDetailsEO::getBussDocumentLibraryId,idList); - phasedImplDetailsEOList = this.phasedImplementationDetailsEOService.list(phasedImplDetailsQueryWrap); - this.phasedImplementationDetailsEOService.disposeData(phasedImplDetailsEOList,cut); - } - - for (Map data : datas) { - StringBuilder phasedImplDetailsSb = new StringBuilder(); - String id = (String) data.get("id"); - - for (OnlCgformField onlCgformField : fileFieldList) { - String value = MyStringUtils.valueOf(data.get(onlCgformField.getDbFieldName())); - if (StringUtils.isNotBlank(value)) { - connectIdList.add(value); - } - } - - if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){ - List phasedImplDetailsEOListTemp = phasedImplDetailsEOList.stream().filter(phased -> { - boolean flag = StringUtils.equals(id, phased.getBussDocumentLibraryId()); - return flag; - }).collect(Collectors.toList()); - - if(CollectionUtils.isNotEmpty(phasedImplDetailsEOListTemp)){ - for (PhasedImplementationDetailsEO detailsEO : phasedImplDetailsEOListTemp) { - StringBuilder phasedImplDetailsSbTemp = new StringBuilder(); - if(StringUtils.isNotEmpty(phasedImplDetailsSb.toString())){ - phasedImplDetailsSb.append("#"); - } - if(StringUtils.isNotEmpty(detailsEO.getStandNumberOrClause())){ - phasedImplDetailsSbTemp.append(detailsEO.getStandNumberOrClause()).append(""); - } - if(StringUtils.isNotEmpty(detailsEO.getImplementationTypeText())){ - phasedImplDetailsSbTemp.append(detailsEO.getImplementationTypeText()).append(""); - } - if(detailsEO.getImplementationDate()!=null){ - phasedImplDetailsSbTemp.append(DateUtils.formatDate(detailsEO.getImplementationDate())).append(""); - } - if(StringUtils.isNotEmpty(detailsEO.getRemarks())){ - phasedImplDetailsSbTemp.append(detailsEO.getRemarks()).append(""); - } - if(StringUtils.isNotEmpty(phasedImplDetailsSbTemp.toString())){ - phasedImplDetailsSb.append(phasedImplDetailsSbTemp, 0, phasedImplDetailsSbTemp.toString().length()-3); - } - } - } - } - data.put("phasedImplDetails",phasedImplDetailsSb.toString()); - } - //所有的文件信息 - List fileInfos = new ArrayList<>(); - if (connectIdList.size() != 0) { - fileInfos = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); - } - //树形数据字典 - List categoryList = sysCategoryService.list(); - int i = 0; - for (Map data : datas) { - - for (Map.Entry entry : data.entrySet()) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, fieldList,null); - //处理树形数据字典 - treeDictItem(categoryList, entry, treeFieldList, cut,null); - } - - - Row row = sheet.createRow(i + 1); - i++; - int sheetNum = 0; - - for (OnlCgformField onlCgformField : fieldList) { - String value = ""; - //时间类型 - if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { - if (ObjectUtils.isNotEmpty(data.get(onlCgformField.getDbFieldName()))) { - value = sdf.format(data.get(onlCgformField.getDbFieldName())); - } - } else if (FieldTypeEnum.FILE.getValue().equals(onlCgformField.getFieldShowType())) { - //处理文件名称(由connect_id转化为文件名) - if (fileInfos.size() != 0) { - List ossFileList = fileInfos.stream() - .filter(e -> e.getConnectId().equals(data.get(onlCgformField.getDbFieldName()))) - .collect(Collectors.toList()); - if (ossFileList.size() != 0) { - List fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList()); - value = StringUtils.join(fileNameList, ","); - } else { - value = ""; - } - } - } else { - value = MyStringUtils.valueOf(data.get(onlCgformField.getDbFieldName())); - } - if("null".equals(value)){ - value = ""; - } - Cell cell = row.createCell(sheetNum); - // cell.setCellStyle(cellStyle); - cell.setCellValue(value); - sheetNum++; - } - } - } - - /** - * 创建表头 - * - * @param workbook - * @param sheet - * @param header - */ - public static void createHeader(Workbook workbook, Sheet sheet, String header) { - CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象 - cellStyle.setAlignment(HorizontalAlignment.CENTER); - Row rowHeader = sheet.createRow(0);//开始创建标题行 - if (StringUtils.isNotBlank(header)) { - String[] headerArr = header.split(","); - for (int i = 0; i < headerArr.length; i++) { - Cell cellHeader = rowHeader.createCell(i); - cellHeader.setCellValue(headerArr[i]); - } - } - } - - /** - * 获取导出的数据 - * - * @param map - * @return - */ - public List> getExportDatas(Map map) { - //需要查询的字段 - List fieldList = onlCgformFieldService.getFieldList("1"); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是) - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowList()))).collect(Collectors.toList()); - } - List fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - List fieldListNew = new ArrayList<>(); - fieldListNew.add("id"); - fieldListNew.addAll(fieldListTemp); - //查询条件 - String condition = getConditionStr(map); - List> infoList = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(fieldListNew, ","), condition); - return infoList; - - } - - /** - * 带文件导出 - * - * @param map - * @param response - * @param request - */ - @Override - public void exportZip(Map map, - HttpServletResponse response, - HttpServletRequest request) { - exportExcel(map, response, request); - } - - - /** - * 模板下载 - * - * @param response - * @param request - */ - @Override - public void exportTemplate(Map map, HttpServletResponse response, HttpServletRequest request) { - OutputStream os = null; - HSSFWorkbook workbook = new HSSFWorkbook(); - try { - String cut = (String) map.get("cut"); - String sheetName = ""; - if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ - sheetName = "文档库导入模板"; - }else { - sheetName = "Document LibraryImport Template"; - } - String fileOriName = "文档库导入模板.xls"; - String filePath = uploadpath + File.separator + fileOriName; - List list = getWorkbookTitle((String) map.get("cut")); - //创建临时文件夹 - File nowFile = new File(filePath); - if (nowFile.exists()) { - nowFile.delete(); - } - nowFile.mkdirs(); - HSSFSheet sheet = workbook.createSheet(sheetName); - sheet.setDefaultColumnWidth(16);//列宽 - HSSFCellStyle cellStyle = workbook.createCellStyle(); - cellStyle.setWrapText(true);//自动换行 - cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); - - //合并单元格 - CellRangeAddress region1 = - new CellRangeAddress(1, 1, 0, Arrays.asList(list.get(0).split(",")).size() - 1); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 - sheet.addMergedRegion(region1); - - for (int i = 0; i < 2; i++) { - //表头 - Row row = sheet.createRow(i);//开始创建标题行 - String exportFieldName = list.get(i); - if (i == 0) { - if (StringUtils.isNotBlank(exportFieldName)) { - String[] headerArr = exportFieldName.split(","); - for (int j = 0; j < headerArr.length; j++) { - row.createCell(j).setCellValue(headerArr[j]); - } - } - } else { - //说明 - short height = (short) (Integer.parseInt(list.get(2)) * 252); - row.setHeight(height); - Cell cell = row.createCell(0); - cell.setCellStyle(cellStyle); - cell.setCellValue(new HSSFRichTextString(list.get(i))); - } - - } - response.setHeader("Content-Disposition", - "attachment; filename=\"" + fileOriName + ".xls"); - response.setContentType("application/force-download"); - response.flushBuffer(); - os = response.getOutputStream(); - workbook.write(os); - } catch (Exception e) { - throw new JeroBootException("下载文件失败,请重试"); - } finally { - IOUtils.closeQuietly(os); - try { - workbook.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - } - - /** - * 获取模板下载的表头 - * - * @return - */ - private List getWorkbookTitle(String cut) { - List> addForm = getField(ModuleEnum.DOCUMENT_LIBRARY.getValue(), cut, "add"); - StringBuilder sb = new StringBuilder(); - List pullMoreList = new LinkedList<>();//多选字段 - List pullSingleList = new LinkedList<>();//单选字段 - List fileList = new LinkedList<>();//文件字段 - List textNumberList = new LinkedList<>();//数字输入框字段 - List textStringList = new LinkedList<>();//字符串输入框字段 - List dateSingleList = new LinkedList<>();//单选日期字段 - List dateMoreList = new LinkedList<>();//多选日期字段 - List standardList = new LinkedList<>();//标准选择字段 - List treeList = new LinkedList<>();//树状结构字段 - for (Map map : addForm) { - if ("1".equals(map.get("field_must_input"))) { - sb.append("*" + map.get("db_field_txt") + ","); - } else { - sb.append(map.get("db_field_txt") + ","); - } - String fieldShowType = "field_show_type"; - //多选字段 - if (FieldTypeEnum.PULL_MORE.getValue().equals(map.get(fieldShowType))) { - pullMoreList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(map.get(fieldShowType))) { - //单选字段 - pullSingleList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.FILE.getValue().equals(map.get(fieldShowType))) { - //文件字段 - fileList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(map.get(fieldShowType))) { - //数字输入框字段 - textNumberList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(map.get(fieldShowType))) { - //字符串输入框字段 - textStringList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(map.get(fieldShowType))) { - //单选日期字段 - dateSingleList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.DATE_MORE.getValue().equals(map.get(fieldShowType))) { - //多选日期字段 - dateMoreList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } else if (FieldTypeEnum.STANDARD.getValue().equals(map.get(fieldShowType))) { - //标准选择字段 - standardList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - }else if(FieldTypeEnum.TREE.getValue().equals(map.get(fieldShowType))){ - treeList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); - } - } - String title = sb.substring(0, sb.length() - 1); - - //第二行 - StringBuilder sbTwo = new StringBuilder(); - if(LanguageEnum.CN.getValue().equals(cut)){ - sbTwo.append("填写说明\n" + "1.导入数据从第三行开始,第一行为表头,第二行为填写说明,第三行是正式数据\n" + "2.所有带*号的字段必须填写\n"); - }else{ - sbTwo.append("Filling explanation\n" - + "1.Import data starts at the third line, the first line is the header, the second line is the description, and the third line is the official data\n" - + "2.All fields marked with * must be filled in\n"); - } - int count = 3; - if (pullSingleList.size() != 0) { - //单选 - if(LanguageEnum.CN.getValue().equals(cut)){ - String pullSingle = StringUtils.join(pullSingleList, ",") + "字段是单选属性,必须和系统中的对应字段选项相匹配\n"; - sbTwo.append(count++ + "." + pullSingle); - }else{ - String pullSingle = StringUtils.join(pullSingleList, ",") + " Fields are radio attributes,Must match the corresponding field option in the system\n"; - sbTwo.append(count++ + "." + pullSingle); - } - } - - if (pullMoreList.size() != 0) { - //多选 - if(LanguageEnum.CN.getValue().equals(cut)){ - String pullMore = StringUtils.join(pullMoreList, ",") + "字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n"; - sbTwo.append(count++ + "." + pullMore); - }else{ - String pullMore = StringUtils.join(pullMoreList, ",") + " A field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n"; - sbTwo.append(count++ + "." + pullMore); - } - } - if (dateSingleList.size() != 0) { - //单选日期 - if(LanguageEnum.CN.getValue().equals(cut)){ - String dateSingle = StringUtils.join(dateSingleList, ",") + "字段为日期,必须精确到日\n"; - sbTwo.append(count++ + "." + dateSingle); - }else{ - String dateSingle = StringUtils.join(dateSingleList, ",") + " The field is the date and must be exact to the day\n"; - sbTwo.append(count++ + "." + dateSingle); - } - } - if (textStringList.size() != 0) { - //输入框 - if(LanguageEnum.CN.getValue().equals(cut)){ - String textString = StringUtils.join(textStringList, ",") + "字段为文本,填写文本内容\n"; - sbTwo.append(count++ + "." + textString); - }else{ - String textString = StringUtils.join(textStringList, ",") + " Field is text. Enter the text content\n"; - sbTwo.append(count++ + "." + textString); - } - } - if (standardList.size() != 0) { - //标准选择 - if(LanguageEnum.CN.getValue().equals(cut)){ - String standard = StringUtils.join(standardList, ",") + "字段为标准号,填写多个时采用英文或中文逗号分割\n"; - sbTwo.append(count++ + "." + standard); - }else{ - String standard = StringUtils.join(standardList, ",") + " The field is a standard number. If you fill in more than one field, separate it with English or Chinese commas\n"; - sbTwo.append(count++ + "." + standard); - } - } - if (fileList.size() != 0) { - //文件 - if(LanguageEnum.CN.getValue().equals(cut)){ - String file = StringUtils.join(fileList, ",") + "字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件且该文件夹下只能有一层级,假设在AAA标准号下放置了B.pdf,则应填写AAA/B.pdf\n"; - sbTwo.append(count++ + "." + file); - }else{ - String file = StringUtils.join(fileList, ",") + " When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder and can be only one level under this folder, Assume that the file is saved in the AAA standard numberB.pdf,Should fill inAAA/B.pdf\n"; - sbTwo.append(count++ + "." + file); - } - } - if(treeList.size() != 0){ - //树状结构 - if(LanguageEnum.CN.getValue().equals(cut)){ - String tree = StringUtils.join(treeList, ",") + "字段为树状结构属性,填写时直接填写选中的数据,如需要选中车身,则直接填写车身,填写多个时采用英文或中文逗号分割\n"; - sbTwo.append(count++ + "." + tree); - }else{ - String tree = StringUtils.join(treeList, ",") + " fields are tree-like structure attributes, and the selected data will be directly filled in when filling in. If the car body needs to be selected, the car body will be directly filled in. If there are more than one fields, English or Chinese commas will be used to separate them\n"; - sbTwo.append(count++ + "." + tree); - } - } - // - if(LanguageEnum.CN.getValue().equals(cut)){ - String tree = "分阶段实施详情字段,多行之间使用#号分隔,列之间使用标签分隔,示例:法规编号/条款新车型2000-10-10备注#"; - sbTwo.append(count++ + "." + tree); - }else{ - String tree = "For the field of phased implementation details, separate rows with # signs and columns with labels. Example: Regulation Number/Articles New model 2000-10-10 Remarks"; - sbTwo.append(count++ + "." + tree); - } - List list = new LinkedList<>(); - list.add(title); - list.add(sbTwo.toString()); - list.add(count + ""); - return list; - - } +// +// } else if (fieldFile.contains(key)) { +// //处理文件类型字段 +// List fileNameList = new ArrayList<>(); +// List fileNameListTemp = new ArrayList<>(); +// //之前的文件 +// if (ObjectUtils.isNotEmpty(value)) { +// List fileInfos = iOSSFileService.getFileInfosByConnectId((String) value); +// fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// } +// //修改的文件 +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// List fileInfosTemp = iOSSFileService.getFileInfos((String) valueTemp); +// fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// } +// +// if (ObjectUtils.isNotEmpty(value)) { +// boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp); +// +// if (fileNameListTemp.size() != 0 && !checkDiffrent) { +// if("2".equals(flagTemp)){ +// //sysUser +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// } +// } else if (fileNameListTemp.size() == 0) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ","); +// } +// +// } +// } else { +// if (fileNameListTemp.size() != 0) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\","); +// } +// +// } +// } +// } else { +//// if ("replace_standard".equals(key) || "corresponding_standard".equals(key)) { +//// if (ObjectUtils.isNotEmpty(value)) { +//// value = getReplaceStandardName(value); +//// } +//// if (ObjectUtils.isNotEmpty(valueTemp)) { +//// valueTemp = getReplaceStandardName(valueTemp); +//// } +//// } +// //其他类型(被代替标准不处理) +// if (!"replaced_standard".equals(key)) { +// if (ObjectUtils.isNotEmpty(value)) { +// if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\","); +// } +// } else if (ObjectUtils.isEmpty(valueTemp)) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); +// }else{ +// sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ","); +// } +// } +// } else { +// if (ObjectUtils.isNotEmpty(valueTemp)) { +// if("2".equals(flagTemp)){ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// }else{ +// sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\","); +// } +// } +// } +// } +// } +// } +// } +// } +// } +// }); +// return sb; +// } +// +// private Object getReplaceStandardName(Object value) { +// String valueStr = (String) value; +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(valueStr); +// List serialNumberList = new ArrayList<>(); +// for (Map stringObjectMap : mapList) { +// serialNumberList.add((String) stringObjectMap.get("serial_number")); +// } +// if (serialNumberList.size() != 0) { +// value = StringUtils.join(serialNumberList, ","); +// } +// return value; +// } + +// /** +// * 处理修改代替标准,发送通知 +// * +// * @param map +// */ +// private void sendMessageUpdate(Map map, +// List> dataList, +// List fieldList, +// List fieldDateList, +// List fieldFileList, +// List fieldPullList, +// String cut) { +// List> dataListTemp = new ArrayList<>(); +// for (Map stringObjectMap : dataList) { +// Map mapT = new HashMap<>(); +// mapCopy(stringObjectMap, mapT); +// dataListTemp.add(mapT); +// } +// +// String technologyTerritoryNew = (String) dataList.get(0).get("technology_territory"); +// //1. 处理订阅的发送消息 +// //修改的内容 +// String flag ="1";//消息的标识(英文) +// StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flag); +// String flagTemp ="2";//消息的标识(中文--消息采用卡片型式发送, 消息内容包含中英文, 所以此处需要获取消息的中文) +// StringBuilder sbCn = getUpdateInfoCn(map, dataListTemp, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flagTemp); +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// String sbStr = ""; +// if (ObjectUtils.isNotEmpty(sb)) { +// sbStr = sb.substring(0, sb.length() - 1); +// } +// String sbStrCn = ""; +// if (ObjectUtils.isNotEmpty(sbCn)) { +// sbStrCn = sbCn.substring(0, sbCn.length() - 1); +// } +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String serialNumber = (String) dataList.get(0).get("serial_number"); +// String technologyTerritory = (String) map.get("technology_territory"); +// //只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”) +// //向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息 +// // 只有技术领域变更为订阅的技术领域这一种情况发消息, 假如订阅了技术领域A,编辑的文档的技术领域也是A,这时编辑的是其他的字段,这种情况不发消息 +// Map mapTemp = new HashMap<>(); +// mapTemp.put("domainId", map.get("technology_territory")); +// mapTemp.put("documentId", map.get("id")); +// //订阅技术领域的人和订阅该条标准的人 +// //订阅技术领域发消息 +// List domainUserRelList = domainManageService.list(); +// List thirdIdList = new ArrayList<>(); +// List userList = new ArrayList<>(); +// String technologyTerritoryNameEn = ""; +// if(StringUtils.isNotBlank(technologyTerritory) && technologyTerritory.equals(technologyTerritoryNew) && domainUserRelList.size() != 0){ +// List collect = domainUserRelList.stream() +// .filter(e -> technologyTerritory.contains(e.getDomainId())) +// .collect(Collectors.toList()); +// if(collect.size() != 0){ +// List userIdList = collect.stream().map(DomainUserRel::getUserId).collect(Collectors.toList()); +// List domainIdList = collect.stream().map(DomainUserRel::getDomainId).distinct().collect(Collectors.toList()); +// if(userIdList.size() != 0){ +// List sysUsersFeishu = this.sysUserMapper.selectBatchIds(userIdList); +// if(sysUsersFeishu.size() != 0){ +// thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList()); +// userList = sysUsersFeishu.stream().map(SysUser::getId).collect(Collectors.toList()); +// } +// } +// if(domainIdList.size() != 0){ +// StringBuilder sbTemp = new StringBuilder(); +// for (String s : domainIdList) { +// List collect1 = categoryList.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList()); +// if(collect1.size() != 0){ +// String enName = collect1.get(0).getEnName().trim(); +// sbTemp.append(enName + ","); +// } +// } +// if(StringUtils.isNotBlank(sbTemp)){ +// technologyTerritoryNameEn = sbTemp.substring(0, sbTemp.length() - 1); +// } +// +// } +// } +// } +// //2. 处理修改代替标准的发送消息(法规负责人) +// //处理修改代替标准,发送通知 +// //修改时前端传参 +// String replaceStandard = (String) map.get("replace_standard"); +// if (dataList.size() != 0) { +// //代替标准(根据id查询出来的) +// String replaceStandardTemp = (String) dataList.get(0).get("replace_standard"); +// +// //(1)此种情况为编辑前代替标准就已经有数据了 +// if (StringUtils.isNotBlank(replaceStandardTemp) && !replaceStandard.equals(replaceStandardTemp)) { +// //需要向被替代标准的法规工程师发送站内通知和飞书信息,提醒内容:"新标准编号"已实施,请注意更新“替代标准编号”状态 +// List list = Arrays.asList(replaceStandard.split(",")); +// List listTemp = Arrays.asList(replaceStandardTemp.split(",")); +// List listNew = list.stream().filter(e -> !listTemp.contains(e)).collect(Collectors.toList()); +// //向listNew对应的工程师发飞书通知 +// replaceStandardSend(listNew); +// sendWebsocket((String) map.get("id"), (String) map.get("id")); +// } else if (StringUtils.isBlank(replaceStandardTemp) && StringUtils.isNotBlank(replaceStandard)) { +// //(2)此种情况为编辑前代替标准没有数据 +// //向replaceStandard对应的工程师发飞书通知 +// replaceStandardSend(Arrays.asList(replaceStandard.split(","))); +// sendWebsocket((String) map.get("id"), (String) map.get("id")); +// } +// } +// } + +// public void sendWebsocket(String msgId, String msgTet) { +// JSONObject obj = new JSONObject(); +// obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC); +// obj.put(WebsocketConst.MSG_ID, msgId); +// obj.put(WebsocketConst.MSG_TXT, msgTet); +// webSocket.sendMessage(obj.toJSONString()); +// } + +// private void replaceStandardSend(List serialNumberListTemp) { +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAllBySerialNumber(StringUtils.join(serialNumberListTemp, ",")); +// List userNameListTemp = new ArrayList<>(); +// List serialNumberList = new ArrayList<>(); +// List urlList = new ArrayList<>(); +// StringBuilder sb = new StringBuilder(); +// for (Map stringObjectMap : mapList) { +// String id = (String) stringObjectMap.get("id"); +// String serialNumber = (String) stringObjectMap.get("serial_number"); +// String title = (String) stringObjectMap.get("title"); +// userNameListTemp.add((String) stringObjectMap.get("create_by")); +// serialNumberList.add(serialNumber); +// +// String href = "" + serialNumber + ","; +// sb.append(href); +// String url = backUrl + "/docManage/library/detail?id=" + stringObjectMap.get("id"); +// urlList.add(url); +// } +// String sbStr = ""; +// if (ObjectUtils.isNotEmpty(sb)) { +// sbStr = sb.substring(0, sb.length() - 1); +// } +// List userList = sysUserMapper.getUserListByNames(StringUtils.join(userNameListTemp, ",")); +// List userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); +// List thirdIdList = userList.stream().map(SysUser::getThirdId).collect(Collectors.toList()); +// String content = "New numbering implemented, please note update status of alternate numbering " + StringUtils.join(serialNumberList, ","); +// String contentInfo = "New numbering implemented, please note update status of alternate numbering " + sbStr; +// String msgTitle = contentInfo; +// //封装消息的实体类 +// SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, +// msgTitle, +// content, +// contentInfo,MessageTypeEnum.READ.getValue(), +// MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), +// null, +// null); +// sysAnnouncementService.saveAnnouncement(sysAnnouncement); +// sendWebsocket(StringUtils.join(serialNumberListTemp, ","), contentInfo); +// +// } + + +// @NotNull +// public SysAnnouncement getSysAnnouncement(List userIdList, +// String title, +// String content, +// String contentInfo, +// String messageType, +// String initiator, +// String contentCn, +// String contentInfoCn) { +// SysAnnouncement sysAnnouncement = new SysAnnouncement(); +// sysAnnouncement.setInitiator(initiator); +// sysAnnouncement.setDelFlag("0"); +// sysAnnouncement.setSendStatus("0"); +// sysAnnouncement.setSendTime(new Date()); +//// sysAnnouncement.setDocumentId((String) dataList.get(0).get("id")); +// sysAnnouncement.setMsgCategory(messageType);//消息类型 +// sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 +// sysAnnouncement.setTitile(title); +// sysAnnouncement.setMsgContent(content); +// sysAnnouncement.setMsgContentInfo(contentInfo); +// sysAnnouncement.setMsgContentCn(contentCn); +// sysAnnouncement.setMsgContentInfoCn(contentInfoCn); +// sysAnnouncement.setUserIds(StringUtils.join(userIdList, ",")); +// return sysAnnouncement; +// } + +// private String getMustValues(String id) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String mustValue = "'" + id + "','" + sysUser.getUsername() + "'," +// + "str_to_date('" + sdf.format(new Date()) + "','%Y-%m-%d %H:%i:%s')" + ",'" + sysUser.getUsername() + "'," +// + "str_to_date('" + sdf.format(new Date()) + "','%Y-%m-%d %H:%i:%s')" + ",'" + sysUser.getOrgCode() + "'"; +// return mustValue; +// } + +// /** +// * 代替标准分页 +// * +// * @param parameter +// * @return +// */ +// @Override +// public IPage replacePageInfo(Map parameter) { +// //查询内容 +// String field = " id,serial_number,title,state"; +// +// //封装查询条件 +// String condition = getConditionStr(parameter); +// int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); +// int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); +// IPage> page = new Page>(pageNo, pageSize); +// +//// IPage infoPage = bussDocumentLibraryEOMapper.replacePageInfo(page, field, conditionSb.toString()); +// IPage> infoPage = bussDocumentLibraryEOMapper.replacePageInfo(page, field, condition); +// +// +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //需要查询的字段 +// List fieldList = onlCgformFieldService.getFieldList("1"); +// +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //下拉选处理数据字典 +// List> records = infoPage.getRecords(); +// for (Map record : records) { +// Map record1 = record; +// for (Map.Entry entry : record1.entrySet()) { +// treeDictItem(categoryList, entry, treeFieldList, (String) parameter.get("cut"),null); +// if ("state".equals(entry.getKey())) { +// List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// //状态数据字典 +// if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// List stateList = sysDictItems.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) +// .collect(Collectors.toList()); +// List state = stateList.stream().filter(e -> e.getItemValue().equals(entry.getValue())).collect(Collectors.toList()); +// if (state.size() != 0) { +// entry.setValue(state.get(0).getItemText()); +// } +// } +// } +// } +// } +// return infoPage; +// } +// +// /** +// * ocr识别调取已入库文件分页 +// * +// * @param parameter +// * @return +// */ +// @Override +// public IPage> ocrPageInfo(Map parameter) { +// //需要查询的字段 +// List fieldList = onlCgformFieldService.getFieldList("1"); +// List fileFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) +// .map(OnlCgformField::getDbFieldName) +// .collect(Collectors.toList()); +// +// //查询字段 +// StringBuilder fieldSb = new StringBuilder(); +// StringBuilder osfSql = new StringBuilder(); +// StringBuilder join = new StringBuilder(); +// int i = 1; +// if (ObjectUtils.isNotEmpty(fileFieldList)) { +// for (String fileField : fileFieldList) { +// fieldSb.append("bdl." + fileField + ","); +// if (i == 1) { +// join.append(" on osf.connect_id = bdl." + fileField); +// osfSql.append("(select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)"); +// i++; +// continue; +// } else if (i == fileFieldList.size()) { +// join.append(" or osf.connect_id = bdl." + fileField); +// osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null))"); +// +// continue; +// } +// +// join.append(" or osf.connect_id = bdl." + fileField); +// osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)"); +// i++; +// +// } +// } +// String fieldStr = fieldSb.substring(0, fieldSb.length() - 1); +// +// String field = " osf.id,bdl.id as \"buss_document_library_id\",bdl.serial_number,bdl.title,bdl.title_en,bdl.state,osf.file_name,osf.connect_id," + fieldStr +// + " from " + osfSql + " osf join buss_document_library bdl" + join; +// +// //查询条件 +// StringBuilder conditionSb = new StringBuilder("where 1 = 1"); +// +// String type = parameter.get("type").toString(); +// if ("pdf".equals(type)) { +// //查询条件 +// conditionSb.append(" and osf.file_name like '%.pdf%'"); +// } else if ("doc".equals(type)) { +// //查询条件 +// conditionSb.append(" and osf.file_name like '%.doc%'"); +// }else if ("pdfdoc".equals(type)) { +// //查询条件 +// conditionSb.append(" and (osf.file_name like '%.doc%' or osf.file_name like '%.pdf%')"); +// } +// +// +// //编码 +// String serialNumber = (String) parameter.get("serial_number"); +// +// //标题 +// String title = (String) parameter.get("title"); +// +// //状态 +// String stateTemp = (String) parameter.get("state"); +// +// if (StringUtils.isNotBlank(serialNumber)) { +// conditionSb.append(" and " + "serial_number" + " like concat(concat('%','" + serialNumber + "'),'%')"); +// } +// if (StringUtils.isNotBlank(title)) { +// if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { +// conditionSb.append(" and " + "title" + " like concat(concat('%','" + title + "'),'%')"); +// } else { +// conditionSb.append(" and " + "title_en" + " like concat(concat('%','" + title + "'),'%')"); +// } +// } +// +// if (StringUtils.isNotBlank(stateTemp)) { +// conditionSb.append(" and " + "state" + " ='" + stateTemp + "'"); +// } +// +// conditionSb.append(" order by bdl.create_time desc"); +// int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); +// int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); +// IPage> page = new Page<>(pageNo, pageSize); +//// IPage infoPage = bussDocumentLibraryEOMapper.ocrPageInfo(page, field, conditionSb.toString()); +//// List records = infoPage.getRecords(); +// List> records = bussDocumentLibraryEOMapper.ocrPageInfo(field, conditionSb.toString()); +// page.setTotal(records.size()); +// +// int subSize = pageSize; // 每页记录数 +// int subCount = records.size(); // 总记录数 +// int subPageTotal = (subCount / subSize) + ((subCount % subSize > 0) ? 1 : 0); //总页数 +// +// // 分页计算 +// int fromIndex = (pageNo-1) * subSize; +// int toIndex = ((pageNo == subPageTotal) ? subCount : (pageNo * subSize)); +// if( fromIndex <= subCount && toIndex <= subCount) { +// records = records.subList(fromIndex, toIndex); +// } else { +// records = new ArrayList(); +// } +// +// +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //下拉选处理数据字典 +// for (Object record : records) { +// Map record1 = (Map) record; +// String key = ""; +// for (Map.Entry entry : record1.entrySet()) { +// +// //状态数据字典 +// if ("state".equals(entry.getKey())) { +// List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// List stateList = sysDictItems.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) +// .collect(Collectors.toList()); +// List state = stateList.stream().filter(e -> e.getItemValue().equals(entry.getValue())).collect(Collectors.toList()); +// if (state.size() != 0) { +// if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { +// entry.setValue(state.get(0).getItemText()); +// } else { +// entry.setValue(state.get(0).getEnName()); +// } +// } +// } +// } +// //添加文本信息 +// String connectId = (String) record1.get("connect_id"); +// if (connectId.equals(entry.getValue())) { +// key = entry.getKey(); +// } +// } +// String finalKey = key; +// List onlCgformFieldList = fieldList.stream().filter(e -> e.getDbFieldName().equals(finalKey)).collect(Collectors.toList()); +// record1.put("text_info_id", onlCgformFieldList.get(0).getId()); +// if (LanguageEnum.CN.getValue().equals((String) parameter.get("cut"))) { +// record1.put("text_info", onlCgformFieldList.get(0).getDbFieldTxt()); +// } else { +// record1.put("text_info", onlCgformFieldList.get(0).getDbFieldEnName()); +// } +// } +// +// page.setRecords(records); +// return page; +// } + +// @Override +// public IPage getInfoPage(Map parameter) { +// String cut = (String) parameter.get("cut");//中英文切换标识 +// //需要查询的字段 +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); +// //日期类型字段 +// List onlCgformFieldList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// List fieldDateList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// if (fieldList.size() != 0) { +// //过滤列表字段(is_show_list-->列表是否显示0否 1是) +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowList()))).collect(Collectors.toList()); +// } +// List fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// List fieldListNew = new ArrayList<>(); +// fieldListNew.add("id"); +// //转时间格式 +// for (String field : fieldListTemp) { +// String fieldTemp = null; +// if (fieldDateList.contains(field)) { +// String fieldNew = "date_format(" + field + ", '%Y-%m-%d')"; +// fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field; +// fieldListNew.add(fieldTemp); +// } else { +// fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field; +// fieldListNew.add(fieldTemp); +// } +// } +// //封装查询条件(包含高级搜索) +// String condition = getConditionStr(parameter); +// int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); +// int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); +// +// +// IPage> page = new Page<>(pageNo, pageSize); +// IPage> infoPage = bussDocumentLibraryEOMapper.getInfoPage(page, " " + StringUtils.join(fieldListNew, ","), condition); +// +// infoPage = stateSort(parameter, fieldListNew, condition, pageNo, pageSize, infoPage); +// +// +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// //过滤出文件字段 +// List onlCgformFieldFileList = fieldList.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// List fileList = onlCgformFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// List> records = infoPage.getRecords(); +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //下拉选处理数据字典 +// List idList = new ArrayList<>(); +// List fileIdLidt = new ArrayList<>(); +// for (Map record : records) { +// //处理标题 +// if(LanguageEnum.EN.getValue().equals(cut)){ +// record.put("title",record.get("title_en")); +// } +// Map record1 = (Map) record; +// idList.add((String) record1.get("id")); +// for (Map.Entry entry : record1.entrySet()) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, fieldList,null); +// treeDictItem(categoryList, entry, treeFieldList, cut,null); +// if(fileList.contains(entry.getKey()) && StringUtils.isNotBlank((String)entry.getValue())){ +// fileIdLidt.add((String)entry.getValue()); +// } +// } +// } +// +// if(!fileIdLidt.isEmpty()){ +// List fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdLidt, ",")); +// if(!fileInfos.isEmpty()){ +// for (Map record : records) { +// Map record1 = (Map) record; +// idList.add((String) record1.get("id")); +// for (Map.Entry entry : record1.entrySet()) { +// String value = (String) entry.getValue(); +// if(fileList.contains(entry.getKey()) && StringUtils.isNotBlank(value)){ +// List ossFileList = fileInfos.stream().filter(e -> value.equals(e.getConnectId())).collect(Collectors.toList()); +// if(!ossFileList.isEmpty()){ +// List fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// entry.setValue(StringUtils.join(fileNameList,",")); +// } +// } +// } +// } +// } +// } +// //收藏和订阅 +// collectAndSubscribe(records, idList); +// return infoPage; +// } + +// private IPage> stateSort(Map parameter, List fieldListNew, String condition, int pageNo, int pageSize, IPage> infoPage) { +// List> list = new LinkedList<>(); +// //状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止 +// if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals(parameter.get("orderByField"))){ +// List> infoList = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(fieldListNew, ","), condition); +// List> active = infoList.stream() +// .filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> theUpcoming = infoList.stream() +// .filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> draft = infoList.stream() +// .filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> beReplaced = infoList.stream() +// .filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// List> abolish = infoList.stream() +// .filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList()); +// if ("1".equals(parameter.get("orderBy"))) { +// //正序 +// list.addAll(active); +// list.addAll(theUpcoming); +// list.addAll(draft); +// list.addAll(beReplaced); +// list.addAll(abolish); +// +// } else if ("2".equals(parameter.get("orderBy"))) { +// //倒序 +// list.addAll(abolish); +// list.addAll(beReplaced); +// list.addAll(draft); +// list.addAll(theUpcoming); +// list.addAll(active); +// } +// if(ObjectUtils.isNotEmpty(list)){ +// infoPage = getPages(pageNo, pageSize, list); +// } +// } +// return infoPage; +// } + +// public IPage> getPages(Integer currentPage, Integer pageSize, List> list){ +// IPage> page =new Page>(); +// if(list==null){ +// return null; +// } +// int size = list.size(); +// if(pageSize > size){ +// pageSize = size; +// } +// if(pageSize!=0){ +// //求出最⼤页数,防⽌currentPage越界 +// int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1; +// if(currentPage > maxPage){ +// currentPage = maxPage; +// } +// } +// //当前页第⼀条数据的下标 +// int curIdx = currentPage >1?(currentPage -1)* pageSize :0; +// List> pageList =new ArrayList<>(); +// //将当前页的数据放进pageList +// for(int i =0; i < pageSize && curIdx + i < size; i++){ +// pageList.add(list.get(curIdx + i)); +// } +// page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList); +// return page; +// } + + +// @NotNull +// public String getConditionStr(Map parameter) { +// String cut = (String) parameter.get("cut"); +// String flag = String.valueOf(parameter.get("flag")); +// //查询条件 +// StringBuilder conditionSb = new StringBuilder("where 1 = 1"); +// +// //过滤查询条件字段类型使用 +// List> mapList = queryCondition("1", cut, null); +// +// //查询条件处理 +// for (Map.Entry entry : parameter.entrySet()) { +// String key = entry.getKey(); +// if (!"pageNo".equals(key) && !"pageSize".equals(key)) { +// String value = ""; +// if(ObjectUtils.isNotEmpty(entry.getValue())){ +// value = MyStringUtils.valueOf(entry.getValue()); +// } +// if (StringUtils.isNotBlank(value)) { +// for (Map map : mapList) { +// String fieldName = (String) map.get("db_field_name");//字段 +// if (key.equals(fieldName)) { +// //字段类型(判断是输入框还是下拉,等等) +// String fieldType = (String) map.get("field_show_type");//字段类型 +// if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldType) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldType)|| FieldTypeEnum.STANDARD.getValue().equals(fieldType)) { +// //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' +// if (value.contains("%")) { +// value = value.replace("%", "/%"); +// } +//// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); +// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%')"); +// } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldType) +// || FieldTypeEnum.PULL_MORE.getValue().equals(fieldType) +// || FieldTypeEnum.TREE.getValue().equals(fieldType)) { +// StringBuilder valueSb = new StringBuilder(); +// StringBuilder condition = new StringBuilder(); +// for (String valueTemp : value.split(",")) { +// valueSb.append("'" + valueTemp + "',"); +// condition.append(" or " + key + " like binary concat(concat('%','" + valueTemp + "'),'%')"); +// } +// condition.append(")"); +// String substring = valueSb.substring(0, valueSb.length() - 1); +// //下拉单选或下拉多选 +// conditionSb.append(" and (" + key + " in(" + substring + ")" + condition); +// +// } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldType)) { +// // 如果是查询实施日期,需要单独处理一下,刚加的分阶段实施详情需求 +// if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key) || StringUtils.equals("implement_time",key)){ +// //日期(区分单日期还时间范围) +// if (value.contains(",")) { +// conditionSb.append(" and ("); +// conditionSb.append(" ("); +// conditionSb.append("date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" +// + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); +// conditionSb.append(" )"); +// conditionSb.append(" or id in ("); +// conditionSb.append("select buss_document_library_id from phased_implementation_details"); +// conditionSb.append(" where implementation_date >= '" + value.split(",")[0] + "' and implementation_date <= '" + value.split(",")[1] + "'"); +// if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key)){ +// conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue() + "'),'%')"); +// }else if(StringUtils.equals("implement_time",key)){ +// conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue() + "'),'%')"); +// } +// conditionSb.append(" )"); +// conditionSb.append(" )"); +// } else { +// conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); +// } +// }else { +// //日期(区分单日期还时间范围) +// if (value.contains(",")) { +// conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" +// + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); +// } else { +// conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); +// } +// } +// } else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) { +// //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' +// if (value.contains("%")) { +// value = value.replace("%", "/%"); +// } +//// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); +// conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%')"); +// } +// } +// } +// } +// } +// +// } +// +// //处理法规预警模块预警时间查询条件 flag = 0(新车实施日期), flag = 1(在产车实施日期) +// String warnTime = (String) parameter.get("WarnTime"); +// if(ObjectUtils.isNotEmpty(parameter.get("queryConditionVOList"))){ +// String queryConditionVOListStr = (String) parameter.get("queryConditionVOList"); +// List queryConditionVOList = JSONObject.parseArray(queryConditionVOListStr, QueryConditionVO.class); +// if(ObjectUtils.isNotEmpty(queryConditionVOList)){ +// String queryCondition = sqlJoint(queryConditionVOList); +// if(StringUtils.isNotBlank(queryCondition)){ +// conditionSb.append(" and " + queryCondition); +// } +// } +// } +// //法规预警的排序与其他不同单独处理 +// if(StringUtils.isNotBlank(warnTime)){ +// //flag = 0(新车实施日期), flag = 1(在产车实施日期) +// if("0".equals(flag)){ +// conditionSb.append(" order by xin1_che1_xing2_shi2_shi1_ri4_qi1 asc"); +// }else{ +// conditionSb.append(" order by implement_time asc"); +// } +// }else{ +// //处理列表表头排序 +// if (StringUtils.isNotBlank((String) parameter.get("orderByField"))) { +// String orderByField = (String) parameter.get("orderByField"); +// if("serial_number".equals(orderByField) +// || "title".equals(orderByField) +// || "title_en".equals(orderByField) +// || "region".equals(orderByField) +// || "technology_territory".equals(orderByField)){ +// +// conditionSb.append(" order by " + "CONVERT("+orderByField +" USING gbk) COLLATE gbk_chinese_ci"); +// orderBySort(parameter, conditionSb); +// }else if("issue_time".equals(orderByField)){ +// conditionSb.append(" order by " + parameter.get("orderByField")); +// orderBySort(parameter, conditionSb); +// } +// } else { +// conditionSb.append(" order by create_time desc"); +// } +// } +// String condition = conditionSb.toString(); +// return condition; +// } + +// private void orderBySort(Map parameter, StringBuilder conditionSb) { +// if ("1".equals(parameter.get("orderBy"))) { +// conditionSb.append(" asc");//正序 +// } else if ("2".equals(parameter.get("orderBy"))) { +// conditionSb.append(" desc");//倒序 +// } +// } + + +// /** +// * 收藏和订阅 +// * +// * @param records +// * @param idList +// */ +// private void collectAndSubscribe(List> records, List idList) { +// //收藏 +// if (idList.size() == 0) { +// return; +// } +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(OnlCgformCollection::getDocumentId, idList); +// wrapper.eq(OnlCgformCollection::getCreateBy, sysUser.getUsername()); +// List collectList = iOnlCgformCollectionService.list(wrapper); +// List collectIdList = collectList.stream().map(OnlCgformCollection::getDocumentId).collect(Collectors.toList()); +// +// for (Map record : records) { +// Map record1 = record; +// String id = (String) record1.get("id"); +// //收藏标识(0-->未收藏 1-->已收藏) +// if (collectIdList.contains(id)) { +// record1.put("collectFlag", "1"); +// } else { +// record1.put("collectFlag", "0"); +// } +// } +// } + +// /** +// * 下拉选处理数据字典 +// * +// * @param sysDictItems +// * @param entry +// */ +// public void dictItem(List sysDictItems, Map.Entry entry, String cut, List fieldList,String flag) { +// //通过dictField判断字段是否为下拉选(不为空则为下拉选) +// List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// //数据字典中文 +// List dictItemsCh = new ArrayList<>(); +// List dictItemsEn = new ArrayList<>(); +// for (OnlCgformField onlCgformField : onlCgformFieldList) { +// if (FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) { +// String value = (String) entry.getValue(); +// if (StringUtils.isNotBlank(value) && onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// for (String itemValue : value.split(",")) { +// //字段的数据字典 +// List dictItemList = sysDictItems.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) +// .collect(Collectors.toList()); +// if (dictItemList.size() != 0) { +// List dictItems = dictItemList.stream() +// .filter(e -> itemValue.equals(e.getItemValue())) +// .collect(Collectors.toList()); +// if (dictItems.size() != 0) { +// List itemText = new ArrayList<>(); +// if (LanguageEnum.CN.getValue().equals(cut)) { +// itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); +// } else if(LanguageEnum.EN.getValue().equals(cut)) { +// itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); +// }else if("1".equals(flag)){ +// itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); +// } +// dictItemsCh.addAll(itemText); +// dictItemsEn.addAll(itemText); +// } +// } +// } +// } +// } +// } +// +// +// if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// if(FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())){ +// if (LanguageEnum.CN.getValue().equals(cut)) { +// entry.setValue(StringUtils.join(dictItemsCh, ",")); +// } else if(LanguageEnum.EN.getValue().equals(cut)){ +// entry.setValue(StringUtils.join(dictItemsEn, ",")); +// }else if("1".equals(flag)){ +// entry.setValue(StringUtils.join(dictItemsEn, ",")); +// } +// } +// } +// } +// /** +// * 用于获取飞书消息中的中文消息 +// * +// * @param sysDictItems +// * @param entry +// */ +// public void dictItemCn(List sysDictItems, Map.Entry entry, String cut, List fieldList,String flagTemp) { +// //通过dictField判断字段是否为下拉选(不为空则为下拉选) +// List onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList()); +// //数据字典中文 +// List dictItemsCh = new ArrayList<>(); +// List dictItemsEn = new ArrayList<>(); +// for (OnlCgformField onlCgformField : onlCgformFieldList) { +// if (FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) { +// String value = (String) entry.getValue(); +// if (StringUtils.isNotBlank(value) && onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// for (String itemValue : value.split(",")) { +// //字段的数据字典 +// List dictItemList = sysDictItems.stream() +// .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField())) +// .collect(Collectors.toList()); +// if (dictItemList.size() != 0) { +// List dictItems = dictItemList.stream() +// .filter(e -> itemValue.equals(e.getItemValue())) +// .collect(Collectors.toList()); +// if (dictItems.size() != 0) { +// List itemText = new ArrayList<>(); +// if (LanguageEnum.CN.getValue().equals(cut)) { +// itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); +// } else if(LanguageEnum.EN.getValue().equals(cut)) { +// itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); +// }else if("2".equals(flagTemp)){ +// itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); +// } +// dictItemsCh.addAll(itemText); +// dictItemsEn.addAll(itemText); +// } +// } +// } +// } +// } +// } +// +// +// if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) { +// if(FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())){ +// if (LanguageEnum.CN.getValue().equals(cut)) { +// entry.setValue(StringUtils.join(dictItemsCh, ",")); +// } else if(LanguageEnum.EN.getValue().equals(cut)){ +// entry.setValue(StringUtils.join(dictItemsEn, ",")); +// }else if("2".equals(flagTemp)){ +// entry.setValue(StringUtils.join(dictItemsEn, ",")); +// } +// } +// } +// } + +// +// @Override +// public void addCollect(String id) { +// //收藏表中添加数据 +// OnlCgformCollection onlCgformCollection = new OnlCgformCollection(); +// onlCgformCollection.setDocumentId(id); +// iOnlCgformCollectionService.add(onlCgformCollection); +// +// } +// +// @Override +// public void cancelCollect(String id) { +// //收藏表中删除数据 +// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// lambdaQueryWrapper.in(OnlCgformCollection::getDocumentId, id); +// iOnlCgformCollectionService.remove(lambdaQueryWrapper); +// +// } +// +// @Override +// public void addSubscribe(String id) { +// //订阅表中添加数据 +// //OnlCgformSubscribe onlCgformSubscribe = new OnlCgformSubscribe(); +// //onlCgformSubscribe.setDocumentId(id); +// //iOnlCgformSubscribeService.add(onlCgformSubscribe); +// } +// +// @Override +// public void cancelSubscribe(String id) { +// //订阅表中删除数据 +// //LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// //lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId, id); +// //iOnlCgformSubscribeService.remove(lambdaQueryWrapper); +// } +// + +// /** +// * 判断两个集合元素是否完全一致 +// * +// * @param list +// * @param list1 +// * @return +// */ +// private static boolean checkDiffrent(List list, List list1) { +// if (list.size() != list1.size()) { +// return false; +// } else { +// for (String str : list) { +// if (!list1.contains(str)) { +// return false; +// } +// } +// } +// return true; +// } +// +// private static void mapCopy(Map map, Map mapResult) { +// if (map == null) { +// return; +// } +// Iterator> iterator = map.entrySet().iterator(); +// while (iterator.hasNext()) { +// Map.Entry entry = iterator.next(); +// Object key = entry.getKey(); +// mapResult.put(key, map.get(key) != null ? map.get(key) : ""); +// } +// } + +// /** +// * 导出excel +// * +// * @param map +// * @param response +// * @param request +// */ +// @Override +// public void exportExcel(Map map, HttpServletResponse response, HttpServletRequest request) { +// LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String cut = (String) map.get("cut"); +// //String flag = "file"为带文件导出标识 +// String flag = (String) map.get("flag"); +//// String flag = "file"; +// OutputStream os = null; +// Workbook workbook = new XSSFWorkbook(); +// try { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String fileName = "文件库 " + sdf.format(new Date()) + ".xlsx"; +// response.setHeader("Content-Disposition", +// "attachment; filename=" + fileName); +// response.setContentType("application/force-download"); +// //需要查询的字段 +// List fieldList = onlCgformFieldService.getFieldList("1"); +// //表头 +// List headerFieldList = new ArrayList<>(); +// List fieldListTemp = new ArrayList<>(); +// if (fieldList.size() != 0) { +// //过滤掉系统默认的字段 +// fieldListTemp = fieldList.stream().filter(e -> !"id".equals(e.getDbFieldName()) +// && !"create_by".equals(e.getDbFieldName()) +// && !"create_time".equals(e.getDbFieldName()) +// && !"update_by".equals(e.getDbFieldName()) +// && !"update_time".equals(e.getDbFieldName()) +// && !"sys_org_code".equals(e.getDbFieldName()) +// && YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowForm())) +// && StringUtils.isNotBlank(e.getShowArea())).collect(Collectors.toList()); +// +// OnlCgformField phasedOnlCgformField = new OnlCgformField(); +// phasedOnlCgformField.setId(UUID.randomUUID().toString().replace("-", "")); +// phasedOnlCgformField.setDbFieldTxt("分阶段实施详情"); +// phasedOnlCgformField.setDbFieldEnName("Details of the phased implementation"); +// phasedOnlCgformField.setDbFieldName("phasedImplDetails"); +// fieldListTemp.add(phasedOnlCgformField); +// +// //只导出数据时,过滤掉文件类型 +// if (!"file".equals(flag)) { +// fieldListTemp = fieldListTemp.stream().filter(e -> !FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// } +// if (LanguageEnum.CN.getValue().equals(cut)) { +// headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldTxt).collect(Collectors.toList()); +// } else { +// headerFieldList = fieldListTemp.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList()); +// } +// } +// //查询字段 +// List conditionFieldList = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// //查询条件 +// String condition = getConditionStr(map); +// //导出数据(全部导出的数据) +// List> datas = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(conditionFieldList, ","), condition); +// //处理被代替标准(由id转中文) +// getStandard(datas); +// //部分导出 +// String partId = (String) map.get("id"); +// if (StringUtils.isNotBlank(partId)) { +// //部门导出的数据 +// datas = datas.stream().filter(entry -> partId.contains((String) entry.get("id"))).collect(Collectors.toList()); +// } +// //创建工作表对象 +// Sheet sheet = workbook.createSheet(); +// // 创建头部 +// String header = StringUtils.join(headerFieldList, ","); +// createHeader(workbook, sheet, header); +// // 创建数据 +// createDatas(workbook, sheet, datas, header, fieldListTemp, cut); +// +// if (!"file".equals(flag)) { +// //不带文件导出 +// os = response.getOutputStream(); +// workbook.write(os); +// os.flush(); +// } else { +// String path = uploadpath + "/tempZip"; +// File fileTemp = new File(path); +// if (fileTemp.exists()) { +// fileTemp.delete(); +// } +// fileTemp.mkdirs(); +// //excel +// OutputStream excelOS = new FileOutputStream(path + File.separator + "文档库.xlsx"); +// workbook.write(excelOS); +// excelOS.flush(); +// //带文件导出 +// //过滤出文件字段 +// List onlCgformFieldList = fieldListTemp.stream() +// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// List fileFieldList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// +// for (Map data : datas) { +// if (StringUtils.isBlank(MyStringUtils.valueOf(data.get("serial_number")))) { +// continue; +// } +// List valueList = new ArrayList<>(); +// for (String field : fileFieldList) { +// String value = MyStringUtils.valueOf(data.get(field)); +// if (StringUtils.isNotBlank(value)) { +// valueList.add(value); +// } +// } +// String serialNumber = MyStringUtils.valueOf(data.get("serial_number")); +// if (serialNumber.contains("/")) { +// serialNumber = serialNumber.replace("/", "-"); +// } +// //每一个编号下的所有的文件 +// if (valueList.size() != 0) { +// List fileInfosList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(valueList, ",")); +// if (fileInfosList.size() != 0) { +// String fileNowPath = uploadpath + "/tempZip/" + serialNumber; +// File file = new File(fileNowPath); +// if (file.exists()) { +// file.delete(); +// } +// file.mkdirs(); +// for (OSSFile ossFile : fileInfosList) { +// String url = ossFile.getUrl(); +// //判断文件是否存在 +// if(StringUtils.isNotBlank(url)){ +// //判断文件是否存在 +// boolean b = MinioUtil.doesObjectExist(url); +// if(b){ +// InputStream download = MinioUtil.download(url); +// if(url.endsWith(".pdf") || url.endsWith(".PDF")){ +// String currentTime = sdf.format(new Date()); +// String waterContent = loginUser.getUsername() + " " + currentTime; +// File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent); +// download = new FileInputStream(newFile.getPath()); +// } +// copyFile(download, fileNowPath + File.separator + ossFile.getFileName()); +// } +// } +// } +// } +// } +// } +// ZipUtil.zip(path, path + ".zip"); +// //文件 +// FileInputStream fis = new FileInputStream(path + ".zip"); +// os = response.getOutputStream(); +// +// int len = 0; +// while ((len = fis.read()) != -1) { +// os.write(len); +// } +// os.flush(); +// fis.close(); +// } +// } catch (IOException e) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("下载文件失败"); +// }else{ +// throw new JeroBootException("Failed to download file"); +// } +// } finally { +// IOUtils.closeQuietly(os); +// File file = new File(uploadpath + "/tempZip"); +// FileUtil.deleteContents(file); +// File fileTemp = new File(uploadpath + "/tempZip.zip"); +// FileUtil.deleteContents(fileTemp); +// } +// } + +// /** +// * 处理对应标准,代替标准,被代替标准(由id转中文) +// * +// * @param datas +// */ +// private void getStandard(List> datas) { +// List> datasTemp = new ArrayList<>(); +// for (Map data : datas) { +// Map mapTemp = new HashMap<>(); +// mapCopy(data, mapTemp); +// datasTemp.add(mapTemp); +// } +// for (Map data : datas) { +// String idTemp = MyStringUtils.valueOf(data.get("serial_number")); +// StringBuilder replacedStandardSb = new StringBuilder(); +// datasTemp.forEach(entry -> { +// String replaceStandardTemp = (String) entry.get("replace_standard"); +// //被代替标准 +// if (StringUtils.isNotBlank(replaceStandardTemp) && replaceStandardTemp.contains(idTemp)) { +// replacedStandardSb.append(entry.get("serial_number") + ","); +// } +// }); +// if (StringUtils.isNotBlank(replacedStandardSb)) { +// String replacedStandardStr = replacedStandardSb.substring(0, replacedStandardSb.length() - 1); +// data.put("replaced_standard", replacedStandardStr); +// } +// } +// } + +// public void createDatas(Workbook workbook, Sheet sheet, List> datas, String header, List fieldList, String cut) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象 +// cellStyle.setAlignment(HorizontalAlignment.CENTER); +// cellStyle.setWrapText(true);//自动换行 +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //文件字段 +// List fileFieldList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// //过滤出所有文件字段对应的connect_id +// List connectIdList = new ArrayList<>(); +// List idList = datas.stream().map(data -> (String) data.get("id")).distinct().collect(Collectors.toList()); +// +// List phasedImplDetailsEOList = null; +// if(CollectionUtils.isNotEmpty(idList)){ +// QueryWrapper phasedImplDetailsQueryWrap = new QueryWrapper<>(); +// phasedImplDetailsQueryWrap.lambda().in(PhasedImplementationDetailsEO::getBussDocumentLibraryId,idList); +// phasedImplDetailsEOList = this.phasedImplementationDetailsEOService.list(phasedImplDetailsQueryWrap); +// this.phasedImplementationDetailsEOService.disposeData(phasedImplDetailsEOList,cut); +// } +// +// for (Map data : datas) { +// StringBuilder phasedImplDetailsSb = new StringBuilder(); +// String id = (String) data.get("id"); +// +// for (OnlCgformField onlCgformField : fileFieldList) { +// String value = MyStringUtils.valueOf(data.get(onlCgformField.getDbFieldName())); +// if (StringUtils.isNotBlank(value)) { +// connectIdList.add(value); +// } +// } +// +// if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){ +// List phasedImplDetailsEOListTemp = phasedImplDetailsEOList.stream().filter(phased -> { +// boolean flag = StringUtils.equals(id, phased.getBussDocumentLibraryId()); +// return flag; +// }).collect(Collectors.toList()); +// +// if(CollectionUtils.isNotEmpty(phasedImplDetailsEOListTemp)){ +// for (PhasedImplementationDetailsEO detailsEO : phasedImplDetailsEOListTemp) { +// StringBuilder phasedImplDetailsSbTemp = new StringBuilder(); +// if(StringUtils.isNotEmpty(phasedImplDetailsSb.toString())){ +// phasedImplDetailsSb.append("#"); +// } +// if(StringUtils.isNotEmpty(detailsEO.getStandNumberOrClause())){ +// phasedImplDetailsSbTemp.append(detailsEO.getStandNumberOrClause()).append(""); +// } +// if(StringUtils.isNotEmpty(detailsEO.getImplementationTypeText())){ +// phasedImplDetailsSbTemp.append(detailsEO.getImplementationTypeText()).append(""); +// } +// if(detailsEO.getImplementationDate()!=null){ +// phasedImplDetailsSbTemp.append(DateUtils.formatDate(detailsEO.getImplementationDate())).append(""); +// } +// if(StringUtils.isNotEmpty(detailsEO.getRemarks())){ +// phasedImplDetailsSbTemp.append(detailsEO.getRemarks()).append(""); +// } +// if(StringUtils.isNotEmpty(phasedImplDetailsSbTemp.toString())){ +// phasedImplDetailsSb.append(phasedImplDetailsSbTemp, 0, phasedImplDetailsSbTemp.toString().length()-3); +// } +// } +// } +// } +// data.put("phasedImplDetails",phasedImplDetailsSb.toString()); +// } +// //所有的文件信息 +// List fileInfos = new ArrayList<>(); +// if (connectIdList.size() != 0) { +// fileInfos = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ",")); +// } +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// int i = 0; +// for (Map data : datas) { +// +// for (Map.Entry entry : data.entrySet()) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, fieldList,null); +// //处理树形数据字典 +// treeDictItem(categoryList, entry, treeFieldList, cut,null); +// } +// +// +// Row row = sheet.createRow(i + 1); +// i++; +// int sheetNum = 0; +// +// for (OnlCgformField onlCgformField : fieldList) { +// String value = ""; +// //时间类型 +// if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { +// if (ObjectUtils.isNotEmpty(data.get(onlCgformField.getDbFieldName()))) { +// value = sdf.format(data.get(onlCgformField.getDbFieldName())); +// } +// } else if (FieldTypeEnum.FILE.getValue().equals(onlCgformField.getFieldShowType())) { +// //处理文件名称(由connect_id转化为文件名) +// if (fileInfos.size() != 0) { +// List ossFileList = fileInfos.stream() +// .filter(e -> e.getConnectId().equals(data.get(onlCgformField.getDbFieldName()))) +// .collect(Collectors.toList()); +// if (ossFileList.size() != 0) { +// List fileNameList = ossFileList.stream().map(OSSFile::getFileName).collect(Collectors.toList()); +// value = StringUtils.join(fileNameList, ","); +// } else { +// value = ""; +// } +// } +// } else { +// value = MyStringUtils.valueOf(data.get(onlCgformField.getDbFieldName())); +// } +// if("null".equals(value)){ +// value = ""; +// } +// Cell cell = row.createCell(sheetNum); +// // cell.setCellStyle(cellStyle); +// cell.setCellValue(value); +// sheetNum++; +// } +// } +// } + +// /** +// * 创建表头 +// * +// * @param workbook +// * @param sheet +// * @param header +// */ +// public static void createHeader(Workbook workbook, Sheet sheet, String header) { +// CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象 +// cellStyle.setAlignment(HorizontalAlignment.CENTER); +// Row rowHeader = sheet.createRow(0);//开始创建标题行 +// if (StringUtils.isNotBlank(header)) { +// String[] headerArr = header.split(","); +// for (int i = 0; i < headerArr.length; i++) { +// Cell cellHeader = rowHeader.createCell(i); +// cellHeader.setCellValue(headerArr[i]); +// } +// } +// } + +// /** +// * 获取导出的数据 +// * +// * @param map +// * @return +// */ +// public List> getExportDatas(Map map) { +// //需要查询的字段 +// List fieldList = onlCgformFieldService.getFieldList("1"); +// if (fieldList.size() != 0) { +// //过滤列表字段(is_show_list-->列表是否显示0否 1是) +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowList()))).collect(Collectors.toList()); +// } +// List fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// List fieldListNew = new ArrayList<>(); +// fieldListNew.add("id"); +// fieldListNew.addAll(fieldListTemp); +// //查询条件 +// String condition = getConditionStr(map); +// List> infoList = bussDocumentLibraryEOMapper.getInfoList(" " + StringUtils.join(fieldListNew, ","), condition); +// return infoList; +// +// } +// +// /** +// * 带文件导出 +// * +// * @param map +// * @param response +// * @param request +// */ +// @Override +// public void exportZip(Map map, +// HttpServletResponse response, +// HttpServletRequest request) { +// exportExcel(map, response, request); +// } + + +// /** +// * 模板下载 +// * +// * @param response +// * @param request +// */ +// @Override +// public void exportTemplate(Map map, HttpServletResponse response, HttpServletRequest request) { +// OutputStream os = null; +// HSSFWorkbook workbook = new HSSFWorkbook(); +// try { +// String cut = (String) map.get("cut"); +// String sheetName = ""; +// if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ +// sheetName = "文档库导入模板"; +// }else { +// sheetName = "Document LibraryImport Template"; +// } +// String fileOriName = "文档库导入模板.xls"; +// String filePath = uploadpath + File.separator + fileOriName; +// List list = getWorkbookTitle((String) map.get("cut")); +// //创建临时文件夹 +// File nowFile = new File(filePath); +// if (nowFile.exists()) { +// nowFile.delete(); +// } +// nowFile.mkdirs(); +// HSSFSheet sheet = workbook.createSheet(sheetName); +// sheet.setDefaultColumnWidth(16);//列宽 +// HSSFCellStyle cellStyle = workbook.createCellStyle(); +// cellStyle.setWrapText(true);//自动换行 +// cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); +// +// //合并单元格 +// CellRangeAddress region1 = +// new CellRangeAddress(1, 1, 0, Arrays.asList(list.get(0).split(",")).size() - 1); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 +// sheet.addMergedRegion(region1); +// +// for (int i = 0; i < 2; i++) { +// //表头 +// Row row = sheet.createRow(i);//开始创建标题行 +// String exportFieldName = list.get(i); +// if (i == 0) { +// if (StringUtils.isNotBlank(exportFieldName)) { +// String[] headerArr = exportFieldName.split(","); +// for (int j = 0; j < headerArr.length; j++) { +// row.createCell(j).setCellValue(headerArr[j]); +// } +// } +// } else { +// //说明 +// short height = (short) (Integer.parseInt(list.get(2)) * 252); +// row.setHeight(height); +// Cell cell = row.createCell(0); +// cell.setCellStyle(cellStyle); +// cell.setCellValue(new HSSFRichTextString(list.get(i))); +// } +// +// } +// response.setHeader("Content-Disposition", +// "attachment; filename=\"" + fileOriName + ".xls"); +// response.setContentType("application/force-download"); +// response.flushBuffer(); +// os = response.getOutputStream(); +// workbook.write(os); +// } catch (Exception e) { +// throw new JeroBootException("下载文件失败,请重试"); +// } finally { +// IOUtils.closeQuietly(os); +// try { +// workbook.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// +// } + +// /** +// * 获取模板下载的表头 +// * +// * @return +// */ +// private List getWorkbookTitle(String cut) { +// List> addForm = getField(ModuleEnum.DOCUMENT_LIBRARY.getValue(), cut, "add"); +// StringBuilder sb = new StringBuilder(); +// List pullMoreList = new LinkedList<>();//多选字段 +// List pullSingleList = new LinkedList<>();//单选字段 +// List fileList = new LinkedList<>();//文件字段 +// List textNumberList = new LinkedList<>();//数字输入框字段 +// List textStringList = new LinkedList<>();//字符串输入框字段 +// List dateSingleList = new LinkedList<>();//单选日期字段 +// List dateMoreList = new LinkedList<>();//多选日期字段 +// List standardList = new LinkedList<>();//标准选择字段 +// List treeList = new LinkedList<>();//树状结构字段 +// for (Map map : addForm) { +// if ("1".equals(map.get("field_must_input"))) { +// sb.append("*" + map.get("db_field_txt") + ","); +// } else { +// sb.append(map.get("db_field_txt") + ","); +// } +// String fieldShowType = "field_show_type"; +// //多选字段 +// if (FieldTypeEnum.PULL_MORE.getValue().equals(map.get(fieldShowType))) { +// pullMoreList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(map.get(fieldShowType))) { +// //单选字段 +// pullSingleList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.FILE.getValue().equals(map.get(fieldShowType))) { +// //文件字段 +// fileList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(map.get(fieldShowType))) { +// //数字输入框字段 +// textNumberList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(map.get(fieldShowType))) { +// //字符串输入框字段 +// textStringList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(map.get(fieldShowType))) { +// //单选日期字段 +// dateSingleList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.DATE_MORE.getValue().equals(map.get(fieldShowType))) { +// //多选日期字段 +// dateMoreList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } else if (FieldTypeEnum.STANDARD.getValue().equals(map.get(fieldShowType))) { +// //标准选择字段 +// standardList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// }else if(FieldTypeEnum.TREE.getValue().equals(map.get(fieldShowType))){ +// treeList.add(MyStringUtils.valueOf(map.get("db_field_txt"))); +// } +// } +// String title = sb.substring(0, sb.length() - 1); +// +// //第二行 +// StringBuilder sbTwo = new StringBuilder(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// sbTwo.append("填写说明\n" + "1.导入数据从第三行开始,第一行为表头,第二行为填写说明,第三行是正式数据\n" + "2.所有带*号的字段必须填写\n"); +// }else{ +// sbTwo.append("Filling explanation\n" +// + "1.Import data starts at the third line, the first line is the header, the second line is the description, and the third line is the official data\n" +// + "2.All fields marked with * must be filled in\n"); +// } +// int count = 3; +// if (pullSingleList.size() != 0) { +// //单选 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String pullSingle = StringUtils.join(pullSingleList, ",") + "字段是单选属性,必须和系统中的对应字段选项相匹配\n"; +// sbTwo.append(count++ + "." + pullSingle); +// }else{ +// String pullSingle = StringUtils.join(pullSingleList, ",") + " Fields are radio attributes,Must match the corresponding field option in the system\n"; +// sbTwo.append(count++ + "." + pullSingle); +// } +// } +// +// if (pullMoreList.size() != 0) { +// //多选 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String pullMore = StringUtils.join(pullMoreList, ",") + "字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n"; +// sbTwo.append(count++ + "." + pullMore); +// }else{ +// String pullMore = StringUtils.join(pullMoreList, ",") + " A field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n"; +// sbTwo.append(count++ + "." + pullMore); +// } +// } +// if (dateSingleList.size() != 0) { +// //单选日期 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String dateSingle = StringUtils.join(dateSingleList, ",") + "字段为日期,必须精确到日\n"; +// sbTwo.append(count++ + "." + dateSingle); +// }else{ +// String dateSingle = StringUtils.join(dateSingleList, ",") + " The field is the date and must be exact to the day\n"; +// sbTwo.append(count++ + "." + dateSingle); +// } +// } +// if (textStringList.size() != 0) { +// //输入框 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String textString = StringUtils.join(textStringList, ",") + "字段为文本,填写文本内容\n"; +// sbTwo.append(count++ + "." + textString); +// }else{ +// String textString = StringUtils.join(textStringList, ",") + " Field is text. Enter the text content\n"; +// sbTwo.append(count++ + "." + textString); +// } +// } +// if (standardList.size() != 0) { +// //标准选择 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String standard = StringUtils.join(standardList, ",") + "字段为标准号,填写多个时采用英文或中文逗号分割\n"; +// sbTwo.append(count++ + "." + standard); +// }else{ +// String standard = StringUtils.join(standardList, ",") + " The field is a standard number. If you fill in more than one field, separate it with English or Chinese commas\n"; +// sbTwo.append(count++ + "." + standard); +// } +// } +// if (fileList.size() != 0) { +// //文件 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String file = StringUtils.join(fileList, ",") + "字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件且该文件夹下只能有一层级,假设在AAA标准号下放置了B.pdf,则应填写AAA/B.pdf\n"; +// sbTwo.append(count++ + "." + file); +// }else{ +// String file = StringUtils.join(fileList, ",") + " When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder and can be only one level under this folder, Assume that the file is saved in the AAA standard numberB.pdf,Should fill inAAA/B.pdf\n"; +// sbTwo.append(count++ + "." + file); +// } +// } +// if(treeList.size() != 0){ +// //树状结构 +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String tree = StringUtils.join(treeList, ",") + "字段为树状结构属性,填写时直接填写选中的数据,如需要选中车身,则直接填写车身,填写多个时采用英文或中文逗号分割\n"; +// sbTwo.append(count++ + "." + tree); +// }else{ +// String tree = StringUtils.join(treeList, ",") + " fields are tree-like structure attributes, and the selected data will be directly filled in when filling in. If the car body needs to be selected, the car body will be directly filled in. If there are more than one fields, English or Chinese commas will be used to separate them\n"; +// sbTwo.append(count++ + "." + tree); +// } +// } +// // +// if(LanguageEnum.CN.getValue().equals(cut)){ +// String tree = "分阶段实施详情字段,多行之间使用#号分隔,列之间使用标签分隔,示例:法规编号/条款新车型2000-10-10备注#"; +// sbTwo.append(count++ + "." + tree); +// }else{ +// String tree = "For the field of phased implementation details, separate rows with # signs and columns with labels. Example: Regulation Number/Articles New model 2000-10-10 Remarks"; +// sbTwo.append(count++ + "." + tree); +// } +// List list = new LinkedList<>(); +// list.add(title); +// list.add(sbTwo.toString()); +// list.add(count + ""); +// return list; +// +// } public static void copyFile(InputStream in, String newFile) throws IOException { File file2 = new File(newFile); @@ -4411,97 +4406,97 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl> getHeaderOrConditionForOcr(String flag, String cut) { - List> list = new ArrayList<>(); - Map map1 = new HashMap<>(); - Map map2 = new HashMap<>(); - Map map3 = new HashMap<>(); - Map map4 = new HashMap<>(); - Map map5 = new HashMap<>(); - - if ("header".equals(flag)) { - if (LanguageEnum.CN.getValue().equals(cut)) { - //编号 - map1.put("db_field_name", "serial_number");//字段 - map1.put("db_field_txt", "编号");//字段中文名 - list.add(map1); - //标题 - map2.put("db_field_name", "title");//字段 - map2.put("db_field_txt", "标题");//字段中文名 - list.add(map2); - //状态 - map3.put("db_field_name", "state");//字段 - map3.put("db_field_txt", "状态");//字段中文名 - list.add(map3); - //文件名称 - map4.put("db_field_name", "file_name");//字段 - map4.put("db_field_txt", "文件名称");//字段中文名 - list.add(map4); - //文件信息 - map5.put("db_field_name", "text_info");//字段 - map5.put("db_field_txt", "文件信息");//字段中文名 - list.add(map5); - } else { - //编号 - map1.put("db_field_name", "serial_number");//字段 - map1.put("db_field_txt", "Number");//字段中文名 - list.add(map1); - //标题 - map2.put("db_field_name", "title_en");//字段 - map2.put("db_field_txt", "Title");//字段英文名 - list.add(map2); - //状态 - map3.put("db_field_name", "state");//字段 - map3.put("db_field_txt", "Status");//字段中文名 - list.add(map3); - //文件名称 - map4.put("db_field_name", "file_name");//字段 - map4.put("db_field_txt", "File Name");//字段中文名 - list.add(map4); - //文件信息 - map5.put("db_field_name", "text_info");//字段 - map5.put("db_field_txt", "Text Info");//字段中文名 - list.add(map5); - } - } else if ("condition".equals(flag)) { - if (LanguageEnum.CN.getValue().equals(cut)) { - //编号 - map1.put("db_field_name", "serial_number");//字段 - map1.put("db_field_txt", "编号");//字段中文名 - map1.put("dict_field", "");//数据字典 - map1.put("field_show_type", "1"); - list.add(map1); - //标题 - map2.put("db_field_name", "title");//字段 - map2.put("db_field_txt", "标题");//字段中文名 - map2.put("dict_field", "");//数据字典 - map2.put("field_show_type", "1"); - list.add(map2); - } else { - //编号 - map1.put("db_field_name", "serial_number");//字段 - map1.put("db_field_txt", "Number");//字段中文名 - map1.put("dict_field", "");//数据字典 - map1.put("field_show_type", "1"); - list.add(map1); - //标题 - map2.put("db_field_name", "title");//字段 - map2.put("db_field_txt", "Title");//字段中文名 - map2.put("dict_field", "");//数据字典 - map2.put("field_show_type", "1"); - list.add(map2); - } - } - return list; - } +// /** +// * ocr识别调取已入库文件-中英文切换 +// * +// * @param flag header-表头,condition-查询条件 +// * @param cut +// * @return +// */ +// @Override +// public List> getHeaderOrConditionForOcr(String flag, String cut) { +// List> list = new ArrayList<>(); +// Map map1 = new HashMap<>(); +// Map map2 = new HashMap<>(); +// Map map3 = new HashMap<>(); +// Map map4 = new HashMap<>(); +// Map map5 = new HashMap<>(); +// +// if ("header".equals(flag)) { +// if (LanguageEnum.CN.getValue().equals(cut)) { +// //编号 +// map1.put("db_field_name", "serial_number");//字段 +// map1.put("db_field_txt", "编号");//字段中文名 +// list.add(map1); +// //标题 +// map2.put("db_field_name", "title");//字段 +// map2.put("db_field_txt", "标题");//字段中文名 +// list.add(map2); +// //状态 +// map3.put("db_field_name", "state");//字段 +// map3.put("db_field_txt", "状态");//字段中文名 +// list.add(map3); +// //文件名称 +// map4.put("db_field_name", "file_name");//字段 +// map4.put("db_field_txt", "文件名称");//字段中文名 +// list.add(map4); +// //文件信息 +// map5.put("db_field_name", "text_info");//字段 +// map5.put("db_field_txt", "文件信息");//字段中文名 +// list.add(map5); +// } else { +// //编号 +// map1.put("db_field_name", "serial_number");//字段 +// map1.put("db_field_txt", "Number");//字段中文名 +// list.add(map1); +// //标题 +// map2.put("db_field_name", "title_en");//字段 +// map2.put("db_field_txt", "Title");//字段英文名 +// list.add(map2); +// //状态 +// map3.put("db_field_name", "state");//字段 +// map3.put("db_field_txt", "Status");//字段中文名 +// list.add(map3); +// //文件名称 +// map4.put("db_field_name", "file_name");//字段 +// map4.put("db_field_txt", "File Name");//字段中文名 +// list.add(map4); +// //文件信息 +// map5.put("db_field_name", "text_info");//字段 +// map5.put("db_field_txt", "Text Info");//字段中文名 +// list.add(map5); +// } +// } else if ("condition".equals(flag)) { +// if (LanguageEnum.CN.getValue().equals(cut)) { +// //编号 +// map1.put("db_field_name", "serial_number");//字段 +// map1.put("db_field_txt", "编号");//字段中文名 +// map1.put("dict_field", "");//数据字典 +// map1.put("field_show_type", "1"); +// list.add(map1); +// //标题 +// map2.put("db_field_name", "title");//字段 +// map2.put("db_field_txt", "标题");//字段中文名 +// map2.put("dict_field", "");//数据字典 +// map2.put("field_show_type", "1"); +// list.add(map2); +// } else { +// //编号 +// map1.put("db_field_name", "serial_number");//字段 +// map1.put("db_field_txt", "Number");//字段中文名 +// map1.put("dict_field", "");//数据字典 +// map1.put("field_show_type", "1"); +// list.add(map1); +// //标题 +// map2.put("db_field_name", "title");//字段 +// map2.put("db_field_txt", "Title");//字段中文名 +// map2.put("dict_field", "");//数据字典 +// map2.put("field_show_type", "1"); +// list.add(map2); +// } +// } +// return list; +// } /** * 文档拆分调取已入库文件-中英文切换 @@ -4586,99 +4581,99 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl allDepartIds = new HashSet<>(); - //查询当前部门下所有部门 - if (StringUtils.isNotEmpty(departIds)) { - String[] departIdArr = departIds.split(","); - for (String departId : departIdArr) { - List subDepIdsByDepId = sysDepartService.getSubDepIdsByDepId(departId); - allDepartIds.addAll(subDepIdsByDepId); - } - } - - - List userIdList = new ArrayList<>(); - List thirdIdList = new ArrayList<>(); - if (StringUtils.isNotBlank(departIds)) { - //查询部门下的人员 - List userList = new ArrayList<>(); - if(allDepartIds.size() != 0){ - userList = sysUserService.getUserListByDepIds(new ArrayList<>(allDepartIds)); - } - - if (userList.size() != 0) { - userIdList = userList.stream().map(SysUser::getId).distinct().collect(Collectors.toList()); - thirdIdList = userList.stream().map(SysUser::getThirdId).distinct().collect(Collectors.toList()); - } - } - if(userIdList.size() == 0 && StringUtils.isNotBlank(userIds)){ - List sysUsers = sysUserService.listByIds(Arrays.asList(userIds.split(","))); - if(sysUsers.size() != 0){ - List userId = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList()); - List thirdId = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); - userIdList.addAll(userId); - thirdIdList.addAll(thirdId); - } - } - -// userIdList.addAll(Arrays.asList(userIds.split(","))); - //查询文档 - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds); - List serialNumberList = new ArrayList<>(); - List urlList = new ArrayList<>(); - List urlPhonelList = new ArrayList<>(); - List hrefList = new ArrayList<>(); - for (Map map : mapList) { - serialNumberList.add(MyStringUtils.valueOf(map.get("serial_number"))); - String url = backUrl + "/docManage/library/detail?id=" + map.get("id") + - "&title=" + map.get("title") + - "&serial_number=" + map.get("serial_number"); - - - String href = "" + map.get("serial_number") + ""; - - String urlPhone = backUrlPhone + "/phoneDocumentDetails?id=" + map.get("id"); - urlList.add(url); - hrefList.add(href); - urlPhonelList.add(urlPhone); - } - - - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please be reminded to check it out."; - String contentInfo = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out."; - String title = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check."; - - String contentEnNo = sysUser.getUsername() + " shared " + StringUtils.join(serialNumberList, ",") + " with you, please be reminded to check it out."; - String contentInfoEnYes = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out."; - String contentInfoCnNo = sysUser.getUsername() + "向您分享了" + StringUtils.join(serialNumberList, ",") + "请查看."; - String contentInfoCnYes = sysUser.getUsername() + "向您分享了" + StringUtils.join(hrefList, ",") + "请查看."; - - //封装消息的实体类 - SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, - title, - contentEnNo, - contentInfoEnYes, - MessageTypeEnum.PUSH.getValue(), - MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), - contentInfoCnNo, - contentInfoCnYes); - sysAnnouncementService.saveAnnouncement(sysAnnouncement); - sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo); - sendWebsocket(documentIds, contentInfo); - return "推送成功"; - } +// /** +// * 推送 +// * +// * @param userIds +// * @param documentIds +// * @return +// */ +// @Override +// public String pullMessage(String departIds, String userIds, String documentIds) { +// Set allDepartIds = new HashSet<>(); +// //查询当前部门下所有部门 +// if (StringUtils.isNotEmpty(departIds)) { +// String[] departIdArr = departIds.split(","); +// for (String departId : departIdArr) { +// List subDepIdsByDepId = sysDepartService.getSubDepIdsByDepId(departId); +// allDepartIds.addAll(subDepIdsByDepId); +// } +// } +// +// +// List userIdList = new ArrayList<>(); +// List thirdIdList = new ArrayList<>(); +// if (StringUtils.isNotBlank(departIds)) { +// //查询部门下的人员 +// List userList = new ArrayList<>(); +// if(allDepartIds.size() != 0){ +// userList = sysUserService.getUserListByDepIds(new ArrayList<>(allDepartIds)); +// } +// +// if (userList.size() != 0) { +// userIdList = userList.stream().map(SysUser::getId).distinct().collect(Collectors.toList()); +// thirdIdList = userList.stream().map(SysUser::getThirdId).distinct().collect(Collectors.toList()); +// } +// } +// if(userIdList.size() == 0 && StringUtils.isNotBlank(userIds)){ +// List sysUsers = sysUserService.listByIds(Arrays.asList(userIds.split(","))); +// if(sysUsers.size() != 0){ +// List userId = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList()); +// List thirdId = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList()); +// userIdList.addAll(userId); +// thirdIdList.addAll(thirdId); +// } +// } +// +//// userIdList.addAll(Arrays.asList(userIds.split(","))); +// //查询文档 +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds); +// List serialNumberList = new ArrayList<>(); +// List urlList = new ArrayList<>(); +// List urlPhonelList = new ArrayList<>(); +// List hrefList = new ArrayList<>(); +// for (Map map : mapList) { +// serialNumberList.add(MyStringUtils.valueOf(map.get("serial_number"))); +// String url = backUrl + "/docManage/library/detail?id=" + map.get("id") + +// "&title=" + map.get("title") + +// "&serial_number=" + map.get("serial_number"); +// +// +// String href = "" + map.get("serial_number") + ""; +// +// String urlPhone = backUrlPhone + "/phoneDocumentDetails?id=" + map.get("id"); +// urlList.add(url); +// hrefList.add(href); +// urlPhonelList.add(urlPhone); +// } +// +// +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please be reminded to check it out."; +// String contentInfo = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out."; +// String title = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check."; +// +// String contentEnNo = sysUser.getUsername() + " shared " + StringUtils.join(serialNumberList, ",") + " with you, please be reminded to check it out."; +// String contentInfoEnYes = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out."; +// String contentInfoCnNo = sysUser.getUsername() + "向您分享了" + StringUtils.join(serialNumberList, ",") + "请查看."; +// String contentInfoCnYes = sysUser.getUsername() + "向您分享了" + StringUtils.join(hrefList, ",") + "请查看."; +// +// //封装消息的实体类 +// SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, +// title, +// contentEnNo, +// contentInfoEnYes, +// MessageTypeEnum.PUSH.getValue(), +// MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), +// contentInfoCnNo, +// contentInfoCnYes); +// sysAnnouncementService.saveAnnouncement(sysAnnouncement); +// sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo); +// sendWebsocket(documentIds, contentInfo); +// return "推送成功"; +// } //private FeishuMsgVo getFeishuMsgVo(String title, String taskType, String content,String url) { // FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); @@ -4748,1227 +4743,1229 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl list = getWorkbookTitle(cut); - int pos = file.getOriginalFilename().lastIndexOf("."); - String str = file.getOriginalFilename().substring(pos + 1).toLowerCase(); - String filenameorg = file.getOriginalFilename().substring(0, pos); - //判断上传文件必须是zip - if (!str.equals("zip") && !str.equals("rar")) { - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("请上传zip格式的文件或rar格式的文件"); - }else{ - throw new JeroBootException("Please upload a zip file or rar file"); - } - } - String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); - File saveDirectory = new File(path); - if (!saveDirectory.isDirectory()) { - saveDirectory.mkdir(); - } - FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); - //解压缩 - String zipEntryName = ""; - if (str.equals("zip")) { - zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); - } else { -// zipEntryName = FileRarUtils.rarUnCompress(path + File.separator + file.getOriginalFilename(), path); - } - - - //判断压缩包下是否只有一个文件夹 - File fileTemp = new File(path); - int length = fileTemp.listFiles().length; - if (length > 2) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传"); - }else{ - throw new JeroBootException("There must be only one folder in the compressed package Please upload it again"); - } - - } - File fileNew = new File(zipEntryName); - List fileList = new ArrayList<>(); - for (File file1 : fileNew.listFiles()) { - if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) { - fileList.add(file1); - } - } - if (fileList.size() == 0) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传"); - }else{ - throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again"); - } - - } else if (fileList.size() > 1) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传"); - }else{ - throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again"); - } - - } - - // 数据相关处理, - // 1.获取其中的Excel, - List excelfilelist = FileUnZip.readImpExcelFile(zipEntryName); - System.gc(); - if (excelfilelist.size() < 1) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("压缩包内没有上传Excel数据"); - }else{ - throw new JeroBootException("No Excel data is uploaded in the compressed package"); - } - - } else if (excelfilelist.size() > 1) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("压缩包内有多个Excel数据源"); - }else{ - throw new JeroBootException("There are multiple Excel data sources in the zip package"); - } - - } - File excelfile = excelfilelist.get(0); - - - Workbook workbook = WorkbookFactory.create(excelfile); - List> dataList = new ArrayList<>(); - if (workbook != null) { - DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); - Sheet sheet = workbook.getSheetAt(0); - if (sheet != null) { - StringBuilder headerSb = new StringBuilder(); - int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数 - for (int i = 0; i <= rowNos; i++) {// 遍历行 - if (i == 1) { - continue; - } - Row row = sheet.getRow(i); - Row headerRow = sheet.getRow(0); - boolean isBlank = isRowEmpty(row); - if (row != null && !isBlank) { - int columNos = headerRow.getLastCellNum();// 表头总共的列数 - Map rowList = new LinkedHashMap<>(); - for (int j = 0; j < columNos; j++) { - Cell cell = row.getCell(j); - Cell headerCell = headerRow.getCell(j); - if (cell != null) { - if (i == 0) { - headerSb.append(cell.getStringCellValue() + ","); - } else { - if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { - Date d = cell.getDateCellValue(); - rowList.put(headerCell.getStringCellValue(), df.format(d)); - } else { - String stringCellValue = cell.getStringCellValue(); - if (StringUtils.isNotBlank(stringCellValue)) { - String replace = stringCellValue.replace(",", ","); - rowList.put(headerCell.getStringCellValue(), replace); - } else { - rowList.put(headerCell.getStringCellValue(), ""); - } - } - } - } else { - if (i != 0) { - rowList.put(headerCell.getStringCellValue(), ""); - } - } - } - if (i != 0) { - dataList.add(rowList); - } - } - } - if (dataList.size() == 0) { - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("请填写必填字段内容,带*的为必填"); - }else{ - throw new JeroBootException("Please fill in the required fields marked with *"); - } - - } - // 校验头部是否符合模板 - String fields = list.get(0); - - //判断结尾为逗号,则减1个字符 - String substring = headerSb.toString(); - if (substring.endsWith(",") || substring.endsWith(",")){ - substring = headerSb.substring(0, headerSb.length() - 1); - } - - String excelHeader = substring; - if (!fields.equals(excelHeader)) { - workbook.close(); - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - if(LanguageEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); - }else{ - throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); - } - - } - } - } - workbook.close(); - //树形数据字典 - List categoryList = sysCategoryService.list(); - //普通数据字典 - List dictItemList = sysDictItemServiceImpl.selectItemsAll(); - //表头 - List> addForm = getField(ModuleEnum.DOCUMENT_LIBRARY.getValue(), cut, "add"); - exportDatas(dataList, addForm, categoryList, dictItemList, zipEntryName,saveDirectory,cut); - //删除原上传文件 - FileUnZip.deleteDir(saveDirectory); - - } - - private void exportDatas(List> dataList, - List> fieldList, - List categoryList, - List dictItemList, - String zipEntryName, - File saveDirectory, - String cut) { - //树形数据字典 - List treeNameList = new ArrayList<>(); - if(LanguageEnum.CN.getValue().equals(cut)){ - treeNameList = categoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); - }else{ - treeNameList = categoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); - } - //普通数据字典 - List itemNameList = new ArrayList<>(); - if(LanguageEnum.CN.getValue().equals(cut)){ - itemNameList = dictItemList.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); - }else{ - itemNameList = dictItemList.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); - } - - int i = 2; - List msgList = new ArrayList<>(); - List> mapList = new ArrayList<>(); - for (Map stringStringMap : dataList) { - Map mapResult = new HashMap<>(); - i++; - int countError = 0; //记录失败数据数量 - String errorMsg = ""; - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg = "第" + i + "行:"; - } else { - errorMsg = i + " line:"; - } - - for (Map.Entry entry : stringStringMap.entrySet()) { - - String key = entry.getKey(); - if (key.contains("*")) { - key = key.replace("*", ""); - } - String value = entry.getValue(); - String field = ""; - // 如果是分阶段实施字段,单独处理,如果是其它字段,按照原有逻辑处理 - if(StringUtils.equals(key,"分阶段实施详情") || StringUtils.equals(key,"Details of the phased implementation")){ - if(StringUtils.isNotEmpty(value)){ - List phasedImplementationDetailsEOList = new ArrayList<>(); - String[] phasedImplDetailsList = value.split("#"); - for (String phasedImplDetails : phasedImplDetailsList) { - PhasedImplementationDetailsEO phasedImplementationDetailsEO = new PhasedImplementationDetailsEO(); - String[] phasedImplDetailsArr = phasedImplDetails.split(""); - if(phasedImplDetailsArr.length < 3){ - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-必填项不能为空, "; - }else{ - errorMsg += "Phased Implementation Details - Required items cannot be empty,"; - } - countError++; - break; - } - - if(phasedImplDetailsArr.length >= 1){ - String standNumberOrClause = phasedImplDetailsArr[0]; - if(StringUtils.isEmpty(standNumberOrClause)){ - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-法规编号/条款不能为空, "; - }else{ - errorMsg += "Phased Implementation Details - Regulation No./clause cannot be empty,"; - } - countError++; - } else if (StringUtils.isNotBlank(standNumberOrClause) && standNumberOrClause.length() > 200) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-法规编号/条款不能超过" + 200 + "个字符, "; - }else{ - errorMsg += "Phased Implementation Details - Regulation No./clause Can not be more than " + 200 + " char, "; - } - countError++; - }else { - phasedImplementationDetailsEO.setStandNumberOrClause(standNumberOrClause); - } - } - if(phasedImplDetailsArr.length >= 2){ - String implementationTypeName = phasedImplDetailsArr[1]; - - if(StringUtils.isNotEmpty(implementationTypeName)){ - String[] implementationTypeNameArr = implementationTypeName.split(","); - ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values(); - List implementationTypeList = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { - boolean flag = false; - for (String type : implementationTypeNameArr) { - if(StringUtils.equals(type,implementationTypeEnum.getNameCn()) || StringUtils.equals(type,implementationTypeEnum.getNameEn())){ - flag = true; - } - } - return flag; - }).map(ImplementationTypeEnum::getItemValue).collect(Collectors.toList()); - - if(implementationTypeNameArr.length != implementationTypeList.size()){ - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-实施类型填写有误,填写值为'新车型 或 在产车', "; - }else{ - errorMsg += "Phased Implementation Details - implementationType The value is set to 'New car model or Car in production', "; - } - countError++; - }else { - phasedImplementationDetailsEO.setImplementationType(implementationTypeList.stream().collect(Collectors.joining(","))); - } - }else { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-实施类型不能为空, "; - }else{ - errorMsg += "Phased Implementation Details - Implementation Type cannot be empty,"; - } - countError++; - } - } - if(phasedImplDetailsArr.length >= 3){ - String implementationDateStr = phasedImplDetailsArr[2]; - if(StringUtils.isEmpty(implementationDateStr)){ - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-实施日期不能为空, "; - }else{ - errorMsg += "Phased Implementation Details - Implementation Date cannot be empty,"; - } - countError++; - }else { - Date implementationDate = null; - try { - implementationDate = DateUtils.parseDate(phasedImplDetailsArr[2], "yyyy-MM-dd"); - } catch (ParseException e) { - e.printStackTrace(); - } - if(implementationDate == null){ - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-实施日期格式错误,正确格式为'yyyy-MM-dd', "; - }else{ - errorMsg += "Phased Implementation Details - implementationDate format is incorrect. The correct format is 'yyyy-MM-dd', "; - } - countError++; - }else { - phasedImplementationDetailsEO.setImplementationDate(implementationDate); - } - } - } - if(phasedImplDetailsArr.length >= 4){ - String remarks = phasedImplDetailsArr[3]; - if (StringUtils.isNotBlank(remarks) && remarks.length() > 1000) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += "分阶段实施详情-备注不能超过" + 1000 + "个字符, "; - }else{ - errorMsg += "Phased Implementation Details - ramarks Can not be more than " + 1000 + " char, "; - } - countError++; - }else { - phasedImplementationDetailsEO.setRemarks(remarks); - } - } - phasedImplementationDetailsEOList.add(phasedImplementationDetailsEO); - } - - mapResult.put("phasedImplementationDetailsEOList",phasedImplementationDetailsEOList); - } - }else { - for (Map map : fieldList) { - String fieldNameCn = (String) map.get("db_field_txt");//中文名称 - String fieldName = (String) map.get("db_field_name");//字段名 - if(StringUtils.equals(fieldName,"phasedImplDetails")){ - continue; - } - String mustInput = (String) map.get("field_must_input");//是否必填 - String dbLength = map.get("db_length").toString();//字段长度 - String fieldShowType = (String) map.get("field_show_type");//字段类型 - - if (key.equals(fieldNameCn)) { - field = fieldName; - //验证字段是否必填,长度,下拉框和树形的值是否匹配 - if (FieldTypeEnum.TREE.getValue().equals(fieldShowType)) { - //树形 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; - } - countError++; - } - //判断数据是否匹配 - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (!treeNameList.contains(valueTemp)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; - }else{ - errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; - } - countError++; - } - } - } - String valueId = ""; - //文字转ID - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (treeNameList.contains(valueTemp)) { - List collect = new ArrayList<>(); - if(LanguageEnum.CN.getValue().equals(cut)){ - collect = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); - }else{ - collect = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); - } - valueId += collect.get(0).getId()+","; - } - } - if(StringUtils.isNotBlank(valueId)){ - value = valueId.substring(0, valueId.length() - 1); - } - } - - } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldShowType)) { - //输入框 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + "char, "; - } - countError++; - } - - } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldShowType)) { - //正则判断仅能为 负号(-),小数点(.)和数字 - - - } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldShowType)) { - //下拉单选 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + " char, "; - } - countError++; - } - //判断是否是单选 - if (StringUtils.isNotBlank(value) && value.contains(",")) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为单选项, "; - }else{ - errorMsg += key + " Is multiple choice, "; - } - - countError++; - } - //判断数据是否匹配 - if (StringUtils.isNotBlank(value)) { - if (!itemNameList.contains(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + value + "与数据字典不匹配, "; - }else{ - errorMsg += key + " " + value + " Does not match the data dictionary, "; - } - countError++; - } - } - //文字转数据字典编码 - if (itemNameList.contains(value)) { - String finalValue = value; - List collect = new ArrayList<>(); - if(LanguageEnum.CN.getValue().equals(cut)){ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(finalValue)).collect(Collectors.toList()); - }else{ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(finalValue)).collect(Collectors.toList()); - } - if (collect.size() != 0) { - value = collect.get(0).getItemValue(); - } - } - } else if (FieldTypeEnum.PULL_MORE.getValue().equals(fieldShowType)) { - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + " char, "; - } - countError++; - } - //下拉多选 - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (!itemNameList.contains(valueTemp)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; - }else{ - errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; - } - countError++; - } - } - } - - String valueId = ""; - //文字转数据字典id - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (itemNameList.contains(valueTemp)) { - List collect = new ArrayList<>(); - if(LanguageEnum.CN.getValue().equals(cut)){ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(valueTemp)).collect(Collectors.toList()); - }else{ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(valueTemp)).collect(Collectors.toList()); - } - - valueId += collect.get(0).getItemValue() + ","; - } - } - if (StringUtils.isNotBlank(valueId)) { - value = valueId.substring(0, valueId.length() - 1); - } - } - - - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { - value = value.replaceAll("/","-"); - //单选日期 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //a判断是否是单日期选择 - if (StringUtils.isNotBlank(value) && value.contains(",")) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为单日期选项, "; - }else{ - errorMsg += key + " Is single date option, "; - } - countError++; - } - //判断格式是否正确 - if (!DateUtils.isValidDate((String) value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - }else{ - errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - } - countError++; - } - - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { - //多选日期 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断格式是否正确 - if (!DateUtils.isValidDate((String) value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - }else{ - errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - } - countError++; - } - - - } else if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { - //文件 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; - } - countError++; - } - if (StringUtils.isNotBlank(value)) { - StringBuilder sb = new StringBuilder(); - for (String fileName : value.split(",")) { - List nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key); - if (nowFileList.size() == 0) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + " 压缩包中没有" + fileName + "文件, "; - }else{ - errorMsg += key + " Not in the zip package" + fileName + "file, "; - } - countError++; - } else { - try { - FileInputStream input = new FileInputStream(nowFileList.get(0)); - MultipartFile multipartFile = - new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); - //文件存入文件表 - OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null,null); - if (ObjectUtils.isNotEmpty(ossFile)) { - sb.append(ossFile.getId() + ","); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - if (StringUtils.isNotBlank(sb)) { - String substring = sb.substring(0, sb.length() - 1); - value = substring; - } - } - - } else if (FieldTypeEnum.STANDARD.getValue().equals(fieldShowType)) { - //标准选择 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; - } - countError++; - } - } - } - } - - mapResult.put(field, value); - } - } - if (countError > 0) { - if(errorMsg.endsWith(", ")){ - String substring = errorMsg.substring(0, errorMsg.length() - 2); - msgList.add(substring); - }else{ - msgList.add(errorMsg); - } - } - mapList.add(mapResult); - } - if (msgList.size() > 0) { - //返回报错信息 - String html = ""; - for (String s : msgList) { - html += s + "
"; - } - FileUnZip.deleteDir(saveDirectory); - throw new JeroBootException(html); - } else { - // 66880 导入去除编号校验。 - //验证重复的标准号 - if (mapList.size() != 0) { - for (Map map : mapList) { - this.addInfo(map); - } - } - } - } +// @SneakyThrows +// @Override +// public void importZip(MultipartFile file,String cut) { +// List list = getWorkbookTitle(cut); +// int pos = file.getOriginalFilename().lastIndexOf("."); +// String str = file.getOriginalFilename().substring(pos + 1).toLowerCase(); +// String filenameorg = file.getOriginalFilename().substring(0, pos); +// //判断上传文件必须是zip +// if (!str.equals("zip") && !str.equals("rar")) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("请上传zip格式的文件或rar格式的文件"); +// }else{ +// throw new JeroBootException("Please upload a zip file or rar file"); +// } +// } +// String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); +// File saveDirectory = new File(path); +// if (!saveDirectory.isDirectory()) { +// saveDirectory.mkdir(); +// } +// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename())); +// //解压缩 +// String zipEntryName = ""; +// if (str.equals("zip")) { +// zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path); +// } else { +//// zipEntryName = FileRarUtils.rarUnCompress(path + File.separator + file.getOriginalFilename(), path); +// } +// +// +// //判断压缩包下是否只有一个文件夹 +// File fileTemp = new File(path); +// int length = fileTemp.listFiles().length; +// if (length > 2) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传"); +// }else{ +// throw new JeroBootException("There must be only one folder in the compressed package Please upload it again"); +// } +// +// } +// File fileNew = new File(zipEntryName); +// List fileList = new ArrayList<>(); +// for (File file1 : fileNew.listFiles()) { +// if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) { +// fileList.add(file1); +// } +// } +// if (fileList.size() == 0) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传"); +// }else{ +// throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again"); +// } +// +// } else if (fileList.size() > 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传"); +// }else{ +// throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again"); +// } +// +// } +// +// // 数据相关处理, +// // 1.获取其中的Excel, +// List excelfilelist = FileUnZip.readImpExcelFile(zipEntryName); +// System.gc(); +// if (excelfilelist.size() < 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("压缩包内没有上传Excel数据"); +// }else{ +// throw new JeroBootException("No Excel data is uploaded in the compressed package"); +// } +// +// } else if (excelfilelist.size() > 1) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("压缩包内有多个Excel数据源"); +// }else{ +// throw new JeroBootException("There are multiple Excel data sources in the zip package"); +// } +// +// } +// File excelfile = excelfilelist.get(0); +// +// +// Workbook workbook = WorkbookFactory.create(excelfile); +// List> dataList = new ArrayList<>(); +// if (workbook != null) { +// DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); +// Sheet sheet = workbook.getSheetAt(0); +// if (sheet != null) { +// StringBuilder headerSb = new StringBuilder(); +// int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数 +// for (int i = 0; i <= rowNos; i++) {// 遍历行 +// if (i == 1) { +// continue; +// } +// Row row = sheet.getRow(i); +// Row headerRow = sheet.getRow(0); +// boolean isBlank = isRowEmpty(row); +// if (row != null && !isBlank) { +// int columNos = headerRow.getLastCellNum();// 表头总共的列数 +// Map rowList = new LinkedHashMap<>(); +// for (int j = 0; j < columNos; j++) { +// Cell cell = row.getCell(j); +// Cell headerCell = headerRow.getCell(j); +// if (cell != null) { +// if (i == 0) { +// headerSb.append(cell.getStringCellValue() + ","); +// } else { +// if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) { +// Date d = cell.getDateCellValue(); +// rowList.put(headerCell.getStringCellValue(), df.format(d)); +// } else { +// String stringCellValue = cell.getStringCellValue(); +// if (StringUtils.isNotBlank(stringCellValue)) { +// String replace = stringCellValue.replace(",", ","); +// rowList.put(headerCell.getStringCellValue(), replace); +// } else { +// rowList.put(headerCell.getStringCellValue(), ""); +// } +// } +// } +// } else { +// if (i != 0) { +// rowList.put(headerCell.getStringCellValue(), ""); +// } +// } +// } +// if (i != 0) { +// dataList.add(rowList); +// } +// } +// } +// if (dataList.size() == 0) { +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("请填写必填字段内容,带*的为必填"); +// }else{ +// throw new JeroBootException("Please fill in the required fields marked with *"); +// } +// +// } +// // 校验头部是否符合模板 +// String fields = list.get(0); +// +// //判断结尾为逗号,则减1个字符 +// String substring = headerSb.toString(); +// if (substring.endsWith(",") || substring.endsWith(",")){ +// substring = headerSb.substring(0, headerSb.length() - 1); +// } +// +// String excelHeader = substring; +// if (!fields.equals(excelHeader)) { +// workbook.close(); +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// throw new JeroBootException("读取失败,请严格按照模板文件导入数据"); +// }else{ +// throw new JeroBootException("The data fails to be read. Import data strictly according to the template file"); +// } +// +// } +// } +// } +// workbook.close(); +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //普通数据字典 +// List dictItemList = sysDictItemServiceImpl.selectItemsAll(); +// //表头 +// List> addForm = getField(ModuleEnum.DOCUMENT_LIBRARY.getValue(), cut, "add"); +// exportDatas(dataList, addForm, categoryList, dictItemList, zipEntryName,saveDirectory,cut); +// //删除原上传文件 +// FileUnZip.deleteDir(saveDirectory); +// +// } +// +// private void exportDatas(List> dataList, +// List> fieldList, +// List categoryList, +// List dictItemList, +// String zipEntryName, +// File saveDirectory, +// String cut) { +// //树形数据字典 +// List treeNameList = new ArrayList<>(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// treeNameList = categoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); +// }else{ +// treeNameList = categoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); +// } +// //普通数据字典 +// List itemNameList = new ArrayList<>(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// itemNameList = dictItemList.stream().map(SysDictItem::getItemText).collect(Collectors.toList()); +// }else{ +// itemNameList = dictItemList.stream().map(SysDictItem::getEnName).collect(Collectors.toList()); +// } +// +// int i = 2; +// List msgList = new ArrayList<>(); +// List> mapList = new ArrayList<>(); +// for (Map stringStringMap : dataList) { +// Map mapResult = new HashMap<>(); +// i++; +// int countError = 0; //记录失败数据数量 +// String errorMsg = ""; +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg = "第" + i + "行:"; +// } else { +// errorMsg = i + " line:"; +// } +// +// for (Map.Entry entry : stringStringMap.entrySet()) { +// +// String key = entry.getKey(); +// if (key.contains("*")) { +// key = key.replace("*", ""); +// } +// String value = entry.getValue(); +// String field = ""; +// // 如果是分阶段实施字段,单独处理,如果是其它字段,按照原有逻辑处理 +// if(StringUtils.equals(key,"分阶段实施详情") || StringUtils.equals(key,"Details of the phased implementation")){ +// if(StringUtils.isNotEmpty(value)){ +// List phasedImplementationDetailsEOList = new ArrayList<>(); +// String[] phasedImplDetailsList = value.split("#"); +// for (String phasedImplDetails : phasedImplDetailsList) { +// PhasedImplementationDetailsEO phasedImplementationDetailsEO = new PhasedImplementationDetailsEO(); +// String[] phasedImplDetailsArr = phasedImplDetails.split(""); +// if(phasedImplDetailsArr.length < 3){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-必填项不能为空, "; +// }else{ +// errorMsg += "Phased Implementation Details - Required items cannot be empty,"; +// } +// countError++; +// break; +// } +// +// if(phasedImplDetailsArr.length >= 1){ +// String standNumberOrClause = phasedImplDetailsArr[0]; +// if(StringUtils.isEmpty(standNumberOrClause)){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-法规编号/条款不能为空, "; +// }else{ +// errorMsg += "Phased Implementation Details - Regulation No./clause cannot be empty,"; +// } +// countError++; +// } else if (StringUtils.isNotBlank(standNumberOrClause) && standNumberOrClause.length() > 200) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-法规编号/条款不能超过" + 200 + "个字符, "; +// }else{ +// errorMsg += "Phased Implementation Details - Regulation No./clause Can not be more than " + 200 + " char, "; +// } +// countError++; +// }else { +// phasedImplementationDetailsEO.setStandNumberOrClause(standNumberOrClause); +// } +// } +// if(phasedImplDetailsArr.length >= 2){ +// String implementationTypeName = phasedImplDetailsArr[1]; +// +// if(StringUtils.isNotEmpty(implementationTypeName)){ +// String[] implementationTypeNameArr = implementationTypeName.split(","); +// ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values(); +// List implementationTypeList = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { +// boolean flag = false; +// for (String type : implementationTypeNameArr) { +// if(StringUtils.equals(type,implementationTypeEnum.getNameCn()) || StringUtils.equals(type,implementationTypeEnum.getNameEn())){ +// flag = true; +// } +// } +// return flag; +// }).map(ImplementationTypeEnum::getItemValue).collect(Collectors.toList()); +// +// if(implementationTypeNameArr.length != implementationTypeList.size()){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-实施类型填写有误,填写值为'新车型 或 在产车', "; +// }else{ +// errorMsg += "Phased Implementation Details - implementationType The value is set to 'New car model or Car in production', "; +// } +// countError++; +// }else { +// phasedImplementationDetailsEO.setImplementationType(implementationTypeList.stream().collect(Collectors.joining(","))); +// } +// }else { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-实施类型不能为空, "; +// }else{ +// errorMsg += "Phased Implementation Details - Implementation Type cannot be empty,"; +// } +// countError++; +// } +// } +// if(phasedImplDetailsArr.length >= 3){ +// String implementationDateStr = phasedImplDetailsArr[2]; +// if(StringUtils.isEmpty(implementationDateStr)){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-实施日期不能为空, "; +// }else{ +// errorMsg += "Phased Implementation Details - Implementation Date cannot be empty,"; +// } +// countError++; +// }else { +// Date implementationDate = null; +// try { +// implementationDate = DateUtils.parseDate(phasedImplDetailsArr[2], "yyyy-MM-dd"); +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// if(implementationDate == null){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-实施日期格式错误,正确格式为'yyyy-MM-dd', "; +// }else{ +// errorMsg += "Phased Implementation Details - implementationDate format is incorrect. The correct format is 'yyyy-MM-dd', "; +// } +// countError++; +// }else { +// phasedImplementationDetailsEO.setImplementationDate(implementationDate); +// } +// } +// } +// if(phasedImplDetailsArr.length >= 4){ +// String remarks = phasedImplDetailsArr[3]; +// if (StringUtils.isNotBlank(remarks) && remarks.length() > 1000) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += "分阶段实施详情-备注不能超过" + 1000 + "个字符, "; +// }else{ +// errorMsg += "Phased Implementation Details - ramarks Can not be more than " + 1000 + " char, "; +// } +// countError++; +// }else { +// phasedImplementationDetailsEO.setRemarks(remarks); +// } +// } +// phasedImplementationDetailsEOList.add(phasedImplementationDetailsEO); +// } +// +// mapResult.put("phasedImplementationDetailsEOList",phasedImplementationDetailsEOList); +// } +// }else { +// for (Map map : fieldList) { +// String fieldNameCn = (String) map.get("db_field_txt");//中文名称 +// String fieldName = (String) map.get("db_field_name");//字段名 +// if(StringUtils.equals(fieldName,"phasedImplDetails")){ +// continue; +// } +// String mustInput = (String) map.get("field_must_input");//是否必填 +// String dbLength = map.get("db_length").toString();//字段长度 +// String fieldShowType = (String) map.get("field_show_type");//字段类型 +// +// if (key.equals(fieldNameCn)) { +// field = fieldName; +// //验证字段是否必填,长度,下拉框和树形的值是否匹配 +// if (FieldTypeEnum.TREE.getValue().equals(fieldShowType)) { +// //树形 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than " + dbLength + " char, "; +// } +// countError++; +// } +// //判断数据是否匹配 +// if (StringUtils.isNotBlank(value)) { +// for (String valueTemp : value.split(",")) { +// if (!treeNameList.contains(valueTemp)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; +// }else{ +// errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; +// } +// countError++; +// } +// } +// } +// String valueId = ""; +// //文字转ID +// if (StringUtils.isNotBlank(value)) { +// for (String valueTemp : value.split(",")) { +// if (treeNameList.contains(valueTemp)) { +// List collect = new ArrayList<>(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// collect = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); +// }else{ +// collect = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); +// } +// valueId += collect.get(0).getId()+","; +// } +// } +// if(StringUtils.isNotBlank(valueId)){ +// value = valueId.substring(0, valueId.length() - 1); +// } +// } +// +// } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldShowType)) { +// //输入框 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than" + dbLength + "char, "; +// } +// countError++; +// } +// +// } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldShowType)) { +// //正则判断仅能为 负号(-),小数点(.)和数字 +// +// +// } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldShowType)) { +// //下拉单选 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than" + dbLength + " char, "; +// } +// countError++; +// } +// //判断是否是单选 +// if (StringUtils.isNotBlank(value) && value.contains(",")) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为单选项, "; +// }else{ +// errorMsg += key + " Is multiple choice, "; +// } +// +// countError++; +// } +// //判断数据是否匹配 +// if (StringUtils.isNotBlank(value)) { +// if (!itemNameList.contains(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "中的" + value + "与数据字典不匹配, "; +// }else{ +// errorMsg += key + " " + value + " Does not match the data dictionary, "; +// } +// countError++; +// } +// } +// //文字转数据字典编码 +// if (itemNameList.contains(value)) { +// String finalValue = value; +// List collect = new ArrayList<>(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(finalValue)).collect(Collectors.toList()); +// }else{ +// collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(finalValue)).collect(Collectors.toList()); +// } +// if (collect.size() != 0) { +// value = collect.get(0).getItemValue(); +// } +// } +// } else if (FieldTypeEnum.PULL_MORE.getValue().equals(fieldShowType)) { +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than" + dbLength + " char, "; +// } +// countError++; +// } +// //下拉多选 +// if (StringUtils.isNotBlank(value)) { +// for (String valueTemp : value.split(",")) { +// if (!itemNameList.contains(valueTemp)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; +// }else{ +// errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; +// } +// countError++; +// } +// } +// } +// +// String valueId = ""; +// //文字转数据字典id +// if (StringUtils.isNotBlank(value)) { +// for (String valueTemp : value.split(",")) { +// if (itemNameList.contains(valueTemp)) { +// List collect = new ArrayList<>(); +// if(LanguageEnum.CN.getValue().equals(cut)){ +// collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(valueTemp)).collect(Collectors.toList()); +// }else{ +// collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(valueTemp)).collect(Collectors.toList()); +// } +// +// valueId += collect.get(0).getItemValue() + ","; +// } +// } +// if (StringUtils.isNotBlank(valueId)) { +// value = valueId.substring(0, valueId.length() - 1); +// } +// } +// +// +// } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { +// value = value.replaceAll("/","-"); +// //单选日期 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //a判断是否是单日期选择 +// if (StringUtils.isNotBlank(value) && value.contains(",")) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为单日期选项, "; +// }else{ +// errorMsg += key + " Is single date option, "; +// } +// countError++; +// } +// //判断格式是否正确 +// if (!DateUtils.isValidDate((String) value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; +// }else{ +// errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; +// } +// countError++; +// } +// +// } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { +// //多选日期 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断格式是否正确 +// if (!DateUtils.isValidDate((String) value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; +// }else{ +// errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; +// } +// countError++; +// } +// +// +// } else if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { +// //文件 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than " + dbLength + " char, "; +// } +// countError++; +// } +// if (StringUtils.isNotBlank(value)) { +// StringBuilder sb = new StringBuilder(); +// for (String fileName : value.split(",")) { +// List nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key); +// if (nowFileList.size() == 0) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + " 压缩包中没有" + fileName + "文件, "; +// }else{ +// errorMsg += key + " Not in the zip package" + fileName + "file, "; +// } +// countError++; +// } else { +// try { +// FileInputStream input = new FileInputStream(nowFileList.get(0)); +// MultipartFile multipartFile = +// new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); +// //文件存入文件表 +// OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null,null); +// if (ObjectUtils.isNotEmpty(ossFile)) { +// sb.append(ossFile.getId() + ","); +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// } +// if (StringUtils.isNotBlank(sb)) { +// String substring = sb.substring(0, sb.length() - 1); +// value = substring; +// } +// } +// +// } else if (FieldTypeEnum.STANDARD.getValue().equals(fieldShowType)) { +// //标准选择 +// //判断是否必填 +// if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "为必填项,不能为空, "; +// }else{ +// errorMsg += key + " This parameter is mandatory and cannot be empty, "; +// } +// countError++; +// } +// //判断长度 +// if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { +// if(LanguageEnum.CN.getValue().equals(cut)){ +// errorMsg += key + "不能超过" + dbLength + "个字符, "; +// }else{ +// errorMsg += key + " Can not be more than " + dbLength + " char, "; +// } +// countError++; +// } +// } +// } +// } +// +// mapResult.put(field, value); +// } +// } +// if (countError > 0) { +// if(errorMsg.endsWith(", ")){ +// String substring = errorMsg.substring(0, errorMsg.length() - 2); +// msgList.add(substring); +// }else{ +// msgList.add(errorMsg); +// } +// } +// mapList.add(mapResult); +// } +// if (msgList.size() > 0) { +// //返回报错信息 +// String html = ""; +// for (String s : msgList) { +// html += s + "
"; +// } +// FileUnZip.deleteDir(saveDirectory); +// throw new JeroBootException(html); +// } else { +// // 66880 导入去除编号校验。 +// //验证重复的标准号 +// if (mapList.size() != 0) { +// for (Map map : mapList) { +// this.addInfo(map); +// } +// } +// } +// } //判断row是否为空 空返回true - public boolean isRowEmpty(Row row) { - if (null == row) { - return true; - } - int firstCellNum = row.getFirstCellNum(); //第一个列位置 - int lastCellNum = row.getLastCellNum(); //最后一列位置 - int nullCellNum = 0; //空列数量 - for (int c = firstCellNum; c < lastCellNum; c++) { - Cell cell = row.getCell(c); - if (null == cell) { - nullCellNum++; - continue; - } - String value = ""; - CellType cellType = cell.getCellType(); - if (cellType == CellType.NUMERIC) { // 数字 - //如果为时间格式的内容 - value = MyStringUtils.valueOf(cell.getNumericCellValue()); - } else if (cellType == CellType.STRING) { // 字符串 - value = cell.getStringCellValue(); - } else if (cellType == CellType.BOOLEAN) { // Boolean - value = cell.getBooleanCellValue() + ""; - } else if (cellType == CellType.FORMULA) { // 公式 - value = cell.getCellFormula() + ""; - } - if (StringUtils.isEmpty(value)) { - nullCellNum++; - } - } - //所有列都为空 - return nullCellNum == (lastCellNum - firstCellNum); - } +// public boolean isRowEmpty(Row row) { +// if (null == row) { +// return true; +// } +// int firstCellNum = row.getFirstCellNum(); //第一个列位置 +// int lastCellNum = row.getLastCellNum(); //最后一列位置 +// int nullCellNum = 0; //空列数量 +// for (int c = firstCellNum; c < lastCellNum; c++) { +// Cell cell = row.getCell(c); +// if (null == cell) { +// nullCellNum++; +// continue; +// } +// String value = ""; +// CellType cellType = cell.getCellType(); +// if (cellType == CellType.NUMERIC) { // 数字 +// //如果为时间格式的内容 +// value = MyStringUtils.valueOf(cell.getNumericCellValue()); +// } else if (cellType == CellType.STRING) { // 字符串 +// value = cell.getStringCellValue(); +// } else if (cellType == CellType.BOOLEAN) { // Boolean +// value = cell.getBooleanCellValue() + ""; +// } else if (cellType == CellType.FORMULA) { // 公式 +// value = cell.getCellFormula() + ""; +// } +// if (StringUtils.isEmpty(value)) { +// nullCellNum++; +// } +// } +// //所有列都为空 +// return nullCellNum == (lastCellNum - firstCellNum); +// } + // TODO 需修改,需从国内、海外、企标库里抓数据 @Override public List> getListBySerialNumber(String serialNumbers) { return bussDocumentLibraryEOMapper.getListBySerialNumber(serialNumbers); } + // TODO 需修改,需从国内、海外、企标库里抓数据 @Override public List getListBySerialNumberFuzzy(String serialNumber) { return bussDocumentLibraryEOMapper.getListBySerialNumberFuzzy(serialNumber); } - @Override - public List getFileInfos(String id) { - List fileInfos = iOSSFileService.getFileInfos(id); - List ossFileForDocumentLibraries = new ArrayList<>(); - // 拆分回传文档库,标准分解单专用 - for (OSSFile fileInfo : fileInfos) { - OSSFileForDocumentLibrary ossFileForDocumentLibrary = new OSSFileForDocumentLibrary(); - BeanUtils.copyProperties(fileInfo, ossFileForDocumentLibrary); +// @Override +// public List getFileInfos(String id) { +// List fileInfos = iOSSFileService.getFileInfos(id); +// List ossFileForDocumentLibraries = new ArrayList<>(); +// // 拆分回传文档库,标准分解单专用 +// for (OSSFile fileInfo : fileInfos) { +// OSSFileForDocumentLibrary ossFileForDocumentLibrary = new OSSFileForDocumentLibrary(); +// BeanUtils.copyProperties(fileInfo, ossFileForDocumentLibrary); +// +// List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfo.getId()); +// if (CollectionUtil.isNotEmpty(infoEOList)) { +// ossFileForDocumentLibrary.setSplitFlag(1); +// ossFileForDocumentLibrary.setSplitInfoId(infoEOList.get(0).getId()); +// } else { +// ossFileForDocumentLibrary.setSplitFlag(0); +// } +// ossFileForDocumentLibraries.add(ossFileForDocumentLibrary); +// } +// return ossFileForDocumentLibraries; +// } - List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfo.getId()); - if (CollectionUtil.isNotEmpty(infoEOList)) { - ossFileForDocumentLibrary.setSplitFlag(1); - ossFileForDocumentLibrary.setSplitInfoId(infoEOList.get(0).getId()); - } else { - ossFileForDocumentLibrary.setSplitFlag(0); - } - ossFileForDocumentLibraries.add(ossFileForDocumentLibrary); - } - return ossFileForDocumentLibraries; - } +// /** +// * 验证字符串是不是id +// * +// * @param s +// * @return +// */ +// public boolean isId(String s) { +// if (StringUtils.isBlank(s)) { +// return false; +// } +// if (s.length() == 32) { +// String sub1 = s.substring(0, 8); +// String sub2 = s.substring(8, 12); +// String sub3 = s.substring(12, 16); +// String sub4 = s.substring(16, 20); +// String sub5 = s.substring(20, 32); +// String id = sub1 + "-" + sub2 + "-" + sub3 + "-" + sub4 + "-" + sub5; +// try { +// UUID uuid = UUID.fromString(id); +// return true; +// } catch (Exception e) { +// log.error("document", e); +// return false; +// } +// } else { +// return false; +// } +// } +// +// @Override +// public String verifyBind(List ids) { +// //判断删除的数据是否被其他文档引用 +// StringBuilder condition = new StringBuilder(); +// for (String id : ids) { +// condition.append(" corresponding_standard like concat(concat('%','" + id + "'),'%') or replace_standard like concat(concat('%','" + id + "'),'%') or"); +// } +// String conditionStr = condition.substring(0, condition.length() - 2); +// List> listInfo = bussDocumentLibraryEOMapper.getListInfo(conditionStr); +// List serialNumbers = new ArrayList<>(); +// if (listInfo.size() != 0) { +// for (Map map : listInfo) { +// serialNumbers.add((String) map.get("serial_number")); +// } +// } +// if (serialNumbers.size() != 0) { +// return StringUtils.join(serialNumbers, ",") + "已被其他文档绑定,是否要删除"; +// } +// return null; +// } - /** - * 验证字符串是不是id - * - * @param s - * @return - */ - public boolean isId(String s) { - if (StringUtils.isBlank(s)) { - return false; - } - if (s.length() == 32) { - String sub1 = s.substring(0, 8); - String sub2 = s.substring(8, 12); - String sub3 = s.substring(12, 16); - String sub4 = s.substring(16, 20); - String sub5 = s.substring(20, 32); - String id = sub1 + "-" + sub2 + "-" + sub3 + "-" + sub4 + "-" + sub5; - try { - UUID uuid = UUID.fromString(id); - return true; - } catch (Exception e) { - log.error("document", e); - return false; - } - } else { - return false; - } - } +// @Override +// public List> queryListByIds(String ids) { +// return bussDocumentLibraryEOMapper.queryListByIds(ids); +// } - @Override - public String verifyBind(List ids) { - //判断删除的数据是否被其他文档引用 - StringBuilder condition = new StringBuilder(); - for (String id : ids) { - condition.append(" corresponding_standard like concat(concat('%','" + id + "'),'%') or replace_standard like concat(concat('%','" + id + "'),'%') or"); - } - String conditionStr = condition.substring(0, condition.length() - 2); - List> listInfo = bussDocumentLibraryEOMapper.getListInfo(conditionStr); - List serialNumbers = new ArrayList<>(); - if (listInfo.size() != 0) { - for (Map map : listInfo) { - serialNumbers.add((String) map.get("serial_number")); - } - } - if (serialNumbers.size() != 0) { - return StringUtils.join(serialNumbers, ",") + "已被其他文档绑定,是否要删除"; - } - return null; - } +// private void putMapCn(String id,String serialNumber,String moduleType, +// String content,String title,String fileText, +// String fileName,String cut,Map stringMap, +// String flag){ +// stringMap.put("id", id); +// stringMap.put("serial_number", serialNumber); +// stringMap.put("module_type", moduleType); +// stringMap.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); +// stringMap.put("content", content); +// stringMap.put("title", title); +// stringMap.put("file_text", fileText); +// stringMap.put("file_name", fileName); +// stringMap.put("cut",cut); +// stringMap.put("flag",flag); +// +// } - @Override - public List> queryListByIds(String ids) { - return bussDocumentLibraryEOMapper.queryListByIds(ids); - } - - private void putMapCn(String id,String serialNumber,String moduleType, - String content,String title,String fileText, - String fileName,String cut,Map stringMap, - String flag){ - stringMap.put("id", id); - stringMap.put("serial_number", serialNumber); - stringMap.put("module_type", moduleType); - stringMap.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); - stringMap.put("content", content); - stringMap.put("title", title); - stringMap.put("file_text", fileText); - stringMap.put("file_name", fileName); - stringMap.put("cut",cut); - stringMap.put("flag",flag); - - } - - /** - * - * @param fieldFileList 文件排序字段 - * @param oSSFileAll 所有文件 - * @param -->字段 value-->关联文件connect_id - */ - public List fileSort(List fieldFileList,List oSSFileAll,Map map){ - List Results = new LinkedList<>(); - List fileFeildList = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - for (OnlCgformField onlCgformField : fieldFileList) { - String dbFieldName = onlCgformField.getDbFieldName(); - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - if(!"create_time".equals(key) - && !"update_time".equals(key) - && !"issue_time".equals(key) - && !"implement_time".equals(key) - && !"xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(key)){ - String value = (String) entry.getValue(); - if (dbFieldName.equals(key)) { - List files = oSSFileAll.stream().filter(e -> StringUtils.isNotBlank(value) && value.equals(e.getConnectId())).collect(Collectors.toList()); - if (files.size() != 0) { - Results.addAll(files); - } - } - } - } - } - return Results; - } +// /** +// * +// * @param fieldFileList 文件排序字段 +// * @param oSSFileAll 所有文件 +// * @param -->字段 value-->关联文件connect_id +// */ +// public List fileSort(List fieldFileList,List oSSFileAll,Map map){ +// List Results = new LinkedList<>(); +// List fileFeildList = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// for (OnlCgformField onlCgformField : fieldFileList) { +// String dbFieldName = onlCgformField.getDbFieldName(); +// for (Map.Entry entry : map.entrySet()) { +// String key = entry.getKey(); +// if(!"create_time".equals(key) +// && !"update_time".equals(key) +// && !"issue_time".equals(key) +// && !"implement_time".equals(key) +// && !"xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(key)){ +// String value = (String) entry.getValue(); +// if (dbFieldName.equals(key)) { +// List files = oSSFileAll.stream().filter(e -> StringUtils.isNotBlank(value) && value.equals(e.getConnectId())).collect(Collectors.toList()); +// if (files.size() != 0) { +// Results.addAll(files); +// } +// } +// } +// } +// } +// return Results; +// } - @Override - public IPage queryPageInfoDummy(Page page, - QueryWrapper queryWrapper, - BussDocumentLibraryEO bussDocumentLibraryEO) { - queryWrapper.orderByDesc("create_time"); - IPage pageList = this.page(page, queryWrapper); - List bussDocumentLibraryEOS = this.list(); - //树形数据字典 - List categoryList = sysCategoryService.list(); - for (BussDocumentLibraryEO record : pageList.getRecords()) { - //处理对应标准 - if(StringUtils.isNotBlank(record.getCorrespondingStandard())){ - StringBuilder sb = new StringBuilder(); - for (String correspondingStandardId : record.getCorrespondingStandard().split(",")) { - List collect = bussDocumentLibraryEOS.stream() - .filter(e -> e.getId().equals(correspondingStandardId)).collect(Collectors.toList()); - if(collect.size() != 0){ - sb.append(collect.get(0).getCorrespondingStandard()+","); - }else{ - sb.append(correspondingStandardId+","); - } - } - if(StringUtils.isNotBlank(sb)){ - String substring = sb.substring(0, sb.length() - 1); - record.setCorrespondingStandard(substring); - } - } - //处理技术领域 technology_territory - if(StringUtils.isNotBlank(record.getTechnologyTerritory())){ - StringBuilder sb = new StringBuilder(); - for (String technologyTerritoryId : record.getTechnologyTerritory().split(",")) { - List collect = categoryList.stream().filter(e -> e.getId().equals(technologyTerritoryId)).collect(Collectors.toList()); - if(collect.size() != 0){ - if(LanguageEnum.CN.getValue().equals(bussDocumentLibraryEO.getCut())){ - sb.append(collect.get(0).getName()+","); - }else{ - sb.append(collect.get(0).getEnName()+","); - } - }else{ - sb.append(technologyTerritoryId+","); - } - } - if(StringUtils.isNotBlank(sb)){ - String substring = sb.substring(0, sb.length() - 1); - record.setTechnologyTerritory(substring); - } - } - } - return pageList; - } +// @Override +// public IPage queryPageInfoDummy(Page page, +// QueryWrapper queryWrapper, +// BussDocumentLibraryEO bussDocumentLibraryEO) { +// queryWrapper.orderByDesc("create_time"); +// IPage pageList = this.page(page, queryWrapper); +// List bussDocumentLibraryEOS = this.list(); +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// for (BussDocumentLibraryEO record : pageList.getRecords()) { +// //处理对应标准 +// if(StringUtils.isNotBlank(record.getCorrespondingStandard())){ +// StringBuilder sb = new StringBuilder(); +// for (String correspondingStandardId : record.getCorrespondingStandard().split(",")) { +// List collect = bussDocumentLibraryEOS.stream() +// .filter(e -> e.getId().equals(correspondingStandardId)).collect(Collectors.toList()); +// if(collect.size() != 0){ +// sb.append(collect.get(0).getCorrespondingStandard()+","); +// }else{ +// sb.append(correspondingStandardId+","); +// } +// } +// if(StringUtils.isNotBlank(sb)){ +// String substring = sb.substring(0, sb.length() - 1); +// record.setCorrespondingStandard(substring); +// } +// } +// //处理技术领域 technology_territory +// if(StringUtils.isNotBlank(record.getTechnologyTerritory())){ +// StringBuilder sb = new StringBuilder(); +// for (String technologyTerritoryId : record.getTechnologyTerritory().split(",")) { +// List collect = categoryList.stream().filter(e -> e.getId().equals(technologyTerritoryId)).collect(Collectors.toList()); +// if(collect.size() != 0){ +// if(LanguageEnum.CN.getValue().equals(bussDocumentLibraryEO.getCut())){ +// sb.append(collect.get(0).getName()+","); +// }else{ +// sb.append(collect.get(0).getEnName()+","); +// } +// }else{ +// sb.append(technologyTerritoryId+","); +// } +// } +// if(StringUtils.isNotBlank(sb)){ +// String substring = sb.substring(0, sb.length() - 1); +// record.setTechnologyTerritory(substring); +// } +// } +// } +// return pageList; +// } - @Override - public IPage getPageDummy(Map parameter) { - String cut = (String) parameter.get("cut");//中英文切换标识 - //文档库字段 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - //需要查询的字段 - List fieldListQuery = new ArrayList<>(); - fieldListQuery.add("serial_number"); - fieldListQuery.add("title"); - fieldListQuery.add("title_en"); - fieldListQuery.add("state"); - fieldListQuery.add("region"); - fieldListQuery.add("technology_territory"); - fieldListQuery.add("xin1_che1_xing2_shi2_shi1_ri4_qi1"); - fieldListQuery.add("implement_time"); - fieldListQuery.add("corresponding_standard"); +// @Override +// public IPage getPageDummy(Map parameter) { +// String cut = (String) parameter.get("cut");//中英文切换标识 +// //文档库字段 +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); +// //需要查询的字段 +// List fieldListQuery = new ArrayList<>(); +// fieldListQuery.add("serial_number"); +// fieldListQuery.add("title"); +// fieldListQuery.add("title_en"); +// fieldListQuery.add("state"); +// fieldListQuery.add("region"); +// fieldListQuery.add("technology_territory"); +// fieldListQuery.add("xin1_che1_xing2_shi2_shi1_ri4_qi1"); +// fieldListQuery.add("implement_time"); +// fieldListQuery.add("corresponding_standard"); +// +// List fieldListNew = new ArrayList<>(); +// fieldListNew.add("id"); +// +// //转时间格式 +// for (String field : fieldListQuery) { +// String fieldTemp = null; +// if ("xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(field) || "implement_time".equals(field)) { +// String fieldNew = "date_format(" + field + ", '%Y-%m-%d')"; +// fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field; +// fieldListNew.add(fieldTemp); +// } else { +// fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field; +// fieldListNew.add(fieldTemp); +// } +// } +// //封装查询条件 +// String condition = getConditionStr(parameter); +// int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); +// int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); +// IPage page = new Page(pageNo, pageSize); +// +// IPage infoPage = bussDocumentLibraryEOMapper.getInfoPage(page, " " + StringUtils.join(fieldListNew, ","), condition); +// +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// +// List records = infoPage.getRecords(); +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// //下拉选处理数据字典 +// for (Map record : records) { +// Map record1 = (Map) record; +// String technology_territory = (String)record1.get("technology_territory"); +// for (Map.Entry entry : record1.entrySet()) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, fieldList,null); +// treeDictItem(categoryList, entry, treeFieldList, cut,null); +// } +// record1.put("technology_territory_id",technology_territory); +// +// if(StringUtils.equals(cut, LanguageEnum.EN.getValue())){ +// if(record.containsKey("title") && record.containsKey("title_en")){ +// record.put("title",record.get("title_en")); +// } +// } +// } +// return infoPage; +// } - List fieldListNew = new ArrayList<>(); - fieldListNew.add("id"); - - //转时间格式 - for (String field : fieldListQuery) { - String fieldTemp = null; - if ("xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(field) || "implement_time".equals(field)) { - String fieldNew = "date_format(" + field + ", '%Y-%m-%d')"; - fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field; - fieldListNew.add(fieldTemp); - } else { - fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field; - fieldListNew.add(fieldTemp); - } - } - //封装查询条件 - String condition = getConditionStr(parameter); - int pageNo = Integer.parseInt(parameter.get("pageNo").toString()); - int pageSize = Integer.parseInt(parameter.get("pageSize").toString()); - IPage page = new Page(pageNo, pageSize); - - IPage infoPage = bussDocumentLibraryEOMapper.getInfoPage(page, " " + StringUtils.join(fieldListNew, ","), condition); - - //树形数据字典 - List categoryList = sysCategoryService.list(); - //过滤出树形字段 - List treeFieldList = fieldList.stream() - .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) - .collect(Collectors.toList()); - - - List records = infoPage.getRecords(); - //数据字典 - List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); - //下拉选处理数据字典 - for (Map record : records) { - Map record1 = (Map) record; - String technology_territory = (String)record1.get("technology_territory"); - for (Map.Entry entry : record1.entrySet()) { - //下拉选处理数据字典 - dictItem(sysDictItems, entry, cut, fieldList,null); - treeDictItem(categoryList, entry, treeFieldList, cut,null); - } - record1.put("technology_territory_id",technology_territory); - - if(StringUtils.equals(cut, LanguageEnum.EN.getValue())){ - if(record.containsKey("title") && record.containsKey("title_en")){ - record.put("title",record.get("title_en")); - } - } - } - return infoPage; - } - - @Override - public void isModifyForOcrAndSplit(Map parameter) { - String id = (String) parameter.get("id"); - String serialNumber = (String) parameter.get("serial_number"); - String title = (String) parameter.get("title"); - String titleEn = (String) parameter.get("title_en"); - //通过id查询数据 - List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); - if (CollectionUtil.isNotEmpty(dataList)) { - String oldSerialNumber = (String) dataList.get(0).get("serial_number"); - String oldTitle = (String) dataList.get(0).get("title"); - String oldTitleEn = (String) dataList.get(0).get("title_en"); - - if (!oldSerialNumber.equals(serialNumber) || !oldTitle.equals(title) || !oldTitleEn.equals(titleEn)) { - ocrRecordEOService.batchUpdateByDocumentSerialNumber(oldSerialNumber, serialNumber, title, titleEn); - sarFileSplitInfoService.batchUpdateByDocumentSerialNumber(oldSerialNumber, serialNumber, title, titleEn); - } - } - } +// @Override +// public void isModifyForOcrAndSplit(Map parameter) { +// String id = (String) parameter.get("id"); +// String serialNumber = (String) parameter.get("serial_number"); +// String title = (String) parameter.get("title"); +// String titleEn = (String) parameter.get("title_en"); +// //通过id查询数据 +// List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); +// if (CollectionUtil.isNotEmpty(dataList)) { +// String oldSerialNumber = (String) dataList.get(0).get("serial_number"); +// String oldTitle = (String) dataList.get(0).get("title"); +// String oldTitleEn = (String) dataList.get(0).get("title_en"); +// +// if (!oldSerialNumber.equals(serialNumber) || !oldTitle.equals(title) || !oldTitleEn.equals(titleEn)) { +// ocrRecordEOService.batchUpdateByDocumentSerialNumber(oldSerialNumber, serialNumber, title, titleEn); +// sarFileSplitInfoService.batchUpdateByDocumentSerialNumber(oldSerialNumber, serialNumber, title, titleEn); +// } +// } +// } //高级搜索条件拼接 - @Override - public String sqlJoint(List queryConditionVOList){ - StringBuilder sb = new StringBuilder(); - if(queryConditionVOList.size() != 0){ - int count =0; - for (QueryConditionVO queryConditionVO : queryConditionVOList) { - String type = queryConditionVO.getType();//and或or - String rule = queryConditionVO.getRule(); - String ruleLike = ""; - if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule) || QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ - ruleLike = QueryRuleEnum.LIKE.getCondition(); - } - String field = queryConditionVO.getField(); - String val = queryConditionVO.getVal(); - //如果查询字段对应的搜索条件值为空,则不作处理 - if(StringUtils.isNotBlank(val)) { - count++;//从第二个查询条件开始拼接type(and或or) - if (count > 1) { - sb.append(" " + type + " "); - } - sb.append(" " + field + " "); - //查询类型 - String ruleTemp = queryType(rule); - if (StringUtils.isNotBlank(ruleLike)) { - sb.append(ruleLike + " "); - } else { - sb.append(ruleTemp + " "); - } - //like和in需要特殊处理 - if (QueryRuleEnum.IN.getCondition().equals(rule)) { - if (val.contains(",")) { - StringBuilder sbTemp = new StringBuilder(); - for (String valTemp : val.split(",")) { - sbTemp.append("'" + valTemp + "' ,"); - } - if (StringUtils.isNotBlank(sbTemp)) { - String substring = sbTemp.substring(0, sbTemp.length() - 1); - sb.append("(" + substring + ")"); - } - } - sb.append("('" + val + "')"); - } else if (QueryRuleEnum.LIKE.getCondition().equals(rule)) { - sb.append("'%" + val + "%'"); - } else if (QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)) { - sb.append("'%" + val + "'"); - } else if (QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)) { - sb.append("'" + val + "%'"); - } else { - sb.append("'" + val + "'"); - } - } - } - } - return sb.toString(); - } +// @Override +// public String sqlJoint(List queryConditionVOList){ +// StringBuilder sb = new StringBuilder(); +// if(queryConditionVOList.size() != 0){ +// int count =0; +// for (QueryConditionVO queryConditionVO : queryConditionVOList) { +// String type = queryConditionVO.getType();//and或or +// String rule = queryConditionVO.getRule(); +// String ruleLike = ""; +// if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule) || QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ +// ruleLike = QueryRuleEnum.LIKE.getCondition(); +// } +// String field = queryConditionVO.getField(); +// String val = queryConditionVO.getVal(); +// //如果查询字段对应的搜索条件值为空,则不作处理 +// if(StringUtils.isNotBlank(val)) { +// count++;//从第二个查询条件开始拼接type(and或or) +// if (count > 1) { +// sb.append(" " + type + " "); +// } +// sb.append(" " + field + " "); +// //查询类型 +// String ruleTemp = queryType(rule); +// if (StringUtils.isNotBlank(ruleLike)) { +// sb.append(ruleLike + " "); +// } else { +// sb.append(ruleTemp + " "); +// } +// //like和in需要特殊处理 +// if (QueryRuleEnum.IN.getCondition().equals(rule)) { +// if (val.contains(",")) { +// StringBuilder sbTemp = new StringBuilder(); +// for (String valTemp : val.split(",")) { +// sbTemp.append("'" + valTemp + "' ,"); +// } +// if (StringUtils.isNotBlank(sbTemp)) { +// String substring = sbTemp.substring(0, sbTemp.length() - 1); +// sb.append("(" + substring + ")"); +// } +// } +// sb.append("('" + val + "')"); +// } else if (QueryRuleEnum.LIKE.getCondition().equals(rule)) { +// sb.append("'%" + val + "%'"); +// } else if (QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)) { +// sb.append("'%" + val + "'"); +// } else if (QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)) { +// sb.append("'" + val + "%'"); +// } else { +// sb.append("'" + val + "'"); +// } +// } +// } +// } +// return sb.toString(); +// } +// +// +// public String queryType(String rule){ +// String value =""; +// if(QueryRuleEnum.GT.getCondition().equals(rule)){ +// value = QueryRuleEnum.GT.getValue(); +// }else if(QueryRuleEnum.GE.getCondition().equals(rule)){ +// value = QueryRuleEnum.GE.getValue(); +// }else if(QueryRuleEnum.LT.getCondition().equals(rule)){ +// value = QueryRuleEnum.LT.getValue(); +// }else if(QueryRuleEnum.LE.getCondition().equals(rule)){ +// value = QueryRuleEnum.LE.getValue(); +// }else if(QueryRuleEnum.EQ.getCondition().equals(rule)){ +// value = QueryRuleEnum.EQ.getValue(); +// }else if(QueryRuleEnum.NE.getCondition().equals(rule)){ +// value = QueryRuleEnum.NE.getValue(); +// }else if(QueryRuleEnum.LIKE.getCondition().equals(rule)){ +// value = QueryRuleEnum.LIKE.getValue(); +// }else if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)){ +// value = QueryRuleEnum.LEFT_LIKE.getValue(); +// }else if(QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ +// value = QueryRuleEnum.RIGHT_LIKE.getValue(); +// }else if(QueryRuleEnum.IN.getCondition().equals(rule)){ +// value = QueryRuleEnum.IN.getValue(); +// } +// return value; +// } + +// @Override +// public String getTitle(String id,String cut) { +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(BussDocumentLibraryEO::getId,id); +// List> mapList = this.listMaps(wrapper); +// String title = ""; +// if(mapList.size() != 0){ +// if(LanguageEnum.CN.getValue().equals(cut)){ +// title = mapList.get(0).get("serial_number") + "《"+ mapList.get(0).get("title") + "》"; +// }else{ +// title = mapList.get(0).get("serial_number") + "《"+ mapList.get(0).get("title_en") + "》"; +// } +// } +// return title; +// } +// +// @Override +// public int updateES() { +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); +// int count = 0; +// for (Map map : mapList) { +// map.put("es_update_flag","es_update_flag"); +// updateInfo(map); +// count ++; +// } +// return count; +// } - public String queryType(String rule){ - String value =""; - if(QueryRuleEnum.GT.getCondition().equals(rule)){ - value = QueryRuleEnum.GT.getValue(); - }else if(QueryRuleEnum.GE.getCondition().equals(rule)){ - value = QueryRuleEnum.GE.getValue(); - }else if(QueryRuleEnum.LT.getCondition().equals(rule)){ - value = QueryRuleEnum.LT.getValue(); - }else if(QueryRuleEnum.LE.getCondition().equals(rule)){ - value = QueryRuleEnum.LE.getValue(); - }else if(QueryRuleEnum.EQ.getCondition().equals(rule)){ - value = QueryRuleEnum.EQ.getValue(); - }else if(QueryRuleEnum.NE.getCondition().equals(rule)){ - value = QueryRuleEnum.NE.getValue(); - }else if(QueryRuleEnum.LIKE.getCondition().equals(rule)){ - value = QueryRuleEnum.LIKE.getValue(); - }else if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)){ - value = QueryRuleEnum.LEFT_LIKE.getValue(); - }else if(QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ - value = QueryRuleEnum.RIGHT_LIKE.getValue(); - }else if(QueryRuleEnum.IN.getCondition().equals(rule)){ - value = QueryRuleEnum.IN.getValue(); - } - return value; - } - - @Override - public String getTitle(String id,String cut) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(BussDocumentLibraryEO::getId,id); - List> mapList = this.listMaps(wrapper); - String title = ""; - if(mapList.size() != 0){ - if(LanguageEnum.CN.getValue().equals(cut)){ - title = mapList.get(0).get("serial_number") + "《"+ mapList.get(0).get("title") + "》"; - }else{ - title = mapList.get(0).get("serial_number") + "《"+ mapList.get(0).get("title_en") + "》"; - } - } - return title; - } - - @Override - public int updateES() { - List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); - int count = 0; - for (Map map : mapList) { - map.put("es_update_flag","es_update_flag"); - updateInfo(map); - count ++; - } - return count; - } - - - /** - * 批量添加-分阶段实施明细信息 - * @param map - * @return - */ - public List insertBatchPhasedImplementationDetailsInfo(Map map){ - String id = (String) map.get("id"); - - // 删除之前的分阶段实施明细信息 - QueryWrapper deleteWrap = new QueryWrapper<>(); - deleteWrap.lambda().eq(PhasedImplementationDetailsEO::getBussDocumentLibraryId,id); - this.phasedImplementationDetailsEOService.getBaseMapper().delete(deleteWrap); - - List phasedImplDetailsEOList = new ArrayList<>(); - if(map.containsKey("phasedImplementationDetailsEOList")){ - PhasedImplementationDetailsEO phasedImplDetailsEO = null; - JSONArray phasedImplDetailsEOJsonArr = JSONObject.parseArray(JSONObject.toJSONString(map.get("phasedImplementationDetailsEOList"))); - Integer orderNum = 1; - for (Object phasedImplDetailsEOJson : phasedImplDetailsEOJsonArr) { - phasedImplDetailsEO = JSONObject.parseObject(JSONObject.toJSONString(phasedImplDetailsEOJson),PhasedImplementationDetailsEO.class); - phasedImplDetailsEO.setBussDocumentLibraryId(id); - phasedImplDetailsEO.setOrderNum(orderNum); - phasedImplDetailsEOList.add(phasedImplDetailsEO); - orderNum ++; - } - - // 批量插入最新的分阶段实施明细信息 - boolean insertPhasedBatchFlag = this.phasedImplementationDetailsEOService.insertBatch(phasedImplDetailsEOList); - if(!insertPhasedBatchFlag){ - throw new JeroBootException("添加分阶段实施详情信息失败!"); - } - - // 处理插入ES数据的正文 新车型、在产车实施日期信息。 - // 处理新车型实施日期 - List newCarModelDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { - boolean flag = StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue()); - return flag; - }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); - - Date newCarModelDate = null; - try { - if (StringUtils.isNotEmpty((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))) { - newCarModelDate = DateUtils.parseDate((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"), "yyyy-MM-dd"); - } - } catch (ParseException e) { - e.printStackTrace(); - } - if(newCarModelDate != null){ - newCarModelDateList.add(newCarModelDate); - } - - String newCarModelDateStr = DateUtils.formatDateList(newCarModelDateList); - map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",newCarModelDateStr); - - // 处理在产车实施日期 - List carInProductionDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { - boolean flag = StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue()); - return flag; - }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); - - Date carInProductionDateDate = null; - try { - if (StringUtils.isNotEmpty((String) map.get("implement_time"))) { - carInProductionDateDate = DateUtils.parseDate((String) map.get("implement_time"), "yyyy-MM-dd"); - } - } catch (ParseException e) { - e.printStackTrace(); - } - if(carInProductionDateDate != null){ - carInProductionDateList.add(carInProductionDateDate); - } - - String carInProductionDateStr = DateUtils.formatDateList(carInProductionDateList); - map.put("implement_time",carInProductionDateStr); - } - - return phasedImplDetailsEOList; - } - @Override - public BussDocumentLibraryEO getBySerialNumber(String serialNumber) { - return bussDocumentLibraryEOMapper.getBySerialNumber(serialNumber); - } +// /** +// * 批量添加-分阶段实施明细信息 +// * @param map +// * @return +// */ +// public List insertBatchPhasedImplementationDetailsInfo(Map map){ +// String id = (String) map.get("id"); +// +// // 删除之前的分阶段实施明细信息 +// QueryWrapper deleteWrap = new QueryWrapper<>(); +// deleteWrap.lambda().eq(PhasedImplementationDetailsEO::getBussDocumentLibraryId,id); +// this.phasedImplementationDetailsEOService.getBaseMapper().delete(deleteWrap); +// +// List phasedImplDetailsEOList = new ArrayList<>(); +// if(map.containsKey("phasedImplementationDetailsEOList")){ +// PhasedImplementationDetailsEO phasedImplDetailsEO = null; +// JSONArray phasedImplDetailsEOJsonArr = JSONObject.parseArray(JSONObject.toJSONString(map.get("phasedImplementationDetailsEOList"))); +// Integer orderNum = 1; +// for (Object phasedImplDetailsEOJson : phasedImplDetailsEOJsonArr) { +// phasedImplDetailsEO = JSONObject.parseObject(JSONObject.toJSONString(phasedImplDetailsEOJson),PhasedImplementationDetailsEO.class); +// phasedImplDetailsEO.setBussDocumentLibraryId(id); +// phasedImplDetailsEO.setOrderNum(orderNum); +// phasedImplDetailsEOList.add(phasedImplDetailsEO); +// orderNum ++; +// } +// +// // 批量插入最新的分阶段实施明细信息 +// boolean insertPhasedBatchFlag = this.phasedImplementationDetailsEOService.insertBatch(phasedImplDetailsEOList); +// if(!insertPhasedBatchFlag){ +// throw new JeroBootException("添加分阶段实施详情信息失败!"); +// } +// +// // 处理插入ES数据的正文 新车型、在产车实施日期信息。 +// // 处理新车型实施日期 +// List newCarModelDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { +// boolean flag = StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue()); +// return flag; +// }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); +// +// Date newCarModelDate = null; +// try { +// if (StringUtils.isNotEmpty((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))) { +// newCarModelDate = DateUtils.parseDate((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"), "yyyy-MM-dd"); +// } +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// if(newCarModelDate != null){ +// newCarModelDateList.add(newCarModelDate); +// } +// +// String newCarModelDateStr = DateUtils.formatDateList(newCarModelDateList); +// map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",newCarModelDateStr); +// +// // 处理在产车实施日期 +// List carInProductionDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { +// boolean flag = StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue()); +// return flag; +// }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); +// +// Date carInProductionDateDate = null; +// try { +// if (StringUtils.isNotEmpty((String) map.get("implement_time"))) { +// carInProductionDateDate = DateUtils.parseDate((String) map.get("implement_time"), "yyyy-MM-dd"); +// } +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// if(carInProductionDateDate != null){ +// carInProductionDateList.add(carInProductionDateDate); +// } +// +// String carInProductionDateStr = DateUtils.formatDateList(carInProductionDateList); +// map.put("implement_time",carInProductionDateStr); +// } +// +// return phasedImplDetailsEOList; +// } +// @Override +// public BussDocumentLibraryEO getBySerialNumber(String serialNumber) { +// return bussDocumentLibraryEOMapper.getBySerialNumber(serialNumber); +// } } diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/impl/PhasedImplementationDetailsEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/document/service/impl/PhasedImplementationDetailsEOServiceImpl.java index b2ba58a1..5b859d4c 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/impl/PhasedImplementationDetailsEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/impl/PhasedImplementationDetailsEOServiceImpl.java @@ -1,148 +1,148 @@ -package com.jero.modules.document.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.common.constant.enums.LanguageEnum; -import com.jero.modules.document.entity.PhasedImplementationDetailsEO; -import com.jero.modules.document.enums.ImplementationTypeEnum; -import com.jero.modules.document.mapper.PhasedImplementationDetailsEOMapper; -import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Description: 文档库-分阶段实施详情表 - * @Author: jero-boot - * @Date: 2023-02-22 - * @Version: V1.0 - */ -@Service -public class PhasedImplementationDetailsEOServiceImpl extends ServiceImpl implements IPhasedImplementationDetailsEOService { - - /** - * 保存 - * - * @param phasedImplementationDetailsEO - * @return - */ - @Override - public void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - Date now = new Date(); - phasedImplementationDetailsEO.setCreateTime(now); - phasedImplementationDetailsEO.setUpdateTime(now); - save(phasedImplementationDetailsEO); - } - - /** - * 更新 - * - * @param phasedImplementationDetailsEO - * @return - */ - @Override - public void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO) { - Date now = new Date(); - phasedImplementationDetailsEO.setUpdateTime(now); - saveOrUpdate(phasedImplementationDetailsEO); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @Override - public void deleteById(String id) { - removeById(id); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @Override - public void deleteByIds(List ids) { - removeByIds(ids); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @Override - public PhasedImplementationDetailsEO queryById(String id) { - return getById(id); - } - - /** - * 列表查询 - * - * @return - */ - @Override - public List queryList() { - return list(); - } - - @Override - public boolean insertBatch(List phasedImplDetailsEOList) { - boolean flag = true; - if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){ - try { - this.saveBatch(phasedImplDetailsEOList); - }catch (Exception ex){ - flag = false; - ex.printStackTrace(); - log.error("批量添加分阶段实施详情信息失败:" + ex.getMessage()); - } - } - return flag; - } - - @Override - public void disposeData(List datas, String cut) { - if(CollectionUtils.isNotEmpty(datas)){ - for (PhasedImplementationDetailsEO data : datas) { - String implementationType = data.getImplementationType(); - if(StringUtils.isNotEmpty(implementationType)){ - String[] implementationTypeArr = implementationType.split(","); - ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values(); - - String implementationTypeText = ""; - if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ - implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { - boolean flag = false; - for (String type : implementationTypeArr) { - if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) { - flag = true; - } - } - return flag; - }).map(ImplementationTypeEnum::getNameCn).collect(Collectors.joining(",")); - }else { - implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { - boolean flag = false; - for (String type : implementationTypeArr) { - if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) { - flag = true; - } - } - return flag; - }).map(ImplementationTypeEnum::getNameEn).collect(Collectors.joining(",")); - } - data.setImplementationTypeText(implementationTypeText); - } - } - } - } -} +//package com.jero.modules.document.service.impl; +// +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import com.jero.common.constant.enums.LanguageEnum; +//import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +//import com.jero.modules.document.enums.ImplementationTypeEnum; +//import com.jero.modules.document.mapper.PhasedImplementationDetailsEOMapper; +//import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; +//import org.apache.commons.collections4.CollectionUtils; +//import org.apache.commons.lang3.StringUtils; +//import org.springframework.stereotype.Service; +// +//import java.util.Arrays; +//import java.util.Date; +//import java.util.List; +//import java.util.stream.Collectors; +// +///** +// * @Description: 文档库-分阶段实施详情表 +// * @Author: jero-boot +// * @Date: 2023-02-22 +// * @Version: V1.0 +// */ +//@Service +//public class PhasedImplementationDetailsEOServiceImpl extends ServiceImpl implements IPhasedImplementationDetailsEOService { +// +// /** +// * 保存 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @Override +// public void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// Date now = new Date(); +// phasedImplementationDetailsEO.setCreateTime(now); +// phasedImplementationDetailsEO.setUpdateTime(now); +// save(phasedImplementationDetailsEO); +// } +// +// /** +// * 更新 +// * +// * @param phasedImplementationDetailsEO +// * @return +// */ +// @Override +// public void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO) { +// Date now = new Date(); +// phasedImplementationDetailsEO.setUpdateTime(now); +// saveOrUpdate(phasedImplementationDetailsEO); +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @Override +// public void deleteById(String id) { +// removeById(id); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @Override +// public void deleteByIds(List ids) { +// removeByIds(ids); +// } +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @Override +// public PhasedImplementationDetailsEO queryById(String id) { +// return getById(id); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @Override +// public List queryList() { +// return list(); +// } +// +// @Override +// public boolean insertBatch(List phasedImplDetailsEOList) { +// boolean flag = true; +// if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){ +// try { +// this.saveBatch(phasedImplDetailsEOList); +// }catch (Exception ex){ +// flag = false; +// ex.printStackTrace(); +// log.error("批量添加分阶段实施详情信息失败:" + ex.getMessage()); +// } +// } +// return flag; +// } +// +// @Override +// public void disposeData(List datas, String cut) { +// if(CollectionUtils.isNotEmpty(datas)){ +// for (PhasedImplementationDetailsEO data : datas) { +// String implementationType = data.getImplementationType(); +// if(StringUtils.isNotEmpty(implementationType)){ +// String[] implementationTypeArr = implementationType.split(","); +// ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values(); +// +// String implementationTypeText = ""; +// if(StringUtils.equals(cut, LanguageEnum.CN.getValue())){ +// implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { +// boolean flag = false; +// for (String type : implementationTypeArr) { +// if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) { +// flag = true; +// } +// } +// return flag; +// }).map(ImplementationTypeEnum::getNameCn).collect(Collectors.joining(",")); +// }else { +// implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { +// boolean flag = false; +// for (String type : implementationTypeArr) { +// if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) { +// flag = true; +// } +// } +// return flag; +// }).map(ImplementationTypeEnum::getNameEn).collect(Collectors.joining(",")); +// } +// data.setImplementationTypeText(implementationTypeText); +// } +// } +// } +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/impl/TimedTaskLaws.java b/laws-modules/src/main/java/com/jero/modules/document/service/impl/TimedTaskLaws.java index 06a5e1b2..2b9ae13e 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/impl/TimedTaskLaws.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/impl/TimedTaskLaws.java @@ -1,63 +1,63 @@ -package com.jero.modules.document.service.impl; - -import com.jero.modules.document.entity.BussDocumentLibraryEO; -import com.jero.modules.document.enums.LawsStateEnum; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.springframework.beans.factory.annotation.Autowired; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -/** - * @description - * @date 2022/9/25 10:03 - * @auth zhn - */ -public class TimedTaskLaws implements Job { - @Autowired - private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService; - - /** - * 法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行 - * @param jobExecutionContext - * @throws JobExecutionException - */ - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String currentTime = sdf.format(new Date()); - //获取所有的法规 - List bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(); - if(bussDocumentLibraryEOList.size() != 0){ - for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) { - String xin1Che1Xing2Shi2Shi1Ri4Qi1Str = ""; - String implementTimestr = ""; - - String state = bussDocumentLibraryEO.getState();//状态 - //新车型实施日期 - Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1(); - //在产车实施日期 - Date implementTime = bussDocumentLibraryEO.getImplementTime(); - if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){ - xin1Che1Xing2Shi2Shi1Ri4Qi1Str = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1); - } - if(ObjectUtils.isNotEmpty(implementTime)){ - implementTimestr = sdf.format(implementTime); - } - //法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行 - if(StringUtils.isNotBlank(state) && LawsStateEnum.THE_UPCOMING.getValue().equals(state) - && (currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str) || currentTime.equals(implementTimestr))){ - BussDocumentLibraryEO bussDocumentLibraryEOTemp = new BussDocumentLibraryEO(); - bussDocumentLibraryEOTemp.setId(bussDocumentLibraryEO.getId()); - bussDocumentLibraryEOTemp.setState(LawsStateEnum.ACTIVE.getValue()); - bussDocumentLibraryEOService.updateById(bussDocumentLibraryEOTemp); - } - } - } - } -} +//package com.jero.modules.document.service.impl; +// +//import com.jero.modules.document.entity.BussDocumentLibraryEO; +//import com.jero.modules.document.enums.LawsStateEnum; +//import org.apache.commons.lang3.ObjectUtils; +//import org.apache.commons.lang3.StringUtils; +//import org.quartz.Job; +//import org.quartz.JobExecutionContext; +//import org.quartz.JobExecutionException; +//import org.springframework.beans.factory.annotation.Autowired; +// +//import java.text.SimpleDateFormat; +//import java.util.Date; +//import java.util.List; +// +///** +// * @description TODO 更新法规实施状态,需要更新国标/海外标准,目前仅处理了文档库是不对的 +// * @date 2022/9/25 10:03 +// * @auth zhn +// */ +//public class TimedTaskLaws implements Job { +// @Autowired +// private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService; +// +// /** +// * 法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行 +// * @param jobExecutionContext +// * @throws JobExecutionException +// */ +// @Override +// public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// String currentTime = sdf.format(new Date()); +// //获取所有的法规 +// List bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(); +// if(bussDocumentLibraryEOList.size() != 0){ +// for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) { +// String xin1Che1Xing2Shi2Shi1Ri4Qi1Str = ""; +// String implementTimestr = ""; +// +// String state = bussDocumentLibraryEO.getState();//状态 +// //新车型实施日期 +// Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1(); +// //在产车实施日期 +// Date implementTime = bussDocumentLibraryEO.getImplementTime(); +// if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){ +// xin1Che1Xing2Shi2Shi1Ri4Qi1Str = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1); +// } +// if(ObjectUtils.isNotEmpty(implementTime)){ +// implementTimestr = sdf.format(implementTime); +// } +// //法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行 +// if(StringUtils.isNotBlank(state) && LawsStateEnum.THE_UPCOMING.getValue().equals(state) +// && (currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str) || currentTime.equals(implementTimestr))){ +// BussDocumentLibraryEO bussDocumentLibraryEOTemp = new BussDocumentLibraryEO(); +// bussDocumentLibraryEOTemp.setId(bussDocumentLibraryEO.getId()); +// bussDocumentLibraryEOTemp.setState(LawsStateEnum.ACTIVE.getValue()); +// bussDocumentLibraryEOService.updateById(bussDocumentLibraryEOTemp); +// } +// } +// } +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/controller/ExtRepoDataController.java b/laws-modules/src/main/java/com/jero/modules/extRepo/controller/ExtRepoDataController.java index 20b88cba..63ab2d45 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/controller/ExtRepoDataController.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/controller/ExtRepoDataController.java @@ -33,14 +33,14 @@ import java.util.List; /** - * @Description: 对外报告数据表 + * @Description: 资料中心数据表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 */ -@Api(tags = "对外报告数据表") +@Api(tags = "资料中心数据表") @RestController -@RequestMapping("/com.jero.modules.extRepo/extRepoData") +@RequestMapping("/extRepo/extRepoData") @Slf4j public class ExtRepoDataController extends JeroController { @Autowired @@ -61,8 +61,8 @@ public class ExtRepoDataController extends JeroController queryPageList(ExtRepoData extRepoData, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @@ -106,8 +106,8 @@ public class ExtRepoDataController extends JeroController> queryList() { List list = extRepoDataService.queryList(); @@ -120,8 +120,8 @@ public class ExtRepoDataController extends JeroController add(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) { Result result = new Result(); @@ -129,7 +129,7 @@ public class ExtRepoDataController extends JeroController edit(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) { Result result = new Result(); @@ -187,8 +187,8 @@ public class ExtRepoDataController extends JeroController delete(@RequestParam("id") String id, @RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) { @@ -231,8 +231,8 @@ public class ExtRepoDataController extends JeroController deleteBatch(@RequestParam("ids") String ids, @RequestParam(name = "cut", defaultValue = "cn") String cut) { @@ -270,8 +270,8 @@ public class ExtRepoDataController extends JeroController queryById(@RequestParam(name = "id", required = true) String id) { Result result = new Result(); @@ -291,7 +291,7 @@ public class ExtRepoDataController extends JeroController queryList() { ERFTreeDataVO dataVO = new ERFTreeDataVO(); @@ -61,8 +61,8 @@ public class ExtRepoFolderController extends JeroController add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) { Result result = new Result(); @@ -140,8 +140,8 @@ public class ExtRepoFolderController extends JeroController edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) { Result result = new Result(); @@ -170,8 +170,8 @@ public class ExtRepoFolderController extends JeroController delete(@RequestParam(name = "id", required = true) String id, @RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) { @@ -231,8 +231,8 @@ public class ExtRepoFolderController extends JeroController queryById(@RequestParam(name = "id", required = true) String id, @RequestParam(name = "cut", defaultValue = "cn") String cut) { diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ERFTreeData.java b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ERFTreeData.java index 04a4af70..fccf3549 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ERFTreeData.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ERFTreeData.java @@ -7,7 +7,7 @@ import java.util.Collections; import java.util.List; /** - * 对外报告文件夹 树结构实体类 + * 资料中心文件夹 树结构实体类 */ public class ERFTreeData implements Comparable { diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoData.java b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoData.java index c15f0bcb..fdfac30f 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoData.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoData.java @@ -17,7 +17,7 @@ import java.io.Serializable; /** - * @Description: 对外报告数据表 + * @Description: 资料中心数据表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 @@ -26,7 +26,7 @@ import java.io.Serializable; @TableName("ext_repo_data") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) -@ApiModel(value="ext_repo_data对象", description="对外报告数据表") +@ApiModel(value="ext_repo_data对象", description="资料中心数据表") public class ExtRepoData implements Serializable { private static final long serialVersionUID = 1L; diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoFolder.java b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoFolder.java index a99d600d..85343f91 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoFolder.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/entity/ExtRepoFolder.java @@ -17,7 +17,7 @@ import java.io.Serializable; /** - * @Description: 对外报告文件夹表 + * @Description: 资料中心文件夹表 * @Author: jero-boot * @Date: 2022-07-27 * @Version: V1.0 @@ -26,7 +26,7 @@ import java.io.Serializable; @TableName("ext_repo_folder") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) -@ApiModel(value="ext_repo_folder对象", description="对外报告文件夹表") +@ApiModel(value="ext_repo_folder对象", description="资料中心文件夹表") public class ExtRepoFolder implements Serializable { private static final long serialVersionUID = 1L; diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java b/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java index 1033458c..323de148 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java @@ -5,7 +5,7 @@ import java.util.List; public enum ExtRepoMamagerRoleIdEnum { MANAGER_ID("系统管理员", "Administrator", "admin", "f6817f48af4fb3af11b9e8bf182f618b", 1), - ERMANAGER_ID("对外报告管理员", "ExternalReportsManager", "ExternalReportsManager", "1552536424587862017", 2); + ERMANAGER_ID("资料中心管理员", "ExternalReportsManager", "ExternalReportsManager", "1552536424587862017", 2); String name; String enName; diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoDataMapper.java b/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoDataMapper.java index d422b82f..35caab12 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoDataMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoDataMapper.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.jero.modules.extRepo.entity.ExtRepoData; /** - * @Description: 对外报告数据表 + * @Description: 资料中心数据表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoFolderMapper.java b/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoFolderMapper.java index 0db47bb5..3ebc068d 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoFolderMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/mapper/ExtRepoFolderMapper.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.jero.modules.extRepo.entity.ExtRepoFolder; /** - * @Description: 对外报告文件夹表 + * @Description: 资料中心文件夹表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoDataService.java b/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoDataService.java index b53f6252..ceebc338 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoDataService.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoDataService.java @@ -6,7 +6,7 @@ import com.jero.modules.extRepo.entity.ExtRepoData; import java.util.List; /** - * @Description: 对外报告数据表 + * @Description: 资料中心数据表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoFolderService.java b/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoFolderService.java index 4a52b095..b4423683 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoFolderService.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/service/IExtRepoFolderService.java @@ -8,7 +8,7 @@ import javax.servlet.http.HttpSession; import java.util.List; /** - * @Description: 对外报告文件夹表 + * @Description: 资料中心文件夹表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoDataServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoDataServiceImpl.java index 0cb6ed9e..5e7e8364 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoDataServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoDataServiceImpl.java @@ -16,7 +16,7 @@ import java.util.Date; import java.util.List; /** - * @Description: 对外报告数据表 + * @Description: 资料中心数据表 * @Author: jero-boot * @Date: 2022-07-25 * @Version: V1.0 diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoFolderServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoFolderServiceImpl.java index 09d160f8..7acb5646 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoFolderServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/service/impl/ExtRepoFolderServiceImpl.java @@ -24,7 +24,7 @@ import java.util.*; import java.util.stream.Collectors; /** - * 对外报告文件夹表 + * 资料中心文件夹表 */ @Service public class ExtRepoFolderServiceImpl extends ServiceImpl implements IExtRepoFolderService { @@ -53,7 +53,7 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl userRoles = sysUserRoleService.list(new QueryWrapper().lambda().eq(SysUserRole::getUserId, loginUser.getId())); // 查询用户所有角色 - List userRoleIds; // 用户管理员/对外报告管理员 + List userRoleIds; // 用户管理员/资料中心管理员 if (CollectionUtil.isNotEmpty(userRoles)) { List roleIdList = ExtRepoMamagerRoleIdEnum.getIdList(); List userRoleIdList = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()); diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java index 56e7e048..002ffc2c 100644 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java +++ b/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java @@ -1,72 +1,72 @@ -package com.jero.modules.lanswitch.controller; - -import com.jero.common.api.vo.Result; -import com.jero.common.aspect.annotation.AutoLog; -import com.jero.modules.lanswitch.service.ILanguageSwitchService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.Map; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 12:07 2022/3/22 - */ -@RestController -@RequestMapping("/language/switch") -@Api(tags="中英文切换通用接口") -@Slf4j -public class LanguageSwitchController { - @Autowired - private ILanguageSwitchService languageSwitchService; - - /** - * 表头中英文切换 - * - * @return - */ - @AutoLog(value = "表头中英文切换") - @ApiOperation(value="表头中英文切换", notes="表头中英文切换") - @GetMapping(value = "/getHeader") - public Result>> getHeader(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.getHeader(flag, cut); - return Result.OK(list); - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @AutoLog(value = "查询条件中英文切换") - @ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换") - @GetMapping(value = "/queryCondition") - public Result>> queryCondition(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.queryCondition(flag, cut); - return Result.OK(list); - } - /** - * 表单中英文切换 - * - * @return - */ - @AutoLog(value = "表单中英文切换") - @ApiOperation(value="表单中英文切换", notes="表单中英文切换") - @GetMapping(value = "/getForm") - public Result>> getForm(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.getForm(flag, cut); - return Result.OK(list); - } - -} +//package com.jero.modules.lanswitch.controller; +// +//import com.jero.common.api.vo.Result; +//import com.jero.common.aspect.annotation.AutoLog; +//import com.jero.modules.lanswitch.service.ILanguageSwitchService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.RestController; +// +//import java.util.List; +//import java.util.Map; +// +///** +// * @Author: liyawei +// * @Description: +// * @Date: Created in 12:07 2022/3/22 +// */ +//@RestController +//@RequestMapping("/language/switch") +//@Api(tags="中英文切换通用接口") +//@Slf4j +//public class LanguageSwitchController { +// @Autowired +// private ILanguageSwitchService languageSwitchService; +// +// /** +// * 表头中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "表头中英文切换") +// @ApiOperation(value="表头中英文切换", notes="表头中英文切换") +// @GetMapping(value = "/getHeader") +// public Result>> getHeader(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = languageSwitchService.getHeader(flag, cut); +// return Result.OK(list); +// } +// +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "查询条件中英文切换") +// @ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换") +// @GetMapping(value = "/queryCondition") +// public Result>> queryCondition(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = languageSwitchService.queryCondition(flag, cut); +// return Result.OK(list); +// } +// /** +// * 表单中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "表单中英文切换") +// @ApiOperation(value="表单中英文切换", notes="表单中英文切换") +// @GetMapping(value = "/getForm") +// public Result>> getForm(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = languageSwitchService.getForm(flag, cut); +// return Result.OK(list); +// } +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java index 95d711ec..6d1b5765 100644 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java +++ b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java @@ -1,36 +1,36 @@ -package com.jero.modules.lanswitch.service; - -import java.util.List; -import java.util.Map; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 12:08 2022/3/22 - */ -public interface ILanguageSwitchService { - - /** - * 列表表头中英文切换 - * @param flag - * @param cut - * @return - */ - List> getHeader(String flag, String cut); - - /** - * 查询条件中英文切换 - * @param flag - * @param cut - * @return - */ - List> queryCondition(String flag, String cut); - - /** - * 表单中英文切换 - * @param flag - * @param cut - * @return - */ - List> getForm(String flag, String cut); -} +//package com.jero.modules.lanswitch.service; +// +//import java.util.List; +//import java.util.Map; +// +///** +// * @Author: liyawei +// * @Description: +// * @Date: Created in 12:08 2022/3/22 +// */ +//public interface ILanguageSwitchService { +// +// /** +// * 列表表头中英文切换 +// * @param flag +// * @param cut +// * @return +// */ +// List> getHeader(String flag, String cut); +// +// /** +// * 查询条件中英文切换 +// * @param flag +// * @param cut +// * @return +// */ +// List> queryCondition(String flag, String cut); +// +// /** +// * 表单中英文切换 +// * @param flag +// * @param cut +// * @return +// */ +// List> getForm(String flag, String cut); +//} diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java index 0ae4414c..d2a26338 100644 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java @@ -1,169 +1,169 @@ -package com.jero.modules.lanswitch.service.impl; - -import com.jero.common.constant.enums.LanguageEnum; -import com.jero.common.constant.enums.ModuleEnum; -import com.jero.common.constant.enums.YesOrNoEnum; -import com.jero.generater.modules.online.cgform.entity.OnlCgformField; -import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; -import com.jero.modules.document.enums.FieldTypeEnum; -import com.jero.modules.lanswitch.service.ILanguageSwitchService; -import com.jero.modules.ocr.util.LineHumpUtil; -import com.jero.modules.system.entity.SysCategoryTreeVO; -import com.jero.modules.system.service.impl.SysCategoryServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 12:08 2022/3/22 - */ -@Service -public class LanguageSwitchServiceImpl implements ILanguageSwitchService { - @Autowired - private OnlCgformFieldServiceImpl onlCgformFieldService; - - @Autowired - private SysCategoryServiceImpl sysCategoryService; - - /** - * 列表表头中英文切换 - * - * @return - */ - @Override - public List> getHeader(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是) - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - if(FieldTypeEnum.TEXT_LINK.getValue().equals(onlCgformField.getFieldShowType())){ - map.put("urlClick","true"); - } - if("file_name".equals(onlCgformField.getDbFieldName())){ - //跳转详情的标识 - map.put("click","true"); - } - //日期添加排序标识 - if ("create_time".equals(onlCgformField.getDbFieldName())) { - map.put("sort", "true");//列表排序标识 - } - if ("update_time".equals(onlCgformField.getDbFieldName())) { - map.put("sort", "true");//列表排序标识 - } - - String dbFieldName = onlCgformField.getDbFieldName(); - if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { - map.put("db_field_name", dbFieldName); - } else { - map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName)); - } - - if(LanguageEnum.CN.getValue().equals(cut)){ - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - }else{ - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @Override - public List> queryCondition(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤出搜索条件() - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList()); - } - //树形数据字典 - List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 - - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - - if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { - List sysCategoryTreeVOList = sysCategoryTree.stream() - .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) - .collect(Collectors.toList()); - map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 - } else { - map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 - } - - map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) - map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 - if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { - map.put("db_field_name", onlCgformField.getDbFieldName());//字段 - } else { - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - } - - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - @Override - public List> getForm(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤出搜索条件() - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); - } - //树形数据字典 - List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 - - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { - List sysCategoryTreeVOList = sysCategoryTree.stream() - .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) - .collect(Collectors.toList()); - map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 - } else { - map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 - } - - map.put("area", null);//展示区域。没用到 - map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) - map.put("field_must_input", onlCgformField.getFieldMustInput());//是否必填 - map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 - if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { - map.put("db_field_name", onlCgformField.getDbFieldName());//字段 - } else { - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - } - map.put("db_length", onlCgformField.getDbLength());//字段长度 - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } -} +//package com.jero.modules.lanswitch.service.impl; +// +//import com.jero.common.constant.enums.LanguageEnum; +//import com.jero.common.constant.enums.ModuleEnum; +//import com.jero.common.constant.enums.YesOrNoEnum; +//import com.jero.generater.modules.online.cgform.entity.OnlCgformField; +//import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; +//import com.jero.modules.document.enums.FieldTypeEnum; +//import com.jero.modules.lanswitch.service.ILanguageSwitchService; +//import com.jero.modules.ocr.util.LineHumpUtil; +//import com.jero.modules.system.entity.SysCategoryTreeVO; +//import com.jero.modules.system.service.impl.SysCategoryServiceImpl; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +// +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +//import java.util.stream.Collectors; +// +///** +// * @Author: liyawei +// * @Description: +// * @Date: Created in 12:08 2022/3/22 +// */ +//@Service +//public class LanguageSwitchServiceImpl implements ILanguageSwitchService { +// @Autowired +// private OnlCgformFieldServiceImpl onlCgformFieldService; +// +// @Autowired +// private SysCategoryServiceImpl sysCategoryService; +// +// /** +// * 列表表头中英文切换 +// * +// * @return +// */ +// @Override +// public List> getHeader(String flag, String cut) { +// List fieldList = onlCgformFieldService.getFieldList(flag); +// if (fieldList.size() != 0) { +// //过滤列表字段(is_show_list-->列表是否显示0否 1是) +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList()); +// } +// List> list = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// Map map = new HashMap<>(); +// if(FieldTypeEnum.TEXT_LINK.getValue().equals(onlCgformField.getFieldShowType())){ +// map.put("urlClick","true"); +// } +// if("file_name".equals(onlCgformField.getDbFieldName())){ +// //跳转详情的标识 +// map.put("click","true"); +// } +// //日期添加排序标识 +// if ("create_time".equals(onlCgformField.getDbFieldName())) { +// map.put("sort", "true");//列表排序标识 +// } +// if ("update_time".equals(onlCgformField.getDbFieldName())) { +// map.put("sort", "true");//列表排序标识 +// } +// +// String dbFieldName = onlCgformField.getDbFieldName(); +// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { +// map.put("db_field_name", dbFieldName); +// } else { +// map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName)); +// } +// +// if(LanguageEnum.CN.getValue().equals(cut)){ +// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 +// }else{ +// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 +// } +// list.add(map); +// } +// return list; +// } +// +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @Override +// public List> queryCondition(String flag, String cut) { +// List fieldList = onlCgformFieldService.getFieldList(flag); +// if (fieldList.size() != 0) { +// //过滤出搜索条件() +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList()); +// } +// //树形数据字典 +// List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 +// +// List> list = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// Map map = new HashMap<>(); +// +// if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { +// List sysCategoryTreeVOList = sysCategoryTree.stream() +// .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) +// .collect(Collectors.toList()); +// map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 +// } else { +// map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 +// } +// +// map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) +// map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 +// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { +// map.put("db_field_name", onlCgformField.getDbFieldName());//字段 +// } else { +// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 +// } +// +// if (LanguageEnum.CN.getValue().equals(cut)) { +// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 +// } else { +// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 +// } +// list.add(map); +// } +// return list; +// } +// +// @Override +// public List> getForm(String flag, String cut) { +// List fieldList = onlCgformFieldService.getFieldList(flag); +// if (fieldList.size() != 0) { +// //过滤出搜索条件() +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); +// } +// //树形数据字典 +// List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 +// +// List> list = new ArrayList<>(); +// for (OnlCgformField onlCgformField : fieldList) { +// Map map = new HashMap<>(); +// if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { +// List sysCategoryTreeVOList = sysCategoryTree.stream() +// .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) +// .collect(Collectors.toList()); +// map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 +// } else { +// map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 +// } +// +// map.put("area", null);//展示区域。没用到 +// map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) +// map.put("field_must_input", onlCgformField.getFieldMustInput());//是否必填 +// map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 +// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { +// map.put("db_field_name", onlCgformField.getDbFieldName());//字段 +// } else { +// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 +// } +// map.put("db_length", onlCgformField.getDbLength());//字段长度 +// if (LanguageEnum.CN.getValue().equals(cut)) { +// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 +// } else { +// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 +// } +// list.add(map); +// } +// return list; +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/log/entity/MarketListVersionUpdateLogEO.java b/laws-modules/src/main/java/com/jero/modules/log/entity/MarketListVersionUpdateLogEO.java index de128d1c..a650c4d4 100644 --- a/laws-modules/src/main/java/com/jero/modules/log/entity/MarketListVersionUpdateLogEO.java +++ b/laws-modules/src/main/java/com/jero/modules/log/entity/MarketListVersionUpdateLogEO.java @@ -1,81 +1,81 @@ -package com.jero.modules.log.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.util.Date; - -/** - * @Description: 市场清单版本更新log表 - * @Author: jero-boot - * @Date: 2023-04-24 - * @Version: V1.0 - */ -@Data -@TableName("market_list_version_update_log") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="market_list_version_update_log对象", description="市场清单版本更新log表") -public class MarketListVersionUpdateLogEO implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**创建人*/ - @ApiModelProperty(value = "创建人") - private String createBy; - - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建日期") - private Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**版本号*/ - @Excel(name = "版本号", width = 15) - @ApiModelProperty(value = "版本号") - private String versionNum; - - /**升版说明*/ - @Excel(name = "升版说明", width = 15) - @ApiModelProperty(value = "升版说明") - private String upgradeExplanation; - - /**清单类型*/ - @Excel(name = "清单类型", width = 15) - @ApiModelProperty(value = "清单类型") - private String listType; - - /**清单id*/ - @Excel(name = "清单id", width = 15) - @ApiModelProperty(value = "清单id") - private String listId; - -} +//package com.jero.modules.log.entity; +// +//import com.baomidou.mybatisplus.annotation.IdType; +//import com.baomidou.mybatisplus.annotation.TableId; +//import com.baomidou.mybatisplus.annotation.TableName; +//import com.fasterxml.jackson.annotation.JsonFormat; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +//import lombok.experimental.Accessors; +//import org.jeecgframework.poi.excel.annotation.Excel; +//import org.springframework.format.annotation.DateTimeFormat; +// +//import java.io.Serializable; +//import java.util.Date; +// +///** +// * @Description: 市场清单版本更新log表 +// * @Author: jero-boot +// * @Date: 2023-04-24 +// * @Version: V1.0 +// */ +//@Data +//@TableName("market_list_version_update_log") +//@Accessors(chain = true) +//@EqualsAndHashCode(callSuper = false) +//@ApiModel(value="market_list_version_update_log对象", description="市场清单版本更新log表") +//public class MarketListVersionUpdateLogEO implements Serializable { +// private static final long serialVersionUID = 1L; +// +// /**主键*/ +// @TableId(type = IdType.ASSIGN_ID) +// @ApiModelProperty(value = "主键") +// private String id; +// +// /**创建人*/ +// @ApiModelProperty(value = "创建人") +// private String createBy; +// +// /**创建日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "创建日期") +// private Date createTime; +// +// /**更新人*/ +// @ApiModelProperty(value = "更新人") +// private String updateBy; +// +// /**更新日期*/ +// @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") +// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") +// @ApiModelProperty(value = "更新日期") +// private Date updateTime; +// +// /**所属部门*/ +// @ApiModelProperty(value = "所属部门") +// private String sysOrgCode; +// +// /**版本号*/ +// @Excel(name = "版本号", width = 15) +// @ApiModelProperty(value = "版本号") +// private String versionNum; +// +// /**升版说明*/ +// @Excel(name = "升版说明", width = 15) +// @ApiModelProperty(value = "升版说明") +// private String upgradeExplanation; +// +// /**清单类型*/ +// @Excel(name = "清单类型", width = 15) +// @ApiModelProperty(value = "清单类型") +// private String listType; +// +// /**清单id*/ +// @Excel(name = "清单id", width = 15) +// @ApiModelProperty(value = "清单id") +// private String listId; +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/log/enums/ListTypeEnum.java b/laws-modules/src/main/java/com/jero/modules/log/enums/ListTypeEnum.java index bcfd884a..6ef1eb95 100644 --- a/laws-modules/src/main/java/com/jero/modules/log/enums/ListTypeEnum.java +++ b/laws-modules/src/main/java/com/jero/modules/log/enums/ListTypeEnum.java @@ -1,33 +1,33 @@ -package com.jero.modules.log.enums; - -/** - * 清单类型枚举类 - */ -public enum ListTypeEnum { - MARKET_REGULATION_LIST("市场法规清单","Market Regulation List"), - MARKET_CERTIFICATION_LIST("市场认证清单","Market Certification List"); - - String name; - String value; - - private ListTypeEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} +//package com.jero.modules.log.enums; +// +///** +// * 清单类型枚举类 +// */ +//public enum ListTypeEnum { +// MARKET_REGULATION_LIST("市场法规清单","Market Regulation List"), +// MARKET_CERTIFICATION_LIST("市场认证清单","Market Certification List"); +// +// String name; +// String value; +// +// private ListTypeEnum(String name, String value) { +// this.name = name; +// this.value = value; +// } +// +// public String getName() { +// return name; +// } +// +// public void setName(String name) { +// this.name = name; +// } +// +// public String getValue() { +// return value; +// } +// +// public void setValue(String value) { +// this.value = value; +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/log/mapper/MarketListVersionUpdateLogEOMapper.java b/laws-modules/src/main/java/com/jero/modules/log/mapper/MarketListVersionUpdateLogEOMapper.java index 822e5e85..904708f0 100644 --- a/laws-modules/src/main/java/com/jero/modules/log/mapper/MarketListVersionUpdateLogEOMapper.java +++ b/laws-modules/src/main/java/com/jero/modules/log/mapper/MarketListVersionUpdateLogEOMapper.java @@ -1,14 +1,14 @@ -package com.jero.modules.log.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; - -/** - * @Description: 市场清单版本更新log表 - * @Author: jero-boot - * @Date: 2023-04-24 - * @Version: V1.0 - */ -public interface MarketListVersionUpdateLogEOMapper extends BaseMapper { - -} +//package com.jero.modules.log.mapper; +// +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; +// +///** +// * @Description: 市场清单版本更新log表 +// * @Author: jero-boot +// * @Date: 2023-04-24 +// * @Version: V1.0 +// */ +//public interface MarketListVersionUpdateLogEOMapper extends BaseMapper { +// +//} diff --git a/laws-modules/src/main/java/com/jero/modules/log/mapper/xml/MarketListVersionUpdateLogEOMapper.xml b/laws-modules/src/main/java/com/jero/modules/log/mapper/xml/MarketListVersionUpdateLogEOMapper.xml deleted file mode 100644 index 63d029a0..00000000 --- a/laws-modules/src/main/java/com/jero/modules/log/mapper/xml/MarketListVersionUpdateLogEOMapper.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/log/service/IMarketListVersionUpdateLogEOService.java b/laws-modules/src/main/java/com/jero/modules/log/service/IMarketListVersionUpdateLogEOService.java index 0c219cc0..e16a7312 100644 --- a/laws-modules/src/main/java/com/jero/modules/log/service/IMarketListVersionUpdateLogEOService.java +++ b/laws-modules/src/main/java/com/jero/modules/log/service/IMarketListVersionUpdateLogEOService.java @@ -1,62 +1,62 @@ -package com.jero.modules.log.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; - -import java.util.List; - -/** - * @Description: 市场清单版本更新log表 - * @Author: jero-boot - * @Date: 2023-04-24 - * @Version: V1.0 - */ -public interface IMarketListVersionUpdateLogEOService extends IService { - - /** - * 保存 - * - * @param marketListVersionUpdateLogEO - * @return - */ - void add(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO); - - /** - * 更新 - * - * @param marketListVersionUpdateLogEO - * @return - */ - void editById(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO); - - /** - * 通过id删除 - * - * @param id - * @return - */ - void deleteById(String id); - - /** - * 批量删除 - * - * @param ids - * @return - */ - void deleteByIds(List ids); - - /** - * 通过id查询 - * - * @param id - * @return - */ - MarketListVersionUpdateLogEO queryById(String id); - - /** - * 列表查询 - * - * @return - */ - List queryList(); -} +//package com.jero.modules.log.service; +// +//import com.baomidou.mybatisplus.extension.service.IService; +//import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; +// +//import java.util.List; +// +///** +// * @Description: 市场清单版本更新log表 +// * @Author: jero-boot +// * @Date: 2023-04-24 +// * @Version: V1.0 +// */ +//public interface IMarketListVersionUpdateLogEOService extends IService { +// +// /** +// * 保存 +// * +// * @param marketListVersionUpdateLogEO +// * @return +// */ +// void add(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO); +// +// /** +// * 更新 +// * +// * @param marketListVersionUpdateLogEO +// * @return +// */ +// void editById(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO); +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// void deleteById(String id); +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// void deleteByIds(List ids); +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// MarketListVersionUpdateLogEO queryById(String id); +// +// /** +// * 列表查询 +// * +// * @return +// */ +// List queryList(); +//} diff --git a/laws-modules/src/main/java/com/jero/modules/log/service/impl/MarketListVersionUpdateLogEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/log/service/impl/MarketListVersionUpdateLogEOServiceImpl.java index 7ab399b8..b3e14484 100644 --- a/laws-modules/src/main/java/com/jero/modules/log/service/impl/MarketListVersionUpdateLogEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/log/service/impl/MarketListVersionUpdateLogEOServiceImpl.java @@ -1,90 +1,90 @@ -package com.jero.modules.log.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; -import com.jero.modules.log.mapper.MarketListVersionUpdateLogEOMapper; -import com.jero.modules.log.service.IMarketListVersionUpdateLogEOService; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -/** - * @Description: 市场清单版本更新log表 - * @Author: jero-boot - * @Date: 2023-04-24 - * @Version: V1.0 - */ -@Service -public class MarketListVersionUpdateLogEOServiceImpl extends ServiceImpl implements IMarketListVersionUpdateLogEOService { - - /** - * 保存 - * - * @param marketListVersionUpdateLogEO - * @return - */ - @Override - public void add(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO) { - Date now = new Date(); - marketListVersionUpdateLogEO.setCreateTime(now); - marketListVersionUpdateLogEO.setUpdateTime(now); - save(marketListVersionUpdateLogEO); - } - - /** - * 更新 - * - * @param marketListVersionUpdateLogEO - * @return - */ - @Override - public void editById(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO) { - Date now = new Date(); - marketListVersionUpdateLogEO.setUpdateTime(now); - saveOrUpdate(marketListVersionUpdateLogEO); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @Override - public void deleteById(String id) { - removeById(id); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @Override - public void deleteByIds(List ids) { - removeByIds(ids); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @Override - public MarketListVersionUpdateLogEO queryById(String id) { - return getById(id); - } - - /** - * 列表查询 - * - * @return - */ - @Override - public List queryList() { - return list(); - } -} +//package com.jero.modules.log.service.impl; +// +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import com.jero.modules.log.entity.MarketListVersionUpdateLogEO; +//import com.jero.modules.log.mapper.MarketListVersionUpdateLogEOMapper; +//import com.jero.modules.log.service.IMarketListVersionUpdateLogEOService; +//import org.springframework.stereotype.Service; +// +//import java.util.Date; +//import java.util.List; +// +///** +// * @Description: 市场清单版本更新log表 +// * @Author: jero-boot +// * @Date: 2023-04-24 +// * @Version: V1.0 +// */ +//@Service +//public class MarketListVersionUpdateLogEOServiceImpl extends ServiceImpl implements IMarketListVersionUpdateLogEOService { +// +// /** +// * 保存 +// * +// * @param marketListVersionUpdateLogEO +// * @return +// */ +// @Override +// public void add(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO) { +// Date now = new Date(); +// marketListVersionUpdateLogEO.setCreateTime(now); +// marketListVersionUpdateLogEO.setUpdateTime(now); +// save(marketListVersionUpdateLogEO); +// } +// +// /** +// * 更新 +// * +// * @param marketListVersionUpdateLogEO +// * @return +// */ +// @Override +// public void editById(MarketListVersionUpdateLogEO marketListVersionUpdateLogEO) { +// Date now = new Date(); +// marketListVersionUpdateLogEO.setUpdateTime(now); +// saveOrUpdate(marketListVersionUpdateLogEO); +// } +// +// /** +// * 通过id删除 +// * +// * @param id +// * @return +// */ +// @Override +// public void deleteById(String id) { +// removeById(id); +// } +// +// /** +// * 批量删除 +// * +// * @param ids +// * @return +// */ +// @Override +// public void deleteByIds(List ids) { +// removeByIds(ids); +// } +// +// /** +// * 通过id查询 +// * +// * @param id +// * @return +// */ +// @Override +// public MarketListVersionUpdateLogEO queryById(String id) { +// return getById(id); +// } +// +// /** +// * 列表查询 +// * +// * @return +// */ +// @Override +// public List queryList() { +// return list(); +// } +//} diff --git a/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java b/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java index acb1f50c..3bfa2b13 100644 --- a/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java +++ b/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java @@ -6,9 +6,9 @@ import java.util.Map; public interface ISearchCenterService { - Result> getDataCount(); +// Result> getDataCount(); - Result> getWdkCollectAndSubscribeInfoByUser(Map params); +// Result> getWdkCollectAndSubscribeInfoByUser(Map params); - Result getWdkPage(Map params); +// Result getWdkPage(Map params); } diff --git a/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java index c4878222..d005f6e5 100644 --- a/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java @@ -10,8 +10,8 @@ import com.jero.common.constant.enums.LanguageEnum; import com.jero.common.es.JeroElasticsearchTemplate; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.DateUtils; -import com.jero.modules.collection.entity.OnlCgformCollection; -import com.jero.modules.collection.service.IOnlCgformCollectionService; +//import com.jero.modules.collection.entity.OnlCgformCollection; +//import com.jero.modules.collection.service.IOnlCgformCollectionService; import com.jero.modules.document.enums.SearchEnum; import com.jero.modules.document.service.IBussDocumentLibraryEOService; import com.jero.modules.enums.DictCodeEnum; @@ -36,314 +36,314 @@ public class SearchCenterServiceImpl implements ISearchCenterService { @Autowired private IBussDocumentLibraryEOService bussDocumentLibraryEOService; - @Autowired - private IOnlCgformCollectionService onlCgformCollectionService; +// @Autowired +// private IOnlCgformCollectionService onlCgformCollectionService; @Autowired private JeroElasticsearchTemplate jeroElasticsearchTemplate; public static final String SEARCH_FLAG = "魑";//标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据) @Autowired private SysDictItemServiceImpl sysDictItemServiceImpl; - @Override - public Result> getDataCount() { - Map result = new HashMap<>(); - Map params = new HashMap<>(); - params.put("cut", LanguageEnum.CN.getValue()); - params.put("pageNo", "1"); - params.put("pageSize", "10"); - IPage documentLibraryInfoPage = this.bussDocumentLibraryEOService.getInfoPage(params); - long documentLibraryCount = documentLibraryInfoPage.getTotal(); +// @Override +// public Result> getDataCount() { +// Map result = new HashMap<>(); +// Map params = new HashMap<>(); +// params.put("cut", LanguageEnum.CN.getValue()); +// params.put("pageNo", "1"); +// params.put("pageSize", "10"); +// IPage documentLibraryInfoPage = this.bussDocumentLibraryEOService.getInfoPage(params); +// long documentLibraryCount = documentLibraryInfoPage.getTotal(); +// +// result.put("documentLibraryCount", documentLibraryCount); +// return Result.OK(result); +// } - result.put("documentLibraryCount", documentLibraryCount); - return Result.OK(result); - } +// @Override +// public Result> getWdkCollectAndSubscribeInfoByUser(Map params) { +// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// Map result = new HashMap<>(); +// +// String id = (String) params.get("id"); +// QueryWrapper collectionQueryWrap = new QueryWrapper<>(); +// collectionQueryWrap.lambda().eq(OnlCgformCollection::getDocumentId, id); +// collectionQueryWrap.lambda().eq(OnlCgformCollection::getCreateBy, currentUser.getUsername()); +// List collectionList = this.onlCgformCollectionService.list(collectionQueryWrap); +// +// result.put("collectionList", collectionList); +// return Result.OK(result); +// } - @Override - public Result> getWdkCollectAndSubscribeInfoByUser(Map params) { - LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - Map result = new HashMap<>(); +// @Override +// public Result getWdkPage(Map params) { +// boolean indexExistsFlag = true; +// String cut = (String) params.get("cut"); +// Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); +// Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); +// if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { +// indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_CN.getValue()); +// } else if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { +// indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_EN.getValue()); +// } +// if (!indexExistsFlag) { +// Page page = new Page(pageNo, pageSize); +// return Result.OK(page); +// } +// +// // 定义需要查询的字段数组 +// List fieldList = new ArrayList<>(); +// fieldList.add("serial_number"); +// if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { +// fieldList.add("title_en"); +// } else if (StringUtils.equals(cut, LanguageEnum.CN.getValue())){ +// fieldList.add("title"); +// } +// fieldList.add("content"); +// fieldList.add("flag"); +// +// JSONArray queryMapJsonAll = new JSONArray(); +// JSONArray queryJsonMustNot = new JSONArray(); +// +// JSONArray queryMapInputJson = new JSONArray(); +// Map mapHighlight = new HashMap<>(); +// Map mapHighlight1 = new HashMap<>(); +// +// String selectValue = (String) params.get("selectValue"); +// if(StringUtils.isNotBlank(selectValue)){ +// Map map = new HashMap<>(); +// Map map1 = new HashMap<>(); +// Map map2 = new HashMap<>(); +// map.put("query",SEARCH_FLAG); +// map1.put("flag",map); +// map2.put("match",map1); +// queryJsonMustNot.add(map2); +// }else { +// selectValue = SEARCH_FLAG; +// } +// if (StringUtils.isNotBlank(selectValue)) { +// for (String field : fieldList) { +// this.setQueryMapJson(queryMapInputJson, selectValue, field); +// //高亮 +// if(!"flag".equals(field)){ +// this.wdkHighlight(mapHighlight, field); +// } else { +// // query_string查询 +// Map map25 = new HashMap<>(); +// Map map45 = new HashMap<>(); +// map25.put("query", selectValue); +// map25.put("fields", fieldList.toArray()); +// map25.put("allow_leading_wildcard", false); //禁用了前置通配符 +// map45.put("query_string", map25); +// queryMapInputJson.add(map45); +// } +// } +// mapHighlight1.put("fields", mapHighlight); +// +// if (CollectionUtils.isNotEmpty(queryMapInputJson)) { +// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapInputJson); +// queryMapJsonAll.add(jsonObject); +// } +// } +// +// //指定module_type_flag= WDK +// JSONArray moduleTypeFlagQueryJsonArrMust = new JSONArray(); +// Map moduleTypeFlagValueMap = new HashMap<>(); +// Map moduleTypeFlagFieldMap = new HashMap<>(); +// Map moduleTypeFlagMatchMap = new HashMap<>(); +// moduleTypeFlagValueMap.put("query", "WDK"); +// moduleTypeFlagFieldMap.put("module_type_flag", moduleTypeFlagValueMap); +// moduleTypeFlagMatchMap.put("match", moduleTypeFlagFieldMap); +// moduleTypeFlagQueryJsonArrMust.add(moduleTypeFlagMatchMap); +// JSONObject moduleTypeFlagQueryJson = jeroElasticsearchTemplate.buildBoolQuery(moduleTypeFlagQueryJsonArrMust, null, null); +// queryMapJsonAll.add(moduleTypeFlagQueryJson); +// +// JSONObject querySort = new JSONObject(); +// if (StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue, SEARCH_FLAG)) { +// Map createTime = new HashMap<>(); +// Map createTime1 = new HashMap<>(); +// createTime.put("order", "desc"); +// createTime1.put("create_time", createTime); +// querySort.putAll(createTime1); +// } else { +// Map score = new HashMap<>(); +// Map score1 = new HashMap<>(); +// score.put("order", "desc"); +// score1.put("_score", score); +// querySort.putAll(score1); +// } +// +// IPage page = this.getWdkPage( +// queryMapJsonAll, +// mapHighlight1, +// pageNo, +// pageSize, +// cut, +// querySort, +// queryJsonMustNot, +// null +// ); +// return Result.OK(page); +// } - String id = (String) params.get("id"); - QueryWrapper collectionQueryWrap = new QueryWrapper<>(); - collectionQueryWrap.lambda().eq(OnlCgformCollection::getDocumentId, id); - collectionQueryWrap.lambda().eq(OnlCgformCollection::getCreateBy, currentUser.getUsername()); - List collectionList = this.onlCgformCollectionService.list(collectionQueryWrap); - - result.put("collectionList", collectionList); - return Result.OK(result); - } - - @Override - public Result getWdkPage(Map params) { - boolean indexExistsFlag = true; - String cut = (String) params.get("cut"); - Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); - Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); - if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { - indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_CN.getValue()); - } else if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { - indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_EN.getValue()); - } - if (!indexExistsFlag) { - Page page = new Page(pageNo, pageSize); - return Result.OK(page); - } - - // 定义需要查询的字段数组 - List fieldList = new ArrayList<>(); - fieldList.add("serial_number"); - if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { - fieldList.add("title_en"); - } else if (StringUtils.equals(cut, LanguageEnum.CN.getValue())){ - fieldList.add("title"); - } - fieldList.add("content"); - fieldList.add("flag"); - - JSONArray queryMapJsonAll = new JSONArray(); - JSONArray queryJsonMustNot = new JSONArray(); - - JSONArray queryMapInputJson = new JSONArray(); - Map mapHighlight = new HashMap<>(); - Map mapHighlight1 = new HashMap<>(); - - String selectValue = (String) params.get("selectValue"); - if(StringUtils.isNotBlank(selectValue)){ - Map map = new HashMap<>(); - Map map1 = new HashMap<>(); - Map map2 = new HashMap<>(); - map.put("query",SEARCH_FLAG); - map1.put("flag",map); - map2.put("match",map1); - queryJsonMustNot.add(map2); - }else { - selectValue = SEARCH_FLAG; - } - if (StringUtils.isNotBlank(selectValue)) { - for (String field : fieldList) { - this.setQueryMapJson(queryMapInputJson, selectValue, field); - //高亮 - if(!"flag".equals(field)){ - this.wdkHighlight(mapHighlight, field); - } else { - // query_string查询 - Map map25 = new HashMap<>(); - Map map45 = new HashMap<>(); - map25.put("query", selectValue); - map25.put("fields", fieldList.toArray()); - map25.put("allow_leading_wildcard", false); //禁用了前置通配符 - map45.put("query_string", map25); - queryMapInputJson.add(map45); - } - } - mapHighlight1.put("fields", mapHighlight); - - if (CollectionUtils.isNotEmpty(queryMapInputJson)) { - JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapInputJson); - queryMapJsonAll.add(jsonObject); - } - } - - //指定module_type_flag= WDK - JSONArray moduleTypeFlagQueryJsonArrMust = new JSONArray(); - Map moduleTypeFlagValueMap = new HashMap<>(); - Map moduleTypeFlagFieldMap = new HashMap<>(); - Map moduleTypeFlagMatchMap = new HashMap<>(); - moduleTypeFlagValueMap.put("query", "WDK"); - moduleTypeFlagFieldMap.put("module_type_flag", moduleTypeFlagValueMap); - moduleTypeFlagMatchMap.put("match", moduleTypeFlagFieldMap); - moduleTypeFlagQueryJsonArrMust.add(moduleTypeFlagMatchMap); - JSONObject moduleTypeFlagQueryJson = jeroElasticsearchTemplate.buildBoolQuery(moduleTypeFlagQueryJsonArrMust, null, null); - queryMapJsonAll.add(moduleTypeFlagQueryJson); - - JSONObject querySort = new JSONObject(); - if (StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue, SEARCH_FLAG)) { - Map createTime = new HashMap<>(); - Map createTime1 = new HashMap<>(); - createTime.put("order", "desc"); - createTime1.put("create_time", createTime); - querySort.putAll(createTime1); - } else { - Map score = new HashMap<>(); - Map score1 = new HashMap<>(); - score.put("order", "desc"); - score1.put("_score", score); - querySort.putAll(score1); - } - - IPage page = this.getWdkPage( - queryMapJsonAll, - mapHighlight1, - pageNo, - pageSize, - cut, - querySort, - queryJsonMustNot, - null - ); - return Result.OK(page); - } - - @NotNull - private IPage getWdkPage(JSONArray queryMapJson, - Map highlightMap, - Integer pageNo, - Integer pageSize, - String cut, - JSONObject querySort, - JSONArray queryMustNot, - JSONArray queryShould) { - JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, queryShould); - JSONArray jsonArraySort = new JSONArray(); - jsonArraySort.add(querySort); - - //1. 条件,分页 - JSONObject queryObject = jeroElasticsearchTemplate.buildQuery( - null, - jsonObject, - highlightMap, - jsonArraySort, - pageNo - 1, - pageSize - ); - - //2. 数据查询 - JSONObject search = new JSONObject(); - if (LanguageEnum.CN.getValue().equals(cut)) { - search = jeroElasticsearchTemplate.search( - SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), - SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), - queryObject - ); - } else { - search = jeroElasticsearchTemplate.search( - SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), - SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), - queryObject - ); - } - - List stateSysDictItems = this.sysDictItemServiceImpl.selectItemsByDictCode(DictCodeEnum.STATE.getValue()); - - List> list = (List>) (((Map) search.get("hits")).get("hits")); - List> mapList = new ArrayList<>(); - for (Map map : list) { - Map mapSource = (Map) map.get("_source"); - Map mapHighlight = (Map) map.get("highlight"); - if(ObjectUtils.isNotEmpty(mapHighlight)){ - for (Map.Entry entry : mapHighlight.entrySet()) { - String key = entry.getKey(); - List value = (List) entry.getValue(); - String fieldConyent= ""; - for (String s : value) { - fieldConyent += s; - } - mapSource.put(key,fieldConyent); - } - } - String state = (String) mapSource.get("state"); - String state_dictText = ""; - for (SysDictItem dictItem : stateSysDictItems) { - if (StringUtils.equals(dictItem.getItemValue(), state)) { - if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { - state_dictText = dictItem.getItemText(); - } else { - state_dictText = dictItem.getEnName(); - } - break; - } - } - mapSource.put("state_dictText", state_dictText); - - String create_time_str = ""; - if(ObjectUtils.isNotEmpty(mapSource.get("create_time"))){ - create_time_str = DateUtils.formatTime((Long) mapSource.get("create_time")); - } - mapSource.put("create_time_str",create_time_str); - // 处理中英文切换的时候 展示的标题 - if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { - mapSource.put("title",mapSource.get("title_en")); - } - mapList.add(mapSource); - } - - //处理分页 - IPage page = new Page(pageNo, pageSize); - page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total")))); - page.setRecords(mapList); - return page; - } +// @NotNull +// private IPage getWdkPage(JSONArray queryMapJson, +// Map highlightMap, +// Integer pageNo, +// Integer pageSize, +// String cut, +// JSONObject querySort, +// JSONArray queryMustNot, +// JSONArray queryShould) { +// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, queryShould); +// JSONArray jsonArraySort = new JSONArray(); +// jsonArraySort.add(querySort); +// +// //1. 条件,分页 +// JSONObject queryObject = jeroElasticsearchTemplate.buildQuery( +// null, +// jsonObject, +// highlightMap, +// jsonArraySort, +// pageNo - 1, +// pageSize +// ); +// +// //2. 数据查询 +// JSONObject search = new JSONObject(); +// if (LanguageEnum.CN.getValue().equals(cut)) { +// search = jeroElasticsearchTemplate.search( +// SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), +// SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), +// queryObject +// ); +// } else { +// search = jeroElasticsearchTemplate.search( +// SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), +// SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), +// queryObject +// ); +// } +// +// List stateSysDictItems = this.sysDictItemServiceImpl.selectItemsByDictCode(DictCodeEnum.STATE.getValue()); +// +// List> list = (List>) (((Map) search.get("hits")).get("hits")); +// List> mapList = new ArrayList<>(); +// for (Map map : list) { +// Map mapSource = (Map) map.get("_source"); +// Map mapHighlight = (Map) map.get("highlight"); +// if(ObjectUtils.isNotEmpty(mapHighlight)){ +// for (Map.Entry entry : mapHighlight.entrySet()) { +// String key = entry.getKey(); +// List value = (List) entry.getValue(); +// String fieldConyent= ""; +// for (String s : value) { +// fieldConyent += s; +// } +// mapSource.put(key,fieldConyent); +// } +// } +// String state = (String) mapSource.get("state"); +// String state_dictText = ""; +// for (SysDictItem dictItem : stateSysDictItems) { +// if (StringUtils.equals(dictItem.getItemValue(), state)) { +// if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { +// state_dictText = dictItem.getItemText(); +// } else { +// state_dictText = dictItem.getEnName(); +// } +// break; +// } +// } +// mapSource.put("state_dictText", state_dictText); +// +// String create_time_str = ""; +// if(ObjectUtils.isNotEmpty(mapSource.get("create_time"))){ +// create_time_str = DateUtils.formatTime((Long) mapSource.get("create_time")); +// } +// mapSource.put("create_time_str",create_time_str); +// // 处理中英文切换的时候 展示的标题 +// if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { +// mapSource.put("title",mapSource.get("title_en")); +// } +// mapList.add(mapSource); +// } +// +// //处理分页 +// IPage page = new Page(pageNo, pageSize); +// page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total")))); +// page.setRecords(mapList); +// return page; +// } /** * 设置文档库高亮字段 * @param mapHighlight * @param key */ - private void wdkHighlight(Map mapHighlight, String key) { - Map mapTemp = new HashMap<>(); - List list = new ArrayList<>(); - list.add(""); - List list1 = new ArrayList<>(); - list1.add(""); - mapTemp.put("pre_tags", list); - mapTemp.put("post_tags", list1); - mapTemp.put("fragment_size", 320); - mapTemp.put("number_of_fragments", 1); - mapTemp.put("type", "plain"); - mapHighlight.put(key, mapTemp); - } - - private void setQueryMapJson(JSONArray queryMapJson, String selectValue, String field) { - // 前缀匹配 缺点是前缀一定不能断开 - // 情况举例:用户只记得前面那段字 - Map map21 = new HashMap<>(); - Map map31 = new HashMap<>(); - Map map41 = new HashMap<>(); - if ("title".equals(field)) { - map31.put("boost", 10); - } else if ("content".equals(field)) { - map31.put("boost", 0.01); - } - map31.put("value", selectValue); - map21.put(field + ".keyword", map31); - map41.put("prefix", map21); - queryMapJson.add(map41); - - // match_phrase_prefix 词组匹配查询,允许最后词组与文中的任意分词前缀匹配 - Map map22 = new HashMap<>(); - Map map32 = new HashMap<>(); - Map map42 = new HashMap<>(); - if ("title".equals(field)) { - map32.put("boost", 10); - } else if ("content".equals(field)) { - map32.put("boost", 0.01); - } - map32.put("query", selectValue); - map22.put(field, map32); - map42.put("match_phrase_prefix", map22); - queryMapJson.add(map42); - - // match分词匹配查询 - // 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字 - Map map23 = new HashMap<>(); - Map map33 = new HashMap<>(); - Map map43 = new HashMap<>(); - if ("title".equals(field)) { - map33.put("boost", 10); - } else if ("content".equals(field)) { - map33.put("boost", 0.01); - } - map33.put("query", selectValue); - map23.put(field, map33); - map43.put("match", map23); - queryMapJson.add(map43); - - // wildcard模糊查询 - // 情况举例:用户只记得中间那段字 - Map map24 = new HashMap<>(); - Map map44 = new HashMap<>(); - map24.put(field, "*" + selectValue + "*"); - map44.put("wildcard", map24); - queryMapJson.add(map44); - } +// private void wdkHighlight(Map mapHighlight, String key) { +// Map mapTemp = new HashMap<>(); +// List list = new ArrayList<>(); +// list.add(""); +// List list1 = new ArrayList<>(); +// list1.add(""); +// mapTemp.put("pre_tags", list); +// mapTemp.put("post_tags", list1); +// mapTemp.put("fragment_size", 320); +// mapTemp.put("number_of_fragments", 1); +// mapTemp.put("type", "plain"); +// mapHighlight.put(key, mapTemp); +// } +// +// private void setQueryMapJson(JSONArray queryMapJson, String selectValue, String field) { +// // 前缀匹配 缺点是前缀一定不能断开 +// // 情况举例:用户只记得前面那段字 +// Map map21 = new HashMap<>(); +// Map map31 = new HashMap<>(); +// Map map41 = new HashMap<>(); +// if ("title".equals(field)) { +// map31.put("boost", 10); +// } else if ("content".equals(field)) { +// map31.put("boost", 0.01); +// } +// map31.put("value", selectValue); +// map21.put(field + ".keyword", map31); +// map41.put("prefix", map21); +// queryMapJson.add(map41); +// +// // match_phrase_prefix 词组匹配查询,允许最后词组与文中的任意分词前缀匹配 +// Map map22 = new HashMap<>(); +// Map map32 = new HashMap<>(); +// Map map42 = new HashMap<>(); +// if ("title".equals(field)) { +// map32.put("boost", 10); +// } else if ("content".equals(field)) { +// map32.put("boost", 0.01); +// } +// map32.put("query", selectValue); +// map22.put(field, map32); +// map42.put("match_phrase_prefix", map22); +// queryMapJson.add(map42); +// +// // match分词匹配查询 +// // 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字 +// Map map23 = new HashMap<>(); +// Map map33 = new HashMap<>(); +// Map map43 = new HashMap<>(); +// if ("title".equals(field)) { +// map33.put("boost", 10); +// } else if ("content".equals(field)) { +// map33.put("boost", 0.01); +// } +// map33.put("query", selectValue); +// map23.put(field, map33); +// map43.put("match", map23); +// queryMapJson.add(map43); +// +// // wildcard模糊查询 +// // 情况举例:用户只记得中间那段字 +// Map map24 = new HashMap<>(); +// Map map44 = new HashMap<>(); +// map24.put(field, "*" + selectValue + "*"); +// map44.put("wildcard", map24); +// queryMapJson.add(map44); +// } } diff --git a/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java b/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java index 1aaf28d7..254a945b 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java @@ -8,7 +8,6 @@ import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.constant.enums.LanguageEnum; import com.jero.common.system.base.controller.JeroController; import com.jero.common.util.oConvertUtils; -import com.jero.modules.lanswitch.service.ILanguageSwitchService; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.split.entity.SarFileSplitInfoEO; @@ -49,9 +48,6 @@ public class FileSplitItemsEOController extends JeroController>> queryCondition(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.queryCondition(flag, cut); - return Result.OK(list); - } - - /** - * 表单中英文切换 - * - * @return - */ - @AutoLog(value = "表单中英文切换") - @ApiOperation(value="表单中英文切换", notes="表单中英文切换") - @GetMapping(value = "/getForm") - @RequiresPermissions("split:sarFileSplitItems:page") - public Result>> getForm(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.getForm(flag, cut); - return Result.OK(list); - } - /** * 文件上传统一方法 * diff --git a/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java b/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java index 84d5a861..963aa409 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java +++ b/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java @@ -10,7 +10,6 @@ import com.jero.common.constant.enums.LanguageEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.base.controller.JeroController; import com.jero.modules.document.service.IBussDocumentLibraryEOService; -import com.jero.modules.lanswitch.service.ILanguageSwitchService; import com.jero.modules.laws.common.constant.ResultCommon; import com.jero.modules.ocr.util.LineHumpUtil; import com.jero.modules.oss.entity.OSSFile; @@ -55,8 +54,6 @@ public class SarFileSplitInfoController extends JeroController>> splitResultPageInfo(@RequestBody Map parameter) { - IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); +// IPage> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter); + + // TODO 数据获取需要从企标和国标里拿,需要重写 + IPage> infoPage = new Page<>(); return Result.OK(infoPage); } @@ -282,18 +282,18 @@ public class SarFileSplitInfoController extends JeroController>> queryCondition(@RequestParam(name = "flag") String flag, - @RequestParam(name = "cut") String cut) { - List> list = languageSwitchService.queryCondition(flag, cut); - return Result.OK(list); - } +// /** +// * 查询条件中英文切换 +// * +// * @return +// */ +// @AutoLog(value = "查询条件中英文切换") +// @ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换") +// @GetMapping(value = "/queryCondition") +//// @RequiresPermissions("split:sarFileSplitInfo:page") +// public Result>> queryCondition(@RequestParam(name = "flag") String flag, +// @RequestParam(name = "cut") String cut) { +// List> list = languageSwitchService.queryCondition(flag, cut); +// return Result.OK(list); +// } } diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java index 3d368101..59936e58 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java @@ -536,22 +536,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))) .collect(Collectors.toList()); } -// List fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); - //sql查询字段 -// List fieldListNew = new ArrayList<>(); -// fieldListNew.add("id"); // 加上主键 - // 处理数据为空的字段,如果字段值为空,显示斜杠 -// for (String field : fieldListTemp) { -// String fieldTemp = null; -// if(fieldDateList.contains(field)){ -// String fieldNew = "date_format(" + field + ", '%Y-%m-%d')"; // 转时间格式 -// fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field; -// fieldListNew.add(fieldTemp); -// }else{ -// fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field; -// fieldListNew.add(fieldTemp); -// } -// } + //sql查询条件 String condition = getConditionStr(parameter, "page"); int pageNo = Integer.parseInt((String) parameter.get("pageNo")); @@ -608,7 +593,10 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 0) { - List> documentLibraryEOList = documentLibraryEOService.queryListByIds(entry.getValue().toString()); + // TODO 选取的库错误,需要改为国标库 企标库 。需修改 +// List> documentLibraryEOList = documentLibraryEOService.queryListByIds(entry.getValue().toString()); + List> documentLibraryEOList = new ArrayList<>(); + Map idSerialNumberMap = new HashMap<>(); List idList = new ArrayList<>(); for (Map map : documentLibraryEOList) { @@ -722,6 +710,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl parameter, String type) { //查询条件 diff --git a/laws-single-startup/src/main/resources/application-dev.yml b/laws-single-startup/src/main/resources/application-dev.yml index cc47f579..6613b8b4 100644 --- a/laws-single-startup/src/main/resources/application-dev.yml +++ b/laws-single-startup/src/main/resources/application-dev.yml @@ -167,7 +167,7 @@ spring: #redis 配置 redis: database: 11 - host: 10.10.10.45 + host: 121.36.69.172 lettuce: pool: max-active: 8 #最大连接数据库连接数,设 0 为没有限制 @@ -176,7 +176,7 @@ spring: min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 shutdown-timeout: 100ms password: hzwlsoft.com - port: 6379 + port: 4780 #rabbitmq 配置 rabbitmq: host: 121.36.69.172