|
@@ -105,6 +105,7 @@ func getQueryParams(condition string, pars []interface{}, sysUser *system.Admin,
|
|
|
// @Param ContractType query string false "合同类型,枚举值:“,`新签合同`,`续约合同`,`补充协议`"
|
|
|
// @Param FormalType query string false "转正类型,枚举值:“,`标准`,`非标`"
|
|
|
// @Param IsExport query bool false "是否导出excel,默认是false"
|
|
|
+// @Param ResearcherRealName query string false "研究员姓名"
|
|
|
// @Param IsAllocation query int false "派点状态: -1-默认全部; 0-未派点; 1-已派点"
|
|
|
// @Success 200 {object} cygx.CompanyContractListResp
|
|
|
// @router /allocation/company_contract_list [get]
|
|
@@ -131,6 +132,7 @@ func (this *ContractAllocationController) CompanyContractList() {
|
|
|
keyword := this.GetString("Keyword")
|
|
|
startDate := this.GetString("StartDate")
|
|
|
endDate := this.GetString("EndDate")
|
|
|
+ researcherRealName := this.GetString("ResearcherRealName")
|
|
|
isAllocation, _ := this.GetInt("IsAllocation", -1) // CRM 13.9
|
|
|
if startDate == "" {
|
|
|
startDate = "2015-01-01"
|
|
@@ -195,7 +197,35 @@ func (this *ContractAllocationController) CompanyContractList() {
|
|
|
|
|
|
//默认只查询权益 2023-06-01 之后的合同
|
|
|
condition += ` AND c.product_id = ? AND a.start_date > ? `
|
|
|
- pars = append(pars, 2, "2023-06-01")
|
|
|
+ pars = append(pars, 2, "2023-01-01")
|
|
|
+
|
|
|
+ mapMoneyPoint := make(map[int]float64)
|
|
|
+ //研究员姓名查询
|
|
|
+ if researcherRealName != "" {
|
|
|
+ var conditionAllocation string
|
|
|
+ var parsAllocation []interface{}
|
|
|
+
|
|
|
+ conditionAllocation = " AND real_name = ? "
|
|
|
+ parsAllocation = append(parsAllocation, researcherRealName)
|
|
|
+ allocationCompanyContractList, err := cygx.GetCygxAllocationCompanyContractList(conditionAllocation, parsAllocation)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetCygxAllocationCompanyContractListErr:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var companyContractIds []int
|
|
|
+ for _, v := range allocationCompanyContractList {
|
|
|
+ companyContractIds = append(companyContractIds, v.CompanyContractId)
|
|
|
+ mapMoneyPoint[v.CompanyContractId] = v.Money
|
|
|
+ }
|
|
|
+ lenCon := len(companyContractIds)
|
|
|
+ if lenCon == 0 {
|
|
|
+ condition += ` AND a.company_contract_id = 0 `
|
|
|
+ } else {
|
|
|
+ condition += ` AND a.company_contract_id IN (` + utils.GetOrmInReplace(lenCon) + `)`
|
|
|
+ pars = append(pars, companyContractIds)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
var list []*cygx.CompanyContractResp
|
|
|
|
|
@@ -248,6 +278,7 @@ func (this *ContractAllocationController) CompanyContractList() {
|
|
|
}
|
|
|
for _, v := range list {
|
|
|
v.ContractId = mapContractCode[v.ContractCode]
|
|
|
+ v.MoneyPoint = mapMoneyPoint[v.CompanyContractId]
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -697,7 +728,7 @@ func (this *ContractAllocationController) CompanyContractStatistics() {
|
|
|
item.GroupProportion += "%"
|
|
|
|
|
|
// 部门占比
|
|
|
- item.DepartmentProportion = fmt.Sprint(mapPermissionMoney[k] / totalMoney * 100)
|
|
|
+ item.DepartmentProportion = fmt.Sprint(mapPermissionMoney[k] / totalMoney * 100 / float64(len(mapPermissionUser[k])))
|
|
|
if item.DepartmentProportion == "" {
|
|
|
item.DepartmentProportion = "0"
|
|
|
}
|