|
|
@@ -409,7 +409,7 @@ func (this *OilSupplierCertAppendController) DeleteEntity() {
|
|
|
var deleteProcessVM workflow.DeleteProcessVM
|
|
|
if model.WorkFlowId != "" && model.WorkFlowId != "0" {
|
|
|
deleteProcessVM.ProcessInstanceId = model.WorkFlowId
|
|
|
- deleteProcessVM.DeleteReason = "未审批通过,被申请人删除"
|
|
|
+ deleteProcessVM.DeleteReason = "增项申请审批未通过后,被申请人删除"
|
|
|
activitiService.DeleteComplete(deleteProcessVM)
|
|
|
}
|
|
|
|
|
|
@@ -1109,6 +1109,154 @@ func (this *OilSupplierCertAppendController) AppendConcentrateAuditEntity() {
|
|
|
//certSrv.UpdateEntityByIdCols(supplierCertId, supplierCertEntity, cols)
|
|
|
}
|
|
|
|
|
|
+// @Title 查询是否交费及交费数
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {string} string
|
|
|
+// @router /check-need-pay [get]
|
|
|
+func (this *OilSupplierCertAppendController) CheckNeedPayAndAmount() {
|
|
|
+ appendId := this.GetString("appendId")
|
|
|
+
|
|
|
+ certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(appendId, &supplierCertAppendEntity)
|
|
|
+
|
|
|
+ var isPayList []string
|
|
|
+ isPayList = append(isPayList, suppliercert.PINGSHEN)
|
|
|
+ isPayList = append(isPayList, suppliercert.WAIBUSHICHANG)
|
|
|
+ var unPayList []string
|
|
|
+ unPayList = append(unPayList, suppliercert.YIJIWUZI)
|
|
|
+ unPayList = append(unPayList, suppliercert.ERJIWUZI)
|
|
|
+ unPayList = append(unPayList, suppliercert.ZHANLUEHEZUO)
|
|
|
+ unPayList = append(unPayList, suppliercert.NEIBUDUOYUAN)
|
|
|
+
|
|
|
+ result := 0
|
|
|
+ isPay := "false"
|
|
|
+ unPay := "false"
|
|
|
+ for _, eachItem := range isPayList {
|
|
|
+ if eachItem == supplierCertAppendEntity.InStyle {
|
|
|
+ // 需要付费
|
|
|
+ isPay = "true"
|
|
|
+ result = 1
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, eachItem := range unPayList {
|
|
|
+ if eachItem == supplierCertAppendEntity.InStyle {
|
|
|
+ // 不需要付费
|
|
|
+ unPay = "true"
|
|
|
+ result = 2
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if supplierCertAppendEntity.AppendType == "01" && result == 1 {
|
|
|
+ // 如果是物资类且属于需要付费类型
|
|
|
+ where := " SupplierCertId = " + strconv.Itoa(supplierCertAppendEntity.SupplierCertId) + " and SupplierTypeCode = '" + supplierCertAppendEntity.AppendType + "' and SupplierCertAppendId = " + strconv.Itoa(supplierCertAppendEntity.Id)
|
|
|
+ svc := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
|
|
|
+ var list []suppliercertsub.OilSupplierCertSub
|
|
|
+ total := svc.GetPagingEntitiesWithOrder(1, 10, "CreateOn", false, &list, where)
|
|
|
+ if total <= 50 {
|
|
|
+ result = 2
|
|
|
+ }
|
|
|
+ log.Print("物资类增项准入范围小于50项, 公司:" + supplierCertAppendEntity.SupplierName + " 增项ID:" + strconv.Itoa(supplierCertAppendEntity.Id) + "增项数目:" + strconv.Itoa(int(total)))
|
|
|
+ } else {
|
|
|
+ log.Println("类别:" + supplierCertAppendEntity.AppendType + "结果:" + strconv.Itoa(result))
|
|
|
+ }
|
|
|
+ if isPay == unPay {
|
|
|
+ // 准入类型是否付费有误!请联系管理员
|
|
|
+ result = 0
|
|
|
+ }
|
|
|
+ var paymentInfoEntity paymentinfo.OilPaymentInfo
|
|
|
+ s := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
+ where := " isPay='2' and SrcId='" + appendId + "' and SupplierCertId='" + strconv.Itoa(supplierCertAppendEntity.SupplierCertId) + "'"
|
|
|
+ s.GetEntityByWhere("OilPaymentInfo", where, &paymentInfoEntity)
|
|
|
+ if paymentInfoEntity.Id > 0 {
|
|
|
+ result = 2 // 已交费, 不再需要交费
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取交费额 1需交费 0未知 2已交费
|
|
|
+ var Amount float64
|
|
|
+ Amount = 0.00
|
|
|
+ if result == 1 {
|
|
|
+ costSvc := oilcostmanage.GetOilCostManageService(utils.DBE)
|
|
|
+ Amount = costSvc.GetAmount("APPEND", supplierCertAppendEntity.AppendType)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.Data["json"] = Amount
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 撤回申请
|
|
|
+// @Description 交费环节之后撤回节点
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /recall-apply/:id [post]
|
|
|
+func (this *OilSupplierCertAppendController) RecallApply() {
|
|
|
+ appendId := this.Ctx.Input.Param(":id")
|
|
|
+ AuditRemark := this.GetString("AuditRemark")
|
|
|
+
|
|
|
+ var errInfo ErrorDataInfo
|
|
|
+ defer func() { //finally处理失败的异常
|
|
|
+ if err := recover(); err != nil {
|
|
|
+ errInfo.Message = err.(string)
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ //返回正确结果
|
|
|
+ errInfo.Message = "申请撤回成功!"
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ if AuditRemark == "" {
|
|
|
+ panic("撤回原因不能为空!")
|
|
|
+ }
|
|
|
+
|
|
|
+ //取出准入表信息
|
|
|
+ certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(appendId, &supplierCertAppendEntity)
|
|
|
+
|
|
|
+ if this.User.Id != strconv.Itoa(supplierCertAppendEntity.CreateUserId) {
|
|
|
+ panic("权限错误,仅申请人可撤回当前申请!")
|
|
|
+ }
|
|
|
+
|
|
|
+ svcPaymentInfo := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
+ var paymentInfo paymentinfo.OilPaymentInfo
|
|
|
+ wherePay := " SrcId=" + appendId + " and SupplierId=" + strconv.Itoa(supplierCertAppendEntity.SupplierId) + " and SupplierCertId=" + strconv.Itoa(supplierCertAppendEntity.SupplierCertId)
|
|
|
+ hasPayInfo := svcPaymentInfo.GetEntityByWhere("OilPaymentInfo", wherePay, &paymentInfo)
|
|
|
+ if hasPayInfo {
|
|
|
+ if paymentInfo.PayType != "3" {
|
|
|
+ log.Println("交费类型错误:" + paymentInfo.PayType + ", 增项申请ID: " + appendId + ", 企业ID:" + strconv.Itoa(supplierCertAppendEntity.SupplierId))
|
|
|
+ panic("交费类型错误,不允许撤回!")
|
|
|
+ }
|
|
|
+ if paymentInfo.IsPay == "2" {
|
|
|
+ panic("该申请已完成交费,不允许撤回!")
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.Println("交费信息不存在:" + ", 准入申请ID: " + appendId + ", 企业ID:" + strconv.Itoa(supplierCertAppendEntity.SupplierId))
|
|
|
+ panic("交费信息不存在或当前申请状态不允许撤回,请重新确认!")
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_APPEND_APPLY
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id //审批人员
|
|
|
+ ActiComplete.Result = "0" // 撤回申请 默认0
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId+" 工作流传参: ", ActiComplete, receiveVal)
|
|
|
+ panic("任务已审批,请刷新!")
|
|
|
+ } else {
|
|
|
+ // 删除已产生的交费信息
|
|
|
+ svcPaymentInfo.DeleteEntityBytbl("OilPaymentInfo", wherePay)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// @Title 确认是否入库
|
|
|
// @Description 确认是否入库
|
|
|
// @Success 200 {object} controllers.Request
|