Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
1782376d
Commit
1782376d
authored
Aug 05, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 加密
parent
d1dcc3e4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
176 additions
and
14 deletions
+176
-14
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
+1
-1
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
+1
-1
icp-deliver/app/base/db/models/delivery/business_opportunity.js
+8
-1
icp-deliver/app/base/db/models/delivery/cache_information.js
+49
-1
icp-deliver/app/base/db/models/delivery/delivery_bill.js
+8
-1
icp-deliver/app/base/db/models/delivery/meterials_info.js
+59
-2
icp-deliver/app/base/system.js
+11
-7
icp-deliver/app/base/utils/totxClient.js
+37
-0
icp-deliver/app/config/settings.js
+2
-0
No files found.
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
View file @
1782376d
...
...
@@ -15,7 +15,7 @@ class BizOptCtl extends CtlBase {
let
result
=
[];
for
(
let
val
of
rs
.
results
.
rows
)
{
val
.
company_name
=
val
.
business_info
.
company
;
val
.
customer_number
=
val
.
business_info
.
contactsPhone
;
val
.
customer_number
=
system
.
decryptStr
(
val
.
business_info
.
contactsPhone
)
;
val
.
customer_name
=
val
.
business_info
.
contactsName
;
val
.
updated_at
=
moment
(
val
.
updated_at
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
val
.
created_at
=
moment
(
val
.
created_at
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
...
...
icp-deliver/app/base/controller/impl/delivery/deliverCtl.js
View file @
1782376d
...
...
@@ -15,7 +15,7 @@ class DeliverCtl extends CtlBase {
let
result
=
[];
for
(
let
val
of
rs
.
results
.
rows
)
{
val
.
company_name
=
val
.
delivery_info
.
companyName
;
val
.
customer_number
=
val
.
delivery_info
.
contactsPhone
;
val
.
customer_number
=
system
.
decryptStr
(
val
.
delivery_info
.
contactsPhone
)
;
val
.
customer_name
=
val
.
delivery_info
.
contactsName
;
val
.
service_address
=
val
.
delivery_info
.
serviceName
;
val
.
updated_at
=
moment
(
val
.
updated_at
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
...
...
icp-deliver/app/base/db/models/delivery/business_opportunity.js
View file @
1782376d
...
...
@@ -20,7 +20,14 @@ module.exports = (db, DataTypes) => {
},
business_info
:
{
// 商机详情
allowNull
:
false
,
type
:
DataTypes
.
JSON
type
:
DataTypes
.
JSON
,
get
()
{
let
value
=
this
.
getDataValue
(
'business_info'
);
return
(
value
&&
{
...
value
,
contactsPhone
:
system
.
decryptStr
(
value
.
contactsPhone
)
})
||
value
}
},
source_number
:
{
// 来源单号 (下单时产生的编号)
allowNull
:
true
,
...
...
icp-deliver/app/base/db/models/delivery/cache_information.js
View file @
1782376d
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
const
{
encryptStr
,
decryptStr
}
=
system
;
/**
* 材料缓存表
*/
...
...
@@ -8,7 +9,14 @@ module.exports = (db, DataTypes) => {
return
db
.
define
(
"cacheinfo"
,
{
cache_info
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
type
:
DataTypes
.
JSON
,
set
(
value
)
{
this
.
setDataValue
(
'cache_info'
,
buildValue
(
value
,
encryptStr
));
},
get
()
{
let
value
=
this
.
getDataValue
(
"cache_info"
);
return
buildValue
(
value
,
decryptStr
);
}
},
},
{
paranoid
:
false
,
//假的删除
...
...
@@ -55,3 +63,43 @@ module.exports = (db, DataTypes) => {
});
}
/**
* 加密解密组装
* @param {*} value
* @param {*} cryptStr
*/
function
buildValue
(
value
,
cryptStr
)
{
if
(
value
)
{
let
newValue
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
if
(
newValue
.
proposerInfo
)
{
if
(
newValue
.
proposerInfo
.
contactInfo
)
{
newValue
.
proposerInfo
.
contactInfo
.
phone
=
cryptStr
(
newValue
.
proposerInfo
.
contactInfo
.
phone
);
}
if
(
newValue
.
proposerInfo
.
recipientInfo
)
{
newValue
.
proposerInfo
.
recipientInfo
.
phone
=
cryptStr
(
newValue
.
proposerInfo
.
recipientInfo
.
phone
);
}
if
(
newValue
.
proposerInfo
.
principalInfo
)
{
newValue
.
proposerInfo
.
principalInfo
=
newValue
.
proposerInfo
.
principalInfo
.
map
(
val
=>
{
return
{
...
val
,
certificateId
:
cryptStr
(
val
.
certificateId
),
phone
:
cryptStr
(
val
.
phone
)
}
})
}
}
if
(
newValue
.
shareholderData
)
{
newValue
.
shareholderData
=
newValue
.
shareholderData
.
map
(
val
=>
{
return
{
...
val
,
idNumber
:
cryptStr
(
val
.
idNumber
)
}
})
}
return
newValue
;
}
else
{
return
value
;
}
}
icp-deliver/app/base/db/models/delivery/delivery_bill.js
View file @
1782376d
...
...
@@ -40,7 +40,14 @@ module.exports = (db, DataTypes) => {
},
delivery_info
:
{
//服务概况
allowNull
:
false
,
type
:
DataTypes
.
JSON
type
:
DataTypes
.
JSON
,
get
()
{
let
value
=
this
.
getDataValue
(
'delivery_info'
);
return
(
value
&&
{
...
value
,
contactsPhone
:
system
.
decryptStr
(
value
.
contactsPhone
)
})
||
value
}
},
delivery_status
:
{
// 服务单流转状态
allowNull
:
false
,
...
...
icp-deliver/app/base/db/models/delivery/meterials_info.js
View file @
1782376d
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
const
{
encryptStr
,
decryptStr
}
=
system
;
/**
* 材料表
*/
...
...
@@ -8,11 +10,25 @@ module.exports = (db, DataTypes) => {
return
db
.
define
(
"material"
,
{
proposerInfo
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
type
:
DataTypes
.
JSON
,
set
(
value
)
{
this
.
setDataValue
(
'proposerInfo'
,
buildProposerInfo
(
value
,
encryptStr
));
},
get
()
{
let
value
=
this
.
getDataValue
(
"proposerInfo"
);
return
buildProposerInfo
(
value
,
decryptStr
);
}
},
shareholderData
:
{
allowNull
:
false
,
type
:
DataTypes
.
JSON
type
:
DataTypes
.
JSON
,
set
(
value
)
{
this
.
setDataValue
(
'shareholderData'
,
buildShareholderData
(
value
,
encryptStr
));
},
get
()
{
let
value
=
this
.
getDataValue
(
"shareholderData"
);
return
buildShareholderData
(
value
,
decryptStr
);
}
},
implementationPlanInfo
:
{
allowNull
:
false
,
...
...
@@ -79,3 +95,44 @@ module.exports = (db, DataTypes) => {
});
}
function
buildProposerInfo
(
value
,
cryptStr
)
{
if
(
value
)
{
let
newValue
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
if
(
newValue
.
contactInfo
)
{
newValue
.
contactInfo
.
phone
=
cryptStr
(
newValue
.
contactInfo
.
phone
);
}
if
(
newValue
.
recipientInfo
)
{
newValue
.
recipientInfo
.
phone
=
cryptStr
(
newValue
.
recipientInfo
.
phone
);
}
if
(
newValue
.
principalInfo
)
{
newValue
.
principalInfo
=
newValue
.
principalInfo
.
map
(
val
=>
{
return
{
...
val
,
certificateId
:
cryptStr
(
val
.
certificateId
),
phone
:
cryptStr
(
val
.
phone
)
}
})
}
return
newValue
;
}
else
{
return
value
;
}
}
function
buildShareholderData
(
value
,
cryptStr
)
{
if
(
value
)
{
let
newValue
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
newValue
=
value
.
map
(
val
=>
{
return
{
...
val
,
idNumber
:
cryptStr
(
val
.
idNumber
)
}
})
return
newValue
}
else
{
return
value
;
}
}
icp-deliver/app/base/system.js
View file @
1782376d
...
...
@@ -323,13 +323,17 @@ class System {
if
(
!
opStr
)
{
return
opStr
;
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
var
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
});
var
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
return
plaintext
;
try
{
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
var
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
});
var
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
return
plaintext
||
opStr
;
}
catch
(
err
)
{
return
opStr
;
}
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
...
...
icp-deliver/app/base/utils/totxClient.js
View file @
1782376d
...
...
@@ -2,6 +2,7 @@ const axios = require("axios");
const
settings
=
require
(
"../../config/settings"
);
const
system
=
require
(
"../system"
);
const
annualreportDao
=
system
.
getObject
(
"db.delivery.annualreportDao"
);
const
{
encryptStr
,
decryptStr
}
=
system
;
const
BUSINESSTYPE
=
{
ICP
:
"/qcfw/icp/"
,
...
...
@@ -108,6 +109,7 @@ const pushChangeOrder = async (status, orderNum, data = {}) => {
* @param {*} materials
*/
const
submitMaterials
=
async
(
deliverData
,
materials
)
=>
{
materials
=
buildValue
(
materials
,
encryptStr
);
let
status
;
if
(
deliverData
.
delivery_status
===
system
.
SERVERSESTATUS
.
COLLECTING
||
deliverData
.
delivery_status
===
system
.
SERVERSESTATUS
.
SUBMITING
)
{
status
=
TXSTATUS
.
SUBMITING
;
...
...
@@ -214,6 +216,41 @@ const postRequest = async (url, data) => {
}
function
buildValue
(
value
,
cryptStr
)
{
if
(
value
)
{
let
newValue
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
if
(
newValue
.
proposerInfo
)
{
if
(
newValue
.
proposerInfo
.
contactInfo
)
{
newValue
.
proposerInfo
.
contactInfo
.
phone
=
cryptStr
(
newValue
.
proposerInfo
.
contactInfo
.
phone
);
}
if
(
newValue
.
proposerInfo
.
recipientInfo
)
{
newValue
.
proposerInfo
.
recipientInfo
.
phone
=
cryptStr
(
newValue
.
proposerInfo
.
recipientInfo
.
phone
);
}
if
(
newValue
.
proposerInfo
.
principalInfo
)
{
newValue
.
proposerInfo
.
principalInfo
=
newValue
.
proposerInfo
.
principalInfo
.
map
(
val
=>
{
return
{
...
val
,
certificateId
:
cryptStr
(
val
.
certificateId
),
phone
:
cryptStr
(
val
.
phone
)
}
})
}
}
if
(
newValue
.
shareholderData
)
{
newValue
.
shareholderData
=
newValue
.
shareholderData
.
map
(
val
=>
{
return
{
...
val
,
idNumber
:
cryptStr
(
val
.
idNumber
)
}
})
}
return
newValue
;
}
else
{
return
value
;
}
}
module
.
exports
=
{
...
...
icp-deliver/app/config/settings.js
View file @
1782376d
...
...
@@ -15,6 +15,8 @@ var ENVINPUT = {
};
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
encrypt_key
:
ENVINPUT
.
ENCRYPT_KEY
,
encrypt_secret
:
ENVINPUT
.
ENCRYPT_SECRET
,
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"gsb2020"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment