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("31","policyResearchGroupAttendMeeting");
// 政策法规资料入库流程
map.put("32","PolicyLawsInformationLibrary");
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 com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
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)
private String id;
/**
* 一级资料类别
*/
@ApiModelProperty("一级资料类别")
@TableField(value = "FIRST_TYPE")
private String firstType;
/**
* 一级资料类别名称
*/
@ApiModelProperty(value = "一级资料类别名称")
@TableField(exist = false)
private String firstTypeName;
/**
* 二级资料类别
*/
@ApiModelProperty(value = "二级资料类别")
@TableField(value = "SECOND_TYPE")
private String secondType;
/**
* 二级资料类别名称
*/
@ApiModelProperty(value = "二级资料类别名称")
@TableField(exist = false)
private String secondTypeName;
/**
* 三级资料类别
*/
@ApiModelProperty(value = "三级资料类别")
@TableField(value = "THIRD_TYPE")
private String thirdType;
/**
* 三级资料类别名称
*/
@ApiModelProperty(value = "三级资料类别名称")
@TableField(exist = false)
private String thirdTypeName;
/**
* 四级资料类别
*/
@ApiModelProperty(value = "四级资料类别")
@TableField(value = "FOURTH_TYPE")
private String fourthType;
/**
* 四级资料类别名称
*/
@ApiModelProperty(value = "四级资料类别名称")
@TableField(exist = false)
private String fourthTypeName;
/**
* 资料名称
*/
@ApiModelProperty(value = "资料名称")
@TableField(value = "NAME")
private String name;
/**
* 资料归属部门
*/
@ApiModelProperty(value = "资料归属部门")
@TableField(value = "DEPARTMENT")
private String department;
/**
* 作者
*/
@ApiModelProperty(value = "作者")
@TableField(value = "AUTHOR")
private String author;
/**
* 上传时间
*/
@ApiModelProperty(value = "上传时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "UPLOAD_TIME")
@@ -106,59 +120,69 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 资料说明
*/
@ApiModelProperty(value = "资料说明")
@TableField(value = "DESCRIPTION")
private String description;
/**
* 资料文件
*/
@ApiModelProperty(value = "资料文件")
@TableField(value = "INFORMATION_FILE")
private String informationFile;
/**
* 资料文件名称
*/
@ApiModelProperty(value = "资料文件名称")
@TableField(exist = false)
private String informationFileName;
/**
* 可查看者,若设置为空则所有用户均可查看,若设置人员后,仅有可查看者可以查看文件信息。
*/
@ApiModelProperty(value = "可查看者")
@TableField(value = "VIEWABLE_BY")
private String viewableBy;
/**
* 可下载者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可下载者可下载文件信息。
*/
@ApiModelProperty(value = "可下载者")
@TableField(value = "DOWNLOADABLE_BY")
private String downloadableBy;
/**
* 创建人和审批人
*/
@ApiModelProperty(value = "创建人和审批人")
@TableField
private String createAndApproveBy;
/**
* 树节点ID
*/
@ApiModelProperty(value = "树节点ID")
private String treeNodeId;
/**
* 树节点名称
*/
@ApiModelProperty(value = "树节点名称")
@TableField(exist = false)
private String treeNodeName;
/**
* 逻辑删除,0可用,1不可用
*/
@ApiModelProperty(value = "逻辑删除")
@TableField(value = "VALID_FLAG")
private Integer validFlag;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "CREATE_TIME")
@@ -167,6 +191,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField(value = "MODIFY_TIME")
@@ -176,18 +201,21 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 排序字段
*/
@ApiModelProperty(value = "排序字段")
@TableField(exist = false)
private String sortField = "ID";
/**
* 排序方式
*/
@ApiModelProperty(value = "排序方式")
@TableField(exist = false)
private String sortMode = "asc";
/**
* 收藏ID
*/
@ApiModelProperty(value = "收藏ID")
@TableField(exist = false)
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.service.SarLawsInformationService;
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -173,7 +174,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
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);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
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())) {
List<String> fileNameList = new ArrayList<>();
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);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
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 {
changes.add("\"" + field.getName() + "\"\"" + oldValue + "\"改为\"" + newValue + "\"");
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
}
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {