Commit 7a07d01c by manxiaoqiang

app排序

parent ba2cdf81
......@@ -186,20 +186,29 @@ public class ContractController {
@RequestMapping(value = "update", method = RequestMethod.PUT)
@ResponseBody
public ResultModel update(@CurrentAccount User loginAccount, @RequestBody Contract contract) {
return ResultModel.OK(service.update(loginAccount, contract));
public ResultModel update(@CurrentAccount User loginAccount, @RequestBody Contract contract, HttpServletRequest request) {
Contract contract1 = service.update(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract.getContractCode(), "修改合同","",contract1.toString(), request);
userlog.start();
return ResultModel.OK(contract1);
}
@RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract) {
return ResultModel.OK(service.pay(loginAccount, contract));
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract, HttpServletRequest request) {
ContractMoney contract1 = service.pay(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract.getContractCode(), "收款开票","",contract1.toString(), request);
userlog.start();
return ResultModel.OK(contract1);
}
@RequestMapping(value = "change", method = RequestMethod.POST)
@ResponseBody
public ResultModel change(@CurrentAccount User loginAccount, @RequestBody ContractChange contract) {
return ResultModel.OK(service.change(loginAccount, contract));
public ResultModel change(@CurrentAccount User loginAccount, @RequestBody ContractChange contract, HttpServletRequest request) {
Contract contract1 = service.change(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract.getContractCode(), "修改套餐","",contract1.toString(), request);
userlog.start();
return ResultModel.OK(contract1);
}
@RequestMapping(value = "find/pay", method = RequestMethod.GET)
......@@ -218,8 +227,11 @@ public class ContractController {
@RequestMapping(value = "update/pay", method = RequestMethod.PUT)
@ResponseBody
public ResultModel updatePay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract) {
return ResultModel.OK(service.updatePay(loginAccount, contract));
public ResultModel updatePay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract, HttpServletRequest request) {
Contract contract1 = service.updatePay(loginAccount, contract);
NewUserLogThread userlog = new NewUserLogThread(loginAccount.getEmail(), loginAccount.getName(), OperateObjectTypeEnum.CUSTOMER.getKey(), contract.getContractCode(), "修改收款开票","", service.updatePay(loginAccount, contract).toString(), request);
userlog.start();
return ResultModel.OK(contract1);
}
@RequestMapping(value = "find/payall", method = RequestMethod.GET)
......
package common.controller;
import common.model.User;
import common.model.UserLog;
import common.service.UserLogService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import security.annotation.CurrentAccount;
import util.ResultModel;
import java.util.List;
......@@ -24,7 +26,7 @@ public class UserLogController
///api/userlog/list?startDate=2017-12-26&endDate=2017-12-27
@RequestMapping(value = "list", method = RequestMethod.GET)
@ResponseBody
public ResultModel findByDS(@RequestParam String startDate, @RequestParam String endDate) {
return ResultModel.OK(userLogService.findUserLog(startDate, endDate));
public ResultModel findByDS(@CurrentAccount User user, @RequestParam String startDate, @RequestParam String endDate) {
return ResultModel.OK(userLogService.findUserLog(user,startDate, endDate));
}
}
......@@ -11,6 +11,6 @@ import java.util.List;
*/
public interface UserLogRepository extends JpaRepository<UserLog, Long>
{
@Query(value = "select * from user_log where substr(operate_time, 1, 10)>=?1 and substr(operate_time, 1, 10)<=?2", nativeQuery = true)
List<UserLog> findByOperateTime(String startDate, String endDate);
@Query(value = "select * from user_log where substr(operate_time, 1, 10)>=?1 and substr(operate_time, 1, 10)<=?2 and opera_account in ?3", nativeQuery = true)
List<UserLog> findByOperateTime(String startDate, String endDate, List<String> emails);
}
package common.service;
import common.model.User;
import common.model.UserLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -11,5 +12,5 @@ import java.util.List;
*/
public interface UserLogService
{
List<UserLog> findUserLog(String startDate, String endDate);
List<UserLog> findUserLog(User user, String startDate, String endDate);
}
package common.service.impl;
import common.model.User;
import common.model.UserLog;
import common.repository.UserLogRepository;
import common.service.UserLogService;
import common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import util.StringUtil;
import util.ValidateUtil;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
......@@ -25,11 +28,22 @@ public class UserLogServiceImpl implements UserLogService
{
@Autowired UserLogRepository userLogRepository;
@Autowired
UserService userService;
@Override
public List<UserLog> findUserLog(String startDate, String endDate)
public List<UserLog> findUserLog(User user,String startDate, String endDate)
{
return userLogRepository.findByOperateTime(startDate, endDate);
List<User> allSons = userService.findAllSons(user.getId());
List<String> emailList = new ArrayList<>();
emailList.add(user.getEmail());
if(ValidateUtil.isValid(allSons)){
for(User u : allSons){
emailList.add(u.getEmail());
}
}
return userLogRepository.findByOperateTime(startDate, endDate, emailList);
}
}
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