add: 政策法规资料入库流程

This commit is contained in:
wxyclub
2023-10-27 11:45:55 +08:00
parent 9bf82151ba
commit 1c082fc9b6
5 changed files with 124 additions and 4 deletions
@@ -69,6 +69,8 @@ public class ActDefineStartMap {
map.put("30","policyResearchGroupEnrollment"); map.put("30","policyResearchGroupEnrollment");
// 政策课题参会流程 // 政策课题参会流程
map.put("31","policyResearchGroupAttendMeeting"); map.put("31","policyResearchGroupAttendMeeting");
// 政策法规资料入库流程
map.put("32","PolicyLawsInformationLibrary");
return map.get(type); return map.get(type);
} }
@@ -0,0 +1,37 @@
package com.adc.da.workFlow.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.workFlow.service.ActSarLawsInformationEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author tjzdw
* @description
* @date 2023/10/27
*/
@Api("政策法规资料")
@RestController
@RequestMapping("/${restPath}/lawss/sarLawsTopic")
public class ActSarLawsInformationEOController {
@Resource
private ActSarLawsInformationEOService informationEOService;
@ApiOperation("政策法规资料入库")
@PostMapping("/processLawsRegulatoryInformation")
public ResponseMessage<String> processCreateLawsInformation(String infoJson) throws Exception {
if (StringUtils.isBlank(infoJson)) {
return Result.error("传入数据json不能为空");
}
informationEOService.processCreateLawsInformation(infoJson);
return Result.success("入库成功");
}
}
@@ -0,0 +1,48 @@
package com.adc.da.workFlow.service;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* @author tjzdw
* @description
* @date 2023/10/27
*/
@Service
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class ActSarLawsInformationEOService {
@Resource
private SarLawsInformationService informationService;
private static final Logger logger = LoggerFactory.getLogger(ActSarLawsInformationEOService.class);
public void processCreateLawsInformation(String lawsInformationInfo) {
SarLawsInformation sarLawsInformation = JSONObject.parseObject(lawsInformationInfo, SarLawsInformation.class);
JSONObject jsonObject = JSONObject.parseObject(lawsInformationInfo);
String applyUserId = jsonObject.getString("applyUserId");
String applyUserName = jsonObject.getString("applyUserName");
String approverId = jsonObject.getString("approverId");
String approverName = jsonObject.getString("approverName");
String createAndApproveBy = "";
// 判断发起人和审批人是否相同
if (approverId.equals(applyUserId)) {
createAndApproveBy = applyUserName + "(" + applyUserId + ")";
}else {
createAndApproveBy = applyUserName + "(" + applyUserId + ")," + approverName + "(" + approverId + ")";
}
sarLawsInformation.setCreateAndApproveBy(createAndApproveBy);
sarLawsInformation.setDownloadableBy(createAndApproveBy);
sarLawsInformation.setViewableBy(createAndApproveBy);
logger.info("政策法规资料入库:" + sarLawsInformation);
informationService.addLawsInformation(sarLawsInformation);
}
}
@@ -9,6 +9,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -26,78 +27,91 @@ public class SarLawsInformation extends BasePage implements Serializable {
/** /**
* 主键 * 主键
*/ */
@ApiModelProperty(value = "主键")
@TableId(value = "ID", type = IdType.ID_WORKER_STR) @TableId(value = "ID", type = IdType.ID_WORKER_STR)
private String id; private String id;
/** /**
* 一级资料类别 * 一级资料类别
*/ */
@ApiModelProperty("一级资料类别")
@TableField(value = "FIRST_TYPE") @TableField(value = "FIRST_TYPE")
private String firstType; private String firstType;
/** /**
* 一级资料类别名称 * 一级资料类别名称
*/ */
@ApiModelProperty(value = "一级资料类别名称")
@TableField(exist = false) @TableField(exist = false)
private String firstTypeName; private String firstTypeName;
/** /**
* 二级资料类别 * 二级资料类别
*/ */
@ApiModelProperty(value = "二级资料类别")
@TableField(value = "SECOND_TYPE") @TableField(value = "SECOND_TYPE")
private String secondType; private String secondType;
/** /**
* 二级资料类别名称 * 二级资料类别名称
*/ */
@ApiModelProperty(value = "二级资料类别名称")
@TableField(exist = false) @TableField(exist = false)
private String secondTypeName; private String secondTypeName;
/** /**
* 三级资料类别 * 三级资料类别
*/ */
@ApiModelProperty(value = "三级资料类别")
@TableField(value = "THIRD_TYPE") @TableField(value = "THIRD_TYPE")
private String thirdType; private String thirdType;
/** /**
* 三级资料类别名称 * 三级资料类别名称
*/ */
@ApiModelProperty(value = "三级资料类别名称")
@TableField(exist = false) @TableField(exist = false)
private String thirdTypeName; private String thirdTypeName;
/** /**
* 四级资料类别 * 四级资料类别
*/ */
@ApiModelProperty(value = "四级资料类别")
@TableField(value = "FOURTH_TYPE") @TableField(value = "FOURTH_TYPE")
private String fourthType; private String fourthType;
/** /**
* 四级资料类别名称 * 四级资料类别名称
*/ */
@ApiModelProperty(value = "四级资料类别名称")
@TableField(exist = false) @TableField(exist = false)
private String fourthTypeName; private String fourthTypeName;
/** /**
* 资料名称 * 资料名称
*/ */
@ApiModelProperty(value = "资料名称")
@TableField(value = "NAME") @TableField(value = "NAME")
private String name; private String name;
/** /**
* 资料归属部门 * 资料归属部门
*/ */
@ApiModelProperty(value = "资料归属部门")
@TableField(value = "DEPARTMENT") @TableField(value = "DEPARTMENT")
private String department; private String department;
/** /**
* 作者 * 作者
*/ */
@ApiModelProperty(value = "作者")
@TableField(value = "AUTHOR") @TableField(value = "AUTHOR")
private String author; private String author;
/** /**
* 上传时间 * 上传时间
*/ */
@ApiModelProperty(value = "上传时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "UPLOAD_TIME") @TableField(value = "UPLOAD_TIME")
@@ -106,59 +120,69 @@ public class SarLawsInformation extends BasePage implements Serializable {
/** /**
* 资料说明 * 资料说明
*/ */
@ApiModelProperty(value = "资料说明")
@TableField(value = "DESCRIPTION") @TableField(value = "DESCRIPTION")
private String description; private String description;
/** /**
* 资料文件 * 资料文件
*/ */
@ApiModelProperty(value = "资料文件")
@TableField(value = "INFORMATION_FILE") @TableField(value = "INFORMATION_FILE")
private String informationFile; private String informationFile;
/** /**
* 资料文件名称 * 资料文件名称
*/ */
@ApiModelProperty(value = "资料文件名称")
@TableField(exist = false) @TableField(exist = false)
private String informationFileName; private String informationFileName;
/** /**
* 可查看者,若设置为空则所有用户均可查看,若设置人员后,仅有可查看者可以查看文件信息。 * 可查看者,若设置为空则所有用户均可查看,若设置人员后,仅有可查看者可以查看文件信息。
*/ */
@ApiModelProperty(value = "可查看者")
@TableField(value = "VIEWABLE_BY") @TableField(value = "VIEWABLE_BY")
private String viewableBy; private String viewableBy;
/** /**
* 可下载者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可下载者可下载文件信息。 * 可下载者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可下载者可下载文件信息。
*/ */
@ApiModelProperty(value = "可下载者")
@TableField(value = "DOWNLOADABLE_BY") @TableField(value = "DOWNLOADABLE_BY")
private String downloadableBy; private String downloadableBy;
/** /**
* 创建人和审批人 * 创建人和审批人
*/ */
@ApiModelProperty(value = "创建人和审批人")
@TableField @TableField
private String createAndApproveBy; private String createAndApproveBy;
/** /**
* 树节点ID * 树节点ID
*/ */
@ApiModelProperty(value = "树节点ID")
private String treeNodeId; private String treeNodeId;
/** /**
* 树节点名称 * 树节点名称
*/ */
@ApiModelProperty(value = "树节点名称")
@TableField(exist = false) @TableField(exist = false)
private String treeNodeName; private String treeNodeName;
/** /**
* 逻辑删除,0可用,1不可用 * 逻辑删除,0可用,1不可用
*/ */
@ApiModelProperty(value = "逻辑删除")
@TableField(value = "VALID_FLAG") @TableField(value = "VALID_FLAG")
private Integer validFlag; private Integer validFlag;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "CREATE_TIME") @TableField(value = "CREATE_TIME")
@@ -167,6 +191,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/** /**
* 修改时间 * 修改时间
*/ */
@ApiModelProperty("修改时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "MODIFY_TIME") @TableField(value = "MODIFY_TIME")
@@ -176,18 +201,21 @@ public class SarLawsInformation extends BasePage implements Serializable {
/** /**
* 排序字段 * 排序字段
*/ */
@ApiModelProperty(value = "排序字段")
@TableField(exist = false) @TableField(exist = false)
private String sortField = "ID"; private String sortField = "ID";
/** /**
* 排序方式 * 排序方式
*/ */
@ApiModelProperty(value = "排序方式")
@TableField(exist = false) @TableField(exist = false)
private String sortMode = "asc"; private String sortMode = "asc";
/** /**
* 收藏ID * 收藏ID
*/ */
@ApiModelProperty(value = "收藏ID")
@TableField(exist = false) @TableField(exist = false)
private String collectId; private String collectId;
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation; import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService; import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao; import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -173,7 +174,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
fourthTypeList.add(dicTypeService.getDicTypeNameByDicCode(type)); fourthTypeList.add(dicTypeService.getDicTypeNameByDicCode(type));
} }
} }
sarLawsInformation.setFirstTypeName(String.join(",",fourthTypeList)); sarLawsInformation.setFourthTypeName(String.join(",",fourthTypeList));
} }
/** /**
@@ -212,7 +213,8 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name"); Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
Object oldTypeName = method.invoke(oldInfo); Object oldTypeName = method.invoke(oldInfo);
changes.add("\"" + field.getName() + "\"由\"" + oldTypeName + "\"改为\"" + String.join(",",typeNameList) + "\""); ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",",typeNameList) + "\"");
} else if ("informationFile".equals(field.getName())) { } else if ("informationFile".equals(field.getName())) {
List<String> fileNameList = new ArrayList<>(); List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) { if (StringUtils.isNotBlank(newValue)) {
@@ -226,10 +228,13 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name"); Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
Object oldTypeName = method.invoke(oldInfo); Object oldTypeName = method.invoke(oldInfo);
changes.add(field.getName() + "由\"" + oldTypeName + "\"改为\"" + String.join(",",fileNameList) + "\""); // 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",",fileNameList) + "\"");
} }
else { else {
changes.add("\"" + field.getName() + "\"由\"" + oldValue + "\"改为\"" + newValue + "\""); ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "由\"" + oldValue + "\"改为\"" + newValue + "\"");
} }
} }
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {