|
|
@@ -8,6 +8,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
|
|
|
"dashoo.cn/backend/api/business/organize"
|
|
|
"dashoo.cn/backend/api/business/paymentinfo"
|
|
|
"dashoo.cn/business2/parameter"
|
|
|
@@ -500,7 +501,7 @@ func (this *OilSupplierCertController) UpdateStorage() {
|
|
|
} else {
|
|
|
|
|
|
var activity oilactivity.OilActivity
|
|
|
- where := "EntityId=" + id + " and ActType='" + oilactivity.STORAGE + "'"
|
|
|
+ where := "EntityId=" + id + " and ActType='" + oilactivity.STORAGE + "'"
|
|
|
svc.GetEntity(&activity, where)
|
|
|
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
@@ -508,7 +509,7 @@ func (this *OilSupplierCertController) UpdateStorage() {
|
|
|
ActiComplete.ProcessKey = activity.ProcessKey
|
|
|
ActiComplete.BusinessKey = activity.BusinessKey
|
|
|
ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Remarks =""
|
|
|
+ ActiComplete.Remarks = ""
|
|
|
ActiComplete.Result = "1"
|
|
|
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
@@ -518,7 +519,7 @@ func (this *OilSupplierCertController) UpdateStorage() {
|
|
|
model.Status = suppliercert.STORE_STATUS
|
|
|
model.Step = 7
|
|
|
model.StorageOn = time.Now()
|
|
|
- model.ApplyTime = time.Now().AddDate(1, 0 ,0)
|
|
|
+ model.ApplyTime = time.Now().AddDate(1, 0, 0)
|
|
|
model.InFlag = "1"
|
|
|
model.ModifiedOn = time.Now()
|
|
|
model.ModifiedBy = this.User.Realname
|
|
|
@@ -537,8 +538,6 @@ func (this *OilSupplierCertController) UpdateStorage() {
|
|
|
err = svc.UpdateEntityBytbl(OilSupplierCertName, id, &model, cols)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if err == nil {
|
|
|
errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
|
@@ -673,7 +672,7 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
result := strconv.Itoa(this.User.IsCompanyUser)
|
|
|
if supplierCertEntity.WorkflowId == "0" || len(supplierCertEntity.WorkflowId) <= 0 {
|
|
|
//启动工作流
|
|
|
- businessKey = certId + "-" + strconv.Itoa(supplierCertEntity.AuditIndex)
|
|
|
+ businessKey = certId + "-" + strconv.Itoa(supplierCertEntity.AuditIndex)
|
|
|
// 1 评审准入 2 一级物资备案准入 3 二级物资备案准入 4 战略合作准入 5 内部多元准入 6 外部市场准入
|
|
|
if supplierCertEntity.InStyle == "2" || supplierCertEntity.InStyle == "4" || supplierCertEntity.InStyle == "6" {
|
|
|
processInstanceId = svcActiviti.StartProcess2(workflow.OIL_FIRST_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
|
|
|
@@ -772,7 +771,7 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
supplierCertEntity.WorkflowId = processInstanceId
|
|
|
if this.User.IsCompanyUser == 1 {
|
|
|
supplierCertEntity.Status = suppliercert.FEN_TRIAL_STATUS //分办
|
|
|
- }else if this.User.IsCompanyUser == 0 {
|
|
|
+ } else if this.User.IsCompanyUser == 0 {
|
|
|
supplierCertEntity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
}
|
|
|
|
|
|
@@ -780,8 +779,8 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
supplierCertEntity.AuditIndex = supplierCertEntity.AuditIndex + 1
|
|
|
supplierCertEntity.BusinessKey = ActiComplete.BusinessKey
|
|
|
- supplierCertEntity.SecondAudit,_ = strconv.Atoi(secondAudit)
|
|
|
- supplierCertEntity.ThirdAudit,_ = strconv.Atoi(thirdAudit)
|
|
|
+ supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
|
supplierCertEntity.ProcessKey = ActiComplete.ProcessKey
|
|
|
supplierCertEntity.CommitComId = unitId
|
|
|
cols := []string{
|
|
|
@@ -849,7 +848,6 @@ func (this *OilSupplierCertController) AuditEntityadmission() {
|
|
|
certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// @Title 审批
|
|
|
// @Description 审批
|
|
|
// @Param body body suppliercert.OilSupplierCert
|
|
|
@@ -865,7 +863,6 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
thirdAudit := this.GetString("ThirdAudit")
|
|
|
//majorDept := this.GetString("majorDept")
|
|
|
|
|
|
-
|
|
|
//取出审批列表
|
|
|
certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
var supplierCertEntity suppliercert.OilSupplierCert
|
|
|
@@ -906,8 +903,8 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
step = 2
|
|
|
supplierCertEntity.Step = 2
|
|
|
supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
- supplierCertEntity.SecondAudit,_ = strconv.Atoi(secondAudit)
|
|
|
- supplierCertEntity.ThirdAudit,_ = strconv.Atoi(thirdAudit)
|
|
|
+ supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
|
cols := []string{
|
|
|
"Id",
|
|
|
"Step",
|
|
|
@@ -937,7 +934,7 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
var setting auditsetting.Base_OilAuditSetting
|
|
|
usvc := userRole.GetUserService(utils.DBE)
|
|
|
|
|
|
- if supplierCertEntity.InStyle == "3"{
|
|
|
+ if supplierCertEntity.InStyle == "3" {
|
|
|
status = suppliercert.THIRD_TRIAL_STATUS
|
|
|
where := "AuditStepCode='" + workflow.PROF_RECE + "'"
|
|
|
usvc.GetEntity(&setting, where)
|
|
|
@@ -956,7 +953,6 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
businessKey := strconv.Itoa(supplierCertEntity.Id)
|
|
|
result := "1"
|
|
|
|
|
|
-
|
|
|
userIds := ""
|
|
|
var userlist []userRole.Base_User
|
|
|
var setting auditsetting.Base_OilAuditSetting
|
|
|
@@ -1003,10 +999,9 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
|
|
|
certSrv.InsertEntityBytbl(OilActivityName, &activity)
|
|
|
|
|
|
-
|
|
|
status = suppliercert.STOREING_STATUS
|
|
|
step = 3
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
status = suppliercert.THIRD_TRIAL_STATUS
|
|
|
where := "AuditStepCode='" + workflow.PROF_RECE + "'"
|
|
|
svc.GetEntity(&setting, where)
|
|
|
@@ -1024,7 +1019,6 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
//var users []userRole.Base_RoleList
|
|
|
//certSrv.GetAuditUser(strconv.Itoa(supplierCertEntity.ThirdAudit), workflow.PROF_RECE, &users)
|
|
|
|
|
|
-
|
|
|
for _, tmpUser := range userlist {
|
|
|
userIds += strconv.Itoa(tmpUser.Id) + "," //strconv.FormatInt(tmpUser.Id, 10) + ","
|
|
|
}
|
|
|
@@ -1099,7 +1093,7 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
paysvc := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
var Amount float64
|
|
|
asvc := oilcostmanage.GetOilCostManageService(utils.DBE)
|
|
|
- Amount = asvc.GetAmount("ZHUNRU",supplierCertEntity.SupplierTypeCode)
|
|
|
+ Amount = asvc.GetAmount("ZHUNRU", supplierCertEntity.SupplierTypeCode)
|
|
|
var payinfo paymentinfo.OilPaymentInfo
|
|
|
payinfo.SupplierId = supplierCertEntity.SupplierId
|
|
|
payinfo.SrcId = supplierCertEntity.Id
|
|
|
@@ -1107,7 +1101,7 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
payinfo.USCCode = supplierEntity.CommercialNo
|
|
|
payinfo.SupplierName = supplierEntity.SupplierName
|
|
|
payinfo.PayType = "1"
|
|
|
- payinfo.Amount = strconv.FormatFloat(Amount,'E',-1,64)
|
|
|
+ payinfo.Amount = strconv.FormatFloat(Amount, 'E', -1, 64)
|
|
|
payinfo.IsPay = "0"
|
|
|
payinfo.CreateUserId = supplierCertEntity.CreateUserId
|
|
|
payinfo.CreateBy = supplierCertEntity.CreateBy
|
|
|
@@ -1115,11 +1109,10 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
|
|
|
wheresup := " SupplierCertId=" + strconv.Itoa(supplierCertEntity.Id)
|
|
|
var sup []suppliercertsub.OilSupplierCertSub
|
|
|
- total := paysvc.GetPagingEntitiesWithOrder(1,10,"Id",true,&sup,wheresup)
|
|
|
-
|
|
|
- if supplierCertEntity.SupplierTypeCode == "01" && total <= 50{
|
|
|
- status = suppliercert.STOREING_STATUS
|
|
|
+ total := paysvc.GetPagingEntitiesWithOrder(1, 10, "Id", true, &sup, wheresup)
|
|
|
|
|
|
+ if supplierCertEntity.SupplierTypeCode == "01" && total <= 50 {
|
|
|
+ status = suppliercert.STOREING_STATUS
|
|
|
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
businessKey := strconv.Itoa(supplierCertEntity.Id)
|
|
|
@@ -1171,15 +1164,13 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
|
|
|
paysvc.InsertEntityBytbl(OilActivityName, &activity)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
paysvc.InsertEntity(&payinfo)
|
|
|
//发短信
|
|
|
toMobile := supplierEntity.Mobile
|
|
|
- msg:= "您的"+supplierCertEntity.SupplierTypeName + "准入审核通过,请及时确认交费信息!"
|
|
|
+ msg := "您的" + supplierCertEntity.SupplierTypeName + "准入审核通过,请及时确认交费信息!"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"3-1",supplierCertEntity.CreateBy,supplierEntity.ContactName,strconv.Itoa(supplierCertEntity.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "3-1", supplierCertEntity.CreateBy, supplierEntity.ContactName, strconv.Itoa(supplierCertEntity.CreateUserId))
|
|
|
}
|
|
|
|
|
|
//paysvc.AddPaymentinfo(supplierCertEntity.SupplierId, supplierCertEntity.Id, Amount, "1")
|
|
|
@@ -1241,8 +1232,6 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
|
|
|
certSrv.InsertEntityBytbl(OilActivityName, &activity)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
supplierCertEntity.Status = suppliercert.STOREING_STATUS
|
|
|
supplierCertEntity.Step = step
|
|
|
cols := []string{
|
|
|
@@ -1303,14 +1292,13 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
|
|
|
certSrv.InsertEntityBytbl(OilActivityName, &activity)
|
|
|
|
|
|
-
|
|
|
supplierCertEntity.Status = suppliercert.STOREING_STATUS
|
|
|
- supplierCertEntity.Step = 3
|
|
|
- cols := []string{
|
|
|
- "Status",
|
|
|
- "Step",
|
|
|
- }
|
|
|
- certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
+ supplierCertEntity.Step = 3
|
|
|
+ cols := []string{
|
|
|
+ "Status",
|
|
|
+ "Step",
|
|
|
+ }
|
|
|
+ certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
} else {
|
|
|
supplierCertEntity.Status = status
|
|
|
supplierCertEntity.Step = step
|
|
|
@@ -1370,9 +1358,9 @@ func (this *OilSupplierCertController) AuditEntityFir() {
|
|
|
certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
|
|
|
toMobile := supplierEntity.Mobile
|
|
|
- msg:= "您的"+supplierCertEntity.SupplierTypeName + "准入审核未通过,请及时查看!"
|
|
|
+ msg := "您的" + supplierCertEntity.SupplierTypeName + "准入审核未通过,请及时查看!"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"4-1",supplierCertEntity.CreateBy,supplierEntity.ContactName,strconv.Itoa(supplierCertEntity.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "4-1", supplierCertEntity.CreateBy, supplierEntity.ContactName, strconv.Itoa(supplierCertEntity.CreateUserId))
|
|
|
errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
|
this.Data["json"] = &errinfo
|
|
|
@@ -1454,7 +1442,7 @@ func (this *OilSupplierCertController) IsAccess() {
|
|
|
if res {
|
|
|
actisvc := workflow.GetActivitiService(utils.DBE)
|
|
|
ids := actisvc.GetMyTasks(processkey, this.User.Id)
|
|
|
- res = strings.Contains(ids,id)
|
|
|
+ res = strings.Contains(ids, id)
|
|
|
}
|
|
|
|
|
|
//for _, user := range users {
|
|
|
@@ -1485,7 +1473,7 @@ func (this *OilSupplierCertController) CreateAccessCardNo() {
|
|
|
//codecSvc.GetEntities(&model, "")
|
|
|
seqStr := ""
|
|
|
cols := []string{}
|
|
|
- if (typeCode == "01") { // 物质
|
|
|
+ if (typeCode == "01") { // 物质
|
|
|
has := true
|
|
|
for has {
|
|
|
seqStr = codecSvc.GetWZAccessCardNo(this.User.AccCode)
|
|
|
@@ -1539,11 +1527,11 @@ func (this *OilSupplierCertController) UpdataInFlag() {
|
|
|
currenttime := time.Now()
|
|
|
//.Format("2006-01-02")
|
|
|
for i := 0; i < len(certentitys); i++ {
|
|
|
- if currenttime.After(certentitys[i].ApplyTime) && !currenttime.After(certentitys[i].ApplyTime.AddDate(1,0,0)) && certentitys[i].InFlag != "2" {
|
|
|
+ if currenttime.After(certentitys[i].ApplyTime) && !currenttime.After(certentitys[i].ApplyTime.AddDate(1, 0, 0)) && certentitys[i].InFlag != "2" {
|
|
|
var certentity suppliercert.OilSupplierCert
|
|
|
certentity.InFlag = "2"
|
|
|
cols := []string{"InFlag"}
|
|
|
- _,err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
|
|
|
+ _, err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
|
|
|
if err != nil {
|
|
|
session.Rollback()
|
|
|
}
|
|
|
@@ -1553,7 +1541,7 @@ func (this *OilSupplierCertController) UpdataInFlag() {
|
|
|
var certentity suppliercert.OilSupplierCert
|
|
|
certentity.InFlag = "3"
|
|
|
cols := []string{"InFlag"}
|
|
|
- _,err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
|
|
|
+ _, err = svc.UpdateEntityByIdCols(certentitys[i].Id, &certentity, cols)
|
|
|
if err != nil {
|
|
|
session.Rollback()
|
|
|
}
|
|
|
@@ -1582,7 +1570,7 @@ func (this *OilSupplierCertController) SaveAccessCardNo() {
|
|
|
svc.GetEntities(&model, where)
|
|
|
supcols := []string{}
|
|
|
if model == nil || len(model) == 0 {
|
|
|
- if (typeCode == "01") { // 物质
|
|
|
+ if (typeCode == "01") { // 物质
|
|
|
supplier.WZAccessCardNo = accessCardNo
|
|
|
supcols = []string{"WZAccessCardNo"}
|
|
|
} else if typeCode == "03" { //技术服务
|
|
|
@@ -1623,33 +1611,31 @@ func (this *OilSupplierCertController) SendingSMS() {
|
|
|
svcsupp.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, 0, 0, "Id", true, &list, where)
|
|
|
currenttime := time.Now()
|
|
|
|
|
|
- for _,item := range list {
|
|
|
- if currenttime.AddDate(0,3,0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
+ for _, item := range list {
|
|
|
+ if currenttime.AddDate(0, 3, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
toMobile := item.Mobile
|
|
|
- msg:= "您的" + item.SupplierTypeName + "准入还有3个月到期"
|
|
|
+ msg := "您的" + item.SupplierTypeName + "准入还有3个月到期"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"1-1",item.CreateBy,item.ContactName,strconv.Itoa(item.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
|
|
|
}
|
|
|
- if currenttime.AddDate(0,2,0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
- toMobile :=item.Mobile
|
|
|
- msg:= "您的" + item.SupplierTypeName + "准入还有2个月到期"
|
|
|
+ if currenttime.AddDate(0, 2, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
+ toMobile := item.Mobile
|
|
|
+ msg := "您的" + item.SupplierTypeName + "准入还有2个月到期"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"1-1",item.CreateBy,item.ContactName,strconv.Itoa(item.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
|
|
|
}
|
|
|
- if currenttime.AddDate(0,1,0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
+ if currenttime.AddDate(0, 1, 0).Format("2006-01-02") == (item.ApplyTime.Format("2006-01-02")) {
|
|
|
toMobile := item.Mobile
|
|
|
- msg:= "您的" + item.SupplierTypeName + "准入还有1个月到期"
|
|
|
+ msg := "您的" + item.SupplierTypeName + "准入还有1个月到期"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"1-1",item.CreateBy,item.ContactName,strconv.Itoa(item.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
|
|
|
}
|
|
|
}
|
|
|
elapsed := time.Since(t)
|
|
|
fmt.Println(elapsed, "快到期提醒")
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// @Title 资质快到期短信通知
|
|
|
// @Description
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
@@ -1657,16 +1643,16 @@ func (this *OilSupplierCertController) SendingSMS() {
|
|
|
func (this *OilSupplierCertController) SendingSMSSupplierFile() {
|
|
|
t := time.Now()
|
|
|
svcsupp := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- var expireFile []supplier.ExpireFile
|
|
|
- where := " b.EffectDate LIKE '%" + time.Now().AddDate(0,1,0).Format("2006-01-02") + "%'"
|
|
|
+ var expireFile []supplier.ExpireFile
|
|
|
+ where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, 1, 0).Format("2006-01-02") + "%'"
|
|
|
err := svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &expireFile, where)
|
|
|
|
|
|
if err == nil {
|
|
|
for _, item := range expireFile {
|
|
|
toMobile := item.Mobile
|
|
|
- msg:= "您的" + item.ExpireAllFile + "还有1个月到期"
|
|
|
+ msg := "您的" + item.ExpireAllFile + "还有1个月到期"
|
|
|
msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"1-1",item.CreateBy,item.ContactName,strconv.Itoa(item.CreateUserId))
|
|
|
+ msgService.HandleMsg(toMobile, msg, "1-1", item.CreateBy, item.ContactName, strconv.Itoa(item.CreateUserId))
|
|
|
}
|
|
|
}
|
|
|
elapsed := time.Since(t)
|
|
|
@@ -1680,11 +1666,11 @@ func (this *OilSupplierCertController) SendingSMSSupplierFile() {
|
|
|
func (this *OilSupplierCertController) ChangeSupplierStatus() {
|
|
|
|
|
|
svcsupp := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- var fileData []supplier.ExpireFile
|
|
|
- where := " b.EffectDate LIKE '%" + time.Now().AddDate(0,0,-1).Format("2006-01-02") + "%'"
|
|
|
+ var fileData []supplier.ExpireFile
|
|
|
+ where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "%'"
|
|
|
svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &fileData, where)
|
|
|
|
|
|
- for _,item := range fileData {
|
|
|
+ for _, item := range fileData {
|
|
|
var sert suppliercert.OilSupplierCert
|
|
|
cols := []string{
|
|
|
"InFlag",
|
|
|
@@ -1694,7 +1680,6 @@ func (this *OilSupplierCertController) ChangeSupplierStatus() {
|
|
|
svcsupp.UpdateEntityBywheretbl(OilSupplierCertName, &sert, cols, where)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// @Title 更新Inflag状态
|
|
|
@@ -1703,7 +1688,6 @@ func (this *OilSupplierCertController) ChangeSupplierStatus() {
|
|
|
// @router /reinput/:id [post]
|
|
|
func (this *OilSupplierCertController) ReInput() {
|
|
|
id := this.Ctx.Input.Param(":id")
|
|
|
- inFlag := this.GetString("InFlag")
|
|
|
|
|
|
var errinfo ErrorInfo
|
|
|
if id == "" {
|
|
|
@@ -1714,69 +1698,195 @@ func (this *OilSupplierCertController) ReInput() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- var model suppliercert.OilSupplierCert
|
|
|
- svc := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
- model.InFlag = inFlag
|
|
|
- model.IsDelete = 1
|
|
|
- model.ModifiedOn = time.Now()
|
|
|
- model.ModifiedBy = this.User.Realname
|
|
|
- model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- cols := []string{
|
|
|
- "IsDelete",
|
|
|
- "InFlag",
|
|
|
- "ModifiedOn",
|
|
|
- "ModifiedUserId",
|
|
|
- "ModifiedBy",
|
|
|
- }
|
|
|
- err := svc.UpdateEntityBytbl(OilSupplierCertName, id, &model, cols)
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "提交成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ session := utils.DBE.NewSession()
|
|
|
+ svc := suppliercert.GetOilSupplierCertSession(session)
|
|
|
+ defer func() {
|
|
|
+ session.Close()
|
|
|
+ }()
|
|
|
+ err := session.Begin()
|
|
|
|
|
|
+ var model []suppliercert.Del_OilSupplierCert
|
|
|
|
|
|
+ where := "SupplierId=" + id
|
|
|
+ var sql string
|
|
|
+ sql = "select * from " + OilSupplierCertName + " where " + where
|
|
|
+ utils.DBE.SQL(sql).Find(&model)
|
|
|
|
|
|
+ isdelsupplier := false
|
|
|
+ if model != nil && len(model) > 0 {
|
|
|
+ isdelsupplier = true
|
|
|
+ }
|
|
|
|
|
|
+ for _, item := range model {
|
|
|
+ if item.InFlag == "3" {
|
|
|
+ where := "Id=" + strconv.Itoa(item.Id)
|
|
|
+ err = svc.DeleteEntityBytbl(OilSupplierCertName, where)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ item.DeleteDate = time.Now()
|
|
|
+ _, err = svc.InsertEntityBytbl(DelOilSupplierCertName, &item)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ // 交费信息
|
|
|
+ var delpay []paymentinfo.Del_OilPaymentInfo
|
|
|
+ wherepay := "SupplierCertId=" + strconv.Itoa(model[0].Id)
|
|
|
+ var sqlpay string
|
|
|
+ sqlpay = "select * from " + OilPaymentInfoName + " where " + wherepay
|
|
|
+ utils.DBE.SQL(sqlpay).Find(&delpay)
|
|
|
|
|
|
+ err = svc.DeleteEntityBytbl(OilPaymentInfoName, wherepay)
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ for idx, _ := range delpay {
|
|
|
+ delpay[idx].DeleteDate = time.Now()
|
|
|
+ }
|
|
|
|
|
|
+ _, err = svc.InsertEntityBytbl(DelOilPaymentInfoName, &delpay)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ // 删除准入范围
|
|
|
+ var certsup []suppliercertsub.Del_OilSupplierCertSub
|
|
|
+ wheresup := "SupplierCertId=" + strconv.Itoa(model[0].Id)
|
|
|
+ var sqlsup string
|
|
|
+ sqlsup = "select * from " + OilSupplierCertSubName + " where " + wheresup
|
|
|
+ utils.DBE.SQL(sqlsup).Find(&certsup)
|
|
|
|
|
|
+ err = svc.DeleteEntityBytbl(OilSupplierCertSubName, wheresup)
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ for idx, _ := range certsup {
|
|
|
+ certsup[idx].DeleteDate = time.Now()
|
|
|
+ }
|
|
|
|
|
|
+ _, err = svc.InsertEntityBytbl(DelOilSupplierCertSubName, &certsup)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ } else {
|
|
|
+ isdelsupplier = false
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if isdelsupplier {
|
|
|
+ // 删除企业信息
|
|
|
+ var modelsupp supplier.Del_OilSupplier
|
|
|
+ where := "Id=" + strconv.Itoa(model[0].SupplierId)
|
|
|
+ var sql string
|
|
|
+ sql = "select * from " + OilSupplierName + " where " + where
|
|
|
+ utils.DBE.SQL(sql).Get(&modelsupp)
|
|
|
|
|
|
+ err = svc.DeleteEntityBytbl(OilSupplierName, where)
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ modelsupp.DeleteDate = time.Now()
|
|
|
+ _, err = svc.InsertEntityBytbl(DelOilSupplierName, &modelsupp)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ // 删除企业资质
|
|
|
+ var delfile []supplierfile.Del_OilSupplierFile
|
|
|
+ wheref := "SupplierId=" + strconv.Itoa(model[0].SupplierId)
|
|
|
+ var sqlw string
|
|
|
+ sqlw = "select * from " + OilSupplierFileName + " where " + wheref
|
|
|
+ utils.DBE.SQL(sqlw).Find(&delfile)
|
|
|
+
|
|
|
+ err = svc.DeleteEntityBytbl(OilSupplierFileName, wheref)
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ for idx, _ := range delfile {
|
|
|
+ delfile[idx].DeleteDate = time.Now()
|
|
|
+ }
|
|
|
|
|
|
+ _, err = svc.InsertEntityBytbl(DelOilSupplierFileName, &delfile)
|
|
|
|
|
|
+ if err != nil {
|
|
|
+ session.Rollback()
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ err = session.Commit()
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
|
|
|
+}
|