清理(前三步归商机产线): - 删邮箱采集: bid_mail.py/bid_mail_accounts表与页面/首页按钮 - 删招标审批状态机: TD_*/HT_TENDER_APPROVAL/摘要审批工具族 - bid_tenders瘦身为解析抽取的商务要素(去邮件字段) QC契合度审核: - 新表bid_qc_reviews(qc_type/round/fit_score/pass_score/passed/improvement) - bid_qc_capability: start_qc/finish_qc/list_qc/qc_report, 四类产出逐类审核 - 判定: 10分制打分, >9.5放行(参数bid_qc_pass_score); 不通过给改进意见 +清空产出+对账器重派解析任务带意见重做; 超轮次抛qc_escalation人工 - bid_flow对账器A2门禁阶段: 幂等/在办去重/轮次守卫/重做不计首跑上限 - 驾驶舱: qc_report工具+解析QC审核菜单; 参数读appbase表+默认兜底
187 lines
4.0 KiB
Plaintext
187 lines
4.0 KiB
Plaintext
|
|
ns = params_kw.copy()
|
|
|
|
|
|
debug(f'get_bid_tenders.dspy:{ns=}')
|
|
if not ns.get('page'):
|
|
ns['page'] = 1
|
|
if not ns.get('sort'):
|
|
|
|
|
|
ns['sort'] = ["created_at desc"]
|
|
|
|
|
|
|
|
sql = '''select a.*, b.source_text
|
|
from (select * from bid_tenders where 1=1 [[filterstr]]) a left join (select k as source,
|
|
v as source_text from appcodes_kv where parentid='bid_tender_source') b on a.source = b.source'''
|
|
|
|
filterjson = params_kw.get('data_filter')
|
|
if filterjson and isinstance(filterjson, str):
|
|
try:
|
|
filterjson = json.loads(filterjson)
|
|
except (json.JSONDecodeError, TypeError):
|
|
filterjson = None
|
|
fields_str=r'''[
|
|
{
|
|
"name": "id",
|
|
"title": "主键ID",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "org_id",
|
|
"title": "机构ID",
|
|
"type": "str",
|
|
"length": 32,
|
|
"nullable": "no",
|
|
"default": "0"
|
|
},
|
|
{
|
|
"name": "project_id",
|
|
"title": "项目ID",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "source",
|
|
"title": "来源",
|
|
"type": "str",
|
|
"length": 16,
|
|
"nullable": "no",
|
|
"default": "tender_doc"
|
|
},
|
|
{
|
|
"name": "title",
|
|
"title": "项目名称",
|
|
"type": "str",
|
|
"length": 255
|
|
},
|
|
{
|
|
"name": "purchaser",
|
|
"title": "招标人/采购人",
|
|
"type": "str",
|
|
"length": 255
|
|
},
|
|
{
|
|
"name": "tender_no",
|
|
"title": "招标编号",
|
|
"type": "str",
|
|
"length": 64
|
|
},
|
|
{
|
|
"name": "industry",
|
|
"title": "行业",
|
|
"type": "str",
|
|
"length": 64
|
|
},
|
|
{
|
|
"name": "summary",
|
|
"title": "项目概况摘要",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "bid_start_at",
|
|
"title": "投标开始时间",
|
|
"type": "str",
|
|
"length": 16
|
|
},
|
|
{
|
|
"name": "bid_deadline",
|
|
"title": "投标截止时间",
|
|
"type": "str",
|
|
"length": 16
|
|
},
|
|
{
|
|
"name": "project_period",
|
|
"title": "项目周期",
|
|
"type": "str",
|
|
"length": 64
|
|
},
|
|
{
|
|
"name": "budget_amount",
|
|
"title": "招标金额",
|
|
"type": "float",
|
|
"length": 14,
|
|
"dec": 2
|
|
},
|
|
{
|
|
"name": "deposit_amount",
|
|
"title": "投标保证金",
|
|
"type": "float",
|
|
"length": 14,
|
|
"dec": 2
|
|
},
|
|
{
|
|
"name": "qualification_req",
|
|
"title": "资质要求摘要",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "key_dates",
|
|
"title": "关键节点(JSON)",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "risk_note",
|
|
"title": "风险提示",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "status",
|
|
"title": "状态",
|
|
"type": "str",
|
|
"length": 16,
|
|
"default": "summarized"
|
|
},
|
|
{
|
|
"name": "created_by",
|
|
"title": "创建人",
|
|
"type": "str",
|
|
"length": 64
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"title": "创建时间",
|
|
"type": "timestamp",
|
|
"nullable": "no"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"title": "更新时间",
|
|
"type": "timestamp"
|
|
}
|
|
]'''
|
|
ori_fields = json.loads(fields_str)
|
|
if not filterjson:
|
|
fields = [ f['name'] for f in ori_fields ]
|
|
filterjson = default_filterjson(fields, ns)
|
|
|
|
filterdic = ns.copy()
|
|
filterdic['filterstr'] = ''
|
|
filterdic['userorgid'] = '${userorgid}$'
|
|
filterdic['userid'] = '${userid}$'
|
|
if filterjson:
|
|
dbf = DBFilter(filterjson)
|
|
conds = dbf.gen(ns)
|
|
if conds:
|
|
ns.update(dbf.consts)
|
|
conds = f' and {conds}'
|
|
filterdic['filterstr'] = conds
|
|
ac = ArgsConvert('[[', ']]')
|
|
vars = ac.findAllVariables(sql)
|
|
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
|
filterdic.update(NameSpace)
|
|
sql = ac.convert(sql, filterdic)
|
|
|
|
debug(f'{sql=}')
|
|
db = DBPools()
|
|
dbname = get_module_dbname('pipeline_bidding')
|
|
async with db.sqlorContext(dbname) as sor:
|
|
r = await sor.sqlPaging(sql, ns)
|
|
return r
|
|
return {
|
|
"total":0,
|
|
"rows":[]
|
|
} |