import BaseController from "../../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { SysParamValue } from "../../../entity/sys/core/sysParamValue";
|
import { TMSWayBill } from "../../../entity/express/tms/tmsWayBill";
|
import { TMSClaim2 } from "../../../entity/express/tms/tmsClaim2";
|
|
/**
|
* 微信端-索赔
|
*/
|
export default class ClaimController extends BaseController {
|
//#region 获取索赔类型
|
/**
|
* 获取索赔类型
|
*/
|
@Post()
|
public async getClaimTypeList() {
|
let userInfo = await this.userInfo;
|
try {
|
var unitList = await this.dbRead.find(SysParamValue, {
|
type_Id: 793,
|
userProduct_Id: userInfo.userProduct_Id
|
});
|
if (unitList.length <= 0) {
|
// 获得默认参数
|
let where = "type_Id=793";
|
unitList = await this.dbRead
|
.createQueryBuilder(SysParamValue, "t")
|
.where(where)
|
.getMany();
|
}
|
this.info.data = unitList.map(item => {
|
return {
|
value02: item.value02
|
};
|
});
|
this.info.result = true;
|
this.ctx.body = this.info;
|
} catch (ex) {
|
let msg = "出现异常:" + ex.message;
|
this.info.result = false;
|
this.info.msg = msg;
|
this.ctx.body = this.info;
|
}
|
}
|
//#endregion
|
|
//#region 微信端新建理赔
|
@Post()
|
public async addClaim() {
|
try {
|
var wayInfo = await this.dbRead.findOne(TMSWayBill, {
|
expressCode: this.body.expressCode
|
});
|
let claim = new TMSClaim2();
|
claim = Object.assign(claim, this.body);
|
await this.setAccountInfo(claim);
|
claim.wayBillCode = wayInfo != null ? wayInfo.wayBillCode : null;
|
claim.acceptResult = "未受理";
|
|
claim.userProduct_Id = 1007;
|
claim.userProductCode = "100000001";
|
claim.userProductAlias = "WmsSaaS云仓系统";
|
claim.platUser_Id = 1;
|
claim.platCorpName = "澳德";
|
claim.platUserCode = "PT20180001";
|
claim.claimStatus = "已提交";
|
claim.applyDate = new Date();
|
await this.dbWrite.save(claim);
|
// if (wayInfo) {
|
// //添加物流轨迹
|
// await this.service.tms.wayBillHelper.setStatusHistory(
|
// wayInfo,
|
// "微信公众号新建理赔单",
|
// "微信公众号新建理赔单",
|
// "微信公众号新建理赔单"
|
// );
|
// }
|
this.info.result = true;
|
this.info.msg = "您的资料已收到,请与悉尼客服联络。";
|
} catch (ex) {
|
let msg = "出现异常:" + ex.message;
|
this.info.result = false;
|
this.info.msg = msg;
|
}
|
this.ctx.body = this.info;
|
}
|
//#endregion
|
}
|