|
@@ -17,7 +17,7 @@ import (
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
-//投标状态更新内容
|
|
|
|
|
|
+// 投标状态更新内容
|
|
type PartStatusContent struct {
|
|
type PartStatusContent struct {
|
|
BidStage []string `json:"bidStage"` //投标项目阶段
|
|
BidStage []string `json:"bidStage"` //投标项目阶段
|
|
BidType int64 `json:"bidType"` //投标类型1:直接投标;2:渠道投标
|
|
BidType int64 `json:"bidType"` //投标类型1:直接投标;2:渠道投标
|
|
@@ -28,7 +28,7 @@ type PartStatusContent struct {
|
|
Winner string `json:"winner"` //中标单位
|
|
Winner string `json:"winner"` //中标单位
|
|
}
|
|
}
|
|
|
|
|
|
-//参标
|
|
|
|
|
|
+// 参标
|
|
type RecordsContent struct {
|
|
type RecordsContent struct {
|
|
After PartStatusContent `json:"after"` //更新前
|
|
After PartStatusContent `json:"after"` //更新前
|
|
Before PartStatusContent `json:"before"` //更新后
|
|
Before PartStatusContent `json:"before"` //更新后
|
|
@@ -43,7 +43,7 @@ var (
|
|
EntnicheUserTable = "entniche_user" // 企业用户表
|
|
EntnicheUserTable = "entniche_user" // 企业用户表
|
|
)
|
|
)
|
|
|
|
|
|
-//划转参标信息
|
|
|
|
|
|
+// 划转参标信息
|
|
func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq) error {
|
|
func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq) error {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
//保存或更新新跟踪人
|
|
//保存或更新新跟踪人
|
|
@@ -161,7 +161,7 @@ func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq)
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-//终止参标
|
|
|
|
|
|
+// 终止参标
|
|
func CancelParticipateInfo(in *bxcore.ParticipateActionReq, roleId int64) error {
|
|
func CancelParticipateInfo(in *bxcore.ParticipateActionReq, roleId int64) error {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
if !IC.BaseMysql.ExecTx("终止参标", func(tx *sql.Tx) bool {
|
|
if !IC.BaseMysql.ExecTx("终止参标", func(tx *sql.Tx) bool {
|
|
@@ -205,7 +205,7 @@ func CancelParticipateInfo(in *bxcore.ParticipateActionReq, roleId int64) error
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-//保存参标信息
|
|
|
|
|
|
+// 保存参标信息
|
|
func SaveParticipateInfo(in *bxcore.ParticipateActionReq) error {
|
|
func SaveParticipateInfo(in *bxcore.ParticipateActionReq) error {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
if !IC.BaseMysql.ExecTx("保存|更新参标信息及保存参标记录", func(tx *sql.Tx) bool {
|
|
if !IC.BaseMysql.ExecTx("保存|更新参标信息及保存参标记录", func(tx *sql.Tx) bool {
|
|
@@ -267,7 +267,7 @@ func SaveParticipateInfo(in *bxcore.ParticipateActionReq) error {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-//查询当前招标信息是否已被参标
|
|
|
|
|
|
+// 查询当前招标信息是否已被参标
|
|
func IsParticipatedByBidId(in *bxcore.ParticipateActionReq) bool {
|
|
func IsParticipatedByBidId(in *bxcore.ParticipateActionReq) bool {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
//如果不允许多人参标 当前项目是否已经有企业其他人员参标
|
|
//如果不允许多人参标 当前项目是否已经有企业其他人员参标
|
|
@@ -280,7 +280,7 @@ func IsParticipatedByBidId(in *bxcore.ParticipateActionReq) bool {
|
|
return IC.BaseMysql.CountBySql(query) > 0
|
|
return IC.BaseMysql.CountBySql(query) > 0
|
|
}
|
|
}
|
|
|
|
|
|
-//获取参标权限
|
|
|
|
|
|
+// 获取参标权限
|
|
func GetParticipateIsAllow(query map[string]interface{}) (b bool) {
|
|
func GetParticipateIsAllow(query map[string]interface{}) (b bool) {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
if info, ok := IC.Mgo.FindOne(PartTable, query); ok {
|
|
if info, ok := IC.Mgo.FindOne(PartTable, query); ok {
|
|
@@ -293,19 +293,13 @@ func GetParticipateIsAllow(query map[string]interface{}) (b bool) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//更新设置信息
|
|
|
|
|
|
+// 更新设置信息
|
|
func UpdateParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) error {
|
|
func UpdateParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) error {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
query := map[string]interface{}{
|
|
query := map[string]interface{}{
|
|
"i_positionid": in.PositionId,
|
|
"i_positionid": in.PositionId,
|
|
}
|
|
}
|
|
if in.PositionType > 0 {
|
|
if in.PositionType > 0 {
|
|
- //企业版 判断是否是管理员
|
|
|
|
- //判断用户身份
|
|
|
|
- userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
|
|
|
|
- if userInfo.Ent.EntRoleId == 0 {
|
|
|
|
- return fmt.Errorf("当前企业身份无权限")
|
|
|
|
- }
|
|
|
|
query["i_entid"] = in.EntId
|
|
query["i_entid"] = in.EntId
|
|
}
|
|
}
|
|
upsert := map[string]interface{}{
|
|
upsert := map[string]interface{}{
|
|
@@ -315,6 +309,16 @@ func UpdateParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) error {
|
|
"l_createtime": time.Now().Unix(),
|
|
"l_createtime": time.Now().Unix(),
|
|
}
|
|
}
|
|
if in.IsAllow != "" {
|
|
if in.IsAllow != "" {
|
|
|
|
+ if in.IsAllow == "0" { //修改为允许单人参标
|
|
|
|
+ //判断是否有多人参标的项目
|
|
|
|
+ sql := `SELECT project_id,COUNT(id) AS c FROM ` + ParticipateUserTable + ` WHERE ent_id = ? GROUP BY project_id ORDER BY c DESC;`
|
|
|
|
+ datas := IC.BaseMysql.SelectBySql(sql, in.EntId)
|
|
|
|
+ if datas != nil && len(*datas) > 0 {
|
|
|
|
+ if max := MC.IntAll((*datas)[0]["c"]); max > 1 {
|
|
|
|
+ return fmt.Errorf("存在多人参标的项目,暂时无法更新配置")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
isAllow, _ := strconv.Atoi(in.IsAllow)
|
|
isAllow, _ := strconv.Atoi(in.IsAllow)
|
|
upsert["i_isallow"] = isAllow
|
|
upsert["i_isallow"] = isAllow
|
|
}
|
|
}
|
|
@@ -335,7 +339,7 @@ func UpdateParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) error {
|
|
return fmt.Errorf("更新失败")
|
|
return fmt.Errorf("更新失败")
|
|
}
|
|
}
|
|
|
|
|
|
-//查询企业|个人参标设置信息
|
|
|
|
|
|
+// 查询企业|个人参标设置信息
|
|
func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfo, error) {
|
|
func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfo, error) {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
query := map[string]interface{}{
|
|
query := map[string]interface{}{
|
|
@@ -405,7 +409,7 @@ func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.Particip
|
|
return nil, nil
|
|
return nil, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//保存或更新tidb 项目信息
|
|
|
|
|
|
+// 保存或更新tidb 项目信息
|
|
func UpdateProjectInfo(id string, pInfo map[string]interface{}) error {
|
|
func UpdateProjectInfo(id string, pInfo map[string]interface{}) error {
|
|
//id 项目id
|
|
//id 项目id
|
|
//name 项目名称
|
|
//name 项目名称
|
|
@@ -457,7 +461,7 @@ func UpdateProjectInfo(id string, pInfo map[string]interface{}) error {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-//参标列表其他条件
|
|
|
|
|
|
+// 参标列表其他条件
|
|
func ParticipateListSql(in *bxcore.ParticipateListReq) string {
|
|
func ParticipateListSql(in *bxcore.ParticipateListReq) string {
|
|
//b project表
|
|
//b project表
|
|
//a participate_user表
|
|
//a participate_user表
|
|
@@ -614,7 +618,7 @@ func ParticipateListSql(in *bxcore.ParticipateListReq) string {
|
|
return conditionSql
|
|
return conditionSql
|
|
}
|
|
}
|
|
|
|
|
|
-//个人或员工查询参标列表
|
|
|
|
|
|
+// 个人或员工查询参标列表
|
|
func SingleParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (data *bxcore.ParticipateData, err error) {
|
|
func SingleParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (data *bxcore.ParticipateData, err error) {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
data = &bxcore.ParticipateData{
|
|
data = &bxcore.ParticipateData{
|
|
@@ -677,7 +681,7 @@ func SingleParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (
|
|
return data, nil
|
|
return data, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//管理员获取参标列表数据
|
|
|
|
|
|
+// 管理员获取参标列表数据
|
|
func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (data *bxcore.ParticipateData, err error) {
|
|
func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (data *bxcore.ParticipateData, err error) {
|
|
defer MC.Catch()
|
|
defer MC.Catch()
|
|
data = &bxcore.ParticipateData{
|
|
data = &bxcore.ParticipateData{
|
|
@@ -741,7 +745,7 @@ func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (d
|
|
return data, nil
|
|
return data, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//获取最新参标 更新内容
|
|
|
|
|
|
+// 获取最新参标 更新内容
|
|
func GetParticipateContent(s string, id int64, projectId string) string {
|
|
func GetParticipateContent(s string, id int64, projectId string) string {
|
|
identitySql := `ent_id = ?`
|
|
identitySql := `ent_id = ?`
|
|
if s == "s" {
|
|
if s == "s" {
|
|
@@ -774,7 +778,7 @@ func GetParticipateContent(s string, id int64, projectId string) string {
|
|
return ""
|
|
return ""
|
|
}
|
|
}
|
|
|
|
|
|
-//根据ent_user_id 获取参标人昵称,企业管理员现在都是“我”
|
|
|
|
|
|
+// 根据ent_user_id 获取参标人昵称,企业管理员现在都是“我”
|
|
func GetParticipateUserName(entUserId string) string {
|
|
func GetParticipateUserName(entUserId string) string {
|
|
if entUserId != "" {
|
|
if entUserId != "" {
|
|
var userNames []string
|
|
var userNames []string
|
|
@@ -876,8 +880,9 @@ func CheckParticipatePersonal(projectId string, positionId int64, valid bool) (f
|
|
}
|
|
}
|
|
|
|
|
|
// GetNameByUserIds 获取用户名字符串
|
|
// GetNameByUserIds 获取用户名字符串
|
|
-// 参数:逗号分割的用户id "11,22,333..."
|
|
|
|
-// 返回: "张三,李四,王五..."
|
|
|
|
|
|
+//
|
|
|
|
+// 参数:逗号分割的用户id "11,22,333..."
|
|
|
|
+// 返回: "张三,李四,王五..."
|
|
func GetNameByUserIds(ids string) *[]map[string]interface{} {
|
|
func GetNameByUserIds(ids string) *[]map[string]interface{} {
|
|
query := "select group_concat(name) as name from " + EntnicheUserTable + " where id in (" + ids + ") "
|
|
query := "select group_concat(name) as name from " + EntnicheUserTable + " where id in (" + ids + ") "
|
|
rs := IC.MainMysql.SelectBySql(query)
|
|
rs := IC.MainMysql.SelectBySql(query)
|
|
@@ -916,7 +921,7 @@ func ParticipateProjectEnt(entId int64, projectId []string) *[]map[string]interf
|
|
return rs
|
|
return rs
|
|
}
|
|
}
|
|
|
|
|
|
-//查询企业人员信息
|
|
|
|
|
|
+// 查询企业人员信息
|
|
func GetPersonInfo(entId, entUserId int64, participateMap map[int64]bool) []*bxcore.ParticipatePerson {
|
|
func GetPersonInfo(entId, entUserId int64, participateMap map[int64]bool) []*bxcore.ParticipatePerson {
|
|
r := IC.MainMysql.SelectBySql(`SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a
|
|
r := IC.MainMysql.SelectBySql(`SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a
|
|
INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id)
|
|
INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id)
|
|
@@ -964,7 +969,7 @@ func GetPersonInfo(entId, entUserId int64, participateMap map[int64]bool) []*bxc
|
|
return list
|
|
return list
|
|
}
|
|
}
|
|
|
|
|
|
-//是否允许多人参标
|
|
|
|
|
|
+// 是否允许多人参标
|
|
func IsALLow(entId int64) bool {
|
|
func IsALLow(entId int64) bool {
|
|
return GetParticipateIsAllow(map[string]interface{}{
|
|
return GetParticipateIsAllow(map[string]interface{}{
|
|
"i_entid": entId,
|
|
"i_entid": entId,
|