|
@@ -0,0 +1,260 @@
|
|
|
+package com.galaxis.manatee.entity.chuanyun.data.object;
|
|
|
+
|
|
|
+import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
+import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.EqualsAndHashCode;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import javax.persistence.Entity;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by IntelliJ IDEA.
|
|
|
+ * User: xuj
|
|
|
+ * Date: 2020/7/23
|
|
|
+ * @author xuj
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@EqualsAndHashCode(callSuper = true)
|
|
|
+@Data
|
|
|
+@Entity(name = "CHUANYUN_PROJECT_CHANGE")
|
|
|
+@JsonIgnoreProperties(ignoreUnknown = true)
|
|
|
+
|
|
|
+public class ChuanyunProjectChangeDO extends BasicDO {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 表名
|
|
|
+ */
|
|
|
+ public static final String SCHEMA_CODE ="D00178958e5a5f6ce9f4bf481d293ffa07d69ba";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 标题
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000001")
|
|
|
+ private String title;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抄送人
|
|
|
+ */
|
|
|
+ @JsonProperty("cc_userids")
|
|
|
+ private String ccUserids;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作
|
|
|
+ */
|
|
|
+ @JsonProperty("biz_action")
|
|
|
+ private String bizAction;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建时间
|
|
|
+ */
|
|
|
+ @JsonProperty("create_time")
|
|
|
+ private LocalDateTime createTime;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 结束时间
|
|
|
+ */
|
|
|
+ @JsonProperty("finish_time")
|
|
|
+ private LocalDateTime finishTime;
|
|
|
+
|
|
|
+ @JsonProperty("main_process_instance_id")
|
|
|
+ private String mainProcessInstanceId;
|
|
|
+
|
|
|
+ @JsonProperty("is_cancel")
|
|
|
+ private int isCancel;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起人userId
|
|
|
+ */
|
|
|
+ @JsonProperty("originator_userid")
|
|
|
+ private String originatorUserid;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起人姓名
|
|
|
+ */
|
|
|
+ @JsonProperty("originator_User_Name")
|
|
|
+ private String originatorUserName;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起部门id
|
|
|
+ */
|
|
|
+ @JsonProperty("originator_dept_id")
|
|
|
+ private String originatorDeptId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起部门名称
|
|
|
+ */
|
|
|
+ @JsonProperty("originator_Dept_Name")
|
|
|
+ private String originatorDeptName;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审批结果: 同意 和 不同意
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000015")
|
|
|
+ private String approvalResult;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审批实例业务编号
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000014")
|
|
|
+ private String businessId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更类型
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000002")
|
|
|
+ private String changeType;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目名称
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000003")
|
|
|
+ private String projectName;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更事项
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000004")
|
|
|
+ private String changes;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目合同内容是否变更
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000005")
|
|
|
+ private String projectContractContentIsChange;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 采购合同内容是否变更
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000006")
|
|
|
+ private String procurementContractContentIsChange;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更方案要求完成日期
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000007")
|
|
|
+ private String completeTime;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更涉及部门
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000008")
|
|
|
+ private String changeInvolveDeptName;
|
|
|
+
|
|
|
+ @JsonProperty("F0000013")
|
|
|
+ private String result;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更内容描述
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000010")
|
|
|
+ private String changeContentDescribe;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更影响描述
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000011")
|
|
|
+ private String changeInfluenceDescribe;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 备注
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000012")
|
|
|
+ private String remarks;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请人Id
|
|
|
+ */
|
|
|
+ @JsonProperty("F0000016")
|
|
|
+ private String projectChangeUserId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据ProcessInstanceTopVo获得chuanyunProjectChangeDO
|
|
|
+ * @param processInstanceTopVo 传输数据
|
|
|
+ * @return 保存数据
|
|
|
+ */
|
|
|
+ public static ChuanyunProjectChangeDO fromProjectChangeDTO(OapiProcessinstanceGetResponse.ProcessInstanceTopVo processInstanceTopVo){
|
|
|
+ ChuanyunProjectChangeDO chuanyunProjectChangeDO = new ChuanyunProjectChangeDO();
|
|
|
+ chuanyunProjectChangeDO.setIsCancel(0);
|
|
|
+ if(processInstanceTopVo.getOperationRecords()!= null) {
|
|
|
+ if(processInstanceTopVo.getOperationRecords().get(0).getUserid().equals(processInstanceTopVo.getOperationRecords().get(processInstanceTopVo.getOperationRecords().size() -1).getUserid())
|
|
|
+ && processInstanceTopVo.getOperationRecords().get(0).getUserid().equals(processInstanceTopVo.getOriginatorUserid()) ) {
|
|
|
+ if(processInstanceTopVo.getOperationRecords().get(0).getOperationType().equals("START_PROCESS_INSTANCE")
|
|
|
+ && processInstanceTopVo.getOperationRecords().get(processInstanceTopVo.getOperationRecords().size() -1).getOperationType().equals("TERMINATE_PROCESS_INSTANCE")) {
|
|
|
+ chuanyunProjectChangeDO.setIsCancel(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(processInstanceTopVo, chuanyunProjectChangeDO);
|
|
|
+ List<OapiProcessinstanceGetResponse.FormComponentValueVo> formComponentList = processInstanceTopVo.getFormComponentValues();
|
|
|
+ if(formComponentList != null && formComponentList.size() > 0) {
|
|
|
+ for (OapiProcessinstanceGetResponse.FormComponentValueVo formComponentValueVo : formComponentList) {
|
|
|
+ if ("变更类型".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setChangeType(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("项目名称".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setProjectName(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("涉及变更项".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setChanges(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("销售合同内容是否变更".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setProjectContractContentIsChange(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("采购合同内容是否变更".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setProcurementContractContentIsChange(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("变更方案要求完成日期".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setCompleteTime(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("变更涉及部门".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setChangeInvolveDeptName(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("变更内容描述".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setChangeContentDescribe(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("变更影响描述".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setChangeInfluenceDescribe(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ if ("备注".equals(formComponentValueVo.getName())) {
|
|
|
+ chuanyunProjectChangeDO.setRemarks(formComponentValueVo.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String statusA = processInstanceTopVo.getStatus();
|
|
|
+ if ("COMPLETED".equals(processInstanceTopVo.getStatus())){
|
|
|
+ chuanyunProjectChangeDO.setStatus(1);
|
|
|
+ chuanyunProjectChangeDO.setApprovalResult("流程已结束");
|
|
|
+ }else if("RUNNING".equals(statusA)){
|
|
|
+ chuanyunProjectChangeDO.setStatus(2);
|
|
|
+ chuanyunProjectChangeDO.setApprovalResult("流程进行中");
|
|
|
+ }else if ("TERMINATED".equals(statusA)){
|
|
|
+ chuanyunProjectChangeDO.setStatus(3);
|
|
|
+ chuanyunProjectChangeDO.setApprovalResult("流程已作废");
|
|
|
+ }
|
|
|
+ Date cratedate = new Date();
|
|
|
+ LocalDateTime crateDateTime = LocalDateTime.now();
|
|
|
+ cratedate = processInstanceTopVo.getCreateTime();
|
|
|
+ crateDateTime = cratedate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ chuanyunProjectChangeDO.setCreateTime(crateDateTime);
|
|
|
+ Date finishdate = new Date();
|
|
|
+ LocalDateTime finishDateTime = LocalDateTime.now();
|
|
|
+ finishdate = processInstanceTopVo.getFinishTime();
|
|
|
+ if(finishdate != null) {
|
|
|
+ finishDateTime = finishdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ chuanyunProjectChangeDO.setFinishTime(finishDateTime);
|
|
|
+ }
|
|
|
+ chuanyunProjectChangeDO.setTitle(chuanyunProjectChangeDO.getCreateTime().toLocalDate() + " " + chuanyunProjectChangeDO.getTitle() + " " + chuanyunProjectChangeDO.getBusinessId());
|
|
|
+ chuanyunProjectChangeDO.setObjectId(UUID.randomUUID().toString());
|
|
|
+ return chuanyunProjectChangeDO;
|
|
|
+ }
|
|
|
+}
|