333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
}