feature: 完善工建

main
Leo 1 year ago
parent 82e16a24d8
commit 02c3ef21eb

@ -28,7 +28,7 @@ var engSysCmd = &cobra.Command{
} }
func run(c *config.Config) { func run(c *config.Config) {
j, _ := filekit.ReadString("test1.json") j, _ := filekit.ReadString("testo.json")
data := gjson.Get(j, "data").Array() data := gjson.Get(j, "data").Array()
for _, v := range data { for _, v := range data {
name := v.Get("name").String() name := v.Get("name").String()
@ -36,17 +36,18 @@ func run(c *config.Config) {
if name == c.Step && process == c.Process { if name == c.Step && process == c.Process {
logkit.Info("***现在开始处理***:" + gjson.Get(v.String(), "tasktitle").String()) logkit.Info("***现在开始处理***:" + gjson.Get(v.String(), "tasktitle").String())
_ = commonkit.RecoverFuncWrapper(func() { _ = commonkit.RecoverFuncWrapper(func() {
service.ReqAccConfirm(v.Get("processInstanceId").String(), v.Get("id").String()) //service.ReqAccConfirm(v.Get("processInstanceId").String(), v.Get("id").String())
//service.ReqWithdrawAssign(v.Get("processInstanceId").String()) service.ReqWithdrawAssign(v.Get("processInstanceId").String())
//service.ReqAccDelivery(v.Get("processInstanceId").String(), v.Get("id").String())
}) })
time.Sleep(5 * time.Second) time.Sleep(1 * time.Second)
} }
} }
} }
func defFlagsEng(cmd *cobra.Command) { func defFlagsEng(cmd *cobra.Command) {
cmd.Flags().String(config.EngSysProcess, "", "Specify the process to be processed, supporting: XQXJ,ZQLX,LYXJ") cmd.Flags().String(config.EngSysProcess, "", "Specify the process to be processed, supporting: XQXJ,ZQLX,LYXJ,YSJF")
cmd.Flags().String(config.EngSysStep, "", "Specify the steps to be processed, supporting: YSQR") cmd.Flags().String(config.EngSysStep, "", "Specify the steps to be processed, supporting: YSQR,JFSQ")
cmd.Flags().String(config.EngSysSid, "", "Specify the sid") cmd.Flags().String(config.EngSysSid, "", "Specify the sid")
//TODO 验收确认阶段,还需要指定交付的人,暂时写死在代码里,目前只适用于周一彬,如果需要调整,则暂时先在代码里调整 //TODO 验收确认阶段,还需要指定交付的人,暂时写死在代码里,目前只适用于周一彬,如果需要调整,则暂时先在代码里调整
} }

@ -22,6 +22,8 @@ func Init() {
switch step { switch step {
case EngSysStepYSQR: case EngSysStepYSQR:
configkit.Set(EngSysStep, StepYSQR) configkit.Set(EngSysStep, StepYSQR)
case EngSysStepJFSQ:
configkit.Set(EngSysStep, StepJFSQ)
default: default:
logkit.Fatal("EngSysStep Not Support!") logkit.Fatal("EngSysStep Not Support!")
} }
@ -37,6 +39,8 @@ func Init() {
configkit.Set(EngSysProcess, ProcessNewBuilding) configkit.Set(EngSysProcess, ProcessNewBuilding)
case EngSysProcessZQLX: case EngSysProcessZQLX:
configkit.Set(EngSysProcess, ProcessNewLX) configkit.Set(EngSysProcess, ProcessNewLX)
case EngSysProcessYSJF:
configkit.Set(EngSysProcess, ProcessYSJF)
default: default:
logkit.Fatal("EngSysStep Not Support!") logkit.Fatal("EngSysStep Not Support!")
} }

@ -8,10 +8,12 @@ const (
const ( const (
EngSysStepYSQR = "YSQR" EngSysStepYSQR = "YSQR"
EngSysStepJFSQ = "JFSQ"
) )
const ( const (
StepYSQR = "验收确认" StepYSQR = "验收确认"
StepJFSQ = "验收交付申请"
) )
// config里入参 // config里入参
@ -19,6 +21,7 @@ const (
EngSysProcessXQXJ = "XQXJ" EngSysProcessXQXJ = "XQXJ"
EngSysProcessZQLX = "ZQLX" //TODO 这个还不确定是不是就是零星 EngSysProcessZQLX = "ZQLX" //TODO 这个还不确定是不是就是零星
EngSysProcessLYXJ = "LYXJ" EngSysProcessLYXJ = "LYXJ"
EngSysProcessYSJF = "YSJF"
) )
// 替换成系统能识别的参数 // 替换成系统能识别的参数
@ -26,6 +29,7 @@ const (
ProcessNewBuilding = "JkDkhfgProcess" //楼宇新建 ProcessNewBuilding = "JkDkhfgProcess" //楼宇新建
ProcessNewHouse = "GkXjGzKrProcess" //小区新建 ProcessNewHouse = "GkXjGzKrProcess" //小区新建
ProcessNewLX = "ZQKHProcess" //政企零星 //TODO 这个还不确定 ProcessNewLX = "ZQKHProcess" //政企零星 //TODO 这个还不确定
ProcessYSJF = "YSJFProcess"
) )
const UrlPrefix = "http://10.202.2.108:8086" const UrlPrefix = "http://10.202.2.108:8086"

@ -0,0 +1,62 @@
package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"reflect"
)
/*
/zjgd/frm/acceptanceComfirmController/backFlow
*/
/*
*/
type BackFlow struct {
DeliveryId string `map:"deliveryId"`
ParentProcInsId string `map:"parentProcInsId"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewBackFlow(deliveryId, parenProcInsId string) *BackFlow {
backFlow := new(BackFlow)
backFlow.DeliveryId = deliveryId
backFlow.ParentProcInsId = parenProcInsId
backFlow.Ranstr = cryptokit.RandomStr(true, 10, 32)
backFlow.Timestamp = cryptokit.GetTimeStamp()
return backFlow
}
func (th *BackFlow) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *BackFlow) structToMap() map[string]string {
result := make(map[string]string)
t := reflect.TypeOf(*th)
v := reflect.ValueOf(*th)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
value := v.Field(i)
// Use the tag value as the key in the map, if it exists; otherwise, use the field name.
tag := field.Tag.Get("map")
if tag == "" {
tag = field.Name
}
result[tag] = value.String()
}
return result
}
func (th *BackFlow) encrypt() {
v := reflect.ValueOf(th).Elem()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
if field.CanSet() {
field.SetString(cryptokit.Encrypt(field.String()))
}
}
}

@ -0,0 +1,55 @@
package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"reflect"
)
/*
/zjgd/frm/acceptanceComfirmController/goAccDeliveryEdit?businessKey=GRNd813lMc5xouGwqRPf7OJtFi2VoRa91V0vs2R7wHAZXvuFFHppwhcX5huFVrN3&processInstanceId=R5xOyY/6RHNkvnBAhuM2ng==&taskDefinitionKey=5LZPb0vNSm2PgEmBIHWeaQ==&taskId=gbXnKZwFUpB3HaRgHukedg==&startLink=DuAb1TXHvyGSasSql6BmZw==&endLink=DuAb1TXHvyGSasSql6BmZw==&taskflag=vROIUK5V0hGnD6kIyfnQBA==&ranstr=rWoHhc1OImhN1akYk0kyjhbJXpY6vUlP7dhw4pIMErI=&timestamp=07I1MQdK8OJUh8R5uzl0RQ==&_=1723698475861
*/
/*
1jfPushProcess使,ToAcceptanceConfirm todo
*/
type GoAccDeliveryEdit struct {
BusinessKey string `map:"businessKey"`
ProcessInstanceId string `map:"processInstanceId"`
TaskDefinitionKey string `map:"taskDefinitionKey"`
TaskId string `map:"taskId"`
StartLink string `map:"startLink"`
EndLink string `map:"endLink"`
TaskFlag string `map:"taskflag"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
TimestampPro string `map:"_"` //工建原始请求key就这样
}
func NewGoAccDeliveryEdit(businessKey, processInstId, taskId string) *GoAccDeliveryEdit {
goAccDeliveryEdit := new(GoAccDeliveryEdit)
goAccDeliveryEdit.BusinessKey = businessKey
goAccDeliveryEdit.ProcessInstanceId = processInstId
goAccDeliveryEdit.TaskDefinitionKey = "JFSQ"
goAccDeliveryEdit.TaskId = taskId //等于id
goAccDeliveryEdit.StartLink = "false"
goAccDeliveryEdit.EndLink = "false"
goAccDeliveryEdit.TaskFlag = "db"
goAccDeliveryEdit.Ranstr = cryptokit.RandomStr(true, 10, 32)
goAccDeliveryEdit.Timestamp = cryptokit.GetTimeStamp()
goAccDeliveryEdit.encrypt()
//这个最终不加密
goAccDeliveryEdit.TimestampPro = cryptokit.GetTimeStamp()
return goAccDeliveryEdit
}
func (th *GoAccDeliveryEdit) encrypt() {
v := reflect.ValueOf(th).Elem()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
if field.CanSet() {
field.SetString(cryptokit.Encrypt(field.String()))
}
}
}

@ -0,0 +1,77 @@
package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"reflect"
)
/*
/zjgd/frm/acceptanceComfirmController/jfPushProcess
*/
/*
*/
type JFPushProcess struct {
ProcessInstanceId string `map:"processInstanceId"`
TaskId string `map:"taskId"`
DeliveryId string `map:"deliveryId"`
TaskDefinitionKey string `map:"taskDefinitionKey"`
Assignee string `map:"assignee"`
Comment string `map:"comment"`
HandleType string `map:"handleType"`
BusinessKey string `map:"businessKey"`
Withdraw string `map:"withdraw"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewJFPushProcess(processInsId, taskId, deliveryId, businessKey string) *JFPushProcess {
jfPushProcess := new(JFPushProcess)
jfPushProcess.ProcessInstanceId = processInsId
jfPushProcess.TaskId = taskId
jfPushProcess.DeliveryId = deliveryId
jfPushProcess.TaskDefinitionKey = "JFQR"
jfPushProcess.Assignee = "3072887" //todo 每个人都是这个吗
jfPushProcess.Comment = "请确认"
jfPushProcess.HandleType = "1"
jfPushProcess.BusinessKey = businessKey
jfPushProcess.Withdraw = "0"
jfPushProcess.Ranstr = cryptokit.RandomStr(true, 10, 32)
jfPushProcess.Timestamp = cryptokit.GetTimeStamp()
return jfPushProcess
}
// GenReqParam 返回加密后的请求参数
func (th *JFPushProcess) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *JFPushProcess) structToMap() map[string]string {
result := make(map[string]string)
t := reflect.TypeOf(*th)
v := reflect.ValueOf(*th)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
value := v.Field(i)
// Use the tag value as the key in the map, if it exists; otherwise, use the field name.
tag := field.Tag.Get("map")
if tag == "" {
tag = field.Name
}
result[tag] = value.String()
}
return result
}
func (th *JFPushProcess) encrypt() {
v := reflect.ValueOf(th).Elem()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
if field.CanSet() {
field.SetString(cryptokit.Encrypt(field.String()))
}
}
}

@ -0,0 +1,231 @@
package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"cu-helper/cus-eng-con-sys/util"
"github.com/mizuki1412/go-core-kit/library/mathkit"
"github.com/spf13/cast"
"reflect"
)
/*
/zjgd/frm/acceptanceComfirmController/pushProcess.action
*/
/*
PushProcess
*/
//tip 工建能写出这么多form参数的的程序员,也是个人才,不能用json吗?我真服了你!
type PushProcess struct {
AccId string `map:"accId"`
Token string `map:"token"`
RemandId string `map:"remandId"`
RemandCode string `map:"remandCode"`
IsSplitedRemand string `map:"isSplitedRemand"`
IsCross string `map:"isCross"`
InvestmentConfigId string `map:"investmentConfigId"`
IsGrid string `map:"isGrid"`
GridId string `map:"gridId"`
AttachGrid string `map:"attachGrid"`
ResourceGridOrg string `map:"resourceGridOrg"`
RemandCreateBy string `map:"remandCreateBy"`
BuildAttr string `map:"buildAttr"`
BussCode string `map:"bussCode"`
Prov string `map:"prov"`
City string `map:"city"`
County string `map:"county"`
LinkCode string `map:"linkCode"`
SpecC string `map:"specC"`
IsBd string `map:"isBd"`
ProcessInstId string `map:"processInstId"`
RemandName string `map:"remandName"`
ProjectName string `map:"projectName"`
ProjectCode string `map:"projectCode"`
RemandCreateName string `map:"remandCreateName"`
RemandTouzi string `map:"remandTouzi"`
ProjectManagerName string `map:"projectManagerName"`
RemandCreatedDate string `map:"remandCreatedDate"`
PdmCreatedName string `map:"pdmCreatedName"`
PdmCreatedDate string `map:"pdmCreatedDate"`
ReplyDate string `map:"replyDate"`
ReplyInvestment string `map:"replyInvestment"`
ActStartDate string `map:"actStartDate"`
ActOrgName string `map:"actOrgName"`
ActFinishDate string `map:"actFinishDate"`
AccApplyDesc string `map:"accApplyDesc"`
EquipCost string `map:"equipCost"`
EnginCost string `map:"enginCost"`
SafetyProdCost string `map:"safetyProdCost"`
SurveyCost string `map:"surveyCost"`
SupervisionCost string `map:"supervisionCost"`
OtherCost string `map:"otherCost"`
AccInvestment string `map:"accInvestment"`
IsInstall string `map:"isInstall"`
PasteCode string `map:"pasteCode"`
OnuLightWane string `map:"onuLightWane"`
WorkAcc string `map:"workAcc"`
MaterialAcc string `map:"materialAcc"`
IsTestSpeed string `map:"isTestSpeed"`
UserRate string `map:"userRate"`
TestSpeedAcc string `map:"testSpeedAcc"`
BuildingNum string `map:"buildingNum"`
PortNum string `map:"portNum"`
InstallNum string `map:"installNum"`
UnconditionalInstall string `map:"unconditionalInstall"`
IsRecordAll string `map:"isRecordAll"`
ResourcesAcc string `map:"resourcesAcc"`
BeamasPlitter string `map:"beamasPlitter"`
OtherNetworkResource string `map:"otherNetworkResource"`
//DoubleExcellent string `map:"doubleExcellent"` //是否双优
IsSupClock string `map:"isSupClock"`
NotClockName string `map:"notClockName"`
NotClockDesc string `map:"notClockDesc"`
PassOrNo string `map:"passOrNo"`
RadioName0 string `map:"radioName_0"`
RecordReason string `map:"recordReason"`
RadioName1 string `map:"radioName_1"`
RadioName2 string `map:"radioName_2"`
RadioName3 string `map:"radioName_3"`
LeavRadio string `map:"leavRadio"`
AccRemainingProb string `map:"accRemainingProb"`
AccConfirmDesc string `map:"accConfirmDesc"`
//最后全部点完后,验收确认多几个参数
TaskDefinitionKey string `map:"taskDefinitionKey"`
BusinessKey string `map:"businessKey"`
Comment string `map:"comment"`
Assignee string `map:"assignee"`
ProcessInstanceId string `map:"processInstanceId"`
TaskId string `map:"taskId"`
HandleType string `map:"handleType"`
Withdraw string `map:"withdraw"`
IndInfo string `map:"indInfo"`
//最后全部点完后,验收确认多几个参数
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
// NewPushProcess remandId=businessKey
func NewPushProcess(taskId, token, remandId, html1, html2 string) *PushProcess {
pushProcess := new(PushProcess)
pushProcess.AccId = util.RegexpFindFirst(html1, `"accId":"([^"]+)"`)
pushProcess.Token = token
pushProcess.RemandId = remandId
pushProcess.RemandCode = util.RegexpFindFirst(html1, `"remandCode":"([^"]+)"`)
pushProcess.IsSplitedRemand = util.RegexpFindFirst(html1, `"isSplitedRemand":"([^"]+)"`)
pushProcess.IsCross = util.HTMLContentFindFirst(html1, "isCross")
pushProcess.InvestmentConfigId = util.HTMLContentFindFirst(html1, "investmentConfigId")
pushProcess.IsGrid = util.HTMLContentFindFirst(html1, "isGrid")
pushProcess.GridId = util.HTMLContentFindFirst(html1, "gridId")
pushProcess.AttachGrid = util.HTMLContentFindFirst(html1, "attachGrid")
pushProcess.ResourceGridOrg = util.HTMLContentFindFirst(html1, "resourceGridOrg")
pushProcess.RemandCreateBy = util.HTMLContentFindFirst(html1, "remandCreateBy")
pushProcess.BuildAttr = util.HTMLContentFindFirst(html1, "buildAttr")
pushProcess.BussCode = util.HTMLContentFindFirst(html1, "bussCode")
pushProcess.Prov = util.HTMLContentFindFirst(html1, "prov")
pushProcess.City = util.HTMLContentFindFirst(html1, "city")
pushProcess.County = util.HTMLContentFindFirst(html1, "county")
pushProcess.LinkCode = util.HTMLContentFindFirst(html1, "linkCode")
pushProcess.SpecC = util.HTMLContentFindFirst(html1, "specC")
pushProcess.IsBd = util.HTMLContentFindFirst(html1, "isBd")
pushProcess.ProcessInstId = util.HTMLContentFindFirst(html1, "processInstId")
pushProcess.RemandName = util.RegexpFindFirst(html1, `"remandName":"([^"]+)"`)
pushProcess.ProjectName = util.HTMLContentFindFirst(html2, "projectName")
pushProcess.ProjectCode = util.HTMLContentFindFirst(html2, "projectCode")
pushProcess.RemandCreateName = util.HTMLContentFindFirst(html2, "remandCreateName")
pushProcess.RemandTouzi = util.HTMLContentFindFirst(html2, "remandTouzi")
pushProcess.ProjectManagerName = util.HTMLContentFindFirst(html2, "projectManagerName")
pushProcess.RemandCreatedDate = util.HTMLContentFindFirst(html2, "remandCreatedDate")
pushProcess.PdmCreatedName = util.HTMLContentFindFirst(html2, "pdmCreatedName")
pushProcess.PdmCreatedDate = util.HTMLContentFindFirst(html2, "pdmCreatedDate")
pushProcess.ReplyDate = util.HTMLContentFindFirst(html2, "replyDate")
pushProcess.ReplyInvestment = util.HTMLContentFindFirst(html2, "replyInvestment")
pushProcess.ActStartDate = util.HTMLContentFindFirst(html2, "actStartDate")
pushProcess.ActOrgName = util.HTMLContentFindFirst(html2, "actOrgName")
pushProcess.ActFinishDate = util.HTMLContentFindFirst(html2, "actFinishDate")
pushProcess.AccApplyDesc = util.HTMLContentFindFirst(html1, "accApplyDesc")
pushProcess.EquipCost = util.RegexpFindFirst(html1, `"equipCost":(\d+(\.\d+)?)`)
pushProcess.EnginCost = util.RegexpFindFirst(html1, `"enginCost":(\d+(\.\d+)?)`)
pushProcess.SafetyProdCost = util.RegexpFindFirst(html1, `"safetyProdCost":(\d+(\.\d+)?)`)
pushProcess.SurveyCost = util.RegexpFindFirst(html1, `"surveyCost":(\d+(\.\d+)?)`)
pushProcess.SupervisionCost = util.RegexpFindFirst(html1, `"supervisionCost":(\d+(\.\d+)?)`)
pushProcess.OtherCost = util.RegexpFindFirst(html1, `"otherCost":(\d+(\.\d+)?)`)
pushProcess.AccInvestment = cast.ToString(mathkit.FloatRound(cast.ToFloat64(pushProcess.EquipCost)+cast.ToFloat64(pushProcess.EnginCost)+cast.ToFloat64(pushProcess.SafetyProdCost)+cast.ToFloat64(pushProcess.SurveyCost)+cast.ToFloat64(pushProcess.SupervisionCost)+cast.ToFloat64(pushProcess.OtherCost), 2))
pushProcess.IsInstall = "ALL"
pushProcess.PasteCode = "1"
pushProcess.OnuLightWane = "DOWN"
pushProcess.WorkAcc = "1"
pushProcess.MaterialAcc = "1"
pushProcess.IsTestSpeed = "1"
pushProcess.UserRate = "1000"
pushProcess.TestSpeedAcc = "1"
pushProcess.BuildingNum = util.RegexpFindFirst(html1, `"buildingNum":(\d+(\.\d+)?)`)
pushProcess.PortNum = util.RegexpFindFirst(html1, `"portNum":(\d+(\.\d+)?)`)
pushProcess.InstallNum = util.RegexpFindFirst(html1, `"installNum":(\d+(\.\d+)?)`)
pushProcess.UnconditionalInstall = "ALL"
pushProcess.IsRecordAll = "1"
pushProcess.ResourcesAcc = "1"
pushProcess.BeamasPlitter = "1"
pushProcess.OtherNetworkResource = ""
//pushProcess.DoubleExcellent = "0" //是否双优
pushProcess.IsSupClock = "0"
pushProcess.NotClockName = "无需"
pushProcess.NotClockDesc = "无需"
pushProcess.PassOrNo = "1"
pushProcess.RadioName0 = "on"
pushProcess.RecordReason = ""
pushProcess.RadioName1 = "on"
pushProcess.RadioName2 = "on"
pushProcess.RadioName3 = "on"
pushProcess.LeavRadio = "1"
pushProcess.AccRemainingProb = ""
pushProcess.AccConfirmDesc = ""
pushProcess.TaskDefinitionKey = "endevent1"
pushProcess.BusinessKey = util.RegexpFindFirst(html1, `"accId":"([^"]+)"`)
pushProcess.Comment = "完成"
pushProcess.Assignee = ""
pushProcess.ProcessInstanceId = util.HTMLContentFindFirst(html1, "processInstId")
pushProcess.TaskId = taskId
pushProcess.HandleType = "1"
pushProcess.Withdraw = "0"
pushProcess.IndInfo = ""
pushProcess.Ranstr = cryptokit.RandomStr(true, 10, 32)
pushProcess.Timestamp = cryptokit.GetTimeStamp()
return pushProcess
}
// GenReqParam 返回加密后的请求参数
func (th *PushProcess) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *PushProcess) structToMap() map[string]string {
result := make(map[string]string)
t := reflect.TypeOf(*th)
v := reflect.ValueOf(*th)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
value := v.Field(i)
// Use the tag value as the key in the map, if it exists; otherwise, use the field name.
tag := field.Tag.Get("map")
if tag == "" {
tag = field.Name
}
result[tag] = value.String()
}
return result
}
func (th *PushProcess) encrypt() {
v := reflect.ValueOf(th).Elem()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
if field.CanSet() {
field.SetString(cryptokit.Encrypt(field.String()))
}
}
}

@ -0,0 +1,56 @@
package service
import (
"cu-helper/cus-eng-con-sys/config"
"cu-helper/cus-eng-con-sys/cryptokit"
"cu-helper/cus-eng-con-sys/model"
"cu-helper/cus-eng-con-sys/util"
"github.com/go-resty/resty/v2"
"github.com/mizuki1412/go-core-kit/class/exception"
"github.com/mizuki1412/go-core-kit/service/logkit"
"strings"
"time"
)
// ReqAccDelivery 验收确认请求
/*
1deliveryId
2businessKey
3
*/
func ReqAccDelivery(processInsId, taskId string) {
businessKey := getRemandId(processInsId, taskId)
deliveryId := getDeliveryId(processInsId, taskId, businessKey)
jfPushProcess(processInsId, taskId, deliveryId, businessKey)
}
func jfPushProcess(processInsId, taskId, deliveryId, businessKey string) {
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
header := h.GenReqParam()
f := model.NewJFPushProcess(processInsId, taskId, deliveryId, businessKey)
form := f.GenReqParam()
client := resty.New().SetRetryCount(5).SetRetryWaitTime(18 * time.Second)
resp, err := client.R().
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/jfPushProcess")
if err != nil {
panic(exception.New(err.Error()))
}
data := strings.Trim(resp.String(), `"`)
logkit.Info("jfPushProcess:" + cryptokit.Decrypt(data))
}
func getDeliveryId(processInsId, taskId, businessKey string) string {
client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second)
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
header := h.GenReqParam()
query := model.NewGoAccDeliveryEdit(businessKey, processInsId, taskId)
resp, err := client.R().
SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/goAccDeliveryEdit?businessKey=" + query.BusinessKey + "&processInstanceId=" + query.ProcessInstanceId + "&taskId=" + query.TaskId + "&startLink=" + query.StartLink + "&endLink=" + query.EndLink + "&taskflag=" + query.TaskFlag + "&ranstr=" + query.Ranstr + "&timestamp=" + query.Timestamp + "&_=" + query.TimestampPro)
if err != nil {
panic(exception.New(err.Error()))
}
deliveryId := util.HTMLContentFindFirst(resp.String(), "deliveryId")
return deliveryId
}

@ -15,16 +15,36 @@ import (
// AssignScrap 取消交付 // AssignScrap 取消交付
/* /*
1searchAccSendListdeliveryId 1searchAccSendListRemovalInfo
2assignScrap 2RemovalInfo
4
3assignScrap
*/ */
func ReqWithdrawAssign(parenProcInsId string) { func ReqWithdrawAssign(parenProcInsId string) {
list := searchAccSendList(parenProcInsId) list := searchAccSendList(parenProcInsId)
assignScrap(list, parenProcInsId) for _, v := range list {
if v.DeliveryId == "" {
continue
}
if v.DeliveryStatus == "COMPLETE" {
//先撤回,再废除
backFlow(v.Name, v.DeliveryId, parenProcInsId)
assignScrap(v.Name, v.DeliveryId, parenProcInsId)
} else {
//未完成的直接废除
assignScrap(v.Name, v.DeliveryId, parenProcInsId)
}
}
} }
func searchAccSendList(parenProcInsId string) []string { type RemovalInfo struct {
Name string
DeliveryId string
DeliveryStatus string
}
func searchAccSendList(parenProcInsId string) []RemovalInfo {
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
header := h.GenReqParam() header := h.GenReqParam()
f := model.NewSearchAccSendList(parenProcInsId) f := model.NewSearchAccSendList(parenProcInsId)
@ -38,27 +58,67 @@ func searchAccSendList(parenProcInsId string) []string {
data := strings.Trim(resp.String(), `"`) data := strings.Trim(resp.String(), `"`)
decrypt := cryptokit.Decrypt(data) decrypt := cryptokit.Decrypt(data)
ok := gjson.Get(decrypt, "data").Array() ok := gjson.Get(decrypt, "data").Array()
var deliveryIdList []string var removalList []RemovalInfo
seen := make(map[string]gjson.Result)
for _, v := range ok { for _, v := range ok {
splitName := gjson.Get(v.String(), "splitName").String()
deliveryId := gjson.Get(v.String(), "deliveryId").String() deliveryId := gjson.Get(v.String(), "deliveryId").String()
deliveryIdList = append(deliveryIdList, deliveryId) deliveryStatus := gjson.Get(v.String(), "deliveryStatus").String()
if deliveryStatus == "ABANDON" {
continue
}
if existing, exists := seen[splitName]; exists {
existingStatus := gjson.Get(existing.String(), "deliveryStatus").String()
if existingStatus == "SUBMIT" && deliveryStatus == "COMPLETE" {
removalList = append(removalList, RemovalInfo{
Name: splitName,
DeliveryId: existing.Get("deliveryId").String(),
DeliveryStatus: existingStatus,
})
seen[splitName] = v
} else {
removalList = append(removalList, RemovalInfo{
Name: splitName,
DeliveryId: deliveryId,
DeliveryStatus: deliveryStatus,
})
}
} else {
seen[splitName] = v
}
} }
return deliveryIdList return removalList
} }
func assignScrap(deliveryIdList []string, parenProcInsId string) { func backFlow(name, deliveryId, parenProcInsId string) {
client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second)
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
header := h.GenReqParam() header := h.GenReqParam()
for _, v := range deliveryIdList { f := model.NewBackFlow(deliveryId, parenProcInsId)
f := model.NewAssignScrap(v, parenProcInsId)
form := f.GenReqParam() form := f.GenReqParam()
resp, err := client.R(). resp, err := client.R().
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/assignScrap") SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/backFlow")
if err != nil { if err != nil {
panic(exception.New(err.Error())) panic(exception.New(err.Error()))
} }
data := strings.Trim(resp.String(), `"`) data := strings.Trim(resp.String(), `"`)
logkit.Info("assignScarp:" + cryptokit.Decrypt(data)) logkit.Info("backFlow:" + name + cryptokit.Decrypt(data))
}
func assignScrap(name, deliveryId, parenProcInsId string) {
client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second)
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
header := h.GenReqParam()
f := model.NewAssignScrap(deliveryId, parenProcInsId)
form := f.GenReqParam()
resp, err := client.R().
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/assignScrap")
if err != nil {
panic(exception.New(err.Error()))
} }
data := strings.Trim(resp.String(), `"`)
logkit.Info("assignScarp:" + name + cryptokit.Decrypt(data))
} }

Loading…
Cancel
Save