Skip to content

Commit

Permalink
Merge pull request #184 from rhinel/test
Browse files Browse the repository at this point in the history
feat: 完整增加燃气相关功能
  • Loading branch information
rhinel authored Sep 27, 2021
2 parents eea4cea + 62aad25 commit 7a23e4b
Show file tree
Hide file tree
Showing 22 changed files with 2,553 additions and 34 deletions.
21 changes: 15 additions & 6 deletions server/config-codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ const codeList = {
3014: '查询失败',
3015: '获取带计费房屋列表失败',
3016: '获取房屋详情失败',
// 租住信息
3031: '租住列表获取失败',
3032: '入住/修改失败',
3033: '搬出失败',
3034: '租住历史获取失败',
3035: '租住历史删除失败',
// 水费管理,增,
3021: '抄表失败',
3022: '水费聚合列表获取失败',
Expand All @@ -50,12 +56,6 @@ const codeList = {
3026: '抄表记录删除失败',
3027: '计费历史删除失败',
3028: '查询失败',
// 租住信息
3031: '租住列表获取失败',
3032: '入住/修改失败',
3033: '搬出失败',
3034: '租住历史获取失败',
3035: '租住历史删除失败',
// 电费管理,增,
3041: '抄表失败',
3042: '电费聚合列表获取失败',
Expand All @@ -66,6 +66,15 @@ const codeList = {
3047: '计费历史删除失败',
3048: '查询失败',
3049: '远程抄表失败',
// 燃气费管理,增,
3081: '抄表失败',
3082: '燃气费聚合列表获取失败',
3083: '燃气表计费失败',
3084: '抄表历史获取失败',
3085: '计费历史获取失败',
3086: '抄表记录删除失败',
3087: '计费历史删除失败',
3088: '查询失败',
// 收租管理
3051: '添加月份失败',
3052: '获取月份周期列表失败',
Expand Down
46 changes: 46 additions & 0 deletions server/controllers-rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const serviceMonth = require('./services-month')
const serviceHouse = require('./services-house')
const serviceWater = require('./services-water')
const serviceElect = require('./services-electric')
const serviceGas = require('./services-gas')
const serviceLease = require('./services-lease')
const code = require('./config-codes')

Expand Down Expand Up @@ -196,6 +197,51 @@ const inner = (req, res, next) => {
} else {
next()
}
} else if (req.params.class === 'gas') {
// 添加燃气表数接口
if (req.params.function === 'add') {
serviceGas
.gasAdd(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3021, err)))
} else if (req.params.function === 'mainList') {
serviceGas
.gasMainList(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3022, err)))
} else if (req.params.function === 'cal') {
serviceGas
.gascalGas(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3023, err)))
} else if (req.params.function === 'list') {
serviceGas
.gasList(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3024, err)))
} else if (req.params.function === 'calList') {
serviceGas
.gasCalList(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3025, err)))
} else if (req.params.function === 'del') {
serviceGas
.gasDel(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3026, err)))
} else if (req.params.function === 'delCal') {
serviceGas
.gasCalDel(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3027, err)))
} else if (req.params.function === 'findByDate') {
serviceGas
.gasFindByDate(req, res)
.then(data => res.json(code(req, 0, data)))
.catch(err => res.json(code(req, 3028, err)))
} else {
next()
}
} else if (req.params.class === 'lease') {
// 租住管理接口
if (req.params.function === 'mainList') {
Expand Down
3 changes: 3 additions & 0 deletions server/services-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@ module.exports = {
const {
defaultCalWaterPrice,
defaultCalElePrice,
defaultCalGasPrice,
defaultElseInfo,
} = req.body

const dbInfo = await db
.dbModel('admin', {//* //标记,更新默认计费方式,修改类型
defaultCalWaterPrice: Object, // 默认水费计费,全拼
defaultCalElePrice: Object, // 默认电费计费,全拼
defaultCalGasPrice: Object, // 默认燃气费计费,全拼
defaultElseInfo: Object, // 默认用户信息,全拼
})
.findOneAndUpdate({
Expand All @@ -158,6 +160,7 @@ module.exports = {
$set: {
defaultCalWaterPrice,
defaultCalElePrice,
defaultCalGasPrice,
defaultElseInfo,
},
})
Expand Down
2 changes: 1 addition & 1 deletion server/services-electric.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = {
.exec()

if (!house) {
return Promise.reject(new FoundError('房屋不存在,无法更新抄水表ID'))
return Promise.reject(new FoundError('房屋不存在,无法更新抄电表ID'))
}

// 3返回数据
Expand Down
Loading

0 comments on commit 7a23e4b

Please sign in to comment.