Commit 5c6cafa6 by 孙亚楠

dd

parent 3bad1f9d
...@@ -84,6 +84,13 @@ class ActionAPI extends APIBase { ...@@ -84,6 +84,13 @@ class ActionAPI extends APIBase {
opResult = await this.obusinessmenSve.queryObusinessmen(action_body); opResult = await this.obusinessmenSve.queryObusinessmen(action_body);
break; break;
case "signing": //签约
opResult = await this.obusinessmenSve.signing(action_body);
break;
case "createAccount": //签约
opResult = await this.obusinessmenSve.createAccount(action_body);
break;
//******************************************************************** */ //******************************************************************** */
// 订单 // 订单
......
...@@ -42,7 +42,7 @@ module.exports = function (db, DataTypes) { ...@@ -42,7 +42,7 @@ module.exports = function (db, DataTypes) {
service_begin_time: {type: DataTypes.DATE, field: 'service_begin_time', allowNull: true, defaultValue:null, comment:'服务开始时间' }, service_begin_time: {type: DataTypes.DATE, field: 'service_begin_time', allowNull: true, defaultValue:null, comment:'服务开始时间' },
service_end_time: {type: DataTypes.DATE, field: 'service_end_time', allowNull: true, defaultValue:null, comment:'服务结束时间' }, service_end_time: {type: DataTypes.DATE, field: 'service_end_time', allowNull: true, defaultValue:null, comment:'服务结束时间' },
cost_rate: {type: DataTypes.INTEGER, field: 'cost_rate', allowNull: true, defaultValue:0, comment:'核定成本费用率' }, cost_rate: {type: DataTypes.INTEGER, field: 'cost_rate', allowNull: true, defaultValue:0, comment:'核定成本费用率' },
tax_rate: {type: DataTypes.INTEGER, field: 'tax_rate', allowNull: true, defaultValue:0, comment:'服务开始时间' }, tax_rate: {type: DataTypes.INTEGER, field: 'tax_rate', allowNull: true, defaultValue:0, comment:'含税价百分比' },
add_value_up_type: {type: DataTypes.STRING, field: 'add_value_up_type', allowNull: true, defaultValue:'1', comment:'增值税累计类型 1按月 2按季度' }, add_value_up_type: {type: DataTypes.STRING, field: 'add_value_up_type', allowNull: true, defaultValue:'1', comment:'增值税累计类型 1按月 2按季度' },
tax_up_type: {type: DataTypes.STRING, field: 'tax_up_type', allowNull: true, defaultValue:'1', comment:'个税累计类型 1按月累计 2按年累计' }, tax_up_type: {type: DataTypes.STRING, field: 'tax_up_type', allowNull: true, defaultValue:'1', comment:'个税累计类型 1按月累计 2按年累计' },
service_rate: {type: DataTypes.INTEGER, field: 'service_rate', allowNull: true, defaultValue:0, comment:'服务费比例' }, service_rate: {type: DataTypes.INTEGER, field: 'service_rate', allowNull: true, defaultValue:0, comment:'服务费比例' },
......
...@@ -13,7 +13,7 @@ class ObusinessmenService extends ServiceBase { ...@@ -13,7 +13,7 @@ class ObusinessmenService extends ServiceBase {
* @param {*} params * @param {*} params
* @Id 个体户ID * @Id 个体户ID
*/ */
async queryObusinessmen(params){ async queryObusinessmen(params) {
try { try {
let obj = await this.findById(this.trim(params.id)); let obj = await this.findById(this.trim(params.id));
return system.getResult(obj); return system.getResult(obj);
...@@ -23,6 +23,83 @@ class ObusinessmenService extends ServiceBase { ...@@ -23,6 +23,83 @@ class ObusinessmenService extends ServiceBase {
} }
} }
/**
* 签约
*/
async signing(params) {
if (!params.hasOwnProperty('credit_code') && !params.credit_code) {
return system.getResult(null, `参数错误 同意社会信用代码不能为空`);
}
if (!params.hasOwnProperty('cost_rate')) {
return system.getResult(null, `参数错误 核定成本费用率不能为空`);
}
if (!params.hasOwnProperty('add_value_up_type') && !params.add_value_up_type) {
return system.getResult(null, `参数错误 增值税累计类型不能为空`);
}
if (!params.hasOwnProperty('tax_up_type')) {
return system.getResult(null, `参数错误 个税累计类型不能为空`);
}
if (!params.hasOwnProperty('service_begin_time')) {
return system.getResult(null, `参数错误 服务开始时间不能为空`);
}
if (!params.hasOwnProperty('service_end_time')) {
return system.getResult(null, `参数错误 服务结束时间不能为空`);
}
if (!params.hasOwnProperty('service_rate') && !params.service_rate) {
return system.getResult(null, `参数错误 服务费比例不能为空`);
}
if (!params.hasOwnProperty('tax_rate') && !params.tax_rate) {
return system.getResult(null, `参数错误 含税价百分比不能为空`);
}
let _obusinessmen = await this.dao.model.findOne({where:{
credit_code:this.trim(params.credit_code)
}});
if(!_obusinessmen){
return system.getResult(null,`个体户不存在`);
}
_obusinessmen.cost_rate = this.trim(params.cost_rate);
_obusinessmen.add_value_up_type = this.trim(params.add_value_up_type);
_obusinessmen.tax_up_type = this.trim(params.tax_up_type);
_obusinessmen.service_begin_time = this.trim(params.service_begin_time);
_obusinessmen.service_end_time = this.trim(params.service_end_time);
_obusinessmen.service_rate = this.trim(params.service_rate);
_obusinessmen.tax_rate = this.trim(params.tax_rate);
_obusinessmen.sign_time = new Date();
_obusinessmen.sign_notes = this.trim(params.sign_notes);
try {
await _obusinessmen.save();
return system.getResultSuccess();
} catch (error) {
console.log(error);
return system.getResult(null,`系统错误 错误信息${error}`);
}
}
/**
* 建账
* @param {*} params
*/
async createAccount(params){
if (!params.hasOwnProperty('credit_code') && !params.credit_code) {
return system.getResult(null, `参数错误 同意社会信用代码不能为空`);
}
let _obusinessmen = await this.dao.model.findOne({where:{
credit_code:this.trim(params.credit_code)
}});
if(!_obusinessmen){
return system.getResult(null,`个体户不存在`);
}
_obusinessmen.is_create_account = true;
try {
await _obusinessmen.save();
return system.getResultSuccess();
} catch (error) {
console.log(error);
system.getResult(null,`系统错误 错误信息${error}`);
}
}
} }
module.exports = ObusinessmenService; module.exports = ObusinessmenService;
\ No newline at end of file
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
1. [用户签约](#businessmenSign) 1. [用户签约](#businessmenSign)
1. [签约管理列表](#signList) 1. [签约管理列表](#signList)
1. [个体户信息列表](#infoList) 1. [个体户信息列表](#infoList)
1. [个体户签约](#signing)
1. [是否建账](#createAccount)
## **<a name="nameList"> 个体户nameList </a>** ## **<a name="nameList"> 个体户nameList </a>**
[返回到目录](#menu) [返回到目录](#menu)
...@@ -336,3 +336,41 @@ ...@@ -336,3 +336,41 @@
``` ```
## **<a name="signing"> 个体户签约 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "createAccount",
"action_body": {
"credit_code": "1", //同意社会信用代码
"cost_rate": "5", //核定成本费用率
"add_value_up_type": "", //增值税累计类型
"tax_up_type": "", //个税累计类型
"service_begin_time": "1", //服务开始时间
"service_end_time": "5", //服务结束时间
"service_rate": "", //服务费比例
"tax_rate": "", //含税价百分比、
"sign_notes":"" //签约备注
}
}
```
## **<a name="createAccount"> 是否建账 </a>**
[返回到目录](#menu)
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"action_process": "test",
"action_type": "signing",
"action_body": {
"credit_code": "1", //同意社会信用代码
}
}
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment