Răsfoiți Sursa

缴费信息删除

lining 6 ani în urmă
părinte
comite
34c562ea6f

+ 3 - 2
src/dashoo.cn/backend/api/business/paymentinfo/paymentinfoService.go

@@ -1,13 +1,14 @@
 package paymentinfo
 
 import (
-. "dashoo.cn/utils/db"
+	. "dashoo.cn/backend/api/mydb"
 "github.com/go-xorm/xorm"
 	"strconv"
+	. "dashoo.cn/utils/db"
 )
 
 type PaymentService struct {
-	ServiceBase
+	MyServiceBase
 }
 
 func GetPaymentService(xormEngine *xorm.Engine) *PaymentService {

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -256,6 +256,7 @@ var (
 	BaseBadRecord                            string = "BadRecord"                   //不良记录表
 	OilSupplierCert2FileName                 string = "OilSupplierCert2File"        // 准入与资质对应关系表
 	OilCorporateInfoName                     string = "OilCorporateInfo"            //企业用户注册临时表
+	OilPaymentInfoName                       string = "OilPaymentInfo"              //缴费信息
 )
 
 //分页信息及数据

+ 77 - 36
src/dashoo.cn/backend/api/controllers/oilsupplier/paymentinfo.go

@@ -63,16 +63,14 @@ func (this *PaymentInfoController) GetEntityList() {
 
 	var registerUser register.OilCorporateInfo
 	sql := " UserName='" + this.User.Username + "'"
-	svcPerm.GetEntity(&registerUser,sql)
+	svcPerm.GetEntity(&registerUser, sql)
 
 	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
 	if !svcPerm.IsAdmin(this.User.Id) && !isauth {
 
-		where = where + " and (p.CreateUserId = '" + this.User.Id + "' or s.CommercialNo='"+registerUser.CommercialNo+"') "
+		where = where + " and (p.CreateUserId = '" + this.User.Id + "' or s.CommercialNo='" + registerUser.CommercialNo + "') "
 	}
 
-
-
 	var paylist []paymentinfo.PaymentinfoList
 	svc := paymentinfo.GetPaymentService(utils.DBE)
 	total := svc.GetPaymentinfoList(page.CurrentPage, page.Size, orderby, asc, &paylist, where)
@@ -222,7 +220,6 @@ func (this *PaymentInfoController) UpdateAmount() {
 	}
 	_, err := svc.UpdateEntityByIdCols(id, &model, cols)
 
-
 	if err == nil {
 		errinfo.Message = "修改成功!"
 		errinfo.Code = 0
@@ -238,8 +235,8 @@ func (this *PaymentInfoController) UpdateAmount() {
 
 type BillInfoSure struct {
 	SupplierEntity supplier.OilSupplier
-	DataInfos [2]DataInfo
-	AmountList [2]float64
+	DataInfos      [2]DataInfo
+	AmountList     [2]float64
 }
 
 // @Title 获取实体
@@ -251,10 +248,10 @@ func (this *PaymentInfoController) GetBillInfo() {
 	supplierSvc := supplier.GetOilSupplierService(utils.DBE)
 
 	var corporateInfo register.OilCorporateInfo
-	regSvc.GetEntity(&corporateInfo, "UserId='"+ this.User.Id +"'")
+	regSvc.GetEntity(&corporateInfo, "UserId='"+this.User.Id+"'")
 
 	var supplierEntity supplier.OilSupplier
-	supplierSvc.GetEntity(&supplierEntity, "CommercialNo='"+ corporateInfo.CommercialNo +"'")
+	supplierSvc.GetEntity(&supplierEntity, "CommercialNo='"+corporateInfo.CommercialNo+"'")
 
 	billInfoSure := new(BillInfoSure)
 	billInfoSure.SupplierEntity = supplierEntity
@@ -262,7 +259,7 @@ func (this *PaymentInfoController) GetBillInfo() {
 	page := this.GetPageInfoForm()
 
 	orderby := "p.Id"
-	where :=  "p.SupplierId='"+ strconv.Itoa(supplierEntity.Id) +"' and p.IsPay='0' "
+	where := "p.SupplierId='" + strconv.Itoa(supplierEntity.Id) + "' and p.IsPay='0' "
 	var paylist []paymentinfo.PaymentinfoList
 	svc := paymentinfo.GetPaymentService(utils.DBE)
 	total := svc.GetPaymentinfoList(page.CurrentPage, page.Size, orderby, " ASC", &paylist, where)
@@ -274,12 +271,12 @@ func (this *PaymentInfoController) GetBillInfo() {
 	datainfo.ItemsPerPage = page.Size
 	amount1 := 0.0
 	for _, payItem := range paylist {
-		tmpAmount, _ := strconv.ParseFloat( payItem.Amount, 64 )
+		tmpAmount, _ := strconv.ParseFloat(payItem.Amount, 64)
 		amount1 += tmpAmount
 	}
 
 	orderby2 := "p.Id"
-	where2 :=  "p.SupplierId='"+ strconv.Itoa(supplierEntity.Id) +"' and p.IsPay='1' "
+	where2 := "p.SupplierId='" + strconv.Itoa(supplierEntity.Id) + "' and p.IsPay='1' "
 	var paylist2 []paymentinfo.PaymentinfoList
 	svc2 := paymentinfo.GetPaymentService(utils.DBE)
 	total2 := svc2.GetPaymentinfoList(page.CurrentPage, page.Size, orderby2, " ASC", &paylist2, where2)
@@ -291,7 +288,7 @@ func (this *PaymentInfoController) GetBillInfo() {
 	datainfo2.ItemsPerPage = page.Size
 	amount2 := 0.0
 	for _, payItem := range paylist2 {
-		tmpAmount, _ := strconv.ParseFloat( payItem.Amount, 64 )
+		tmpAmount, _ := strconv.ParseFloat(payItem.Amount, 64)
 		amount2 += tmpAmount
 	}
 
@@ -304,10 +301,10 @@ func (this *PaymentInfoController) GetBillInfo() {
 	this.ServeJSON()
 }
 
-
 type BillSure struct {
 	Ids string `json:"ids"`
 }
+
 // @Title 确认缴费单
 // @Description 确认缴费单
 // @Success	200	{object} controllers.Request
@@ -377,7 +374,7 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 	svc.DBE.Query(sql)
 
 	for _, payItem := range paymentInfos {
-		if payItem.PayType == "1" {//准入
+		if payItem.PayType == "1" { //准入
 			var certentity suppliercert.OilSupplierCert
 			certentity.Status = suppliercert.STOREING_STATUS
 			certentity.Step = 5
@@ -387,41 +384,41 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 			}
 			svc.UpdateEntityByIdCols(strconv.Itoa(payItem.SupplierCertId), &certentity, cols)
 
-		} else if payItem.PayType == "2" {//年审
+		} else if payItem.PayType == "2" { //年审
 			//TODO: 修改年审时间
 			annuasvc := annualaudit.GetOilAnnualAuditService(utils.DBE)
-			var annualentities  []annualaudit.OilAnnualAudit
-			annwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId)+ " and CerId = "+utils.ToStr(payItem.SupplierCertId) +" and Status = '6'"
+			var annualentities []annualaudit.OilAnnualAudit
+			annwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and CerId = " + utils.ToStr(payItem.SupplierCertId) + " and Status = '6'"
 			svc.GetEntitysByWhere(OilAnnualAuditName, annwhere, &annualentities)
-			if len(annualentities) >0 {
+			if len(annualentities) > 0 {
 				//更新年审表时间
-				var annmodel  annualaudit.OilAnnualAudit
+				var annmodel annualaudit.OilAnnualAudit
 				annmodel.Status = suppliercert.ALL_PASE_STATUS
 				annmodel.ApplyTime = annualentities[0].ApplyTime.AddDate(1, 0, 0)
-				annuasvc.UpdateEntityBywheretbl(OilAnnualAuditName,&annmodel,[]string{"ApplyTime", "Status"},annwhere)
+				annuasvc.UpdateEntityBywheretbl(OilAnnualAuditName, &annmodel, []string{"ApplyTime", "Status"}, annwhere)
 				//更新准入表时间
 				var certmodel suppliercert.OilSupplierCert
 				certmodel.ApplyTime = annualentities[0].ApplyTime.AddDate(1, 0, 0)
 				svc.UpdateEntityByIdCols(strconv.Itoa(payItem.SupplierCertId), &certmodel, []string{"ApplyTime"})
 			}
-		} else if payItem.PayType == "3" {//增项
+		} else if payItem.PayType == "3" { //增项
 			appsvc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 			//更新准入项表
-			appendwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId)+ " and SupplierCertId = "+utils.ToStr(payItem.SupplierCertId)+" and Type = '2'"
+			appendwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupplierCertId = " + utils.ToStr(payItem.SupplierCertId) + " and Type = '2'"
 			var appendsubmodel suppliercertsub.OilSupplierCertSub
 			appendsubmodel.Type = "3"
 			appsvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendsubmodel, []string{"Type"}, appendwhere)
 			//更新资质表
-			appendfilewhere := " SupplierId = " + utils.ToStr(payItem.SupplierId)+" and SupType = 2"
+			appendfilewhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupType = 2"
 			var appendsubfilemodel supplierfile.OilSupplierFile
 			appendsubfilemodel.SupType = 3
 			appsvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendsubfilemodel, []string{"SupType"}, appendfilewhere)
 			//更新增项表
-			appdwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId)+ " and SupplierCertId = "+utils.ToStr(payItem.SupplierCertId)+" and Status = '6'"
+			appdwhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupplierCertId = " + utils.ToStr(payItem.SupplierCertId) + " and Status = '6'"
 			var appendmodel suppliercertappend.OilSupplierCertAppend
 			appendmodel.Status = suppliercert.ALL_PASE_STATUS
-			appsvc.UpdateEntityBywheretbl(OilSupplierCertAppendName,&appendmodel,[]string{"Status"},appdwhere)
-			}
+			appsvc.UpdateEntityBywheretbl(OilSupplierCertAppendName, &appendmodel, []string{"Status"}, appdwhere)
+		}
 	}
 	//记录对账日志
 	paymentBankInfo := new(paymentbankinfo.OilPaymentBankInfo)
@@ -445,7 +442,6 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 	this.ServeJSON()
 }
 
-
 // @Title 对账后有未更改状态的,再次确认缴费单--回调
 // @Description 确认缴费单
 // @Success	200	{object} controllers.Request
@@ -474,7 +470,7 @@ func (this *PaymentInfoController) ReceiveMoneyAgainList() {
 		sqlList := " 1=1 and Id in (" + strIds + ") and IsPay = '1'"
 		var paymentInfo paymentinfo.OilPaymentInfo
 		utils.DBE.Find(&paymentInfo, sqlList)
-		if paymentInfo.PayType == "1" {//准入
+		if paymentInfo.PayType == "1" { //准入
 			var certentity suppliercert.OilSupplierCert
 			certentity.Status = suppliercert.STOREING_STATUS
 			certentity.Step = 5
@@ -484,10 +480,10 @@ func (this *PaymentInfoController) ReceiveMoneyAgainList() {
 			}
 			svc.UpdateEntityByIdCols(strconv.Itoa(paymentInfo.SupplierCertId), &certentity, cols)
 
-		} else if paymentInfo.PayType == "2" {//年审
+		} else if paymentInfo.PayType == "2" { //年审
 			//TODO: 修改年审时间
 
-		} else if paymentInfo.PayType == "3" {//增项
+		} else if paymentInfo.PayType == "3" { //增项
 
 		}
 
@@ -514,7 +510,6 @@ func (this *PaymentInfoController) ReceiveMoneyAgainList() {
 	this.ServeJSON()
 }
 
-
 // @Title 对账
 // @Description 对账
 // @Success	200	{object} controllers.Request
@@ -529,13 +524,13 @@ func (this *PaymentInfoController) CheckMoneyList() {
 	checkRet := new(bankapi.BillCheckMoneyRet)
 
 	paymentWhere := "1=1 and IsPay='2' "
-	paymentWhere += " and PayDate >= '"+checkMoneyParams.StartTime.Format("2006-01-02 15:04:05") + "'"
-	paymentWhere += " and PayDate <= '"+checkMoneyParams.EndTime.Format("2006-01-02 15:04:05") + "'"
+	paymentWhere += " and PayDate >= '" + checkMoneyParams.StartTime.Format("2006-01-02 15:04:05") + "'"
+	paymentWhere += " and PayDate <= '" + checkMoneyParams.EndTime.Format("2006-01-02 15:04:05") + "'"
 	svc.GetEntities(&(checkRet.PaymentInfos), paymentWhere)
 
 	bankWhere := "1=1"
-	bankWhere += " and PayDate >= '"+checkMoneyParams.StartTime.Format("2006-01-02 15:04:05") + "'"
-	bankWhere += " and PayDate <= '"+checkMoneyParams.EndTime.Format("2006-01-02 15:04:05") + "'"
+	bankWhere += " and PayDate >= '" + checkMoneyParams.StartTime.Format("2006-01-02 15:04:05") + "'"
+	bankWhere += " and PayDate <= '" + checkMoneyParams.EndTime.Format("2006-01-02 15:04:05") + "'"
 	svc.GetEntities(&(checkRet.PaymentBankInfos), bankWhere)
 
 	var datainfo DataInfo
@@ -544,3 +539,49 @@ func (this *PaymentInfoController) CheckMoneyList() {
 	this.ServeJSON()
 }
 
+// @Title 删除单条信息
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /delete/:Id [delete]
+func (this *PaymentInfoController) DeleteEntity() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model paymentinfo.OilPaymentInfo
+	svc := paymentinfo.GetPaymentService(utils.DBE)
+	svc.GetEntityById(Id, &model)
+	where := "Id=" + Id
+	err := svc.DeleteEntityBytbl(OilPaymentInfoName, where)
+
+	if err != nil {
+		errinfo.Message = "删除失败!"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	if err == nil {
+		var cert suppliercert.OilSupplierCert
+		cert.Status = suppliercert.STOREING_STATUS
+		cols := []string{"Status"}
+		where := "Id=" + strconv.Itoa(model.SupplierCertId)
+		svc.UpdateEntityBywheretbl(OilSupplierCertName, &cert, cols, where)
+		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()
+	}
+}

+ 6 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/paymentinfo.js

@@ -40,4 +40,10 @@ export default {
       data: params
     })
   },
+  deleteEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/paymentinfo/delete/' + entityId,
+      method: 'delete'
+    })
+  }
 }

+ 6 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/paymentinfo/_opera/operation.vue

@@ -10,10 +10,11 @@
           <i class="icon icon-table2"></i> 缴费信息
         </span>
         <span style="float: right;">
-          <el-button type="primary" size="mini" style="margin-right: 15px" @click="printBtn" v-if="formData.IsPay == '1'">打印</el-button>
+          <el-button type="primary" size="mini" style="margin-right: 15px" v-if="formData.IsPay == '1'" @click="printBtn" >打印</el-button>
           <!--<el-button type="primary" size="mini" style="margin-right: 15px" @click="submitPay" v-if="formData.IsPay == '1'">提交缴费</el-button>-->
+          <el-button type="primary" size="mini" style="margin-right: 15px" @click="updateEntity" v-if="formData.IsPay == '0' && authUser.Profile.IsCompanyUser!=1 "><i class="el-icon-circle-check"></i>保存</el-button>
           <router-link :to="'/oilsupplier/paymentinfo'">
-            <el-button type="primary" size="mini">返回</el-button>
+            <el-button type="info" size="mini">返回</el-button>
           </router-link>
         </span>
       </div>
@@ -78,9 +79,9 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item :span="24" style="text-align: center;">
-          <el-button type="primary" size="small" @click="updateEntity" v-if="formData.IsPay == '0' && authUser.Profile.IsCompanyUser!=1 "><i class="el-icon-circle-check"></i>保存</el-button>
-        </el-form-item>
+        <!--<el-form-item :span="24" style="text-align: center;">-->
+          <!--<el-button type="primary" size="small" @click="updateEntity" v-if="formData.IsPay == '0' && authUser.Profile.IsCompanyUser!=1 "><i class="el-icon-circle-check"></i>保存</el-button>-->
+        <!--</el-form-item>-->
       </el-form>
     </el-card>
     <!--<el-dialog :visible.sync="dialogVisible" width="1024px">-->

+ 12 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/paymentinfo/index.vue

@@ -42,6 +42,16 @@
             <router-link :to="'/oilsupplier/paymentinfo/' + scope.row.Id + '/operation'">
               <el-button type="primary" plain title="查看详情" size="mini">查看</el-button>
             </router-link>
+            <el-popover placement="top" title="提示" trigger="click">
+              <el-alert title="" description="确认要删除吗?" type="warning" :closable="false">
+              </el-alert>
+              <br />
+              <div style="text-align: right; margin: 0">
+                <el-button type="primary" size="mini" @click="deleteEntity(scope.row)">删除</el-button>
+              </div>
+              <el-button slot="reference" plain type="danger" title="删除" style="margin-left:10px"
+                         size="mini">删除</el-button>
+            </el-popover>
             <!-- <el-popover placement="top" title="提示">
               <el-alert
                 title=""
@@ -332,9 +342,9 @@
       transferStr (val) {
         if (val === '1') {
           return '准入缴费'
-        }else if (val === '2') {
+        } else if (val === '2') {
           return '年审缴费'
-        }else if (val === '3') {
+        } else if (val === '3') {
           return '增项缴费'
         } else {
           return val