萧山公安原来的db33需要更换成国标这个坑

 

6-19终于把这个巨大的坑填了。5年过程中积累的各种

db33不对无法转换的    5524   还是有这么多的东西不知道哪个下级过来的咩有按db33做的
db33有,属于移动设备,不推送的,内控的    1852
国标转换完毕的    22191

 

 

 

1 一个用的了5年的系统的通道id是说改就改的么?市局要求所有下级推送改国标。正确的做法绝对不是直接改下级。因为对于萧山这个下级来说,还有下下级。

   应该想办法在推送的网关上做数据转换。可惜dh选择了错误的办法。萧山27000个点位,很多都不是标准的db33

用下面的函数,能转一部分。根据sql查询的条件慢慢转,从目录最下级开始。

python牛的不行,尝试用了下。感觉程序么,也就那样,触类旁通。

python

1 库倒是很多,但是跟asp,代码不能保护,要是给人分发,什么数据库密码都明文了。

2 python的条件语句,是用缩进来分的。你之前有严格的代码书写要求,就是快马加鞭了,不然查问题坑死你。

 

 

#----------转换函数
def check(sn):
   ss=''
   a='132' # //121 人脸 131枪
   if 18  == len(sn):
       if str(sn[-2:])=='60' and str(sn[8:10])=='00'  :   #如果是db33尾号60 治安的 首字母是index=0
          ss=(sn[0:10]+a+"0"+sn[10:16])
          return ss
       if str(sn[-2:])=='60' and str(sn[8:12])=='9910' :
          b='87' #电信
          ss=(sn[0:6]+b+"00"+a+"8"+sn[6:8]+sn[12:16])  #99是db社会,现在需要改00表示路面
          return ss
       if str(sn[-2:])=='60' and str(sn[8:11])=='999' :
          b='87' #电信
          ss=(sn[0:6]+b+"00"+a+"8"+sn[6:8]+sn[12:16]) #999是电信社会,进化现在需要改00表示路面
          return ss
       if str(sn[-2:])=='60' and str(sn[8:11])=='992' :   #如果是db33尾号60 社会的99 2 移动改88
          b='88' #移动
          ss=(sn[0:6]+"8800"+a+"8"+sn[6:8]+sn[12:16])   #99是db社会,现在需要改00表示路面  3华数改89
          return ss
       if str(sn[-2:])=='60' and str(sn[8:10])=='63' :   #如果是db33尾号60 社会的99 1 电信改87 63是宗教
          b='86' #宗教
          ss=(sn[0:6]+b+"00"+a+"8"+sn[6:8]+sn[12:16]) #99是db社会,现在需要改00表示路面
          return ss
       if str(sn[-2:])=='60' and str(sn[8:11])=='993' :   #如果是db33尾号60 社会的99 2 移动改88
          b='89' #华数
          ss=(sn[0:6]+"8900"+a+"8"+sn[6:8]+sn[12:16]) #99是db社会,现在需要改00表示路面  3华数改89
          return ss
       if str(sn[-2:])=='60' and str(sn[6:8])=='17' :   #如果是db33尾号60 交警的卡口
          b='17' #交警
          ss=(sn[0:6]+"1705"+a+"1"+sn[10:16]) #17是交警,现在需要改00表示路面  3华数改89
          return ss
       if str(sn[-2:])=='60' and str(sn[0:12])=='330109519911' :   #公交自行车和城厢社会有
          b='51' #交警
          ss=(sn[0:6]+"5107"+a+"8"+sn[10:16]) 
          return ss

   ss='EEEE'
   if  str(sn[0:10])=='3301090000':   #guobo
       ss=(sn[0:6]+"85011324"+sn[-6:])
       return ss
   if  str(sn[8:12])=='9911' or str(sn[8:12])=='9912':   #JYZ
       ss=(sn[0:8]+"121328"+sn[10:16])
       return ss      
   return ss
#-----------------------------
select * from t44 where gb28 in (SELECT gb28 from t44 GROUP BY gb28 HAVING count(*) >1 )

SELECT DISTINCT count(*) FROM t44 where length(gb28)=20
UNION
SELECT  count(*) FROM t44 where length(gb28)=20

select  count(gb28) as '重复次数',gb28 from t44  where del=0  group by gb28  having count(*)>2 order by 重复次数 desc
select  count(channel_sn),org_name as '重复次数',channel_sn from t44 where del=0 group by channel_sn  having count(*)>1 order by channel_sn desc
select * from t44 where channel_sn='330109179900706960'
select  * from t44 where gb28 ='33010989001328300200'

#001a19001 这个是对的二期有2个瓜沥
#001a13001
/*
SELECT * from t44 where org_code like '001a13%' and org_name in ('党湾' ,'瓜沥' ,'靖江') 
update t44 set del=1 where org_code like '001a13%' and org_name in ('党湾' ,'瓜沥' ,'靖江') 

*/

SELECT
*
from t44
where 
1=1
and (gb28 is null or length(gb28) <10)
#and length(CHANNEL_SN) =20
and length(gb28) =20
#and (ORG_CODE like '001a13001%' or ORG_CODE like '001a15001%' or org_code like '001a19001%')  #3个二期高清
#3个社会面的,移动有2个
# and (ORG_CODE like '001a11001%' or ORG_CODE like '001a16001%' or org_code like '001a01001%' or ORG_CODE like '001a09001%') 
#and ORG_NAME like "北干%"
#and ORG_NAME like '%人脸%' 
#and CHANNEL_SN like '3301090000%'
#and CHANNEL_name like '113金家桥%'
#select  * from t44 where LENGTH(channel_sn)= 18 and length(gb28) <10  and ORG_CODE like '001001%'
#update t44 set gb28='33010986001318100006' where channel_sn ='330109666310000660' 
# SELECT count(1) from t44 where gb28 is not null
/*
select  * from t44 where( gb28 is null or length(gb28)<18) and length(channel_sn)=18
and org_code!='001a10001034'
select  * from t44 where LENGTH(channel_sn)= 18 and gb28  is null  and ORG_NAME like '%人脸%'
select  * from t44 where  CHANNEL_name like '26 南阳街道横蓬村17组港兴%'
select  * from t44 where  CHANNEL_sn like '%999%'
select  * from t44 where org_code like '001a10001034%' #yidong 4g
select  * from t44 where org_code like '001a01001007%'
update t44 set gb28='' where org_code like '001a11001%'
001a19001 这个是对的二期有2个瓜沥
001a13001
 */
select * from t44 where gb28 in (SELECT gb28 from t44 GROUP BY gb28 HAVING count(*) >1 )

SELECT DISTINCT count(*) FROM t44 where length(gb28)=20
UNION
SELECT  count(*) FROM t44 where length(gb28)=20


#修改131为132
select  count(*) FROM t44 where substring(gb28,11,3)=131
select * FROM t44 where substring(gb28,11,3)=132
update t44 set gb28=concat(substring(gb28,1,10),'132',substring(gb28,14,7)) where  gb28='33010985011314851572'
update t44 set gb28=concat(substring(gb28,1,10),'132',substring(gb28,14,7)) where substring(gb28,11,3)=131
33010985011314851572

#社会面重复很多
select  count(gb28) as '重复次数',gb28 from t44  where del=0  group by gb28  having count(*)>2 order by 重复次数 desc
select  count(channel_sn),org_name as '重复次数',channel_sn from t44 where del=0 group by channel_sn  having count(*)>1 order by channel_sn desc
select * from t44 where channel_sn like '330109__9911______'
select  * from t44 where (org_code like '001a01001007%' or org_code like '001a11001%') and del=0
select  * from t44 where org_code like '001a01001%'
select  * from t44 where org_code like '001005%' #检查站
select  * from t44 where org_code like '001a03001001%' #公交自行车

select  * from t44 where org_code like '001a01001007%' #JYZ
select  * from t44 where gb28 ='33010985011324001144'
select  * from t44 where gb28 ='error to check'
select  * from t44 where gb28 like '3301096612132%'


# 交警
select  * from t44 where gb28='' or gb28 is null
select  count(1) from t44 where gb28 is null and LENGTH(channel_sn)=18
select  * from t44 where gb28 is null and LENGTH(channel_sn)=18
select  * from t44 where org_code like '001a05001%' #交警



#001a19001 这个是对的二期有2个瓜沥
#001a13001
/*
SELECT * from t44 where org_code like '001a13%' and org_name in ('党湾' ,'瓜沥' ,'靖江') 
update t44 set del=1 where org_code like '001a13%' and org_name in ('党湾' ,'瓜沥' ,'靖江') 

*/

 

你可能感兴趣的:(python)