feat: There is no way the Laws

This commit is contained in:
super_liu
2021-10-28 18:10:31 +08:00
parent ac60a29630
commit 62c18594db
45 changed files with 3817 additions and 39 deletions
@@ -0,0 +1,207 @@
package com.adc.da.slrs.sarLawsStandInfo.controller;
import com.adc.da.common.ReadExcel;
import com.adc.da.excel.poi.excel.ExcelExportUtil;
import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandardsInfo.entity.StandardsInfoExcelVO;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.service.IDicTypeEOService;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.utils.util.LawsStandExportUtil;
import com.adc.da.utils.util.SarAdvanceSearchUtil;
import com.adc.da.utils.util.StandExportUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
@RestController
@Api(description = "|SarLawsStandInfo|")
@RequestMapping("/${restPath}/lawss/sarLawsInfo")
public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo> {
private static final Logger logger = LoggerFactory.getLogger(SarLawsStandInfoController.class);
@Autowired
private ISarLawsStandInfoService sarLawsInfoEOService;
@Autowired
private IPersonCollectEOService personCollectEOService;
@Autowired
private ITsResourceService iTsResourceService;
@Autowired
private ITsUserService tsUserService;
@Autowired
private IDicTypeEOService dicTypeEOService;
@ApiOperation(value = "|SarLawsInfoEO|分页查询")
@GetMapping("/page")
/*@RequiresPermissions("lawss:sarLawsInfo:page")*/
public ResponseMessage<PageInfo<SarLawsStandInfo>> page(SarLawsStandInfoPage page) throws Exception {
if (null != page.getNowOrderBy()) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("a.issueTime");//发布日期
break;
case 2:
page.setOrderByA("SAR_LAWS_ATTR_INFO.XCXSSRQLAWS");//新车型实施日期
break;
case 3:
page.setOrderByA("SAR_LAWS_ATTR_INFO.ZCXSSRQLAWS");//在产车实施日期
break;
case 4:
page.setOrderByA("a.LAWS_TEXT_STATE");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SAR_LAWS_ATTR_INFO.SSRQ");
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
default:
page.setOrder1(null);
break;
}
}
}
if (com.adc.da.util.utils.StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
String advanceStr = SarAdvanceSearchUtil.createSql(searchList,"SAR_LAWS_ATTR_INFO");
if (StringUtils.isNotBlank(advanceStr)) {
page.setAdvanceSearchStr(advanceStr);
} else {
page.setAdvanceSearchStr(null);
}
}
List<SarLawsStandInfo> rows = sarLawsInfoEOService.getSarStandardsInfoPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarLawsStandInfo|详情")
@GetMapping("/getStandInfoById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarLawsStandInfo> find(String id) throws Exception {
SarLawsStandInfo result = sarLawsInfoEOService.selectStandardsInfoByKey(id);
return Result.success(result);
}
@ApiOperation(value = "|SarLawsStandInfo|详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarLawsStandInfo> getStandInfoUpdateById(String id) throws Exception {
SarLawsStandInfo result = sarLawsInfoEOService.selectStandardsInfoUpdateByKey(id);
String collectId = personCollectEOService.queryCollectByUserAndId(id);
result.setCollectId(collectId);
return Result.success(result);
}
@ApiOperation(value = "|SarLawsStandInfo|导出excel")
@GetMapping(value = "/exportStandardsInfoExcel")
public void exportStandardsInfoExcel(String exportContent, String exportType, String exportName,String userId, HttpServletResponse response,
HttpServletRequest request) throws Exception {
OutputStream os = null;
Workbook workbook = null;
try {
if(StringUtils.isEmpty(exportName)||exportName.equals("null")){
exportName="政策库";
}
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx",request));
response.setContentType("application/force-download");
// 导出所有数据
List<SarLawsStandInfo> data = sarLawsInfoEOService.getExportData(exportType,exportContent,userId);
workbook = LawsStandExportUtil.exportDatas(data);
os = response.getOutputStream();
workbook.write(os);
os.flush();
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new AdcDaBaseException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
}
}
@ApiOperation(value = "|SarLawsStandInfo|确认配置标准")
@PostMapping("/saveStandardsMenu")
//@RequiresPermissions("lawss:sarBussionessStand:saveStandardsMenu")
public ResponseMessage saveStandardsMenu(@RequestBody SarLawsStandInfoPage standardsInfoEO){
if ("wdsc".equals(standardsInfoEO.getMenuId()) || "gxhbq".equals(standardsInfoEO.getMenuId())) {
return Result.error("所选节点不支持配置标准");
} else {
SarLawsStandInfoPage standlist = sarLawsInfoEOService.updateStandardsMenu(standardsInfoEO);
return Result.success(standardsInfoEO);
}
}
@ApiOperation(value = "|SarLawsStandInfo|企业标准修改")
@PostMapping(value = "/updateSarLawsStandInfo")
public ResponseMessage<SarLawsStandInfo> updateSarLawsStandInfo(@RequestBody SarLawsStandInfo sarLawsStandInfo) throws Exception {
sarLawsStandInfo.setModifyTime(new Date());
sarLawsInfoEOService.updateSarLawsStandInfo(sarLawsStandInfo);
return Result.success("","修改成功",sarLawsStandInfo);
}
// @ApiOperation(value = "|SarBussionessStandEO|删除")
// @PostMapping("deleteSarBussionessStand")
// public ResponseMessage delete(String ids) throws Exception {
// SarLawsStandInfoPage sarLawsStandInfoPage = new SarLawsStandInfoPage();
// sarLawsStandInfoPage.setIdlist(ids.split(","));
// ResponseMessage<SarLawsStandInfo> result = sarLawsInfoEOService.deleteSarLawsStandInfo(sarLawsStandInfoPage);
// logger.info("delete from SAR_BUSSIONESS_STAND where id = {}", ids);
// return result;
// }
}
@@ -0,0 +1,30 @@
package com.adc.da.slrs.sarLawsStandInfo.dao;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
@Repository
public interface SarLawsStandInfoDao extends BaseMapper<SarLawsStandInfo> {
List<SarLawsStandInfo> getSarStandardsInfoPage(SarLawsStandInfoPage page);
int getSarStandardsInfoCount(SarLawsStandInfoPage page);
List<SarLawsStandInfo> selectStandardsInfoByKey(String id);
List<SarLawsStandInfo> getSarStandardsExportInfo(SarLawsStandInfoPage page);
}
@@ -0,0 +1,243 @@
package com.adc.da.slrs.sarLawsStandInfo.entity;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import com.adc.da.slrs.sarStandAttrDetails.entity.SarStandAttrDetails;
import com.adc.da.slrs.standardSplit.entity.SarStandAttrDetailsEO;
import com.adc.da.sys.entity.DicTypeEO;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.*;
import com.baomidou.mybatisplus.annotation.TableField;
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 oracle.sql.DATE;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsStandInfo对象", description="")
public class SarLawsStandInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "政策分类 共四级,逐级选择-配置管理中维护")
@TableField("LAWS_TYPE")
private String lawsType;
@ApiModelProperty(value = "政策编号")
@TableField("LAWS_NUMBER")
private String lawsNumber;
@ApiModelProperty(value = "中文名称")
@TableField("LAWS_NAME")
private String lawsName;
@ApiModelProperty(value = "英文名称")
@TableField("LAWS_EN_NAME")
private String lawsEnName;
@ApiModelProperty(value = "政策文号")
@TableField("LAWS_NO")
private String lawsNo;
@ApiModelProperty(value = "发文日期")
@TableField("ISSUE_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String issueTime;
@ApiModelProperty(value = "发文单位")
@TableField("ISSUE_COMPANY")
private String issueCompany;
@ApiModelProperty(value = "征集意见周期-起始时间")
@TableField("COMMENT_CYCLE_START")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String commentCycleStart;
@ApiModelProperty(value = "征集意见周期-结束时间")
@TableField("COMMENT_CYCLE_END")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String commentCycleEnd;
@ApiModelProperty(value = "文件状态-配置管理中维护")
@TableField("LAWS_TEXT_STATE")
private String lawsTextState;
@ApiModelProperty(value = "适用区域-配置管理中维护")
@TableField("LAWS_SYQY")
private String lawsSyqy;
@ApiModelProperty(value = "适用车型-配置管理中维护")
@TableField("LAWS_SYCX")
private String lawsSycx;
@ApiModelProperty(value = "是/否(选择否,只有政策、政策中文名称是必填项目)")
@TableField("IS_RELATE_ACCESS")
private String isRelateAccess;
@ApiModelProperty(value = "年度-可在配置管理中维护,根据发布日期自动带入可手动修改")
@TableField("LAWS_YEAR")
private String lawsYear;
@ApiModelProperty(value = "福田转发通知文号")
@TableField("LAWS_NOTISYNC_NUM")
private String lawsNotisyncNum;
@ApiModelProperty(value = "信息简报 xxx期次xxx板块")
@TableField("LAWS_BULLETIN")
private String lawsBulletin;
@ApiModelProperty(value = "标签-可在配置管理中维护")
@TableField("LAWS_LABEL")
private String lawsLabel;
@ApiModelProperty(value = "备注")
@TableField("LAWS_REMARK")
private String lawsRemark;
@ApiModelProperty(value = "国家地区")
@TableField("COUNTRY")
private String country;
@TableField("CREATION_USER")
private String creationUser;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@ApiModelProperty(value = "参数1")
@TableField("PARAM1")
private Long param1;
@ApiModelProperty(value = "参数2")
@TableField("PARAM2")
private String param2;
// 非表字段
@TableField(exist = false)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private String firstPutTime;
@TableField(exist = false)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String putTimeShow;
@TableField(exist = false)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String issueTimeShow;
@TableField(exist = false)
private String issueTimeStr;
@TableField(exist = false)
private String putTimeStr;
//目录ID 非标准信息表中的字段
@TableField(exist = false)
private String menuId;
@TableField(exist = false)
private String menuParentId;
@TableField(exist = false)
private String standStatusShow; // 标准状态下拉框 --单选
@TableField(exist = false)
private String standNatrueShow;
@TableField(exist = false)
private String standSortShow;
@TableField(exist = false)
private String applyCountryShow;
@TableField(exist = false)
private List<AttFileVo> standFileList = new ArrayList<AttFileVo>();
@TableField(exist = false)
private List<AttFileVo> opinionFilesList = new ArrayList<AttFileVo>();
@TableField(exist = false)
private List<AttFileVo> relevanceFileList = new ArrayList<AttFileVo>();
@TableField(exist = false)
private String collectId;
//文件的类型
@TableField(exist = false)
private String standFileClassify;
//文件的下载id
@TableField(exist = false)
private String attId;
//记录是否修改了替代文件号
@TableField(exist = false)
private int upReplaceNumFlag;
//记录是否修改了文件号
@TableField(exist = false)
private int upNumFlag;
// 数据库新加的字段
@TableField(exist = false)
private String remark;//备注
@TableField(exist = false)
private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值
@TableField(exist = false)
private Map<String, Object> attrInfoCaseMap = new LinkedHashMap<>(); //属性表字段与值小写前端带入渲染
@TableField(exist = false)
private String sarStandAttrEOStr; //新增修改时属性表信息
@TableField(exist = false)
private String fileIds; //全部文件ID
@TableField(exist = false)
private List<SarStandAttrDetailsEO> attrInfoList = new ArrayList<>();
@TableField(exist = false)
private String standTextStatusShow; // 标准文本状态显示名称
// 以下为非表中字段
@TableField(exist = false)
private String countryShow; //国家地区显示名称
@TableField(exist = false)
private String standStateShow; // 标准状态显示名称
@TableField(exist = false)
private String standNatureShow; // 标准性质显示名称
@TableField(exist = false)
private List<DicTypeEO> dicTypeList = new ArrayList(); // 记录标准涉及到的所有数据字典数据
}
@@ -0,0 +1,261 @@
package com.adc.da.slrs.sarLawsStandInfo.entity;
import com.adc.da.base.entity.BaseEntity;
import com.adc.da.base.page.BasePage;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
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 oracle.sql.DATE;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsStandInfo对象", description="")
public class SarLawsStandInfoPage extends BasePage {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "政策分类 共四级,逐级选择-配置管理中维护")
@TableField("LAWS_TYPE")
private String lawsType;
@ApiModelProperty(value = "政策编号")
@TableField("LAWS_NUMBER")
private String lawsNumber;
@ApiModelProperty(value = "中文名称")
@TableField("LAWS_NAME")
private String lawsName;
@ApiModelProperty(value = "英文名称")
@TableField("LAWS_EN_NAME")
private String lawsEnName;
@ApiModelProperty(value = "政策文号")
@TableField("LAWS_NO")
private String lawsNo;
@ApiModelProperty(value = "发文日期")
@TableField("ISSUE_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String issueTime;
@ApiModelProperty(value = "发文单位")
@TableField("ISSUE_COMPANY")
private String issueCompany;
@ApiModelProperty(value = "征集意见周期-起始时间")
@TableField("COMMENT_CYCLE_START")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String commentCycleStart;
@ApiModelProperty(value = "征集意见周期-结束时间")
@TableField("COMMENT_CYCLE_END")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String commentCycleEnd;
@ApiModelProperty(value = "文件状态-配置管理中维护")
@TableField("LAWS_TEXT_STATE")
private String lawsTextState;
@ApiModelProperty(value = "适用区域-配置管理中维护")
@TableField("LAWS_SYQY")
private String lawsSyqy;
@ApiModelProperty(value = "适用车型-配置管理中维护")
@TableField("LAWS_SYCX")
private String lawsSycx;
@ApiModelProperty(value = "是/否(选择否,只有政策、政策中文名称是必填项目)")
@TableField("IS_RELATE_ACCESS")
private String isRelateAccess;
@ApiModelProperty(value = "年度-可在配置管理中维护,根据发布日期自动带入可手动修改")
@TableField("LAWS_YEAR")
private String lawsYear;
@ApiModelProperty(value = "福田转发通知文号")
@TableField("LAWS_NOTISYNC_NUM")
private String lawsNotisyncNum;
@ApiModelProperty(value = "信息简报 xxx期次xxx板块")
@TableField("LAWS_BULLETIN")
private String lawsBulletin;
@ApiModelProperty(value = "标签-可在配置管理中维护")
@TableField("LAWS_LABEL")
private String lawsLabel;
@ApiModelProperty(value = "备注")
@TableField("LAWS_REMARK")
private String lawsRemark;
@ApiModelProperty(value = "国家地区")
@TableField("COUNTRY")
private String country;
@TableField("CREATION_USER")
private String creationUser;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private DATE modifyTime;
@ApiModelProperty(value = "参数1")
@TableField("PARAM1")
private Long param1;
@ApiModelProperty(value = "参数2")
@TableField("PARAM2")
private String param2;
private String[] commentCycleDate;
private String modifyTime1;
private String modifyTime2;
private String modifyTimeOperator = "=";
private String creationTime1;
private String creationTime2;
private String creationTimeOperator = "=";
private String validFlagOperator = "=";
private String putUser;
private String putUserOperator = "=";
private String citationUser;
private String citationUserOperator = "=";
private String responsibleUnit;
private String responsibleUnitOperator = "=";
private String standFile;
private String standFileOperator = "=";
private String tags;
private String tagsOperator = "=";
private String standStatus;
private String standStatusOperator = "=";
private String replacedStandNum;
private String replacedStandNumOperator = "=";
private String replaceStandNum;
private String replaceStandNumOperator = "=";
private String quoteStand;
private String quoteStandOperator = "=";
private String firstPutTime;
private String firstPutTime1;
private String firstPutTime2;
private String firstPutTimeOperator = "=";
private String putYear;
private String putYear1;
private String putYear2;
private String putYearOperator = "=";
private String putTime;
private String putTime1;
private String putTime2;
private String putTimeOperator = "=";
private String issueTime1;
private String issueTime2;
private String issueTimeOperator = "=";
private String energyKind;
private String energyKindOperator = "=";
private String applyArctic;
private String applyArcticOperator = "=";
private String standEnName;
private String standEnNameOperator = "=";
private String standName;
private String standNameOperator = "=";
private String standCode;
private String standCodeOperator = "=";
private String classifyCode;
private String classifyCodeOperator = "=";
private String standSubclass;
private String standSubclassOperator = "=";
private String standGenera;
private String standGeneraOperator = "=";
private String idOperator = "=";
private String menuId;
private List<String> menuIdList;
private String[] idlist;
//为了在sql中区分修改操作
private String updateFlag;
// 数据库新增字段
private String applyCountry;
private String standYear;
private String applyCountryOperator = "=";
private String standNature;
private String standNatureOperator = "=";
private String synopsis;
private String synopsisOperator = "=";
private String standSort;
private String standSortOperator = "=";
private String opinionFile;
private String opinionFileOperator = "=";
private String relevanceFile;
private String relevanceFileOperator = "=";
private String remark;
private String remarkOperator = "=";
private List<String> roleIds;
private String rootMenuId;
private String orgName;
private List<String> menuRoleList;
private String[] replacedStandNumList;
private String numberName;
// 树结构增加搜索条件
private String collectMenuId;
private String advanceSearchVOStr;
private String advanceSearchStr;
private List<String> menuAllChildrenIdList;
private String userId;
private String zqcrId;
//页面排序
private String paixu;
private String shunxu;
private String sql;
// 树结构增加搜索条件
@TableField(exist = false)
private String labelMenuId;
@TableField(exist = false)
private String ids;
@TableField(exist = false)
private String proType;
@TableField(exist = false)
private Integer nowOrder;
@TableField(exist = false)
private Integer nowOrderBy;
@TableField(exist = false)
private String orderByA = "a.issue_time";
@TableField(exist = false)
private String orderBy1 = "SAR_LAWS_STAND_INFO.issue_time";
@TableField(exist = false)
private String order1 = "desc";
}
@@ -0,0 +1,36 @@
package com.adc.da.slrs.sarLawsStandInfo.service;
import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
public interface ISarLawsStandInfoService extends IService<SarLawsStandInfo> {
// ResponseMessage<SarLawsStandInfo> deleteSarLawsStandInfo(SarLawsStandInfoPage page) throws Exception;
SarLawsStandInfo updateSarLawsStandInfo(SarLawsStandInfo sarLawsStandInfo) throws Exception;
SarLawsStandInfoPage updateStandardsMenu(SarLawsStandInfoPage standardsInfoEO);
List<SarLawsStandInfo> getExportData(String exportType, String exportContent,String userId) throws Exception;
List<SarLawsStandInfo> getSarStandardsInfoPage(SarLawsStandInfoPage page) throws Exception;
SarLawsStandInfo selectStandardsInfoByKey(String id) throws Exception;
SarLawsStandInfo selectStandardsInfoUpdateByKey(String id) throws Exception;
}
@@ -0,0 +1,763 @@
package com.adc.da.slrs.sarLawsStandInfo.service.impl;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.SelectionTypeEnum;
import com.adc.da.common.UseModuleEnum;
import com.adc.da.login.util.UserUtils;
import com.adc.da.mq.CreateMQService;
import com.adc.da.mq.CreateStandMQService;
import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.page.PersonCollectEOPage;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.search.service.StandLawsSearchService;
import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao;
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
import com.adc.da.slrs.sarBussStandItems.dao.SarBussStandItemsDao;
import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao;
import com.adc.da.slrs.sarBussStandVal.dao.SarBussStandValDao;
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
import com.adc.da.slrs.sarLawsAttrInfo.dao.SarLawsAttrInfoDao;
import com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo;
import com.adc.da.slrs.sarLawsFile.dao.SarLawsFileDao;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.adc.da.slrs.sarLawsInfo.dao.SarLawsInfoDao;
import com.adc.da.slrs.sarLawsMenu.dao.SarLawsMenuDao;
import com.adc.da.slrs.sarLawsMenu.entity.SarLawsMenu;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import com.adc.da.slrs.sarLawsStandInfo.dao.SarLawsStandInfoDao;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
import com.adc.da.slrs.sarLawsVal.dao.SarLawsValDao;
import com.adc.da.slrs.sarLawsVal.entity.SarLawsVal;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.constant.ValueStateEnum;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.FieldConvertUtil;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.adc.da.utils.util.SarAdvanceSearchUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.json.JSONTokener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.sql.Clob;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-10-25
*/
@Service
public class SarLawsStandInfoServiceImpl extends ServiceImpl<SarLawsStandInfoDao, SarLawsStandInfo> implements ISarLawsStandInfoService {
@Value("${elas.flag}")
private boolean elasflag; //ES是否启用
@Value("${file.path}")
private String filePath;//文件存储路径
@Autowired
private IPersonCollectEOService personCollectEOService;
@Autowired
private ITsResourceService iTsResourceService;
@Autowired
private ITsUserService tsUserService;
@Autowired
private SarBussionessStandDao sarLawsStandInfoDao;
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private DicTypeEODao dicTypeEODao;
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private SarLawsMenuDao sarLawsMenuDao;
@Autowired
private OtConvertMqDao otConvertEODao;
@Autowired
private CreateMQService convertMq;
@Autowired
private SarLawsValDao sarBussStandValEODao;
@Autowired
private SarLawsFileDao sarBussStandFileEODao;
@Autowired
private CreateStandMQService createStandMQService;
@Autowired
private ISarUpdLogService sarUpdLogEOService;
@Autowired
private ITsResourceService sarMenuEOService;
@Autowired
private PersonCollectEODao personCollectEODao;
@Autowired
private SarLawsAttrInfoDao sarLawsAttrInfoDao;
@Autowired
private SarBussStandItemsDao sarBussStandItemsEODao;
@Autowired
private StandLawsSearchService standLawsSearchService;
@Override
public List<SarLawsStandInfo> getSarStandardsInfoPage(SarLawsStandInfoPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
String userId = UserUtils.getUserId();
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(userId)){
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
List<String> getMenuIdList = tsUserService.getResourceUserId(userId);
if (!getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iTsResourceService.getChildMenuList(userId);
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
Integer rowCount = this.baseMapper.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarLawsStandInfo> rows = this.baseMapper.getSarStandardsInfoPage(page);
attrInfoCollect(rows);
return rows;
}
/***
* @Description: 处理属性表数据
* @Param: [sarlist]
* @Return: void
*/
public void attrInfo (List<SarLawsStandInfo> sarlist) throws Exception {
for(SarLawsStandInfo row : sarlist){
attrInfoDetails(row);
}
}
public void attrInfoCollect (List<SarLawsStandInfo> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarLawsStandInfo row : sarlist) {
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
@Override
public SarLawsStandInfo selectStandardsInfoByKey(String id) throws Exception{
List<SarLawsStandInfo> sarLawsStandInfoList = this.baseMapper.selectStandardsInfoByKey(id);
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
if(!sarLawsStandInfoList.isEmpty()) {
List<SarLawsStandInfo> newStandList = new ArrayList<>();
newStandList.add(sarLawsStandInfoList.get(0));
attrInfoShowDetails(newStandList);
sarLawsStandInfo = newStandList.get(0);
}
return sarLawsStandInfo;
}
@Override
public SarLawsStandInfo selectStandardsInfoUpdateByKey(String id) throws Exception{
List<SarLawsStandInfo> sarLawsStandInfoList = this.baseMapper.selectStandardsInfoByKey(id);
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
if(!sarLawsStandInfoList.isEmpty()) {
List<SarLawsStandInfo> newStandList = new ArrayList<>();
newStandList.add(sarLawsStandInfoList.get(0));
attrInfo(newStandList);
sarLawsStandInfo = newStandList.get(0);
}
return sarLawsStandInfo;
}
public void attrInfoDetails (SarLawsStandInfo row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
row.setCollectId(collectId);
// 查询属性表数据
if (StringUtils.isNotBlank(fieldInfo)) {
Map<String, Object> getAttrMap = sarLawsAttrInfoDao.selectLawsFieldAndData(fieldInfo,row.getId());
if (InitStandAttrUtil.clobFieldListBuss != null && !InitStandAttrUtil.clobFieldListBuss.isEmpty()) {
// 遍历修改所有clob类型的值
for (String clobField : InitStandAttrUtil.clobFieldListBuss) {
Clob clobValue = (Clob) getAttrMap.get(clobField);
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
getAttrMap.put(clobField,fieldValue);
}
}
// 组织机构和人员
Map<String,Object> newMap = new HashMap<>();
if(getAttrMap != null){
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
Object value1 = entry.getValue();
if (value1 != null && value1.toString().equals("\"null\"")){
entry.setValue("");
}
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListLaws != null && InitStandAttrUtil.selectionFieldListLaws.size() > 0 && InitStandAttrUtil.selectionFieldListLaws.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
value = sysInfoEOService.getOrgNamesByIds(value);
newMap.put(name + "Name",value);
} else if (SelectionTypeEnum.USERLIST.getValue().equals(selVal)) {
value = sysInfoEOService.getUserNamesByIds(value);
newMap.put(name + "Name",value);
} else if (SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
value = sysInfoEOService.getRoleNamesByIds(value);
newMap.put(name + "Name",value);
}
}
}
getAttrMap.putAll(newMap);
}
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap);
}
}
private Map<String, Object> transformUpperCase(Map<String, Object> orgMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : orgMap.entrySet()) {
String newKey = entry.getKey().toLowerCase();
resultMap.put(newKey, orgMap.get(entry.getKey()));
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListLaws != null && !InitStandAttrUtil.fileFieldListLaws.isEmpty() && InitStandAttrUtil.fileFieldListLaws.contains(entry.getKey())) {
String value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
if(!fileObj.isEmpty()){
resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName());
}
}
}
}
return resultMap;
}
public void attrInfoShowDetails(List<SarLawsStandInfo> sarlist) throws Exception {
for (SarLawsStandInfo row : sarlist) {
attrInfoDetails(row);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListLaws != null && InitStandAttrUtil.fileFieldListLaws.size() > 0 && InitStandAttrUtil.fileFieldListLaws.contains(name)) {
value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
entry.setValue(fileObj);
}
}else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListLaws != null && InitStandAttrUtil.selectionFieldListLaws.size() > 0 && InitStandAttrUtil.selectionFieldListLaws.contains(name)) {
value = entry.getValue().toString();
List<String> valArr = Arrays.asList(value.split(","));
value = dicTypeEODao.getDicNamesByCodes(valArr);
entry.setValue(value);
}
}
}
}
}
@Override
public List<SarLawsStandInfo> getExportData(String exportType, String exportContent,String userId) throws Exception {
SarLawsStandInfoPage page = new SarLawsStandInfoPage();
if ("apart".equals(exportType)) {
page.setIdlist(exportContent.split(","));
} else {
JSONObject jsonObject = JSONObject.fromObject(exportContent);
page = (SarLawsStandInfoPage)JSONObject.toBean(jsonObject, SarLawsStandInfoPage.class);
page.setPage(1);
page.setPageSize(10000);
//查询当前登录人角色拥有权限的菜单
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = com.alibaba.fastjson.JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
String advanceStr = SarAdvanceSearchUtil.createSql(searchList,"SAR_LAWS_ATTR_INFO");
if (com.adc.da.util.utils.StringUtils.isNotBlank(advanceStr)) {
page.setAdvanceSearchStr(advanceStr);
} else {
page.setAdvanceSearchStr(null);
}
}
}
page.setOrderBy("SAR_BUSSIONESS_STAND.issue_time is null,SAR_BUSSIONESS_STAND.issue_time desc,SAR_BUSSIONESS_STAND.id");
if(userId != null){
page.setUserId(userId);
}else {
page.setUserId(LoginUserUtil.getUserId());
}
List<SarLawsStandInfo> rows = this.baseMapper.getSarStandardsExportInfo(page);
attrInfoShow(rows);
return rows;
}
public void attrInfoShow (List<SarLawsStandInfo> sarlist) throws Exception {
for(SarLawsStandInfo row : sarlist){
attrInfoDetails(row);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
Map<String, Object> getNewMap = new LinkedHashMap<>();
if (getAttrMap != null && getAttrMap.size() > 0) {
String svppsTip = "";
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListLaws != null && InitStandAttrUtil.fileFieldListLaws.size() > 0 && InitStandAttrUtil.fileFieldListLaws.contains(name)) {
value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
entry.setValue(fileObj);
}
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListLaws != null && InitStandAttrUtil.selectionFieldListLaws.size() > 0 && InitStandAttrUtil.selectionFieldListLaws.contains(name)) {
value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapLaws.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal) || SelectionTypeEnum.USERLIST.getValue().equals(selVal) || SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
if("ZYQCR".equals(name)||"QTQCR".equals(name)){
if(getAttrMap.get(name + "Name")!=null && !getAttrMap.get(name + "Name").equals("")){
value = String.valueOf(getAttrMap.get(name + "Name"));
}
}else{
value = String.valueOf(getAttrMap.get(name + "Name"));
}
} else {
List<String> valArr = Arrays.asList(value.split(","));
value = dicTypeEODao.getDicNamesByCodes(valArr);
}
entry.setValue(value);
}
}
getAttrMap.put("SVPPSTips",svppsTip);
}
}
}
@Override
public SarLawsStandInfoPage updateStandardsMenu(SarLawsStandInfoPage standardsInfoEO) {
SarLawsMenu sarStandMenuEO = new SarLawsMenu();
String nowMenuId = standardsInfoEO.getMenuId();
sarStandMenuEO.setMenuId(nowMenuId);
for (int i = 0; i < standardsInfoEO.getIdlist().length; i++) {
sarStandMenuEO.setLawsId(standardsInfoEO.getIdlist()[i]);
sarStandMenuEO.setId(null);
sarStandMenuEO.setValidFlag(0);
// 根据当前目录查询所在父节点
String secondLevelId = "";
List<String> getMenuPIds = iTsResourceService.getParentMenuId(nowMenuId);
if (getMenuPIds != null && getMenuPIds.size() > 1) {
int idSize = getMenuPIds.size();
secondLevelId = getMenuPIds.get(idSize-1);
} else {
secondLevelId = nowMenuId;
}
//查询标准是否已在 当前父节点中
SarLawsMenu standMenuEOQuery = new SarLawsMenu();
standMenuEOQuery.setMenuId(secondLevelId);
standMenuEOQuery.setLawsId(standardsInfoEO.getIdlist()[i]);
List<String> menuIds = iTsResourceService.getChildMenuList(secondLevelId);
standMenuEOQuery.setMenuIds(menuIds);
List<SarLawsMenu> getInfo = sarLawsMenuDao.selectMenuByMenuParentId(standMenuEOQuery);
//删除节点与根节点的关联
SarLawsMenu sarStandMenuDel = new SarLawsMenu();
sarStandMenuDel.setLawsId(standardsInfoEO.getIdlist()[i]);
sarStandMenuDel.setMenuId(standardsInfoEO.getRootMenuId());
sarLawsMenuDao.deleteByLawsIdAndMenuId(sarStandMenuDel);
if (getInfo == null || getInfo.isEmpty()) {
sarStandMenuEO.setId(UUIDUtils.randomUUID20());
sarLawsMenuDao.insert(sarStandMenuEO);
} else {
sarStandMenuEO.setOldMenuId(secondLevelId);
List<String> menuOldIds = iTsResourceService.getChildMenuList(secondLevelId);
sarStandMenuEO.setMenuIds(menuOldIds);
sarLawsMenuDao.updateByLawsIdAndMenuId(sarStandMenuEO);
}
}
return standardsInfoEO;
}
public SarLawsStandInfo updateSarLawsStandInfo(SarLawsStandInfo sarLawsStandInfo) throws Exception {
String standId = sarLawsStandInfo.getId();
SarLawsStandInfo beforeStandEO = this.baseMapper.selectById(standId);
if(beforeStandEO!=null){
attrInfoDetails(beforeStandEO);
}
//规范性引用文件,如有数据,删除以前关联
int resultCount = this.baseMapper.updateById(sarLawsStandInfo);
if (resultCount >= 1) {
// 修改属性表数据
sarLawsAttrInfoDao.deleteLawsAttrByStandId(standId);
//
sarBussStandValEODao.deleteDataByStandId(standId);
//删除文件详情表数据
sarBussStandFileEODao.deleteByStandId(standId);
SarLawsFile sarBussStandFileEO = new SarLawsFile();
sarBussStandFileEO.setLawsId(standId);
sarBussStandFileEO.setIdList(null);
List<SarLawsFile> listFile = sarBussStandFileEODao.selectFileByStandIdAndId(sarBussStandFileEO);
if (listFile != null) {
if (!listFile.isEmpty()) {
for (int f = 0; f < listFile.size(); f++) {
//删除转换表ot_convert数据
otConvertEODao.deleteByAttId(listFile.get(f).getAttId());
}
}
}
createStandAttrInfo(sarLawsStandInfo);
// 根据代替标准号 ,修改代替标准号标准中的,被代替标准号
// updateReplaceConnect(sarLawsStandInfo);
//修改收藏分享编号名称
updateCollectAndShare(sarLawsStandInfo);
// 记录修改日志
saveUpdateLog(sarLawsStandInfo,beforeStandEO);
if (elasflag) {
attrInfoShowSearchDetails(sarLawsStandInfo,"upd");
createStandMQService.sendLawsMQ(sarLawsStandInfo, "update");
}
}
return sarLawsStandInfo;
}
public void attrInfoShowSearchDetails(SarLawsStandInfo row,String type) throws Exception {
if (row != null) {
attrInfoSearchDetails(row,type);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
List<String> valArr = new ArrayList<>();
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
if(StringUtils.isNotBlank(entry.getValue().toString())){
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
if(json instanceof org.json.JSONArray){
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
}else {
value = entry.getValue().toString();
valArr = Arrays.asList(value.split(","));
}
if(!valArr.isEmpty()){
value = dicTypeEODao.getDicNamesByCodes(valArr);
}
}
entry.setValue(value);
}
}
}
}
}
public void attrInfoSearchDetails(SarLawsStandInfo row,String type) throws Exception {
String fieldInfo = InitStandAttrUtil.queryField;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
row.setCollectId(collectId);
// 查询属性表数据
if (StringUtils.isNotBlank(fieldInfo)) {
Map<String, Object> getAttrMap = new TreeMap<>();
if(type.equals("add")){
String sarStandAttrEOStr = row.getSarStandAttrEOStr();
getAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
}else {
getAttrMap = sarLawsAttrInfoDao.selectLawsFieldAndData(fieldInfo, row.getId());
}
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
// 遍历修改所有clob类型的值
for (String clobField : InitStandAttrUtil.clobFieldList) {
Clob clobValue = (Clob) getAttrMap.get(clobField);
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
getAttrMap.put(clobField, fieldValue);
}
}
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap);
}
}
public void saveUpdateLog(SarLawsStandInfo sarStandardsInfoEO,SarLawsStandInfo beforeSarStandardsInfo) throws Exception{
Map<String,Object> newMap = new HashMap<>();
Map<String,Object> oldMap = beforeSarStandardsInfo.getAttrInfoMap();
String attrStr = sarStandardsInfoEO.getSarStandAttrEOStr();
if (StringUtils.isNotBlank(attrStr)) {
newMap = JSONObject.fromObject(attrStr);
}
newMap = changeMap(sarStandardsInfoEO,newMap);
oldMap = changeMap(beforeSarStandardsInfo,oldMap);
String sortName = sysInfoEOService.getDicNamesByCodes(sarStandardsInfoEO.getLawsType());
String number = sortName + " " + sarStandardsInfoEO.getLawsNumber();
String content = number + " 《" + sarStandardsInfoEO.getLawsName()+" " + sarStandardsInfoEO.getLawsEnName() + "》";
sarUpdLogEOService.createUpdateLog(SarTypeEnum.BUSINESS.getValue(),sarStandardsInfoEO.getId(),oldMap,newMap,content);
}
public Map<String,Object> changeMap (SarLawsStandInfo sarStandardsInfoEO,Map<String,Object> map) {
// map.put("country",verifyObj(sarStandardsInfoEO.getApplyCountry()));
map.put("lawsType",verifyObj(sarStandardsInfoEO.getLawsType()));
map.put("lawsNumber",verifyObj(sarStandardsInfoEO.getLawsNumber()));
map.put("lawsName",verifyObj(sarStandardsInfoEO.getLawsName()));
map.put("lawsEnName",verifyObj(sarStandardsInfoEO.getLawsEnName()));
map.put("lawsNo",verifyObj(sarStandardsInfoEO.getLawsNo()));
return map;
}
private Object verifyObj(Object str){
return str == null ? "" : str;
}
public void updateCollectAndShare(SarLawsStandInfo sarLawsStandInfo) throws Exception {
//修改收藏表中
String number = sarLawsStandInfo.getLawsNumber()+ ")";
PersonCollectEOPage personCollectEOPage = new PersonCollectEOPage();
personCollectEOPage.setValidFlag("0");
personCollectEOPage.setCollectResId(sarLawsStandInfo.getId());
List<TsPersonCollect> listCollect = personCollectEOService.queryByList(personCollectEOPage);
if (listCollect != null && listCollect.size() > 0) {
for (TsPersonCollect getCollect : listCollect) {
TsPersonCollect collectEO = new TsPersonCollect();
collectEO.setId(getCollect.getId());
collectEO.setCollectTitle(sarLawsStandInfo.getLawsName() + " " + "( 编号:" + number);
personCollectEOService.updateByPrimaryKeySelective(collectEO);
}
}
}
/***
* @Description: 新增属性表数据
* @Date: 2020/9/8 9:53
* @Param: [sarStandardsInfoEO]
* @Return: void
*/
public void createStandAttrInfo (SarLawsStandInfo sarBussionessStandEO) throws Exception {
String sarStandAttrEOStr = sarBussionessStandEO.getSarStandAttrEOStr();
String mustFields = FieldConvertUtil.mustFields;
String mustValues = FieldConvertUtil.mustValues(sarBussionessStandEO.getId());
// 将字符串转为map进行解析
Map<String,String> sarStandAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
StringBuilder fieldsBuilder = new StringBuilder();
StringBuilder valuesBuilder = new StringBuilder();
Map<String,String> selectionMap = new HashMap<>();
Map<String,String> fileMap = new HashMap<>();
Map<String,String> multiTimeMap = new HashMap<>();
String fileIds = "";
for (Map.Entry<String,String> entry : sarStandAttrMap.entrySet()) {
String attrKey = entry.getKey();
String attrValue = entry.getValue();
if (InitStandAttrUtil.queryFieldListLaws != null && !InitStandAttrUtil.queryFieldListLaws.isEmpty()) {
if (InitStandAttrUtil.queryFieldListLaws.contains(attrKey)) {
fieldsBuilder.append("," + attrKey);
// 多选项,文件类型需要单独处理 向子表添加数据
if (InitStandAttrUtil.selectionFieldListLaws.contains(attrKey)) {
selectionMap.put(attrKey,attrValue);
} else if (InitStandAttrUtil.fileFieldListLaws.contains(attrKey)) {
fileMap.put(attrKey,attrValue);
fileIds += attrValue + ",";
} else if (InitStandAttrUtil.multiTimeFieldList.contains(attrKey)) {
multiTimeMap.put(attrKey,attrValue);
}
// 不同类型存储数据需单独处理值
if (InitStandAttrUtil.numFieldListLaws.contains(attrKey)) {
if (StringUtils.isBlank(attrValue)) {
attrValue = "null";
}
} else if (InitStandAttrUtil.timeFieldListLaws.contains(attrKey)) {
attrValue = FieldConvertUtil.changeTimeValue(attrValue);
} else {
attrValue = "'" + attrValue + "'";
}
valuesBuilder.append("," + attrValue);
sarBussionessStandEO.setFileIds(fileIds);
}
}
}
String insertField = mustFields + fieldsBuilder.toString();
String insertValue = mustValues + valuesBuilder.toString();
int insertRes = sarLawsAttrInfoDao.insertLawsAttr(insertField,insertValue);
if (insertRes > 0) {
// 多选项处理
createStandVal(sarBussionessStandEO.getId(),selectionMap);
// 文件处理
createStandFile(sarBussionessStandEO.getId(),fileMap);
// 多时间处理
// createStandPutTime(sarBussionessStandEO.getId(),multiTimeMap);
}
}
/***
* @Description: 多选项处理
* @Author: yangxuenan
* @Date: 2020/9/8 14:37
* @Param: [sarStandardsInfoEO, selectionMap]
* @Return: void
*/
public void createStandVal (String standId,Map<String,String> selectionMap) {
if (selectionMap != null && selectionMap.size() > 0) {
List<SarLawsVal> standValList = new ArrayList<>();
for (Map.Entry<String,String> entry : selectionMap.entrySet()) {
String value = entry.getValue();
String field = entry.getKey();
if (StringUtils.isNotBlank(value)) {
String[] valArr = value.trim().split(",");
for (String val : valArr) {
SarLawsVal sarStandValEO = new SarLawsVal();
sarStandValEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
sarStandValEO.setCreationTime(new Date());
sarStandValEO.setModifyTime(new Date());
sarStandValEO.setLawsId(standId);
sarStandValEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
sarStandValEO.setPropertyType(field);
sarStandValEO.setPropertyVal(val);
standValList.add(sarStandValEO);
}
}
}
if (standValList != null && !standValList.isEmpty()) {
sarBussStandValEODao.insertForeach(standValList);
}
}
}
/***
* @Description: 文件处理
* @Author: yangxuenan
* @Date: 2020/9/8 15:01
* @Param: [standId, fileMap]
* @Return: void
*/
public void createStandFile (String standId,Map<String,String> fileMap) throws Exception {
if (fileMap != null && fileMap.size() > 0) {
List<SarLawsFile> standFileList = new ArrayList<>();
for (Map.Entry<String,String> entry : fileMap.entrySet()) {
String value = entry.getValue();
String field = entry.getKey();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileList = attFileEOService.getMultiFileInfos(value);
if (fileList != null && !fileList.isEmpty()) {
createStandFileAppend(standId,field,fileList,standFileList);
}
}
}
if (standFileList != null && !standFileList.isEmpty()) {
sarBussStandFileEODao.insertForeach(standFileList);
}
}
}
public void createStandFileAppend (String standId,String field,List<AttFileEO> fileList,List<SarLawsFile> standFileList) throws Exception {
for (AttFileEO fileInfo : fileList) {
SarLawsFile sarStandFileEO = new SarLawsFile();
sarStandFileEO.setCreationUser(LoginUserUtil.getUserId());
sarStandFileEO.setCreationTime(new Date());
sarStandFileEO.setModifyTime(new Date());
sarStandFileEO.setValidFlag(0);
sarStandFileEO.setLawsId(standId); //标准ID
sarStandFileEO.setUseModel(UseModuleEnum.SOURCE_FILE.getValue()); //文件使用模式
sarStandFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
sarStandFileEO.setAttId(fileInfo.getId()); //文件ID
sarStandFileEO.setLawsFileClassify(field); //文件分类
sarStandFileEO.setFileName(fileInfo.getOldFileName());
sarStandFileEO.setFileSuffix(fileInfo.getFileSuffix());
sarStandFileEO.setOriAttId(fileInfo.getId());
standFileList.add(sarStandFileEO);
//文档转换
if ("pdf".equals(fileInfo.getFileSuffix()) || "PDF".equals(fileInfo.getFileSuffix())) {
SarLawsFile newFileEO = new SarLawsFile();
newFileEO.setCreationUser(LoginUserUtil.getUserId());
newFileEO.setCreationTime(new Date());
newFileEO.setModifyTime(new Date());
newFileEO.setValidFlag(0);
newFileEO.setLawsId(standId); //标准ID
newFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
newFileEO.setAttId(fileInfo.getId()); //文件ID
newFileEO.setLawsFileClassify(field); //文件分类
newFileEO.setFileName(fileInfo.getOldFileName());
newFileEO.setFileSuffix(fileInfo.getFileSuffix());
newFileEO.setUseModel(UseModuleEnum.WEB_FILE.getValue()); //文件使用模式 //文件名称@@@@@@@需要修改
newFileEO.setOriAttId(fileInfo.getId());
standFileList.add(newFileEO);
} else {
String filePath = fileInfo.getFilePath() + fileInfo.getFileName();
OtConvertMq convert = new OtConvertMq();
convert.setLawsId(standId);
convert.setAttId(fileInfo.getId());
convert.setFilePath(filePath);
convert.setAddOrUp("0");
convert.setFileSuffix(fileInfo.getFileSuffix());
convert.setStandFileClassify(field);
convert.setConvertType(SarTypeEnum.BUSINESS.getValue());
convertMq.sendMQ(convert);
}
}
}
}