|
@@ -1,7 +1,9 @@
|
|
|
package oilcontract
|
|
package oilcontract
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "dashoo.cn/backend/api/business/auditsetting"
|
|
|
"dashoo.cn/backend/api/business/oilcontract/contractReview"
|
|
"dashoo.cn/backend/api/business/oilcontract/contractReview"
|
|
|
|
|
+ "dashoo.cn/backend/api/business/organize"
|
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"fmt"
|
|
"fmt"
|
|
@@ -349,7 +351,15 @@ func (this *OilContractController) GetEntityList() {
|
|
|
where = where + " and PoNumber like '%" + SignedDate + "%'"
|
|
where = where + " and PoNumber like '%" + SignedDate + "%'"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 企管法规处可看所有合同, 获取企管法规处人员
|
|
|
|
|
+ var setting auditsetting.Base_OilAuditSetting
|
|
|
|
|
+ orgSvc := organize.GetOrganizeService(utils.DBE)
|
|
|
|
|
+ whereAudit := "AuditStepCode='PROF_REGULATION'"
|
|
|
|
|
+ orgSvc.GetEntity(&setting, whereAudit)
|
|
|
|
|
+ res := orgSvc.UserInRoleById(this.User.Id, strconv.Itoa(setting.RoleId))
|
|
|
|
|
+ if !res {
|
|
|
|
|
+ where = where + " and SecondUnit= " + strconv.Itoa(this.User.UnitId)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
|
var list []contract.OilContract
|
|
var list []contract.OilContract
|
|
@@ -382,7 +392,6 @@ func (this *OilContractController) GetDictList() {
|
|
|
dictList["ContractMode"] = dictSvc.GetKeyValueItems("ContractMode")
|
|
dictList["ContractMode"] = dictSvc.GetKeyValueItems("ContractMode")
|
|
|
dictList["CurrencyType"] = dictSvc.GetKeyValueItems("CurrencyType")
|
|
dictList["CurrencyType"] = dictSvc.GetKeyValueItems("CurrencyType")
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//var dictCustomer []svccustomer.Customer
|
|
//var dictCustomer []svccustomer.Customer
|
|
|
//customerSvc.GetEntitysByWhere("" + CustomerName, "", &dictCustomer)
|
|
//customerSvc.GetEntitysByWhere("" + CustomerName, "", &dictCustomer)
|
|
|
//dictList["EntrustCorp"] = &dictCustomer
|
|
//dictList["EntrustCorp"] = &dictCustomer
|
|
@@ -441,6 +450,7 @@ func (this *OilContractController) GetEntity() {
|
|
|
this.Data["json"] = &model
|
|
this.Data["json"] = &model
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// @Title get 导入excel
|
|
// @Title get 导入excel
|
|
|
// @Description 数据存入word
|
|
// @Description 数据存入word
|
|
|
// @Success 200 {object} controllers.Request
|
|
// @Success 200 {object} controllers.Request
|
|
@@ -491,41 +501,41 @@ func (this *OilContractController) ImportExcel() {
|
|
|
lineNo := strconv.Itoa(i + 1)
|
|
lineNo := strconv.Itoa(i + 1)
|
|
|
fmt.Println(lineNo)
|
|
fmt.Println(lineNo)
|
|
|
tmp := make(map[string]string)
|
|
tmp := make(map[string]string)
|
|
|
- tmp["ContractNo"] = sheet.Rows[i].Cells[0].String()
|
|
|
|
|
- tmp["ContractName"] = sheet.Rows[i].Cells[1].String()
|
|
|
|
|
- tmp["Amount"] = sheet.Rows[i].Cells[2].String()
|
|
|
|
|
- tmp["SourceContractClass"] = sheet.Rows[i].Cells[3].String()
|
|
|
|
|
|
|
+ tmp["ContractNo"] = sheet.Rows[i].Cells[0].String()
|
|
|
|
|
+ tmp["ContractName"] = sheet.Rows[i].Cells[1].String()
|
|
|
|
|
+ tmp["Amount"] = sheet.Rows[i].Cells[2].String()
|
|
|
|
|
+ tmp["SourceContractClass"] = sheet.Rows[i].Cells[3].String()
|
|
|
|
|
|
|
|
tmp["ContractSonClass"] = sheet.Rows[i].Cells[4].String()
|
|
tmp["ContractSonClass"] = sheet.Rows[i].Cells[4].String()
|
|
|
- tmp["SmallClass"] = sheet.Rows[i].Cells[5].String()
|
|
|
|
|
- tmp["SignedDate"] = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
|
|
|
|
|
- tmp["SourceSupplierName"] = sheet.Rows[i].Cells[7].String()
|
|
|
|
|
-
|
|
|
|
|
- tmp["People"] = sheet.Rows[i].Cells[8].String()
|
|
|
|
|
- tmp["Number"] = sheet.Rows[i].Cells[9].String()
|
|
|
|
|
- tmp["ChooseWay"] = sheet.Rows[i].Cells[10].String()
|
|
|
|
|
- tmp["ContractMark"] = sheet.Rows[i].Cells[11].String()
|
|
|
|
|
- tmp["Currency"] = sheet.Rows[i].Cells[12].String()
|
|
|
|
|
- tmp["BudgetAmount"] = sheet.Rows[i].Cells[13].String()
|
|
|
|
|
- tmp["PerformAmount"] = sheet.Rows[i].Cells[14].String()
|
|
|
|
|
- tmp["IsInternal"] = sheet.Rows[i].Cells[15].String()
|
|
|
|
|
- tmp["IsForeign"] = sheet.Rows[i].Cells[16].String()
|
|
|
|
|
- tmp["IsDeal"] = sheet.Rows[i].Cells[17].String()
|
|
|
|
|
- tmp["MoneyFlows"] = sheet.Rows[i].Cells[18].String()
|
|
|
|
|
- tmp["MoneyChannel"] = sheet.Rows[i].Cells[19].String()
|
|
|
|
|
- tmp["MoneyChannelSon"] = sheet.Rows[i].Cells[20].String()
|
|
|
|
|
|
|
+ tmp["SmallClass"] = sheet.Rows[i].Cells[5].String()
|
|
|
|
|
+ tmp["SignedDate"] = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
|
|
|
|
|
+ tmp["SourceSupplierName"] = sheet.Rows[i].Cells[7].String()
|
|
|
|
|
+
|
|
|
|
|
+ tmp["People"] = sheet.Rows[i].Cells[8].String()
|
|
|
|
|
+ tmp["Number"] = sheet.Rows[i].Cells[9].String()
|
|
|
|
|
+ tmp["ChooseWay"] = sheet.Rows[i].Cells[10].String()
|
|
|
|
|
+ tmp["ContractMark"] = sheet.Rows[i].Cells[11].String()
|
|
|
|
|
+ tmp["Currency"] = sheet.Rows[i].Cells[12].String()
|
|
|
|
|
+ tmp["BudgetAmount"] = sheet.Rows[i].Cells[13].String()
|
|
|
|
|
+ tmp["PerformAmount"] = sheet.Rows[i].Cells[14].String()
|
|
|
|
|
+ tmp["IsInternal"] = sheet.Rows[i].Cells[15].String()
|
|
|
|
|
+ tmp["IsForeign"] = sheet.Rows[i].Cells[16].String()
|
|
|
|
|
+ tmp["IsDeal"] = sheet.Rows[i].Cells[17].String()
|
|
|
|
|
+ tmp["MoneyFlows"] = sheet.Rows[i].Cells[18].String()
|
|
|
|
|
+ tmp["MoneyChannel"] = sheet.Rows[i].Cells[19].String()
|
|
|
|
|
+ tmp["MoneyChannelSon"] = sheet.Rows[i].Cells[20].String()
|
|
|
tmp["MoneyChannelSmall"] = sheet.Rows[i].Cells[21].String()
|
|
tmp["MoneyChannelSmall"] = sheet.Rows[i].Cells[21].String()
|
|
|
tmp["SingUnit"] = sheet.Rows[i].Cells[22].String()
|
|
tmp["SingUnit"] = sheet.Rows[i].Cells[22].String()
|
|
|
- tmp["Place"] = sheet.Rows[i].Cells[23].String()
|
|
|
|
|
-
|
|
|
|
|
- tmp["StartDate"] = convertToFormatDay(sheet.Rows[i].Cells[24].Value)
|
|
|
|
|
- tmp["EndDate"] = convertToFormatDay(sheet.Rows[i].Cells[25].Value)
|
|
|
|
|
- tmp["DisputeResolution"] = sheet.Rows[i].Cells[26].String()
|
|
|
|
|
- tmp["Remark"] = sheet.Rows[i].Cells[27].String()
|
|
|
|
|
- tmp["ProjectOwner"] = sheet.Rows[i].Cells[28].String()
|
|
|
|
|
- tmp["SubmitDate"] = convertToFormatDay(sheet.Rows[i].Cells[29].Value)
|
|
|
|
|
- tmp["SealName"] = sheet.Rows[i].Cells[30].String()
|
|
|
|
|
- tmp["PoNumber"] = sheet.Rows[i].Cells[31].String()
|
|
|
|
|
|
|
+ tmp["Place"] = sheet.Rows[i].Cells[23].String()
|
|
|
|
|
+
|
|
|
|
|
+ tmp["StartDate"] = convertToFormatDay(sheet.Rows[i].Cells[24].Value)
|
|
|
|
|
+ tmp["EndDate"] = convertToFormatDay(sheet.Rows[i].Cells[25].Value)
|
|
|
|
|
+ tmp["DisputeResolution"] = sheet.Rows[i].Cells[26].String()
|
|
|
|
|
+ tmp["Remark"] = sheet.Rows[i].Cells[27].String()
|
|
|
|
|
+ tmp["ProjectOwner"] = sheet.Rows[i].Cells[28].String()
|
|
|
|
|
+ tmp["SubmitDate"] = convertToFormatDay(sheet.Rows[i].Cells[29].Value)
|
|
|
|
|
+ tmp["SealName"] = sheet.Rows[i].Cells[30].String()
|
|
|
|
|
+ tmp["PoNumber"] = sheet.Rows[i].Cells[31].String()
|
|
|
codemap[i-1] = tmp
|
|
codemap[i-1] = tmp
|
|
|
//this.OperationCell(svc, lineNo, columnArr, sheet.Rows[i].Cells, &errLineNum)
|
|
//this.OperationCell(svc, lineNo, columnArr, sheet.Rows[i].Cells, &errLineNum)
|
|
|
}
|
|
}
|
|
@@ -584,64 +594,64 @@ func (this *OilContractController) DocExport() {
|
|
|
// @Description 数据存入
|
|
// @Description 数据存入
|
|
|
// @Success 200 {object} controllers.Request
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /importbatchsave [post]
|
|
// @router /importbatchsave [post]
|
|
|
-func (this *OilContractController) ImportBatchSave(){
|
|
|
|
|
|
|
+func (this *OilContractController) ImportBatchSave() {
|
|
|
var model contract.OilContractItems
|
|
var model contract.OilContractItems
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
var errinfo ErrorInfo
|
|
var errinfo ErrorInfo
|
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
|
// 新增配置项
|
|
// 新增配置项
|
|
|
- for i,v := range model.Items{
|
|
|
|
|
|
|
+ for i, v := range model.Items {
|
|
|
fmt.Print(i)
|
|
fmt.Print(i)
|
|
|
if v.SupplierName == "" || v.SupplierId == 0 {
|
|
if v.SupplierName == "" || v.SupplierId == 0 {
|
|
|
- errinfo.Message = "操作失败!未选择供应商名称,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!未选择供应商名称,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if v.ContractClass == "" {
|
|
if v.ContractClass == "" {
|
|
|
- errinfo.Message = "操作失败!未选择合同分类,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!未选择合同分类,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if v.ContractNo == "" {
|
|
if v.ContractNo == "" {
|
|
|
- errinfo.Message = "操作失败!合同编号不能为空,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!合同编号不能为空,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if v.ContractName == "" {
|
|
if v.ContractName == "" {
|
|
|
- errinfo.Message = "操作失败!合同名称不能为空,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!合同名称不能为空,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var noCount = 0
|
|
|
|
|
|
|
+ var noCount = 0
|
|
|
var nameCount = 0
|
|
var nameCount = 0
|
|
|
- for ii,vv := range model.Items{
|
|
|
|
|
|
|
+ for ii, vv := range model.Items {
|
|
|
fmt.Print(ii)
|
|
fmt.Print(ii)
|
|
|
if vv.ContractNo == v.ContractNo {
|
|
if vv.ContractNo == v.ContractNo {
|
|
|
- noCount ++
|
|
|
|
|
|
|
+ noCount++
|
|
|
}
|
|
}
|
|
|
if vv.ContractName == v.ContractName {
|
|
if vv.ContractName == v.ContractName {
|
|
|
- nameCount ++
|
|
|
|
|
|
|
+ nameCount++
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if noCount >= 2{
|
|
|
|
|
- errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ if noCount >= 2 {
|
|
|
|
|
+ errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if nameCount >= 2{
|
|
|
|
|
- errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ if nameCount >= 2 {
|
|
|
|
|
+ errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
@@ -649,26 +659,30 @@ func (this *OilContractController) ImportBatchSave(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var contract contract.OilContract
|
|
var contract contract.OilContract
|
|
|
- tempCount,_:= svc.GetCount(&contract,"ContractNo='" + v.ContractNo + "'")
|
|
|
|
|
|
|
+ tempCount, _ := svc.GetCount(&contract, "ContractNo='"+v.ContractNo+"'")
|
|
|
if tempCount > 0 {
|
|
if tempCount > 0 {
|
|
|
- errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!合同编号已存在,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- tempCount2,_:= svc.GetCount(&contract,"ContractName='" + v.ContractName + "'")
|
|
|
|
|
|
|
+ tempCount2, _ := svc.GetCount(&contract, "ContractName='"+v.ContractName+"'")
|
|
|
if tempCount2 > 0 {
|
|
if tempCount2 > 0 {
|
|
|
- errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa (i + 1)
|
|
|
|
|
|
|
+ errinfo.Message = "操作失败!合同名称已存在,行号:" + strconv.Itoa(i+1)
|
|
|
errinfo.Code = -2
|
|
errinfo.Code = -2
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ model.Items[i].CreateUserId, _ = strconv.Atoi(this.User.Id)
|
|
|
|
|
+ model.Items[i].CreateOn = time.Now()
|
|
|
|
|
+ model.Items[i].CreateBy = this.User.Realname
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- _ , err := svc.DBE.Insert(model.Items)
|
|
|
|
|
|
|
+ _, err := svc.DBE.Insert(model.Items)
|
|
|
if err == nil {
|
|
if err == nil {
|
|
|
errinfo.Message = "导入成功!"
|
|
errinfo.Message = "导入成功!"
|
|
|
errinfo.Code = 0
|
|
errinfo.Code = 0
|
|
@@ -682,20 +696,18 @@ func (this *OilContractController) ImportBatchSave(){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// excel日期字段格式化 yyyy-mm-dd
|
|
// excel日期字段格式化 yyyy-mm-dd
|
|
|
-func convertToFormatDay(excelDaysString string)string{
|
|
|
|
|
|
|
+func convertToFormatDay(excelDaysString string) string {
|
|
|
// 2006-01-02 距离 1900-01-01的天数
|
|
// 2006-01-02 距离 1900-01-01的天数
|
|
|
baseDiffDay := int64(38719) //在网上工具计算的天数需要加2天,什么原因没弄清楚
|
|
baseDiffDay := int64(38719) //在网上工具计算的天数需要加2天,什么原因没弄清楚
|
|
|
curDiffDay := excelDaysString
|
|
curDiffDay := excelDaysString
|
|
|
|
|
|
|
|
comma := strings.Index(curDiffDay, ".")
|
|
comma := strings.Index(curDiffDay, ".")
|
|
|
- if(comma != -1){
|
|
|
|
|
- curDiffDay = curDiffDay[0:comma]
|
|
|
|
|
|
|
+ if comma != -1 {
|
|
|
|
|
+ curDiffDay = curDiffDay[0:comma]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- b,_ := strconv.ParseInt(curDiffDay, 10, 64) //strconv.Atoi(curDiffDay)
|
|
|
|
|
|
|
+ b, _ := strconv.ParseInt(curDiffDay, 10, 64) //strconv.Atoi(curDiffDay)
|
|
|
// 获取excel的日期距离2006-01-02的天数
|
|
// 获取excel的日期距离2006-01-02的天数
|
|
|
realDiffDay := b - baseDiffDay
|
|
realDiffDay := b - baseDiffDay
|
|
|
//fmt.Println("realDiffDay:",realDiffDay)
|
|
//fmt.Println("realDiffDay:",realDiffDay)
|
|
@@ -719,13 +731,13 @@ func (this *OilContractController) OperationCell(svc *contract.OilContractSessio
|
|
|
cellsArrLen := len(cellsArr)
|
|
cellsArrLen := len(cellsArr)
|
|
|
var valstr = ""
|
|
var valstr = ""
|
|
|
|
|
|
|
|
- for i := 0; i < cellsArrLen;i++ {
|
|
|
|
|
|
|
+ for i := 0; i < cellsArrLen; i++ {
|
|
|
valstr += "'" + cellsArr[i].String() + "',"
|
|
valstr += "'" + cellsArr[i].String() + "',"
|
|
|
}
|
|
}
|
|
|
valstr = strings.Trim(valstr, ",")
|
|
valstr = strings.Trim(valstr, ",")
|
|
|
valstr = strings.Replace(valstr, "是", "1", -1)
|
|
valstr = strings.Replace(valstr, "是", "1", -1)
|
|
|
log.Println(cellsArr[6].String() + "==" + valstr)
|
|
log.Println(cellsArr[6].String() + "==" + valstr)
|
|
|
- var columnstr= ""
|
|
|
|
|
|
|
+ var columnstr = ""
|
|
|
for l := 0; l < cellsArrLen; l++ {
|
|
for l := 0; l < cellsArrLen; l++ {
|
|
|
columnstr += columnArr[l] + ","
|
|
columnstr += columnArr[l] + ","
|
|
|
}
|
|
}
|
|
@@ -738,7 +750,6 @@ func (this *OilContractController) OperationCell(svc *contract.OilContractSessio
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
func structToMapDemo(obj interface{}) map[string]interface{} {
|
|
func structToMapDemo(obj interface{}) map[string]interface{} {
|
|
|
obj1 := reflect.TypeOf(obj)
|
|
obj1 := reflect.TypeOf(obj)
|
|
|
obj2 := reflect.ValueOf(obj)
|
|
obj2 := reflect.ValueOf(obj)
|
|
@@ -748,6 +759,7 @@ func structToMapDemo(obj interface{}) map[string]interface{} {
|
|
|
}
|
|
}
|
|
|
return data
|
|
return data
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// @Title 添加
|
|
// @Title 添加
|
|
|
// @Description 新增
|
|
// @Description 新增
|
|
|
// @Param body body oilcontract.OilContract
|
|
// @Param body body oilcontract.OilContract
|
|
@@ -766,7 +778,7 @@ func (this *OilContractController) AddEntity() {
|
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
|
|
|
|
|
var contract contract.OilContract
|
|
var contract contract.OilContract
|
|
|
- tempCount,_:=svc.GetCount(&contract,"ContractNo='" + model.ContractNo +"' ")
|
|
|
|
|
|
|
+ tempCount, _ := svc.GetCount(&contract, "ContractNo='"+model.ContractNo+"' ")
|
|
|
if tempCount > 0 {
|
|
if tempCount > 0 {
|
|
|
errinfo.Message = "合同编号已存在!"
|
|
errinfo.Message = "合同编号已存在!"
|
|
|
errinfo.Code = -1
|
|
errinfo.Code = -1
|
|
@@ -777,7 +789,6 @@ func (this *OilContractController) AddEntity() {
|
|
|
|
|
|
|
|
_, err := svc.InsertEntityBytbl(OilContractName, &model)
|
|
_, err := svc.InsertEntityBytbl(OilContractName, &model)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if err == nil {
|
|
if err == nil {
|
|
|
//新增
|
|
//新增
|
|
|
errinfo.Message = "添加成功!"
|
|
errinfo.Message = "添加成功!"
|
|
@@ -938,7 +949,7 @@ func (this *OilContractController) UpdateEntity() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var contract contract.OilContract
|
|
var contract contract.OilContract
|
|
|
- tempCount,_:=svc.GetCount(&contract,"ContractNo='" + model.ContractNo +"' and id <> " + id)
|
|
|
|
|
|
|
+ tempCount, _ := svc.GetCount(&contract, "ContractNo='"+model.ContractNo+"' and id <> "+id)
|
|
|
if tempCount > 0 {
|
|
if tempCount > 0 {
|
|
|
errinfo.Message = "合同编号已存在!"
|
|
errinfo.Message = "合同编号已存在!"
|
|
|
errinfo.Code = -1
|
|
errinfo.Code = -1
|
|
@@ -981,7 +992,7 @@ func (this *OilContractController) DeleteEntity() {
|
|
|
itemsSvc := contractReview.GetOilContractReviewService(utils.DBE)
|
|
itemsSvc := contractReview.GetOilContractReviewService(utils.DBE)
|
|
|
var review contractReview.OilContractReview
|
|
var review contractReview.OilContractReview
|
|
|
//tempCount,_:=itemsSvc.GetCount(&review,"ContractId='" + Id +"' and status > 0 and status < 8 ")
|
|
//tempCount,_:=itemsSvc.GetCount(&review,"ContractId='" + Id +"' and status > 0 and status < 8 ")
|
|
|
- tempCount,_:=itemsSvc.GetCount(&review,"ContractId='" + Id +"' ")
|
|
|
|
|
|
|
+ tempCount, _ := itemsSvc.GetCount(&review, "ContractId='"+Id+"' ")
|
|
|
if tempCount > 0 {
|
|
if tempCount > 0 {
|
|
|
errinfo.Message = "该合同存在评价不能删除!"
|
|
errinfo.Message = "该合同存在评价不能删除!"
|
|
|
errinfo.Code = -1
|
|
errinfo.Code = -1
|