package com.ningdatech.pmapi.sys.processDef;

import com.alibaba.fastjson.JSON;
import org.junit.Test;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * @Classname ProcessTest
 * @Description
 * @Date 2023/2/4 9:54
 * @Author PoffyZhang
 */
public class ProcessDefTest {


    @Test
    public void test() {
        String processStr = "{\"id\":\"node_039152532706\",\"name\":\"审批单位\",\"type\":\"ORG\",\"props\":{\"regionCode\":\"\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\",\"subNode\":[]},\"children\":{},\"parentId\":\"root\"}";

        Node node = JSON.parseObject(processStr, Node.class);

        OrgProps props = JSON.parseObject(node.getProps().toString(), OrgProps.class);
        System.out.println(props.getOrgCode());
    }

    @Test
    public void date(){
        System.out.println(LocalDateTime.parse("2023-02-05 10:25", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")));
    }

    public static class OrgProps {
        private String regionCode;

        private String orgCode;

        private String type;

        private String processDefId;

        private List<Node> subNode;

        public String getRegionCode() {
            return regionCode;
        }

        public void setRegionCode(String regionCode) {
            this.regionCode = regionCode;
        }

        public String getOrgCode() {
            return orgCode;
        }

        public void setOrgCode(String orgCode) {
            this.orgCode = orgCode;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getProcessDefId() {
            return processDefId;
        }

        public void setProcessDefId(String processDefId) {
            this.processDefId = processDefId;
        }

        public List<Node> getSubNode() {
            return subNode;
        }

        public void setSubNode(List<Node> subNode) {
            this.subNode = subNode;
        }
    }
}
