Browse Source

工位工作流完成

v1_dev_2
超级管理员 3 years ago
parent
commit
df48214c27
  1. 13
      README.md
  2. 103
      api/shiyan/maptostruct/maptostr.go
  3. 25
      api/shiyan/maptostruct/type.go
  4. 34
      api/version1/flowchart/flow.go
  5. 20
      api/version1/postseting/postweb/postration.go
  6. 691
      api/version1/postseting/postweb/posttarget.go
  7. 3
      api/version1/postseting/postweb/type.go
  8. 3
      apirouter/apishiyan/maptostruct.go
  9. 1
      apirouter/v1/postseting/web.go
  10. 83
      middleware/grocerystore/redis.go
  11. 1043
      middleware/wechatapp/wechatcallback/event_processing.go
  12. 40
      middleware/wechatapp/wechatcallback/response.go
  13. 113
      middleware/wechatapp/wechatcallback/type.go
  14. 2
      middleware/wechatapp/wechatsendmsg/send_applets_type.go
  15. 26
      middleware/wechatapp/wechatsendmsg/send_ordinary_msg.go
  16. 22
      middleware/wechatapp/wechatsendmsg/type.go
  17. 6
      middleware/wechatapp/wechatstatice/type.go
  18. 2
      models/modelskpi/open_approval_change_log.go
  19. 4
      models/modelskpi/post_nature_flow.go
  20. 1
      models/modelskpi/post_workflow_orders.go
  21. 65
      models/modelskpi/rectification_measures.go
  22. 65
      models/modelskpi/register.go
  23. 2
      models/wechatcallback/callbacklog.go
  24. 22
      overall/publicmethod/type.go

13
README.md

@ -183,26 +183,27 @@ Time:2022-08-29 <br>
CREATE TABLE `post_workflow_orders` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '审批单ID',
`step` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '当前执行到第几步',
`next_step` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '下一步执行哪个步骤',
`step` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '当前执行到第几步',
`next_step` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '下一步执行哪个步骤',
`count_step` int(5) unsigned NOT NULL DEFAULT '1' COMMENT '总共几步',
`work_flow` longtext COMMENT '工作流(审批json字符串)',
`company_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '公司',
`department_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '部门',
`org_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '行政组织',
`post_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '岗位',
`class` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '属性1、定性;2、定量',
`class` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '属性1、定性;2、定量',
`dimension` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '维度',
`target` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标',
`son_target` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标子栏目',
`detailed` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标细则',
`executor` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '执行人',
`executor_department` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '执行人部门',
`state` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除',
`state` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除',
`start_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '流程开始时间',
`time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
`enclosure_format` longtext COMMENT '附件',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位审批工作流';
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='岗位审批工作流';
```

103
api/shiyan/maptostruct/maptostr.go

@ -1,13 +1,18 @@
package maptostruct
import (
"encoding/xml"
"fmt"
"key_performance_indicators/middleware/wechatapp/wechatcallback"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"time"
"github.com/gin-gonic/gin"
)
//map 装 struct 实验
// map 装 struct 实验
func (a *ApiMethod) MapToStructShiyan(c *gin.Context) {
mapShiyan := map[string]string{
"name": "秦东",
@ -26,3 +31,99 @@ func (a *ApiMethod) MapToStructShiyan(c *gin.Context) {
fmt.Printf("shiyanType---->%v\n", shiyanVal)
publicmethod.Result(0, shiyanVal, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-06 11:08:11
@ 功能: 模拟回调
@ 参数
#
@ 返回值
#
*/
func (a *ApiMethod) SimulationCallBack(c *gin.Context) {
var receivedValue callBackCont
c.ShouldBindJSON(&receivedValue)
var jieMiCont wechatcallback.DecryptMsgCont
jieMiCont.MsgSignature = receivedValue.MsgSignature
jieMiCont.Timestamp = receivedValue.Timestamp
jieMiCont.Nonce = receivedValue.Nonce
jieMiCont.ToUsername = receivedValue.ToUsername
jieMiCont.Agentid = receivedValue.Agentid
jieMiCont.Encrypt = receivedValue.Encrypt
decryptMsgCont, jsonErr := jieMiCont.DecryptMsgInfo()
fmt.Printf("Xml----->%v----->%v\n\n", string(decryptMsgCont), jsonErr)
var msgCont wechatcallback.MsgContentXml
errXml := xml.Unmarshal(decryptMsgCont, &msgCont)
if errXml != nil {
fmt.Printf("回调事件失败!%v\n", errXml)
return
}
fmt.Printf("XmlCont----->%v\n\nwxcptJson----->%v\n\n", string(decryptMsgCont), msgCont)
switch msgCont.MsgType {
/*消息格式类型
*/
case "text": //文本
case "image": //图片
case "voice": //语音
case "video": //视频
case "location": //位置
wechatcallback.GeographicalPosition(decryptMsgCont)
case "link": //链接
/*事件格式类型*/
case "event":
/*
事件附属格式
*/
wechatcallback.EventProcessing(decryptMsgCont, jieMiCont, c)
// return
default:
}
// outData := publicmethod.MapOut[string]()
// outData["Xml"] = string(decryptMsgCont)
// outData["jieMiCont"] = jieMiCont
// outData["jsonErr"] = jsonErr
// outData["msgCont"] = msgCont
// publicmethod.Result(0, outData, c)
}
// 设置HR系统对接账号和密码
func (a *ApiMethod) SetUpHrSystem(c *gin.Context) {
var receivedValue hrUsernameAndPassword
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
var hrCont modelshr.EmpowerUser
err = hrCont.GetCont(map[string]interface{}{"`userkey`": receivedValue.Username}, "`id`")
if err == nil {
publicmethod.Result(1, err, c, "该授权已经存在!请不要重复!")
return
}
//密码加密
var passWordMd5 publicmethod.Md5Encryption
passWordMd5.Md5EncryptionInit(receivedValue.Password)
passWordMd5Str := passWordMd5.Md5EncryptionAlgorithm()
hrCont.UserKey = receivedValue.Username
hrCont.Password = passWordMd5Str
hrCont.Name = receivedValue.Name
hrCont.State = 1
hrCont.Time = time.Now().Unix()
hrCont.EiteTime = time.Now().Unix()
hrCont.VerificationCode = receivedValue.VerificationCode
err = overall.CONSTANT_DB_HR.Create(&hrCont).Error
if err != nil {
publicmethod.Result(104, err, c)
return
}
publicmethod.Result(0, err, c)
}

25
api/shiyan/maptostruct/type.go

@ -8,14 +8,14 @@ import (
type ApiMethod struct{}
//实验入口
// 实验入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "实验入口"
publicmethod.Result(0, outputCont, c)
}
//实验数据
// 实验数据
type shiyanType struct {
Name string `json:"name"`
Age int `json:"age"`
@ -24,3 +24,24 @@ type shiyanType struct {
Time2 float32 `json:"time2"`
Time3 float64 `json:"time3"`
}
// 模拟回调
type callBackCont struct {
MsgSignature string `json:"msg_signature"`
Timestamp string `json:"timestamp"`
Nonce string `json:"nonce"`
Echostr string `json:"echostr"`
DataType string `json:"datatype"`
SystemApp string `json:"systemapp"`
ToUsername string `json:"ToUserName"`
Agentid uint32 `json:"AgentID"`
Encrypt string `json:"encrypt"`
}
// Hr username AND password
type hrUsernameAndPassword struct {
Username string `json:"username"`
Password string `json:"password"`
VerificationCode string `json:"verification_code"`
publicmethod.PublicName
}

34
api/version1/flowchart/flow.go

@ -253,7 +253,7 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
begin.NodeName = publicmethod.GetSetpName(1) //节点名称
begin.State = 2 //状态 1、不点亮;2、点亮
begin.Class = 1 //节点类型 1、普通节点;2、运行中指定节点
begin.RunType = 1 //运行状态(1:开始;2:操作点;3:结束)
begin.RunType = 1 //运行状态(1:开始;2:操作点;3:结束;4:抄送
beginUserList := append(begin.UserList, GetApproveUser(founderWechat, founderWechat))
for _, bv := range beginUserList {
if isAdd == 1 {
@ -268,7 +268,11 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
isTureCopyMan = append(isTureCopyMan, bv.Id)
}
}
var oenStep publicmethod.NodeRelationshipStruct
oenStep.FromNode = 0
oenStep.ToNode = 2
oenStep.RejectNode = 0
begin.NodeRelationship = oenStep
flowMap = append(flowMap, begin)
//第二步:本部门负责人审批
@ -299,6 +303,12 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
}
}
var twoFlowStep publicmethod.NodeRelationshipStruct
twoFlowStep.FromNode = endStep - 1
twoFlowStep.ToNode = endStep + 1
twoFlowStep.RejectNode = 1
stepTwo.NodeRelationship = twoFlowStep
flowMap = append(flowMap, stepTwo)
if qualEvalScheme.Attribute == 1 {
@ -328,6 +338,11 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
}
}
}
var threeStep publicmethod.NodeRelationshipStruct
threeStep.FromNode = endStep - 1
threeStep.ToNode = endStep + 1
threeStep.RejectNode = 1
stepThree.NodeRelationship = threeStep
flowMap = append(flowMap, stepThree)
//发起人验收
endStep = endStep + 1
@ -338,6 +353,11 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
stepFour.Class = 1
stepFour.RunType = 3
stepFour.UserList = append(stepFour.UserList, GetApproveUser(founderWechat, founderWechat))
var fourStep publicmethod.NodeRelationshipStruct
fourStep.FromNode = endStep - 1
fourStep.ToNode = endStep + 1
fourStep.RejectNode = endStep - 1
stepFour.NodeRelationship = fourStep
flowMap = append(flowMap, stepFour)
// endStep = 5
} else {
@ -363,8 +383,16 @@ func SetUpWorkFlow(founderWechat string, founderDepartment int64, reviewFlowPara
stepCopy.Step = endStep
stepCopy.NodeName = publicmethod.GetSetpName(6)
stepCopy.State = 1
stepCopy.Class = 1
stepCopy.Class = 3
stepCopy.UserList = sendCopyMan
stepCopy.RunType = 4
var endFlowStep publicmethod.NodeRelationshipStruct
endFlowStep.FromNode = endStep - 1
endFlowStep.ToNode = 0
endFlowStep.RejectNode = 0
stepCopy.NodeRelationship = endFlowStep
flowMap = append(flowMap, stepCopy)
return
}

20
api/version1/postseting/postweb/postration.go

@ -10,6 +10,7 @@ import (
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
@ -201,7 +202,7 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
overall.CONSTANT_DB_KPI.Model(&modelskpi.PostTarget{}).Select("unit").Where(map[string]interface{}{"`id`": postShemeCont.TargetId}).First(&targetUnit)
//获取被考核人基本信息
var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.PersonLiable}, "`company`", "`maindeparment`", "`admin_org`", "`position`,`wechat`,`work_wechat`")
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.PersonLiable}, "`company`", "`maindeparment`", "`admin_org`", "`position`", "`wechat`", "`work_wechat`", "`key`")
if err != nil {
publicmethod.Result(107, err, c)
return
@ -244,6 +245,13 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
flowCont.OrderId = uuId //审批单ID"`
flowCont.Step = 1 //当前执行到第几步"`
flowCont.NextStep = 2 //下一步执行哪个步骤"`
sumStep := len(flowMap)
if sumStep-1 > 0 {
sumStep = sumStep - 1
} else {
sumStep = 1
}
flowCont.CountStep = sumStep
flowMapJson, _ := json.Marshal(flowMap)
flowCont.WorkFlow = string(flowMapJson) //工作流(审批json字符串)"`
flowCont.CompanyId = userCont.Company //公司"`
@ -337,12 +345,12 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
var buttonList1 wechatsendmsg.ButtonListCont
buttonList1.Text = "批准"
buttonList1.Style = 1
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 1)
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 2)
buttonList = append(buttonList, buttonList1)
var buttonList2 wechatsendmsg.ButtonListCont
buttonList2.Text = "驳回"
buttonList2.Style = 3
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 1)
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 2)
buttonList = append(buttonList, buttonList2)
//二级标题+文本列表
var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo
@ -372,8 +380,8 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId)
var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify
// sendButtionMsg.Touser = strings.Join(sendUserList, "|")
sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
sendButtionMsg.Touser = strings.Join(sendUserList, "|")
// sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
sendButtionMsg.Msgtype = "template_card"
agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64)
sendButtionMsg.Agentid = agentIdInt
@ -416,6 +424,8 @@ func (a *ApiMethod) SubmitRationPostCont(c *gin.Context) {
openAppChangeLog.ResponseCode = callData.ResponseCode //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
openAppChangeLog.Stepper = 1
openAppChangeLog.ChangeIsTrue = 1 //是否可变更(1:可变更;2:不可变更)"`
openAppChangeLog.Eiteyime = addTime
openAppChangeLog.YesOrNo = 1
overall.CONSTANT_DB_KPI.Create(&openAppChangeLog)
}
}

691
api/version1/postseting/postweb/posttarget.go

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"key_performance_indicators/api/version1/flowchart"
"key_performance_indicators/middleware/wechatapp/wechatcallback"
"key_performance_indicators/middleware/wechatapp/wechatsendmsg"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
@ -512,7 +513,7 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
}
//获取被考核人基本信息
var userCont modelshr.PersonArchives
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.UserKey}, "`company`", "`maindeparment`", "`admin_org`", "`position`,`wechat`,`work_wechat`")
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.UserKey}, "`company`", "`maindeparment`", "`admin_org`", "`position`", "`wechat`", "`work_wechat`", "`key`")
if err != nil {
publicmethod.Result(107, err, c)
return
@ -523,30 +524,30 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
if receivedValue.Punishmode == 0 {
receivedValue.Punishmode = 1
}
var scoreVal int64 = 0
var moneyVal int64 = 0
var scoreVal float64 = 0
var moneyVal float64 = 0
isTrue := false
var msg string
switch receivedValue.Punishmode {
case 1:
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, postShemeCont.MaxScore, postShemeCont.MinScore)
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, float64(postShemeCont.MaxScore), float64(postShemeCont.MinScore))
if isTrue != true {
publicmethod.Result(1, isTrue, c, msg)
return
}
case 2:
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, postShemeCont.Maxmoney, postShemeCont.Minmoney)
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, float64(postShemeCont.Maxmoney), float64(postShemeCont.Minmoney))
if isTrue != true {
publicmethod.Result(1, isTrue, c, msg)
return
}
case 3:
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, postShemeCont.MaxScore, postShemeCont.MinScore)
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, float64(postShemeCont.MaxScore), float64(postShemeCont.MinScore))
if isTrue != true {
publicmethod.Result(1, isTrue, c, msg)
return
}
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, postShemeCont.Maxmoney, postShemeCont.Minmoney)
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, float64(postShemeCont.Maxmoney), float64(postShemeCont.Minmoney))
if isTrue != true {
publicmethod.Result(1, isTrue, c, msg)
return
@ -617,6 +618,13 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
flowCont.OrderId = uuId //审批单ID"`
flowCont.Step = 1 //当前执行到第几步"`
flowCont.NextStep = 2 //下一步执行哪个步骤"`
sumStep := len(flowMap)
if sumStep-1 > 0 {
sumStep = sumStep - 1
} else {
sumStep = 1
}
flowCont.CountStep = sumStep
flowMapJson, _ := json.Marshal(flowMap)
flowCont.WorkFlow = string(flowMapJson) //工作流(审批json字符串)"`
flowCont.CompanyId = userCont.Company //公司"`
@ -667,7 +675,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
postNatureFlowCont.HappenTime = currentTime //发生时间"`
postNatureFlowCont.HappenCount = receivedValue.Count //发生次数"`
postNatureFlowCont.Time = time.Now().Unix() //时间"`
// publicmethod.Result(1, postNatureFlowCont, c, msg)
// return
//开启事务提交
gormDbAffair := overall.CONSTANT_DB_KPI.Begin()
@ -774,12 +783,12 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
var buttonList1 wechatsendmsg.ButtonListCont
buttonList1.Text = "批准"
buttonList1.Style = 1
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 1)
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 2)
buttonList = append(buttonList, buttonList1)
var buttonList2 wechatsendmsg.ButtonListCont
buttonList2.Text = "驳回"
buttonList2.Style = 3
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 1)
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 2)
buttonList = append(buttonList, buttonList2)
//二级标题+文本列表
@ -810,8 +819,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId)
var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify
// sendButtionMsg.Touser = strings.Join(sendUserList, "|")
sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
sendButtionMsg.Touser = strings.Join(sendUserList, "|")
// sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
sendButtionMsg.Msgtype = "template_card"
agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64)
sendButtionMsg.Agentid = agentIdInt
@ -866,6 +875,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
openAppChangeLog.ResponseCode = callData.ResponseCode //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
openAppChangeLog.Stepper = 1
openAppChangeLog.ChangeIsTrue = 1 //是否可变更(1:可变更;2:不可变更)"`
openAppChangeLog.Eiteyime = addTime
openAppChangeLog.YesOrNo = 1
overall.CONSTANT_DB_KPI.Create(&openAppChangeLog)
}
@ -888,14 +899,15 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) {
@MaxScore 最大值
@minScore 最小值
*/
func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore int64) (scoreInt64 int64, isTrue bool, msg string) {
func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore float64) (scoreInt64 float64, isTrue bool, msg string) {
isTrue = false
// fmt.Printf("\n\nscoreState:%v\n\nscore:%v\n\nmaxScore:%v\n\nminScore:%v\n\n", scoreState, score, maxScore, minScore)
switch scoreState {
case 2, 3:
if score == "" {
return
}
scoreInt64, _ = strconv.ParseInt(score, 10, 64)
scoreInt64, _ = strconv.ParseFloat(score, 64)
scoreInt64 = scoreInt64 * 100
if scoreInt64 > maxScore {
msg = fmt.Sprintf("您提交的数值超过允许提交的最大值(最大值:%v)!", float64(maxScore)/100)
@ -907,12 +919,661 @@ func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore in
}
isTrue = true
case 1:
scoreInt64, _ = strconv.ParseInt(score, 10, 64)
scoreInt64, _ = strconv.ParseFloat(score, 64)
scoreInt64 = scoreInt64 * 100
isTrue = true
default:
msg = "请您输入要操作的数据,谢谢!"
return
}
// fmt.Printf("\nscoreInt64:%v\n\nisTrue:%v\n\nmsg:%v\n\n", scoreInt64, isTrue, msg)
return
}
// 整改措施
func (a *ApiMethod) PostRectificationMeasures(c *gin.Context) {
var receivedValue publicmethod.CorrectiveMeasuresType
c.ShouldBindJSON(&receivedValue)
if receivedValue.OrderId == "" || receivedValue.Register == "" || receivedValue.Content == "" {
publicmethod.Result(101, receivedValue, c)
return
}
//判断此号码是否可以使用
var setUpRegister modelskpi.Register
err := setUpRegister.GetCont(map[string]interface{}{"`number`": receivedValue.Register}, "`state`", "`id`")
if err != nil {
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!")
return
}
if setUpRegister.State != 1 {
publicmethod.Result(1, err, c, "此考核项已经提交过整改方案!")
return
}
syncSeting.Add(1)
go UpdateRegister(setUpRegister.Id, 2)
//获取登录人信息
context, _ := publicmethod.LoginMyCont(c)
//获取审批流
var pwoCont modelskpi.PostWorkflowOrders
err = pwoCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId})
if err != nil {
publicmethod.Result(1, err, c, "不存在的审批整改项目!")
return
}
if pwoCont.State != 3 {
publicmethod.Result(1, err, c, "此考核项目已经审批结束!请不要重复提交整改措施!")
return
}
if pwoCont.Class == 1 { //定性
var pnfCont modelskpi.PostNatureFlow
err = pnfCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId})
if err != nil {
publicmethod.Result(1, err, c, "不存在的审批整改项目!")
return
}
if pnfCont.PersonLiable != context.Key {
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!")
return
}
} else { //定量
var pnfCont modelskpi.PostMeteringFlow
err = pnfCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId})
if err != nil {
publicmethod.Result(1, err, c, "不存在的审批整改项目!")
return
}
if pnfCont.PersonLiable != context.Key {
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!")
return
}
}
//提交整改内容
var addRecMeas modelskpi.RectificationMeasures
addRecMeas.UserKey = context.Key
addRecMeas.Department = context.MainDeparment
addRecMeas.Group = context.Company
addRecMeas.OrderKey = pwoCont.OrderId
addRecMeas.State = 1
addRecMeas.Time = time.Now().Unix()
addRecMeas.EiteTime = time.Now().Unix()
addRecMeas.Content = receivedValue.Content
if len(receivedValue.Enclosure) > 0 {
enclosure, enclosureErr := json.Marshal(receivedValue.Enclosure)
if enclosureErr == nil {
addRecMeas.Enclosure = string(enclosure) //附件
}
}
err = overall.CONSTANT_DB_KPI.Create(&addRecMeas).Error
if err != nil {
publicmethod.Result(104, err, c)
return
}
//发送下一步审批信息
stepIng := pwoCont.NextStep
if stepIng == 0 {
if pwoCont.CountStep-1 > 0 {
stepIng = pwoCont.CountStep - 1
} else {
stepIng = 1
}
}
flowMap, flowOneCont, _ := wechatcallback.GetOneNodeCont(pwoCont.WorkFlow, stepIng) //获取流程图
nextStep := 0 //下一步执行哪个步骤
flowState := 3 //判断流程状态
switch flowOneCont.RunType {
case 1:
flowState = 3
case 2:
flowState = 3
case 3:
flowState = 4
case 4:
flowState = 4
default:
flowState = 1
}
//判断下一个当前节点是否为最后一个节点
if flowState == 4 {
nextStep = 0
} else {
nextStep = flowOneCont.Step + 1
}
//更新审批流状态
syncSeting.Add(1)
go UpdateStateFlow(pwoCont.Id, nextStep, flowState)
//更新审批工作流json内容
wechatName := context.Wechat
if context.WorkWechat != "" {
wechatName = context.WorkWechat
}
syncSeting.Add(1)
go EidtPostFlowLog(pwoCont.Id, flowMap, flowOneCont, wechatName, 2, stepIng)
//获取下一个执行点位
var nextClickStep int
overall.CONSTANT_DB_KPI.Model(&modelskpi.OpenApprovalChangeLog{}).Select("stepper").Where("`orderid` = ?", pwoCont.OrderId).Order("stepper DESC").First(&nextClickStep)
//执行下一步审批
nextClickStep = nextClickStep + 1
syncSeting.Add(1)
go ApproveFlow("kpi", flowMap, flowOneCont, nextClickStep, pwoCont)
var operatorIsTreu modelskpi.OpenApprovalChangeLog
operatorIsTreu.Type = 2
operatorIsTreu.Title = flowOneCont.NodeName
operatorIsTreu.Operator = context.Key
operatorIsTreu.OrderId = pwoCont.OrderId
operatorIsTreu.OperatorTime = time.Now().Unix()
operatorIsTreu.Step = flowOneCont.Step
operatorIsTreu.OperatorType = 2
operatorIsTreu.Msgid = ""
operatorIsTreu.ResponseCode = ""
operatorIsTreu.Stepper = nextClickStep
operatorIsTreu.ChangeIsTrue = 2
operatorIsTreu.YesOrNo = 1
operatorIsTreu.Eiteyime = time.Now().Unix()
overall.CONSTANT_DB_KPI.Create(&operatorIsTreu)
syncSeting.Wait()
sendMap := publicmethod.MapOut[string]()
sendMap["flowMap"] = flowMap
sendMap["flowOneCont"] = flowOneCont
publicmethod.Result(0, sendMap, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-09 16:48:09
@ 功能: 更新挂号单
@ 参数
#
@ 返回值
#
*/
func UpdateRegister(id int64, state int) {
defer syncSeting.Done()
var setUpRegister modelskpi.Register
setUpRegister.EiteCont(map[string]interface{}{"`id`": id}, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()})
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-08 11:20:38
@ 功能: 同意
@ 参数
#systemApp 系统
#pwoCont 岗位审批工作流
#flowMap 流程结构体
#flowOneCont 当前节点构体
#step 记录值
#liangOrXing 属性1定性2定量
ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders)
@ 返回值
#
*/
func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) {
defer syncSeting.Done()
nextStep := 0
flowState := 3 //判断流程状态
switch flowOneCont.RunType {
case 1:
flowState = 3
case 2:
flowState = 3
case 3:
flowState = 4
case 4:
flowState = 4
default:
flowState = 1
}
//判断下一个当前节点是否为最后一个节点
if flowState == 4 {
nextStep = 0
} else {
nextStep = flowOneCont.Step + 1
}
//更新审批流状态
var pwoCont modelskpi.PostWorkflowOrders
pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "`time`": time.Now().Unix()}) //改变审批流状态
//获取下一部操作
for _, fv := range flowMap {
if fv.Step == flowOneCont.Step+1 {
var sendToUserList []string //获取发送人
for _, fvu := range fv.UserList {
if publicmethod.IsInTrue[string](fvu.Wechat, sendToUserList) == false {
sendToUserList = append(sendToUserList, fvu.Wechat)
}
}
if len(sendToUserList) > 0 { //存在接收人执行以下操作
var postTarDeta modelskpi.PostTarget
postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`")
if fv.Class < 3 {
sendNextStep := step + 1
//发送按钮信息
if pwoContOld.Class == 1 { //定性操作
var postTarDetailsDeta modelskpi.PostTargetDetails
postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`")
unitTitle := postTarDetailsDeta.Company
if unitTitle == "" {
unitTitle = postTarDeta.Unit
}
var postNatuerFlowCont modelskpi.PostNatureFlow
postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
if fv.Class == 2 { //需要填写信息,发送相关信息
//挂号
registerNum := publicmethod.GetUUid(2)
var setUpRegister modelskpi.Register
setUpRegister.Number = registerNum
setUpRegister.State = 1
setUpRegister.Time = time.Now().Unix()
setUpRegister.AddCont()
//抄送信息
markDowmStr := "整改通知"
markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr)
markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title)
markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title)
markDowmStr = fmt.Sprintf("%v\n><font color=\"info\">发生时间: %v</font> ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1))
switch postTarDetailsDeta.Punishmode {
case 1:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
case 2:
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
default:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
}
//获取提报人信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">提报人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum)
//发送同通信息
wechatcallback.SendNoticeMsg(sendToUserList, markDowmStr, systemApp)
} else { //无需填写信息。继续发送
//考核标准
var sunTextCont string
var quoteTextCont string
switch postTarDetailsDeta.Punishmode {
case 2:
var moneyTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
moneyTitle = "现金奖励标准"
quoteTextCont = fmt.Sprintf("奖励现金:%v元", postNatuerFlowCont.Money)
} else {
moneyTitle = "现金罚款标准"
quoteTextCont = fmt.Sprintf("罚款现金:%v元", postNatuerFlowCont.Money)
}
var scoreStr string
if postTarDetailsDeta.Minmoney != 0 {
scoreStr = fmt.Sprintf("%v元-%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
} else {
scoreStr = fmt.Sprintf("%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
}
sunTextCont = fmt.Sprintf("%v:%v", moneyTitle, scoreStr)
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
case 3:
var moneyTitle string
var scoreTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
moneyTitle = "现金奖励标准"
scoreTitle = "考核扣分标准"
quoteTextCont = fmt.Sprintf("考核加:%v%v\n奖励现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money)
} else {
moneyTitle = "现金罚款标准"
scoreTitle = "考核加分标准"
quoteTextCont = fmt.Sprintf("考核扣:%v%v\n罚款现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money)
}
var scoreStr string
if postTarDetailsDeta.MinScore != 0 {
scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
} else {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
}
sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr)
if postTarDetailsDeta.Minmoney != 0 {
sunTextCont = fmt.Sprintf("%v\n%v:%v元-%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
} else {
sunTextCont = fmt.Sprintf("%v\n%v:%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
}
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
default:
var scoreTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
scoreTitle = "考核加分标准"
quoteTextCont = fmt.Sprintf("考核加:%v%v", postNatuerFlowCont.Score, unitTitle)
} else {
scoreTitle = "考核扣分标准"
quoteTextCont = fmt.Sprintf("考核扣:%v%v", postNatuerFlowCont.Score, unitTitle)
}
var scoreStr string
if postTarDetailsDeta.MinScore != 0 {
scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
} else {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
}
sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr)
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
}
var quoteAreaInfo wechatsendmsg.QuoteAreaCont
quoteAreaInfo.Type = 0
quoteAreaInfo.Title = "考核明细"
quoteAreaInfo.QuoteText = quoteTextCont
//二级标题+文本列表
var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo
var shenQingRen modelshr.PersonArchives
shenQingRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`")
if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" {
wechatOpenId := shenQingRen.Wechat
if shenQingRen.WorkWechat != "" {
wechatOpenId = shenQingRen.WorkWechat
}
//发送人
var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo
horizontalContentLis3.KeyName = "申请人:"
horizontalContentLis3.Value = "点击查看"
horizontalContentLis3.Type = 3
horizontalContentLis3.Userid = wechatOpenId
twoTitleTextList = append(twoTitleTextList, horizontalContentLis3)
}
var beiKaoHeRen modelshr.PersonArchives
beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`")
//被考核人
if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" {
weChatStrs := beiKaoHeRen.Wechat
if beiKaoHeRen.WorkWechat != "" {
weChatStrs = beiKaoHeRen.WorkWechat
}
var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo
twoTitleTextCont.KeyName = "被考核人:"
twoTitleTextCont.Value = "点击查看"
twoTitleTextCont.Type = 3
twoTitleTextCont.Userid = weChatStrs
twoTitleTextList = append(twoTitleTextList, twoTitleTextCont)
}
wechatcallback.SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList)
}
} else { //定量操作
//定量操作
var postMeterFlowCont modelskpi.PostMeteringFlow
postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
//获取考核项目信息
var postShemeCont modelskpi.QualitativeEvaluationScheme
postShemeCont.GetCont(map[string]interface{}{"`id`": postMeterFlowCont.ShemeId})
//引用文献
var quoteAreaInfo wechatsendmsg.QuoteAreaCont
quoteAreaInfo.Type = 0
quoteAreaInfo.Title = "数据详细"
quoteAreaInfo.QuoteText = fmt.Sprintf("数值:%v%v\n备注:%v", publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit, postMeterFlowCont.Reason)
//二级标题+文本列表
var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo
var shenQingRen modelshr.PersonArchives
shenQingRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`")
if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" {
wechatOpenId := shenQingRen.Wechat
if shenQingRen.WorkWechat != "" {
wechatOpenId = shenQingRen.WorkWechat
}
//发送人
var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo
horizontalContentLis3.KeyName = "申请人:"
horizontalContentLis3.Value = "点击查看"
horizontalContentLis3.Type = 3
horizontalContentLis3.Userid = wechatOpenId
twoTitleTextList = append(twoTitleTextList, horizontalContentLis3)
}
var beiKaoHeRen modelshr.PersonArchives
beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`")
//被考核人
if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" {
weChatStrs := beiKaoHeRen.Wechat
if beiKaoHeRen.WorkWechat != "" {
weChatStrs = beiKaoHeRen.WorkWechat
}
var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo
twoTitleTextCont.KeyName = "被考核人:"
twoTitleTextCont.Value = "点击查看"
twoTitleTextCont.Type = 3
twoTitleTextCont.Userid = weChatStrs
twoTitleTextList = append(twoTitleTextList, twoTitleTextCont)
}
wechatcallback.SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList)
}
} else {
//抄送信息
markDowmStr := "审批通过-抄送"
markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr)
markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title)
if pwoContOld.Class == 1 {
//定性操作
var postTarDetailsDeta modelskpi.PostTargetDetails
postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`")
markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title)
var postNatuerFlowCont modelskpi.PostNatureFlow
postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
switch postTarDetailsDeta.Punishmode {
case 1:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
case 2:
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
default:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
}
//获取责任信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.PersonLiable}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">被考核人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n><font color=\"info\">发生时间: %v</font> ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1))
markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId)
} else {
//定量操作
var postMeterFlowCont modelskpi.PostMeteringFlow
postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
markDowmStr = fmt.Sprintf("%v\n>%v年", markDowmStr, postMeterFlowCont.Year)
switch postTarDeta.Cycle {
case 5:
markDowmStr = fmt.Sprintf("%v\n>%v季度上报数值%v%v", markDowmStr, postMeterFlowCont.Quarter, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
case 6:
markDowmStr = fmt.Sprintf("%v\n>上报数值%v%v", markDowmStr, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
default:
markDowmStr = fmt.Sprintf("%v\n>%v月上报数值%v%v", markDowmStr, postMeterFlowCont.Month, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
}
//获取责任信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">被考核人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId)
}
//发送抄送信息
wechatcallback.SendNoticeMsg(sendToUserList, markDowmStr, systemApp)
}
}
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-09 16:15:56
@ 功能: 更新审批流
@ 参数
#pwoId 岗位审批工作流ID
#flowMap 流程结构体
#operatorWechat 操作人
#clickEnter 操作
#step 执行的哪一步
@ 返回值
#
*/
func EidtPostFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, oneFlowCont publicmethod.FlowChartList, operatorWechat string, clickEnter, step int) {
defer syncSeting.Done()
var newFlowMap []publicmethod.FlowChartList
for _, v := range flowMap {
var newFlowMapCont publicmethod.FlowChartList
newFlowMapCont.Step = v.Step //步伐
newFlowMapCont.NodeName = v.NodeName //节点名称
newFlowMapCont.Class = v.Class //节点类型 1、普通节点;2、运行中指定节点
newFlowMapCont.RunType = v.RunType //运行状态(1:开始;2:操作点;3:结束)
newFlowMapCont.NodeRelationship = v.NodeRelationship
if v.Step == oneFlowCont.Step { //获取到当前执行的节点
newFlowMapCont.State = 2 //状态 1、不点亮;2、点亮
for _, uv := range v.UserList { //遍历审批人列表
if uv.Wechat == operatorWechat { //当前操作人
var logCont publicmethod.LogList
switch clickEnter {
case 1:
logCont.State = 2
case 2:
logCont.State = 3
default:
logCont.State = 1
}
logCont.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1)
uv.LogList = append(uv.LogList, logCont)
}
newFlowMapCont.UserList = append(newFlowMapCont.UserList, uv)
}
} else {
newFlowMapCont.State = v.Class //状态 1、不点亮;2、点亮
newFlowMapCont.UserList = v.UserList
}
newFlowMap = append(newFlowMap, newFlowMapCont)
}
jsonStr, _ := json.Marshal(newFlowMap)
var pwoCont modelskpi.PostWorkflowOrders
pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`work_flow`": string(jsonStr), "`time`": time.Now().Unix()})
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-09 16:09:35
@ 功能: 更新审批状态
@ 参数
#pwoId 审批流ID
#nextStep 下一步
#flowState 流程状态
@ 返回值
#
*/
func UpdateStateFlow(pwoId int64, nextStep, flowState int) {
defer syncSeting.Done()
var pwoCont modelskpi.PostWorkflowOrders
pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "`time`": time.Now().Unix()}) //改变审批流状态
}

3
api/version1/postseting/postweb/type.go

@ -3,12 +3,15 @@ package postweb
import (
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall/publicmethod"
"sync"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
var syncSeting = sync.WaitGroup{}
// 岗位考核WEB端入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()

3
apirouter/apishiyan/maptostruct.go

@ -16,5 +16,8 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("maptostructshiyan", methodBinding.MapToStructShiyan) //map转struct
apiRouter.POST("simulationcallback", methodBinding.SimulationCallBack) //模拟回调
apiRouter.POST("setuphrsystem", methodBinding.SetUpHrSystem) //设置HR系统对接账号和密码
}
}

1
apirouter/v1/postseting/web.go

@ -24,6 +24,7 @@ func (a *ApiRouter) RouterGroupWeb(router *gin.RouterGroup) {
apiRouter.POST("send_us_nature_evaluation", methodBinding.SendUsNatureEvaluation) //提交个人岗位定性考核数据
apiRouter.POST("get_ration_target_cont", methodBinding.GetRationTargetCont) //获取定量考核详细内容
apiRouter.POST("submit_ration_post_cont", methodBinding.SubmitRationPostCont) //提交定量考核数据
apiRouter.POST("post_rectification_measures", methodBinding.PostRectificationMeasures) //提交整改措施
}
}

83
middleware/grocerystore/redis.go

@ -9,7 +9,7 @@ import (
"github.com/go-redis/redis/v8"
)
//redis 基础设定
// redis 基础设定
type RedisStoreType struct {
Expiration time.Duration
PreKey string
@ -17,7 +17,7 @@ type RedisStoreType struct {
RedisDb *redis.Client
}
//启动redis
// 启动redis
func RunRedis(redisClient *redis.Client) *RedisStoreType {
var redisStoreType RedisStoreType
redisStoreType.Expiration = time.Second * 300
@ -27,17 +27,17 @@ func RunRedis(redisClient *redis.Client) *RedisStoreType {
return &redisStoreType
}
//设置键前缀
// 设置键前缀
func (r *RedisStoreType) SetRedisPrefix(prefix string) {
r.PreKey = prefix
}
//设置过期时间
// 设置过期时间
func (r *RedisStoreType) SetRedisTime(timeDate int64) {
r.Expiration = time.Second * time.Duration(timeDate)
}
//设置字符串
// 设置字符串
func (r *RedisStoreType) Set(key string, value string) bool {
err := r.RedisDb.Set(r.Context, r.PreKey+key, value, r.Expiration).Err()
if err != nil {
@ -46,7 +46,7 @@ func (r *RedisStoreType) Set(key string, value string) bool {
return true
}
//获取字符串
// 获取字符串
func (r *RedisStoreType) Get(key string) (bool, string) {
err := r.RedisDb.Get(r.Context, r.PreKey+key)
if err.Err() != nil {
@ -55,7 +55,7 @@ func (r *RedisStoreType) Get(key string) (bool, string) {
return true, err.Val()
}
//删除键
// 删除键
func (r *RedisStoreType) DelKey(key string) bool {
err := r.RedisDb.Del(r.Context, r.PreKey+key).Err()
if err != nil {
@ -122,6 +122,22 @@ func (r *RedisStoreType) HashMsetAdd(hashName string, hashVal map[string]interfa
return true
}
func (r *RedisStoreType) HashMsetAddinterface(hashName string, hashVal interface{}) bool {
// rdb := RedisInit()
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err()
// fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
if err != nil {
return false
}
if r.Expiration == 0 {
r.RedisDb.Persist(r.Context, r.PreKey+hashName)
} else {
r.RedisDb.PExpire(r.Context, r.PreKey+hashName, r.Expiration)
}
return true
}
func (r *RedisStoreType) HashMsetAddAry(hashName string, hashVal []map[string]interface{}) bool {
// rdb := RedisInit()
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err()
@ -159,7 +175,8 @@ func (r *RedisStoreType) HashGetAll(hashName string) (map[string]string, bool) {
//Redis 列表(List)
/**
/*
*
Linsert 命令用于在列表的元素前或者后插入元素当指定元素不存在于列表中时不执行任何操作
当列表不存在时被视为空列表不执行任何操作
如果 key 不是列表类型返回一个错误
@ -180,7 +197,8 @@ func (r *RedisStoreType) Linsert(key string, op int, pivot, value interface{}) (
return linsert, true
}
/**
/*
*
Lindex 命令用于通过索引获取列表中的元素你也可以使用负数下标 -1 表示列表的最后一个元素 -2 表示列表的倒数第二个元素以此类推
@key 列表
@index 索引
@ -190,7 +208,8 @@ func (r *RedisStoreType) Lindex(key string, index int64) (val string, err error)
return
}
/**
/*
*
Llen 命令用于返回列表的长度 如果列表 key 不存在 key 被解释为一个空列表返回 0 如果 key 不是列表类型返回一个错误
@key 列表
*/
@ -199,7 +218,8 @@ func (r *RedisStoreType) Llen(key string) (val int64, err error) {
return
}
/**
/*
*
Lpop 命令用于移除并返回列表的第一个元素
@key 列表
*/
@ -208,7 +228,8 @@ func (r *RedisStoreType) Lpop(key string) (val string, err error) {
return
}
/**
/*
*
Lpush 命令将一个或多个值插入到列表头部 如果 key 不存在一个空列表会被创建并执行 LPUSH 操作 key 存在但不是列表类型时返回一个错误
@key 列表
@value 要插入的字符串
@ -218,7 +239,8 @@ func (r *RedisStoreType) Lpush(key string, value ...interface{}) (val int64, err
return
}
/**
/*
*
Lpushx 将一个值插入到已存在的列表头部列表不存在时操作无效
@key 列表
@value 要插入的字符串
@ -228,7 +250,8 @@ func (r *RedisStoreType) Lpushx(key, value string) (val int64, err error) {
return
}
/**
/*
*
Lrange 返回列表中指定区间内的元素区间以偏移量 START END 指定 其中 0 表示列表的第一个元素 1 表示列表的第二个元素以此类推 你也可以使用负数下标 -1 表示列表的最后一个元素 -2 表示列表的倒数第二个元素以此类推
@key 列表
@start 起始值
@ -239,12 +262,15 @@ func (r *RedisStoreType) Lrange(key string, start, stop int64) (val []string, er
return
}
/**
/*
*
Lrem 根据参数 COUNT 的值移除列表中与参数 VALUE 相等的元素
COUNT 的值可以是以下几种
count > 0 : 从表头开始向表尾搜索移除与 VALUE 相等的元素数量为 COUNT
count < 0 : 从表尾开始向表头搜索移除与 VALUE 相等的元素数量为 COUNT 的绝对值
count = 0 : 移除表中所有与 VALUE 相等的值
@start = COUNT
@key 列表
*/
@ -253,7 +279,8 @@ func (r *RedisStoreType) Lrem(key string, start int64, value ...interface{}) (va
return
}
/**
/*
*
Redis Lset 通过索引来设置元素的值
当索引参数超出范围或对一个空列表进行 LSET 返回一个错误
@ -265,7 +292,8 @@ func (r *RedisStoreType) Lset(key string, indexes int64, value ...interface{}) (
return
}
/**
/*
*
Ltrim 对一个列表进行修剪(trim)就是说让列表只保留指定区间内的元素不在指定区间之内的元素都将被删除
下标 0 表示列表的第一个元素 1 表示列表的第二个元素以此类推 你也可以使用负数下标 -1 表示列表的最后一个元素 -2 表示列表的倒数第二个元素以此类推
@ -278,7 +306,8 @@ func (r *RedisStoreType) Ltrim(key string, start, stop int64) (val string, err e
return
}
/**
/*
*
Rpop 命令用于移除列表的最后一个元素返回值为移除的元素
@key 列表
*/
@ -287,7 +316,8 @@ func (r *RedisStoreType) Rpop(key string) (val string, err error) {
return
}
/**
/*
*
Rpoplpush 命令用于移除列表的最后一个元素并将该元素添加到另一个列表并返回
@sourceKey 源列表
@newKey 目标列表
@ -297,7 +327,8 @@ func (r *RedisStoreType) Rpoplpush(sourceKey, newKey string) (val string, err er
return
}
/**
/*
*
Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)
如果列表不存在一个空列表会被创建并执行 RPUSH 操作 当列表存在但不是列表类型时返回一个错误
@key 列表
@ -308,7 +339,8 @@ func (r *RedisStoreType) Rpush(key string, value ...interface{}) (val int64, err
return
}
/**
/*
*
Rpushx 命令用于将一个值插入到已存在的列表尾部(最右边)如果列表不存在操作无效
@key 列表
@value 要插入的字符串
@ -318,7 +350,8 @@ func (r *RedisStoreType) Rpushx(key string, value ...interface{}) (val int64, er
return
}
/**
/*
*
Blpop 命令移出并获取列表的第一个元素 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
@key 列表
*/
@ -327,7 +360,8 @@ func (r *RedisStoreType) Blpop(key string) (val []string, err error) {
return
}
/**
/*
*
Brpop 命令移出并获取列表的最后一个元素 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
@key 列表
*/
@ -336,7 +370,8 @@ func (r *RedisStoreType) Brpop(key string) (val []string, err error) {
return
}
/**
/*
*
Brpoplpush 命令从列表中取出最后一个元素并插入到另外一个列表的头部 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
@source 源列表
@destination 目标列表

1043
middleware/wechatapp/wechatcallback/event_processing.go

File diff suppressed because it is too large

40
middleware/wechatapp/wechatcallback/response.go

@ -4,7 +4,11 @@ import (
"encoding/xml"
"fmt"
"key_performance_indicators/middleware/wechatapp/wechatstatice"
"key_performance_indicators/models/wechatcallback"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"time"
"github.com/gin-gonic/gin"
)
@ -61,6 +65,7 @@ func (a *ApiRouter) CallbackMessageApi(c *gin.Context) {
msgStr = basicValueCallback.VerificationUrl()
c.String(200, msgStr)
} else {
//回调事件
fmt.Printf("回调事件\n")
var callBackXmlMsg XmlMsgCont
@ -104,7 +109,7 @@ func (a *ApiRouter) CallbackMessageApi(c *gin.Context) {
/*
事件附属格式
*/
EventProcessing(decryptMsgCont, c)
EventProcessing(decryptMsgCont, jieMiCont, c)
// return
default:
}
@ -172,6 +177,37 @@ func (d *DecryptMsgCont) DecryptMsgInfo() (msg []byte, err error) {
if cryptErr != nil {
err = fmt.Errorf("解密失败1")
}
// fmt.Printf("msg:-----------%v\n cryptErr:-----------%v----->all\n\n", string(msg), cryptErr)
var callbackLog wechatcallback.CallbackLog
callbackLog.MsgSignature = d.MsgSignature
TimestampInt, _ := strconv.ParseInt(d.Timestamp, 10, 64)
callbackLog.TimeStamp = TimestampInt
callbackLog.Nonce = d.Nonce
callbackLog.Echostr = d.Encrypt
callbackLog.Xmlstr = string(msg)
// callbackLog.Reqdata = string(reqData)
callbackLog.AddTime = time.Now().Unix()
overall.CONSTANT_DB_WECHAT_LOG.Create(&callbackLog)
// var decryptMsgCont DecryptMsgCont
// decryptMsgCont.ToUsername = d.ToUsername
// decryptMsgCont.Agentid = d.Agentid
// decryptMsgCont.Encrypt = d.Encrypt
// decryptMsgCont.MsgSignature = d.MsgSignature
// decryptMsgCont.Timestamp = d.Timestamp
// decryptMsgCont.Nonce = d.Nonce
// decryptMsgCont.SystemApp = d.SystemApp
// msgStr := publicmethod.MapOut[string]()
// jsonDecry, _ := json.Marshal(decryptMsgCont)
// msgStr["DecryptMsgCont"] = string(jsonDecry) //
// msgStr["MsgCont"] = string(msg)
// // jsonStr, _ := json.Marshal(msgStr)
// //API Token数据
// redisFileKeyStr := fmt.Sprintf("WorkWechat:CallBack:Xml_%v_%v_%v", d.ToUsername, d.Nonce, d.Agentid)
// redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3)
// redisClient.SetRedisTime(86400)
// redisClient.HashMsetAdd(redisFileKeyStr, msgStr)
// fmt.Printf("msg:-----------%v\n cryptErr:-----------%v----->all\n\n", string(jsonDecry), redisFileKeyStr)
return
}

113
middleware/wechatapp/wechatcallback/type.go

@ -1,8 +1,27 @@
package wechatcallback
import "sync"
//企业微信回调
type ApiRouter struct{}
// 协程设置
var syncSeting = sync.WaitGroup{}
var syncSetingCallback = sync.WaitGroup{}
// 岗位指标协程操作
type updateButtonSync struct {
content string `json:"content"`
mutext sync.RWMutex
}
// 读取岗位指标协程数据
func (d *updateButtonSync) readDataLock() string {
d.mutext.RLock()
defer d.mutext.RUnlock()
return d.content
}
//企业微信回调基础参数
type CallBackData struct {
MsgSignature string `json:"msg_signature"`
@ -28,27 +47,27 @@ type MsgContent struct {
//XML 格式回调
type XmlMsgCont struct {
ToUsername string `xml:"ToUserName"`
Agentid uint32 `xml:"AgentID"`
Encrypt string `json:"encrypt"`
ToUsername string `xml:"ToUserName" json:"ToUserName"`
Agentid uint32 `xml:"AgentID" json:"AgentID"`
Encrypt string `xml:"Encrypt" json:"encrypt"`
}
//通用更新切片
type XmlMsgUpdateCont struct {
ToUsername string `xml:"ToUserName"`
FromUsername string `xml:"FromUserName"`
CreateTime uint32 `xml:"CreateTime"`
MsgType string `xml:"MsgType"`
Agentid uint32 `xml:"AgentID"`
Event string `xml:"Event"`
EventKey string `xml:"EventKey"`
ToUsername string `xml:"ToUserName" json:"ToUserName"`
FromUsername string `xml:"FromUserName" json:"FromUserName"`
CreateTime uint32 `xml:"CreateTime" json:"CreateTime"`
MsgType string `xml:"MsgType" json:"MsgType"`
Agentid uint32 `xml:"AgentID" json:"AgentID"`
Event string `xml:"Event" json:"Event"`
EventKey string `xml:"EventKey" json:"EventKey"`
}
//XML数据解密
type MsgContentXml struct {
XmlMsgUpdateCont
Content string `xml:"Content"`
Msgid string `xml:"MsgId"`
Content string `xml:"Content" json:"Content"`
Msgid string `xml:"MsgId" json:"MsgId"`
}
//返回消息体解密
@ -68,21 +87,21 @@ type jsonMsgCont struct {
//上报地理位置
type GeographicalPositionType struct {
CurrencyMessage
Latitude string `xml:"Latitude"`
Longitude string `xml:"Longitude"`
Precision string `xml:"Precision"`
AppType string `xml:"AppType"`
Latitude string `xml:"Latitude" json:"Latitude"`
Longitude string `xml:"Longitude" json:"Longitude"`
Precision string `xml:"Precision" json:"Precision"`
AppType string `xml:"AppType" json:"AppType"`
}
//通用更新切片
type CurrencyMessage struct {
ToUsername string `xml:"ToUserName"`
FromUsername string `xml:"FromUserName"`
CreateTime uint32 `xml:"CreateTime"`
MsgType string `xml:"MsgType"`
Agentid uint32 `xml:"AgentID"`
Event string `xml:"Event"`
EventKey string `xml:"EventKey"`
ToUsername string `xml:"ToUserName" json:"ToUserName"`
FromUsername string `xml:"FromUserName" json:"FromUserName"`
CreateTime uint32 `xml:"CreateTime" json:"CreateTime"`
MsgType string `xml:"MsgType" json:"MsgType"`
Agentid uint32 `xml:"AgentID" json:"AgentID"`
Event string `xml:"Event" json:"Event"`
EventKey string `xml:"EventKey" json:"EventKey"`
// TaskId string `xml:"TaskId"`
}
@ -99,32 +118,50 @@ type GeographicalPositionRedis struct {
//模板卡片事件推送 通用
type ButtonEvent struct {
ToUsername string `json:"ToUserName"`
FromUsername string `json:"FromUserName"`
CreateTime uint32 `json:"CreateTime"`
MsgType string `json:"MsgType"`
Event string `xml:"Event"`
EventKey string `xml:"EventKey"`
TaskId string `xml:"TaskId"`
CardType string `xml:"CardType"`
ResponseCode string `xml:"ResponseCode"`
Agentid uint32 `xml:"AgentID"`
ToUsername string `xml:"ToUserName" json:"ToUserName"`
FromUsername string `xml:"FromUserName" json:"FromUserName"`
CreateTime uint32 `xml:"CreateTime" json:"CreateTime"`
MsgType string `xml:"MsgType" json:"MsgType"`
Event string `xml:"Event" json:"Event"`
EventKey string `xml:"EventKey" json:"EventKey"`
TaskId string `xml:"TaskId" json:"TaskId"`
CardType string `xml:"CardType" json:"CardType"`
ResponseCode string `xml:"ResponseCode" json:"ResponseCode"`
Agentid uint32 `xml:"AgentID" json:"AgentID"`
}
//模板卡片事件推送 问题列表
type ButtonEventQuestion struct {
ButtonEvent
SelectedItems []SelectedItemsList `xml:"SelectedItems"` //问题列表
SelectedItems []SelectedItemsList `xml:"SelectedItems" json:"SelectedItems"` //问题列表
}
//问题列表
type SelectedItemsList struct {
SelectedItem []SelectedItemList `xml:"SelectedItem"`
SelectedItem []SelectedItemList `xml:"SelectedItem" json:"SelectedItem"`
}
type SelectedItemList struct {
QuestionKey string `xml:"QuestionKey"`
OptionIds []OptionIdsStr `xml:"OptionIds"`
QuestionKey string `xml:"QuestionKey" json:"QuestionKey"`
OptionIds []OptionIdsStr `xml:"OptionIds" json:"OptionIds"`
}
type OptionIdsStr struct {
OptionId string `xml:"OptionId"`
OptionId string `xml:"OptionId" json:"OptionId"`
}
//回调写入redis
type callBackRedis struct {
DecryptMsgCont string `decrypt_msg_cont`
MsgCont string `msg_cont`
}
//更新按钮文案
type UpdateButtonText struct {
ToUserName string `xml:"ToUserName" json:"ToUserName"`
FromUserName string `xml:"FromUserName" json:"FromUserName"`
CreateTime string `xml:"CreateTime" json:"CreateTime"`
MsgType string `xml:"MsgType" json:"MsgType"`
Button UpdateButtonTextCont `xml:"Button" json:"Button"`
}
type UpdateButtonTextCont struct {
ReplaceName string `xml:"ReplaceName" json:"ReplaceName"`
}

2
middleware/wechatapp/wechatsendmsg/send_applets_type.go

@ -2,7 +2,7 @@ package wechatsendmsg
import "key_performance_indicators/middleware/wechatapp/wechatstatice"
//发送markdown消息
//发送小程序消息
type SendMiniprogramNotice struct {
wechatstatice.PublicSendMsgSmaillSub
MsgBody MiniprogramNoticeCont `json:"miniprogram_notice"`

26
middleware/wechatapp/wechatsendmsg/send_ordinary_msg.go

@ -299,3 +299,29 @@ func (s *SendMultipleInteraction) SendMsg(systemApp string) (callBackCont wechat
err = json.Unmarshal(callBackByte, &callBackCont)
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-06 15:21:06
@ 功能: 更新按钮为不可点击状态
@ 参数
#
@ 返回值
#
*/
func (u *UpdateButtonNotClickable) UpdateButtonNotClick(systemApp string) (callBackCont wechatstatice.UpdateButtonCallBackMsg, err error) {
sendUrl, _, err := wechatstatice.GetSendMsgTokenUrl(systemApp, "update")
if err != nil {
callBackCont.Errcode = 666666
callBackCont.Errmsg = "更新失败!"
return
}
sendDate, _ := json.Marshal(u)
callBackByte := publicmethod.CurlPostJosn(sendUrl, sendDate)
err = json.Unmarshal(callBackByte, &callBackCont)
return
}

22
middleware/wechatapp/wechatsendmsg/type.go

@ -114,3 +114,25 @@ type SendMarkDown struct {
wechatstatice.PublicSendMsg
MsgBody TextMsgCont `json:"markdown"`
}
/*
更新模版卡片消息
*/
//更新模板卡片通用
type UpdateTemplateCardCurrency struct {
Userids []string `json:"userids"` //企业的成员ID列表(最多支持1000个)
Partyids []int `json:"partyids"` //企业的部门ID列表(最多支持100个)
Tagids []int `json:"tagids"` //企业的标签ID列表(最多支持100个)
Atall int `json:"atall"` //更新整个任务接收人员
Agentid uint32 `json:"agentid"` //应用的agentid
ResponseCode string `json:"response_code"`
}
//更新按钮为不可点击状态
type UpdateButtonNotClickable struct {
UpdateTemplateCardCurrency
Button ButtonNotClick `json:"button"`
}
type ButtonNotClick struct {
ReplaceName string `json:"replace_name"`
}

6
middleware/wechatapp/wechatstatice/type.go

@ -49,3 +49,9 @@ type RevokeMsgSendCallBack struct {
Errcode int `json:"errcode"` //返回码
Errmsg string `json:"errmsg"` //对返回码的文本描述内容
}
//更新模板卡片信息回调
type UpdateButtonCallBackMsg struct {
RevokeMsgSendCallBack
Invaliduser []string `json:"invaliduser"` //不合法的userid,不区分大小写,统一转为小写
}

2
models/modelskpi/open_approval_change_log.go

@ -19,6 +19,8 @@ type OpenApprovalChangeLog struct {
ResponseCode string `json:"responsecode" gorm:"column:response_code;type:varchar(255);comment:仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
Stepper int `json:"stepper" gorm:"column:stepper;type:int(5) unsigned;default:1;not null;comment:步进器"`
ChangeIsTrue int `json:"changeistrue" gorm:"column:change_is_true;type:int(1) unsigned;default:1;not null;comment:是否可变更(1:可变更;2:不可变更)"`
Eiteyime int64 `json:"eiteyime" gorm:"column:eiteyime;type:bigint(20) unsigned;default:0;not null;comment:变动时间"`
YesOrNo int `json:"yesorno" gorm:"column:yesorno;type:int(1) unsigned;default:0;not null;comment:0:未操作;1:同意;2:驳回;3:撤回"`
}
func (OpenApprovalChangeLog *OpenApprovalChangeLog) TableName() string {

4
models/modelskpi/post_nature_flow.go

@ -10,8 +10,8 @@ type PostNatureFlow struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"`
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"`
AddOrDecrease int `json:"addordecrease" gorm:"column:add_or_decrease;type:tinyint(1) unsigned;default:1;not null;comment:增加或减少(1:增加;2:减少)"`
Score int64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"`
Money int64 `json:"money" gorm:"column:money;type:bigint(20) unsigned;default:0;not null;comment:钱(扣款或奖励)*100保存"`
Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"`
Money float64 `json:"money" gorm:"column:money;type:bigint(20) unsigned;default:0;not null;comment:钱(扣款或奖励)*100保存"`
Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"`
ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"`
ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"`

1
models/modelskpi/post_workflow_orders.go

@ -11,6 +11,7 @@ type PostWorkflowOrders struct {
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"`
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"`
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"`
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"`
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"`
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"`
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"`

65
models/modelskpi/rectification_measures.go

@ -0,0 +1,65 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 整改措施
type RectificationMeasures struct {
Id int64 `json:"id" gorm:"primaryKey;column:rm_id;type:bigint(20) unsigned;not null"`
UserKey int64 `json:"userkey" gorm:"column:rm_user_key;type:bigint(20) unsigned;default:0;not null;comment:整改人"`
Department int64 `json:"department" gorm:"column:rm_department;type:bigint(20) unsigned;default:0;not null;comment:整改部门"`
Group int64 `json:"group" gorm:"column:rm_group;type:bigint(20) unsigned;default:0;not null;comment:集团"`
OrderKey int64 `json:"order" gorm:"column:rm_order;type:bigint(20) unsigned;default:0;not null;comment:订单ID"`
State int `json:"state" gorm:"column:rm_state;type:int(1) unsigned;default:1;not null;comment:1:草果;2:审批中;3:不合格;4:合格"`
Time int64 `json:"time" gorm:"column:rm_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:rm_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
Content string `json:"content" gorm:"column:rm_content;type:longtext;comment:整改内容"`
Enclosure string `json:"enclosure" gorm:"column:rm_files;type:longtext;comment:附件"`
}
func (RectificationMeasures *RectificationMeasures) TableName() string {
return "rectification_measures"
}
// 编辑内容
func (cont *RectificationMeasures) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *RectificationMeasures) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *RectificationMeasures) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *RectificationMeasures) ContMap(whereMap interface{}, field ...string) (countAry []RectificationMeasures, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *RectificationMeasures) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}

65
models/modelskpi/register.go

@ -0,0 +1,65 @@
package modelskpi
import (
"key_performance_indicators/overall"
"strings"
)
// 订单挂号
type Register struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null"`
Number int64 `json:"userkey" gorm:"column:number;type:bigint(20) unsigned;default:0;not null;comment:号码"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:1:正常;2:已经使用"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}
func (Register *Register) TableName() string {
return "register"
}
// 编辑内容
func (cont *Register) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Register) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *Register) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Register) ContMap(whereMap interface{}, field ...string) (countAry []Register, err error) {
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Register) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
// 添加
func (cont *Register) AddCont() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
}

2
models/wechatcallback/callbacklog.go

@ -6,7 +6,7 @@ type CallbackLog struct {
MsgSignature string `json:"msgSignature" gorm:"column:msg_signature;type:varchar(255);not null;comment:组织名称"`
TimeStamp int64 `json:"timestamp" gorm:"column:timestamp;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
Nonce string `json:"nonce" gorm:"column:nonce;type:varchar(255);not null;comment:组织名称"`
Echostr string `json:"echostr" gorm:"column:echostr;type:varchar(255);not null;comment:组织名称"`
Echostr string `json:"echostr" gorm:"column:echostr;type:text;not null;comment:组织名称"`
Xmlstr string `json:"xmlstr" gorm:"column:xmlstr;type:text;comment:组织名称"`
Jsonstr string `json:"jsonstr" gorm:"column:jsonstr;type:text;comment:组织名称"`
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`

22
overall/publicmethod/type.go

@ -153,11 +153,19 @@ type FlowChartList struct {
Step int `json:"step"` //步伐
NodeName string `json:"nodename"` //节点名称
State int `json:"state"` //状态 1、不点亮;2、点亮
Class int `json:"class"` //节点类型 1、普通节点;2、运行中指定节点
RunType int `json:"runtype"` //运行状态(1:开始;2:操作点;3:结束)
Class int `json:"class"` //节点类型 1、普通节点;2、运行中指定节点;3:抄送节点
RunType int `json:"runtype"` //运行状态(1:开始;2:操作点;3:结束;4:抄送)
NodeRelationship NodeRelationshipStruct `json:"noderelationship"` //节点关系
UserList []UserListFlowAll `json:"userlist"` //节点操作人
}
// 节点关系
type NodeRelationshipStruct struct {
FromNode int `json:"fromnode"` // 来源
ToNode int `json:"tonode"` //去向
RejectNode int `json:"rejectnode"` //退回
}
// 节点操作人
type UserListFlowAll struct {
Id string `json:"id"` //操作人ID
@ -197,3 +205,13 @@ type roleGroupBodyAry struct {
Bfid string `json:"bf_id"`
Icons string `json:"icons"`
}
// 改正措施数据提交
type CorrectiveMeasuresType struct {
OrderId string `json:"orderid"`
Content string `json:"content"` //整改内容
Register string `json:"register"` //挂号
// Enclosure []string `json:"enclosure"` //附件
// Enclosure []EnclosureFormat `json:"enclosure"` //附件
Enclosure []EnclosureFormat `json:"enclosure"` //附件
}

Loading…
Cancel
Save