开发 国家与国旗中间表。

This commit is contained in:
wangzhijiang
2022-08-09 17:45:34 +08:00
parent a5afc80b31
commit d244074144
9 changed files with 501 additions and 0 deletions
@@ -840,3 +840,33 @@ ALTER TABLE `laws_weilai`.`problem_knowledge_base`
-- 问题知识库 字段类型修改 2022-08-09
ALTER TABLE `laws_weilai`.`problem_knowledge_base`
MODIFY COLUMN `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '内容(正文)' AFTER `stand_title`;
-- 国家与国旗关系表 2022-08-09
CREATE TABLE `laws_weilai`.`country_national_flag` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新日期',
`sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
`country_name_cn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国家名称中文',
`country_name_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国家名称英文',
`national_flag_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国旗文件id',
`national_flag_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国旗url',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '国家与国旗中间表' ROW_FORMAT = Dynamic;
-- 初始化数据 2022-08-09
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('11', NULL, NULL, NULL, NULL, NULL, '澳大利亚', 'Australia', NULL, '澳大利亚.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('12', NULL, NULL, NULL, NULL, NULL, '新西兰', 'New Zealand', NULL, '新西兰.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('13', NULL, NULL, NULL, NULL, NULL, '英国', 'UK', NULL, '英国.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('2', NULL, NULL, NULL, NULL, NULL, '中国', 'China', NULL, '中国.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('3', NULL, NULL, NULL, NULL, NULL, '中国香港', 'Hong Kong China', NULL, '中国香港.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('4', NULL, NULL, NULL, NULL, NULL, '韩国', 'South Korea', NULL, '韩国.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('5', NULL, NULL, NULL, NULL, NULL, '日本', 'Japan', NULL, '日本.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('6', NULL, NULL, NULL, NULL, NULL, '新加坡', 'Singapore', NULL, '新加坡.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('7', NULL, NULL, NULL, NULL, NULL, '马来西亚', 'Malaysia', NULL, '马来西亚.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('8', NULL, NULL, NULL, NULL, NULL, '海湾地区', 'GCC', NULL, '海湾地区.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('9', NULL, NULL, NULL, NULL, NULL, '阿联酋', 'UAE', NULL, '阿联酋.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('1', NULL, NULL, NULL, NULL, NULL, '欧盟', 'EU', NULL, '欧盟.jpg');
INSERT INTO `laws_weilai`.`country_national_flag` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `country_name_cn`, `country_name_en`, `national_flag_id`, `national_flag_url`) VALUES ('10', NULL, NULL, NULL, NULL, NULL, '美国', 'US', NULL, '美国.jpg');
@@ -0,0 +1,170 @@
package com.jero.modules.problemKnowledgeBase.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.jero.modules.problemKnowledgeBase.service.ICountryNationalFlagEOService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog;
/**
* @Description: 国家与国旗中间表
* @Author: jero-boot
* @Date: 2022-08-09
* @Version: V1.0
*/
@Api(tags="国家与国旗中间表")
@RestController
@RequestMapping("/problemKnowledgeBase/countryNationalFlagEO")
@Slf4j
public class CountryNationalFlagEOController extends JeroController<CountryNationalFlagEO, ICountryNationalFlagEOService> {
@Autowired
private ICountryNationalFlagEOService countryNationalFlagEOService;
/**
* 分页列表查询
*
* @param countryNationalFlagEO
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "国家与国旗中间表-分页列表查询")
@ApiOperation(value="国家与国旗中间表-分页列表查询", notes="国家与国旗中间表-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(CountryNationalFlagEO countryNationalFlagEO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CountryNationalFlagEO> queryWrapper = QueryGenerator.initQueryWrapper(countryNationalFlagEO, req.getParameterMap());
Page<CountryNationalFlagEO> page = new Page<CountryNationalFlagEO>(pageNo, pageSize);
IPage<CountryNationalFlagEO> pageList = countryNationalFlagEOService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 列表查询
*
* @return
*/
@AutoLog(value = "国家与国旗中间表-列表查询")
@ApiOperation(value="国家与国旗中间表-列表查询", notes="国家与国旗中间表-列表查询")
@GetMapping(value = "/list")
public Result<List<CountryNationalFlagEO>> queryList() {
List<CountryNationalFlagEO> list = countryNationalFlagEOService.queryList();
return Result.OK(list);
}
/**
* 添加
*
* @param countryNationalFlagEO
* @return
*/
@AutoLog(value = "国家与国旗中间表-添加")
@ApiOperation(value="国家与国旗中间表-添加", notes="国家与国旗中间表-添加")
@PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody CountryNationalFlagEO countryNationalFlagEO) {
countryNationalFlagEOService.add(countryNationalFlagEO);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param countryNationalFlagEO
* @return
*/
@AutoLog(value = "国家与国旗中间表-编辑")
@ApiOperation(value="国家与国旗中间表-编辑", notes="国家与国旗中间表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody CountryNationalFlagEO countryNationalFlagEO) {
countryNationalFlagEOService.editById(countryNationalFlagEO);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "国家与国旗中间表-通过id删除")
@ApiOperation(value="国家与国旗中间表-通过id删除", notes="国家与国旗中间表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
countryNationalFlagEOService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "国家与国旗中间表-批量删除")
@ApiOperation(value="国家与国旗中间表-批量删除", notes="国家与国旗中间表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.countryNationalFlagEOService.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) {
CountryNationalFlagEO countryNationalFlagEO = countryNationalFlagEOService.queryById(id);
if(countryNationalFlagEO==null) {
return Result.error("未找到对应数据");
}
return Result.OK(countryNationalFlagEO);
}
/**
* 导出excel
*
* @param request
* @param countryNationalFlagEO
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CountryNationalFlagEO countryNationalFlagEO) {
return super.exportXls(request, countryNationalFlagEO, CountryNationalFlagEO.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, CountryNationalFlagEO.class);
}
}
@@ -83,4 +83,8 @@ public class CountryCardManageReleaseEO implements Serializable {
@TableField(exist = false)
private List<CountryCardManageReleaseDetailEO> countryCardManageReleaseDetailEOList;
/**国旗**/
@TableField(exist = false)
private java.lang.String countryNationalFlag;
}
@@ -0,0 +1,84 @@
package com.jero.modules.problemKnowledgeBase.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* @Description: 国家与国旗中间表
* @Author: jero-boot
* @Date: 2022-08-09
* @Version: V1.0
*/
@Data
@TableName("country_national_flag")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="country_national_flag对象", description="国家与国旗中间表")
public class CountryNationalFlagEO implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.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 java.lang.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 java.lang.String sysOrgCode;
/**国家名称*/
@Excel(name = "国家名称中文", width = 15)
@ApiModelProperty(value = "国家名称中文")
private java.lang.String countryNameCn;
/**国家名称*/
@Excel(name = "国家名称英文", width = 15)
@ApiModelProperty(value = "国家名称英文")
private java.lang.String countryNameEn;
/**国旗文件id*/
@Excel(name = "国旗文件id", width = 15)
@ApiModelProperty(value = "国旗文件id")
private java.lang.String nationalFlagId;
/**国旗文件url*/
@Excel(name = "国旗文件url", width = 15)
@ApiModelProperty(value = "国旗文件url")
private java.lang.String nationalFlagUrl;
}
@@ -0,0 +1,17 @@
package com.jero.modules.problemKnowledgeBase.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 国家与国旗中间表
* @Author: jero-boot
* @Date: 2022-08-09
* @Version: V1.0
*/
public interface CountryNationalFlagEOMapper extends BaseMapper<CountryNationalFlagEO> {
}
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.problemKnowledgeBase.mapper.CountryNationalFlagEOMapper">
<resultMap id="CountryNationalFlagEOResultMap" type="com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO">
<id column="id" property="id" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="sys_org_code" property="sysOrgCode" />
<result column="country_name_cn" property="countryNameCn" />
<result column="country_name_en" property="countryNameEn" />
<result column="national_flag_id" property="nationalFlagId" />
<result column="national_flag_url" property="nationalFlagUrl" />
</resultMap>
</mapper>
@@ -0,0 +1,61 @@
package com.jero.modules.problemKnowledgeBase.service;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 国家与国旗中间表
* @Author: jero-boot
* @Date: 2022-08-09
* @Version: V1.0
*/
public interface ICountryNationalFlagEOService extends IService<CountryNationalFlagEO> {
/**
* 保存
*
* @param countryNationalFlagEO
* @return
*/
void add(CountryNationalFlagEO countryNationalFlagEO);
/**
* 更新
*
* @param countryNationalFlagEO
* @return
*/
void editById(CountryNationalFlagEO countryNationalFlagEO);
/**
* 通过id删除
*
* @param id
* @return
*/
void deleteById(String id);
/**
* 批量删除
*
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
/**
* 通过id查询
*
* @param id
* @return
*/
CountryNationalFlagEO queryById(String id);
/**
* 列表查询
*
* @return
*/
List<CountryNationalFlagEO> queryList();
}
@@ -6,10 +6,12 @@ import com.jero.common.api.vo.Result;
import com.jero.common.system.vo.DictModel;
import com.jero.modules.problemKnowledgeBase.entity.CountryCardManageReleaseDetailEO;
import com.jero.modules.problemKnowledgeBase.entity.CountryCardManageReleaseEO;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.jero.modules.problemKnowledgeBase.enums.ReleaseStatusEnum;
import com.jero.modules.problemKnowledgeBase.mapper.CountryCardManageReleaseEOMapper;
import com.jero.modules.problemKnowledgeBase.service.ICountryCardManageReleaseDetailEOService;
import com.jero.modules.problemKnowledgeBase.service.ICountryCardManageReleaseEOService;
import com.jero.modules.problemKnowledgeBase.service.ICountryNationalFlagEOService;
import com.jero.modules.system.enums.DicCodeEnum;
import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.collections4.CollectionUtils;
@@ -41,6 +43,8 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
private ICountryCardManageReleaseDetailEOService countryCardManageReleaseDetailEOService;
@Autowired
private ISysDictService sysDictService;
@Autowired
private ICountryNationalFlagEOService countryNationalFlagEOService;
/**
* 保存
@@ -134,6 +138,11 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
List<CountryCardManageReleaseDetailEO> releaseDetailEOList = this.countryCardManageReleaseDetailEOService.list(releaseDetailEOQueryWrapper);
this.countryCardManageReleaseDetailEOService.disposeData(releaseDetailEOList,cut);
List<DictModel> dictModelList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
//获取国旗
List<CountryNationalFlagEO> countryNationalFlagList = countryNationalFlagEOService.list();
datas.forEach(data -> {
if (StringUtils.isNotEmpty(data.getReleaseStatus())) {
data.setReleaseStatus_dictText(ReleaseStatusEnum.getTextByValue(data.getReleaseStatus(),cut));
@@ -149,6 +158,27 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
}).collect(Collectors.toList());
data.setCountryCardManageReleaseDetailEOList(collect);
}
List<DictModel> regionList = dictModelList.stream().filter(region -> {
boolean flag = false;
if (StringUtils.equals(region.getValue(), data.getApplyMarket())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(regionList)){
DictModel dictModel = regionList.get(0);
String collect = countryNationalFlagList.stream().filter(nationalFlag -> {
boolean flag = false;
if(StringUtils.equals(nationalFlag.getCountryNameCn(),dictModel.getText())){
flag = true;
}
return flag;
}).map(CountryNationalFlagEO::getNationalFlagUrl).collect(Collectors.joining(","));
data.setCountryNationalFlag(collect);
}
});
}
}
@@ -0,0 +1,89 @@
package com.jero.modules.problemKnowledgeBase.service.impl;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.jero.modules.problemKnowledgeBase.mapper.CountryNationalFlagEOMapper;
import com.jero.modules.problemKnowledgeBase.service.ICountryNationalFlagEOService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 国家与国旗中间表
* @Author: jero-boot
* @Date: 2022-08-09
* @Version: V1.0
*/
@Service
public class CountryNationalFlagEOServiceImpl extends ServiceImpl<CountryNationalFlagEOMapper, CountryNationalFlagEO> implements ICountryNationalFlagEOService {
/**
* 保存
*
* @param countryNationalFlagEO
* @return
*/
@Override
public void add(CountryNationalFlagEO countryNationalFlagEO) {
Date now = new Date();
countryNationalFlagEO.setCreateTime(now);
countryNationalFlagEO.setUpdateTime(now);
save(countryNationalFlagEO);
}
/**
* 更新
*
* @param countryNationalFlagEO
* @return
*/
@Override
public void editById(CountryNationalFlagEO countryNationalFlagEO) {
Date now = new Date();
countryNationalFlagEO.setUpdateTime(now);
saveOrUpdate(countryNationalFlagEO);
}
/**
* 通过id删除
*
* @param id
* @return
*/
@Override
public void deleteById(String id) {
removeById(id);
}
/**
* 批量删除
*
* @param ids
* @return
*/
@Override
public void deleteByIds(List<String> ids) {
removeByIds(ids);
}
/**
* 通过id查询
*
* @param id
* @return
*/
@Override
public CountryNationalFlagEO queryById(String id) {
return getById(id);
}
/**
* 列表查询
*
* @return
*/
@Override
public List<CountryNationalFlagEO> queryList() {
return list();
}
}