You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
Go
53 lines
1.7 KiB
Go
package cmd
|
|
|
|
import (
|
|
"cu-helper/cus-eng-con-sys/config"
|
|
"cu-helper/cus-eng-con-sys/service"
|
|
"github.com/mizuki1412/go-core-kit/init/initkit"
|
|
"github.com/mizuki1412/go-core-kit/library/commonkit"
|
|
"github.com/mizuki1412/go-core-kit/library/filekit"
|
|
"github.com/mizuki1412/go-core-kit/service/logkit"
|
|
"github.com/spf13/cobra"
|
|
"github.com/tidwall/gjson"
|
|
"time"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(engSysCmd)
|
|
defFlagsEng(engSysCmd)
|
|
}
|
|
|
|
var engSysCmd = &cobra.Command{
|
|
Use: "eng",
|
|
Short: "Batch processing operations of the cus-eng-con-sys",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
initkit.BindFlags(cmd)
|
|
config.Init()
|
|
run(config.Conf)
|
|
},
|
|
}
|
|
|
|
func run(c *config.Config) {
|
|
j, _ := filekit.ReadString("test1.json")
|
|
data := gjson.Get(j, "data").Array()
|
|
for _, v := range data {
|
|
name := v.Get("name").String()
|
|
process := v.Get("processDefinitionKey").String()
|
|
if name == c.Step && process == c.Process {
|
|
logkit.Info("***现在开始处理***:" + gjson.Get(v.String(), "tasktitle").String())
|
|
_ = commonkit.RecoverFuncWrapper(func() {
|
|
service.ReqAccConfirm(v.Get("processInstanceId").String(), v.Get("id").String())
|
|
//service.ReqWithdrawAssign(v.Get("processInstanceId").String())
|
|
})
|
|
time.Sleep(5 * time.Second)
|
|
}
|
|
}
|
|
}
|
|
|
|
func defFlagsEng(cmd *cobra.Command) {
|
|
cmd.Flags().String(config.EngSysProcess, "", "Specify the process to be processed, supporting: XQXJ,ZQLX,LYXJ")
|
|
cmd.Flags().String(config.EngSysStep, "", "Specify the steps to be processed, supporting: YSQR")
|
|
cmd.Flags().String(config.EngSysSid, "", "Specify the sid")
|
|
//TODO 验收确认阶段,还需要指定交付的人,暂时写死在代码里,目前只适用于周一彬,如果需要调整,则暂时先在代码里调整
|
|
}
|