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
a18f9213
Commit
a18f9213
authored
Aug 25, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 财税项目询价
parent
e32073a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
2 deletions
+68
-2
center-manage/app/base/api/impl/common/product.js
+6
-0
center-manage/app/base/service/impl/product/productpriceSve.js
+62
-2
No files found.
center-manage/app/base/api/impl/common/product.js
View file @
a18f9213
...
...
@@ -22,6 +22,12 @@ class ProductAPI extends APIBase {
let
rs
=
await
this
.
productpriceS
.
findRegionsByProductName
(
pname
,
sp
)
return
system
.
getResult
(
rs
);
}
async
findProductInfoForFt
(
p
,
q
,
req
)
{
let
pname
=
p
.
productname
;
let
region
=
p
.
region
;
let
rs
=
await
this
.
productpriceS
.
findProductInfoForFt
(
pname
,
region
)
return
system
.
getResult
(
rs
);
}
classDesc
()
{
return
{
groupName
:
"auth"
,
...
...
center-manage/app/base/service/impl/product/productpriceSve.js
View file @
a18f9213
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
_
=
require
(
"lodash"
);
class
ProductpriceService
extends
ServiceBase
{
constructor
()
{
super
(
"product"
,
ServiceBase
.
getDaoName
(
ProductpriceService
));
...
...
@@ -8,7 +9,7 @@ class ProductpriceService extends ServiceBase {
* @param {*} pname 产品名称
* @param {*} spname 服务商名称
*/
async
findRegionsByProductName
(
productname
,
spname
)
{
async
findRegionsByProductName
(
productname
,
spname
)
{
let
ps
=
await
this
.
dao
.
model
.
findAll
({
where
:
{
sptags
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
spname
+
"%"
},
...
...
@@ -53,7 +54,66 @@ class ProductpriceService extends ServiceBase {
})
return
psrtn
}
async
updownProduct
(
uid
)
{
/**
* 为 财税 提供 产品 详情 接口
* @param {*} productname 产品名称 小规模纳税人、一般纳税人
* @param {*} region 地区
* @param {*} spname 服务商
*/
async
findProductInfoForFt
(
productname
,
region
,
spname
=
'公司宝'
)
{
let
datas
=
await
this
.
dao
.
model
.
findAll
({
where
:
{
$and
:
[
{
sptags
:
{
$like
:
"%"
+
spname
+
"%"
},
isEnabled
:
true
,
pname
:
{
$like
:
"%"
+
"财税服务"
+
"%"
},
},
{
pname
:
{
$like
:
"%"
+
"代理记账"
+
"%"
}
}
]
},
attributes
:
[
'pname'
,
'strategyitems'
,
"hignpriceref"
],
// 价格、地区、skucode
raw
:
true
});
console
.
log
(
datas
)
let
result
=
[];
//查询出地区
let
address
=
await
this
.
db
.
models
.
region
.
findAll
({
attributes
:
[
'code'
,
'name'
],
raw
:
true
});
for
(
let
val
of
datas
)
{
let
area
=
val
.
pname
.
split
(
"~"
)[
1
].
split
(
"/"
);
area
=
area
[
area
.
length
-
1
];
//按照名字去取地区编码
let
areaCode
=
address
.
filter
(
f
=>
{
if
(
f
.
name
.
indexOf
(
area
)
>=
0
)
{
return
true
}
else
{
return
false
}
})
areaCode
=
`
${
areaCode
[
0
].
code
}
00`
;
result
.
push
({
area
,
areaCode
,
type
:
val
.
strategyitems
,
price
:
val
.
hignpriceref
})
}
console
.
log
(
result
);
result
=
_
.
groupBy
(
result
,
'type'
)
if
(
productname
)
{
result
=
result
[
productname
];
}
if
(
productname
&&
region
)
{
result
=
_
.
find
(
result
,
(
item
)
=>
{
return
item
.
area
.
indexOf
(
region
)
>=
0
})
}
return
result
}
async
updownProduct
(
uid
)
{
let
p
=
await
this
.
dao
.
findById
(
uid
)
p
.
isEnabled
=
!
p
.
isEnabled
await
p
.
save
()
...
...
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