Commit d474f3bd by manxiaoqiang

大后台token改为redis存储

parent b83284fa
package tkio.controller;
import common.model.BackVisit;
import common.model.Payment;
import common.model.Reminder;
import common.model.User;
import common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,10 +30,34 @@ public class TkioAccountController {
}
//关闭到期提醒
@RequestMapping(value = "/forbiden/{id}", method = RequestMethod.PUT)
@RequestMapping(value = "/forbiden/", method = RequestMethod.PUT)
@ResponseBody
public ResultModel delete(@CurrentAccount User loginAccount, @RequestBody User resource) {
public ResultModel forbiden(@CurrentAccount User loginAccount, @RequestBody Reminder resource) {
tkioAccountService.forbiden(loginAccount, resource);
return ResultModel.OK();
}
//开启到期提醒
@RequestMapping(value = "/enable/", method = RequestMethod.PUT)
@ResponseBody
public ResultModel enable(@CurrentAccount User loginAccount, @RequestBody Reminder resource) {
tkioAccountService.enable(loginAccount, resource);
return ResultModel.OK();
}
//缴费
@RequestMapping(value = "/pay/", method = RequestMethod.PUT)
@ResponseBody
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody Payment resource) {
tkioAccountService.pay(loginAccount, resource);
return ResultModel.OK();
}
//回访
@RequestMapping(value = "/visit/", method = RequestMethod.PUT)
@ResponseBody
public ResultModel visit(@CurrentAccount User loginAccount, @RequestBody BackVisit resource) {
tkioAccountService.visit(loginAccount, resource);
return ResultModel.OK();
}
......
package tkio.service;
import common.model.Account4Web;
import common.model.User;
import common.model.*;
import java.util.List;
......@@ -12,9 +11,15 @@ public interface TkioAccountService {
List<Account4Web> findAll(User user);
//到期提醒关闭
Account4Web forbiden(User user, Long accountId);
Reminder forbiden(User user, Reminder resource);
//到期提醒开启
Account4Web enable(User user, Long accountId);
Reminder enable(User user, Reminder resource);
//缴费
Payment pay(User user, Payment resource);
//回访
BackVisit visit(User user, BackVisit resource);
}
......@@ -2,10 +2,7 @@ package tkio.service.impl;
import com.amazonaws.services.dynamodbv2.xspec.B;
import common.model.*;
import common.repository.Account4WebRepository;
import common.repository.BackVisitRepository;
import common.repository.PaymentRepository;
import common.repository.UserRepository;
import common.repository.*;
import dic.RoleEnum;
import dic.RoleTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -17,10 +14,7 @@ import tkio.repository.SalesManLeaderRepository;
import tkio.service.TkioAccountService;
import util.ValidateUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Created by mxq on 2017/12/26.
......@@ -43,6 +37,9 @@ public class TkioAccountServiceImpl implements TkioAccountService {
@Autowired
PaymentRepository paymentRepository;
@Autowired
ReminderRepository reminderRepository;
@Override
public List<Account4Web> findAll(User user) {
List<Account4Web> result = new ArrayList<>();
......@@ -94,15 +91,39 @@ public class TkioAccountServiceImpl implements TkioAccountService {
}
@Override
public Account4Web forbiden(User user, Long accountId) {
return null;
public Reminder forbiden(User user, Reminder resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setRemindStatus(false);
return reminderRepository.save(resource);
}
@Override
public Reminder enable(User user, Reminder resource) {
resource.setUser(user.getId());
resource.setModifyTime(new Date());
resource.setPlatform("tkio");
resource.setRemindStatus(true);
return reminderRepository.save(resource);
}
@Override
public Account4Web enable(User user, Long accountId) {
return null;
public Payment pay(User user, Payment resource) {
resource.setUser(user.getId());
resource.setPayDate(new Date());
return paymentRepository.save(resource);
}
@Override
public BackVisit visit(User user, BackVisit resource) {
resource.setUser(user.getId());
resource.setVisitDate(new Date());
return backVisitRepository.save(resource);
}
public Map<String, Integer> getBackTime(){
Map<String, Integer> map = new HashMap<>();
List<BackVisit> all = backVisitRepository.findAll();
......
......@@ -51,7 +51,7 @@
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<filter>
<!-- <filter>
<filter-name>cors</filter-name>
<filter-class>security.cors.CorsFilter</filter-class>
</filter>
......@@ -59,7 +59,7 @@
<filter-mapping>
<filter-name>cors</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</filter-mapping>-->
<welcome-file-list>
<welcome-file>/home.html</welcome-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