Prechádzať zdrojové kódy

Merge branch 'crm1.0' into debug

Roc 3 rokov pred
rodič
commit
99fae3d1fa

+ 1 - 1
controllers/approval.go

@@ -28,7 +28,7 @@ type ApprovalCommon struct {
 // @Description 获取审批列表接口
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   Status   query   string  true       "状态:'全部','待审批','已审批','驳回','已撤回'"
+// @Param   Status   query   string  true       "状态:'待审批','已审批','驳回','已撤回'"
 // @Param   KeyWord   query   string  true       "搜索关键词"
 // @Success 200 {object} approval.CompanyApprovalListResp
 // @router /list [get]

+ 1 - 5
controllers/base_auth.go

@@ -65,11 +65,7 @@ func (this *BaseAuth) Prepare() {
 
 	this.Session = session
 	var adminWx *custom.AdminWx
-	if session.AdminId > 0 {
-		tmpAdminWx, tmpErr := services.GetAdminUserItemByAdminId(session.AdminId, utils.WxPlatform)
-		adminWx = tmpAdminWx
-		err = tmpErr
-	} else if session.OpenId != "" {
+	if session.OpenId != "" {
 		tmpAdminWx, tmpErr := services.GetAdminUserItemByOpenId(session.OpenId)
 		adminWx = tmpAdminWx
 		err = tmpErr

+ 22 - 79
controllers/contract.go

@@ -1,11 +1,9 @@
 package controllers
 
 import (
-	"hongze/hongze_mobile_admin/models/response/contract"
-	"hongze/hongze_mobile_admin/models/tables/company_contract"
-	"hongze/hongze_mobile_admin/models/tables/company_report_permission"
-	"hongze/hongze_mobile_admin/services"
-	"hongze/hongze_mobile_admin/utils"
+	"encoding/json"
+	contractReq "hongze/hongze_mobile_admin/models/request/contract"
+	contractService "hongze/hongze_mobile_admin/services/contract"
 )
 
 //合同模块
@@ -13,84 +11,29 @@ type ContractCommon struct {
 	BaseAuth
 }
 
-// @Title 合同详情详情
-// @Description 合同详情接口接口
-// @Param   CompanyId   query   int  true       "客户ID"
-// @Param   CompanyContractId   query   int  true       "合同id"
-// @Success 200 {object} company_contract.CompanyContractDetail
-// @router /detail [get]
-func (this *ContractCommon) ApplyContractDetail() {
-	sysUser := this.AdminWx
-
-	companyId, _ := this.GetInt("CompanyId")
-	if companyId <= 0 {
-		this.FailWithMessage("参数错误", "参数错误,客户id小于等于0")
+// @Title 上传签回附件
+// @Description 上传签回附件接口接口
+// @Param	request	body contract.UploadCheckBackFileReq true "type json string"
+// @Success Ret=200 驳回成功
+// @router /upload_check_back_file [get]
+func (this *ContractCommon) UploadCheckBackFile() {
+	var req contractReq.UploadCheckBackFileReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		this.FailWithMessage("参数解析异常!", "参数解析失败,Err:"+err.Error())
 		return
 	}
-	companyContractId, _ := this.GetInt("CompanyContractId")
-
-	roleTypeCode := sysUser.RoleTypeCode
-	productId := services.GetProductId(roleTypeCode)
-	if productId == 0 {
-		this.FailWithMessage("当前账户类型异常", "客户类型为:"+roleTypeCode)
+	//合同编号
+	if req.ContractId <= 0 {
+		this.FailWithMessage("请传入合同编号!", "请传入合同编号")
 		return
 	}
-	detail, err := company_contract.GetCompanyContractDetail(companyId, productId, companyContractId)
-	if err != nil {
-		this.FailWithMessage("获取信息失败", "获取信息失败,Err:"+err.Error())
+
+	if req.FileUrl == "" {
+		this.FailWithMessage("请先上传附件!", "请先上传附件")
 		return
 	}
-	productId = detail.ProductId
-	if productId == 1 {
-		for _, v := range utils.PermissionFiccClassifyArr {
-			checkList := make([]int, 0)
-			plist := new(company_report_permission.PermissionLookList)
-			items, err := company_report_permission.GetPermissionLookItems(productId, v)
-			if err != nil {
-				this.FailWithMessage("获取失败", "获取权限信息失败,Err:"+err.Error())
-				return
-			}
-			for _, n := range items {
-				count, err := company_contract.GetCompanyContractPermissionCheckByContractId(companyId, detail.CompanyContractId, n.ChartPermissionId)
-				if err != nil {
-					this.FailWithMessage("获取失败", "获取权限信息失败,Err:"+err.Error())
-					return
-				}
-				if count > 0 {
-					checkList = append(checkList, n.ChartPermissionId)
-				}
-			}
-			plist.Items = items
-			plist.ClassifyName = v
-			plist.CheckList = checkList
-			detail.PermissionList = append(detail.PermissionList, plist)
-		}
-	} else {
-		classifyName := "权益"
-		checkList := make([]int, 0)
-		plist := new(company_report_permission.PermissionLookList)
-		items, err := company_report_permission.GetPermissionLookItems(productId, classifyName)
-		if err != nil {
-			this.FailWithMessage("获取失败", "获取权限信息失败,Err:"+err.Error())
-			return
-		}
-		for _, n := range items {
-			count, err := company_contract.GetCompanyContractPermissionCheckByContractId(companyId, detail.CompanyContractId, n.ChartPermissionId)
-			if err != nil {
-				this.FailWithMessage("获取失败", "获取权限信息失败,Err:"+err.Error())
-				return
-			}
-			if count > 0 {
-				checkList = append(checkList, n.ChartPermissionId)
-			}
-		}
-		plist.Items = items
-		plist.ClassifyName = classifyName
-		plist.CheckList = checkList
-		detail.PermissionList = append(detail.PermissionList, plist)
-	}
-	resp := contract.CompanyContractDetailResp{
-		detail,
-	}
-	this.OkDetailed(resp, "获取成功")
+	err = contractService.UploadCheckBackFile(req.ContractId, req.FileUrl, this.AdminWx)
+
+	this.OkWithMessage("上传成功")
 }

+ 2 - 2
controllers/contract_approval.go

@@ -14,7 +14,7 @@ import (
 	"strings"
 )
 
-//合同模块
+//合同审批模块
 type ContractApprovalCommon struct {
 	BaseAuth
 }
@@ -208,7 +208,7 @@ func (this *ContractApprovalCommon) List() {
 
 // @Title 驳回审批
 // @Description 驳回审批接口
-// @Param	request	body request.RejectReq true "type json string"
+// @Param	request	body contract.RejectReq true "type json string"
 // @Success Ret=200 驳回成功
 // @router /reject [post]
 func (this *ContractApprovalCommon) Reject() {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 117 - 0
controllers/resource.go


+ 12 - 6
models/request/contract/contract.go

@@ -4,10 +4,16 @@ package contract
 type AddContractServiceDetailReq struct {
 	CanEdit    bool   `json:"CanEdit";description:"是否可编辑"`
 	Type       string `json:"Type";description:"类型"`
-	Value      string `json:"Value"description:"类型"`
-	ValueId    []int  `json:"ValueId",description:"类型"`
-	HeadName   string `json:"HeadName",description:"表头名称"`
-	Tag        string `json:"Tag",description:"表头名称"`
-	RowDisable bool   `json:"RowDisable",description:"该行是否禁用操作"`
-	RowName    string `json:"RowName",description:"该行关联名称"`
+	Value      string `json:"Value";description:"类型"`
+	ValueId    []int  `json:"ValueId";description:"类型"`
+	HeadName   string `json:"HeadName";description:"表头名称"`
+	Tag        string `json:"Tag";description:"表头名称"`
+	RowDisable bool   `json:"RowDisable";description:"该行是否禁用操作"`
+	RowName    string `json:"RowName";description:"该行关联名称"`
+}
+
+//上传签回合同请求
+type UploadCheckBackFileReq struct {
+	FileUrl    string `description:"签回合同url"`
+	ContractId int    `description:"合同id"`
 }

+ 11 - 0
models/response/response/response.go

@@ -0,0 +1,11 @@
+package response
+
+type ResourceResp struct {
+	Id          int64  `orm:"column(id);" description:"用户id"`
+	ResourceUrl string `description:"资源地址"`
+	PlaySeconds uint32 `description:"播放时长,单位秒"`
+}
+
+type ResourceBase64Resp struct {
+	Image string `description:"图片,base64字符串"`
+}

+ 8 - 1
models/tables/contract/contract.go

@@ -16,7 +16,7 @@ type Contract struct {
 	SellerName       string    `description:"所属销售名称"`
 	ProductId        int       `description:"产品id,1:ficc;2:权益"`
 	ContractType     string    `description:"合同类型,枚举值:'新签合同','续约合同','补充协议'"`
-	Status           string    `description:"合同状态,枚举值:'待提交','待审批','已撤回','已审批','已驳回','已作废'"`
+	Status           string    `description:"合同状态,枚举值:'待提交','待审批','已撤回','已审批','已驳回','已作废','已签回'"`
 	StartDate        time.Time `description:"合同开始日期"`
 	EndDate          time.Time `description:"合同结束日期"`
 	OriginalPrice    float64   `description:"合同原金额,优惠前的金额"`
@@ -44,6 +44,13 @@ type Contract struct {
 	CreateTime       time.Time `description:"合同添加时间"`
 }
 
+//更新合同基础信息
+func (contract *Contract) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(contract, cols...)
+	return
+}
+
 //根据合同id获取合同信息
 func GetContractById(contractId int) (contractInfo *Contract, err error) {
 	o := orm.NewOrm()

+ 1 - 1
models/tables/contract_operation_record/contract_operation_record.go

@@ -9,7 +9,7 @@ import (
 type ContractOperationRecord struct {
 	Id               int       `orm:"column(id);pk"`
 	ContractId       int       `orm:"column(contract_id)";description:"合同id"`
-	Operation        string    `description:"操作类型,add:新增,edit:编辑,apply:发起审批,cancel_apply:撤回审批,reject:拒绝审批,approval:审批操作,invalid:作废;长度36位"`
+	Operation        string    `description:"操作类型,add:新增,edit:编辑,apply:发起审批,cancel_apply:撤回审批,reject:拒绝审批,approval:审批操作,invalid:作废,upload:上传签回附件;长度36位"`
 	OpUserId         int       `description:"操作人id"`
 	OpUserName       string    `description:"操作人名称"`
 	Remark           string    `description:"备注,长度255位"`

+ 28 - 0
models/tables/resource/resource.go

@@ -0,0 +1,28 @@
+package resource
+
+import (
+	"rdluck_tools/orm"
+	"time"
+)
+
+type Resource struct {
+	Id           int       `orm:"column(id);" description:"资源id"`
+	ResourceUrl  string    `description:"资源地址"`
+	CreateTime   time.Time `description:"创建时间"`
+	ResourceType int       `description:"资源类型,1:图片,2:音频,3:视频 "`
+}
+
+func AddResource(item *Resource) (newId int64, err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	newId, err = o.Insert(item)
+	return
+}
+
+func GetResourceById(id string) (item *Resource, err error) {
+	o := orm.NewOrm()
+	o.Using("rddp")
+	sql := "SELECT * FROM resource WHERE id=? "
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}

+ 25 - 0
services/contract/contract.go

@@ -3,8 +3,10 @@ package contract
 import (
 	"errors"
 	"fmt"
+	"hongze/hongze_mobile_admin/models/custom"
 	contractCustom "hongze/hongze_mobile_admin/models/custom/contract"
 	"hongze/hongze_mobile_admin/models/tables/contract"
+	"hongze/hongze_mobile_admin/models/tables/contract_operation_record"
 	"hongze/hongze_mobile_admin/models/tables/contract_service_detail"
 	"hongze/hongze_mobile_admin/utils"
 )
@@ -36,3 +38,26 @@ func GetContractDetail(contractId int) (contractDetail *contract.ContractDetail,
 	contractDetail.Service = serviceList
 	return
 }
+
+//上传签回合同附件
+func UploadCheckBackFile(contractId int, fileUrl string, opUser *custom.AdminWx) (err error) {
+	//获取合同信息
+	contractInfo, err := contract.GetContractById(contractId)
+	if err != nil {
+		return
+	}
+	//合同状态判断
+	if contractInfo.Status != "已审批" && contractInfo.Status != "已签回" {
+		err = errors.New("合同状态异常,不允许上传签回合同附件,当前合同状态:" + contractInfo.Status)
+		return
+	}
+	contractInfo.CheckBackFileUrl = fileUrl
+	contractInfo.Status = "已签回"
+	var updateCol = []string{"CheckBackFileUrl", "Status"}
+	contractInfo.Update(updateCol)
+
+	//添加操作日志
+	remark := "上传签回合同附件"
+	_ = contract_operation_record.AddContractOperationRecord(contractInfo.ContractId, opUser.AdminId, 0, "upload", opUser.RealName, remark)
+	return
+}

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov