TkioAccountController.java 5.07 KB
Newer Older
manxiaoqiang committed
1 2
package tkio.controller;

3 4 5
import common.model.BackVisit;
import common.model.Payment;
import common.model.Reminder;
manxiaoqiang committed
6 7
import common.model.User;
import common.service.UserService;
manxiaoqiang committed
8
import dic.OperateObjectTypeEnum;
manxiaoqiang committed
9 10 11 12 13 14
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import security.annotation.CurrentAccount;
import tkio.service.TkioAccountService;
import util.ResultModel;
manxiaoqiang committed
15 16 17
import util.UserLogThread;

import javax.servlet.http.HttpServletRequest;
manxiaoqiang committed
18 19 20 21 22

/**
 * Created by mxq on 2017/12/21.
 */
@Controller
23
@RequestMapping("tkio/marketing/accountmng")
manxiaoqiang committed
24 25
public class TkioAccountController {

26 27 28 29 30
    @Autowired
    TkioAccountService tkioAccountService;

    //客户列表
    @RequestMapping(value = "/findAll", method = RequestMethod.GET)
manxiaoqiang committed
31 32
    @ResponseBody
    public ResultModel find(@CurrentAccount User loginAccount) {
33
        return ResultModel.OK(tkioAccountService.findAll(loginAccount));
manxiaoqiang committed
34 35
    }

manxiaoqiang committed
36

37
    //关闭到期提醒
38
    @RequestMapping(value = "/forbiden", method = RequestMethod.PUT)
manxiaoqiang committed
39
    @ResponseBody
manxiaoqiang committed
40 41 42
    public ResultModel forbiden(@CurrentAccount User loginAccount, @RequestBody Reminder resource, HttpServletRequest request) {
        UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "关闭到期提醒", request);
        userlog.start();
43
        return ResultModel.OK(tkioAccountService.forbiden(loginAccount, resource));
44 45 46
    }

    //开启到期提醒
47
    @RequestMapping(value = "/enable", method = RequestMethod.PUT)
48
    @ResponseBody
manxiaoqiang committed
49 50 51
    public ResultModel enable(@CurrentAccount User loginAccount, @RequestBody Reminder resource, HttpServletRequest request) {
        UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "开启到期提醒", request);
        userlog.start();
52
        return ResultModel.OK(tkioAccountService.enable(loginAccount, resource));
53
    }
manxiaoqiang committed
54

55
    //缴费
56
    @RequestMapping(value = "/pay", method = RequestMethod.PUT)
57
    @ResponseBody
manxiaoqiang committed
58 59 60
    public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody Payment resource, HttpServletRequest request) {
        UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "缴费", request);
        userlog.start();
61
        return ResultModel.OK(tkioAccountService.pay(loginAccount, resource));
62 63 64
    }

    //回访
65
    @RequestMapping(value = "/visit", method = RequestMethod.PUT)
66
    @ResponseBody
manxiaoqiang committed
67 68 69
    public ResultModel visit(@CurrentAccount User loginAccount, @RequestBody BackVisit resource, HttpServletRequest request) {
        UserLogThread userlog = new UserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), resource.getEmail(), "回访", request);
        userlog.start();
70 71 72 73
        return ResultModel.OK( tkioAccountService.visit(loginAccount, resource));
    }
    //功能使用查询
    @RequestMapping(value = "/find/function/{accountId}", method = RequestMethod.GET)
manxiaoqiang committed
74
    @ResponseBody
75 76
    public ResultModel updateName(@CurrentAccount User loginAccount, @RequestParam String startDate,
                                  @RequestParam String endDate,  @PathVariable Long accountId) {
manxiaoqiang committed
77

78
        return ResultModel.OK(tkioAccountService.findFunTimes(accountId,startDate,endDate));
manxiaoqiang committed
79 80
    }

81 82
    //功能使用查询
    @RequestMapping(value = "/find/pv/{accountId}", method = RequestMethod.GET)
manxiaoqiang committed
83
    @ResponseBody
84 85
    public ResultModel pv(@CurrentAccount User loginAccount, @RequestParam String startDate,
                                  @RequestParam String endDate,  @PathVariable Long accountId) {
manxiaoqiang committed
86

87
        return ResultModel.OK(tkioAccountService.findPv(accountId,startDate,endDate));
manxiaoqiang committed
88 89
    }

90 91
    //到期提醒查询
    @RequestMapping(value = "/find/reminder/{accountId}", method = RequestMethod.GET)
manxiaoqiang committed
92
    @ResponseBody
93 94
    public ResultModel findRed(@CurrentAccount User loginAccount, @RequestParam String startDate,
                          @RequestParam String endDate,  @PathVariable Long accountId) {
manxiaoqiang committed
95

96
        return ResultModel.OK(tkioAccountService.findRed(accountId,startDate,endDate));
manxiaoqiang committed
97 98
    }

99 100
    //回访查询
    @RequestMapping(value = "/find/visit/{accountId}", method = RequestMethod.GET)
manxiaoqiang committed
101
    @ResponseBody
102 103
    public ResultModel findVisit(@CurrentAccount User loginAccount, @RequestParam String startDate,
                               @RequestParam String endDate,  @PathVariable Long accountId) {
manxiaoqiang committed
104

105
        return ResultModel.OK(tkioAccountService.findVisit(accountId,startDate,endDate));
manxiaoqiang committed
106 107
    }

108 109
    //缴费查询
    @RequestMapping(value = "/find/pay/{accountId}", method = RequestMethod.GET)
manxiaoqiang committed
110
    @ResponseBody
111 112
    public ResultModel findPay(@CurrentAccount User loginAccount, @RequestParam String startDate,
                               @RequestParam String endDate,  @PathVariable Long accountId) {
manxiaoqiang committed
113

114
        return ResultModel.OK(tkioAccountService.findPay(accountId,startDate,endDate));
manxiaoqiang committed
115
    }
116

manxiaoqiang committed
117
}