Commit 7a07d01c by manxiaoqiang

app排序

parent ba2cdf81
...@@ -186,20 +186,29 @@ public class ContractController { ...@@ -186,20 +186,29 @@ public class ContractController {
@RequestMapping(value = "update", method = RequestMethod.PUT) @RequestMapping(value = "update", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
public ResultModel update(@CurrentAccount User loginAccount, @RequestBody Contract contract) { public ResultModel update(@CurrentAccount User loginAccount, @RequestBody Contract contract, HttpServletRequest request) {
return ResultModel.OK(service.update(loginAccount, contract)); 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) @RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract) { public ResultModel pay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract, HttpServletRequest request) {
return ResultModel.OK(service.pay(loginAccount, contract)); 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) @RequestMapping(value = "change", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public ResultModel change(@CurrentAccount User loginAccount, @RequestBody ContractChange contract) { public ResultModel change(@CurrentAccount User loginAccount, @RequestBody ContractChange contract, HttpServletRequest request) {
return ResultModel.OK(service.change(loginAccount, contract)); 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) @RequestMapping(value = "find/pay", method = RequestMethod.GET)
...@@ -218,8 +227,11 @@ public class ContractController { ...@@ -218,8 +227,11 @@ public class ContractController {
@RequestMapping(value = "update/pay", method = RequestMethod.PUT) @RequestMapping(value = "update/pay", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
public ResultModel updatePay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract) { public ResultModel updatePay(@CurrentAccount User loginAccount, @RequestBody ContractMoney contract, HttpServletRequest request) {
return ResultModel.OK(service.updatePay(loginAccount, contract)); 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) @RequestMapping(value = "find/payall", method = RequestMethod.GET)
......
package common.controller; package common.controller;
import common.model.User;
import common.model.UserLog; import common.model.UserLog;
import common.service.UserLogService; import common.service.UserLogService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import security.annotation.CurrentAccount;
import util.ResultModel; import util.ResultModel;
import java.util.List; import java.util.List;
...@@ -24,7 +26,7 @@ public class UserLogController ...@@ -24,7 +26,7 @@ public class UserLogController
///api/userlog/list?startDate=2017-12-26&endDate=2017-12-27 ///api/userlog/list?startDate=2017-12-26&endDate=2017-12-27
@RequestMapping(value = "list", method = RequestMethod.GET) @RequestMapping(value = "list", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResultModel findByDS(@RequestParam String startDate, @RequestParam String endDate) { public ResultModel findByDS(@CurrentAccount User user, @RequestParam String startDate, @RequestParam String endDate) {
return ResultModel.OK(userLogService.findUserLog(startDate, endDate)); return ResultModel.OK(userLogService.findUserLog(user,startDate, endDate));
} }
} }
...@@ -11,6 +11,6 @@ import java.util.List; ...@@ -11,6 +11,6 @@ import java.util.List;
*/ */
public interface UserLogRepository extends JpaRepository<UserLog, Long> 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) @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<UserLog> findByOperateTime(String startDate, String endDate, List<String> emails);
} }
package common.service; package common.service;
import common.model.User;
import common.model.UserLog; import common.model.UserLog;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -11,5 +12,5 @@ import java.util.List; ...@@ -11,5 +12,5 @@ import java.util.List;
*/ */
public interface UserLogService public interface UserLogService
{ {
List<UserLog> findUserLog(String startDate, String endDate); List<UserLog> findUserLog(User user, String startDate, String endDate);
} }
package common.service.impl; package common.service.impl;
import common.model.User;
import common.model.UserLog; import common.model.UserLog;
import common.repository.UserLogRepository; import common.repository.UserLogRepository;
import common.service.UserLogService; import common.service.UserLogService;
import common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import util.StringUtil; import util.StringUtil;
import util.ValidateUtil;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
...@@ -25,11 +28,22 @@ public class UserLogServiceImpl implements UserLogService ...@@ -25,11 +28,22 @@ public class UserLogServiceImpl implements UserLogService
{ {
@Autowired UserLogRepository userLogRepository; @Autowired UserLogRepository userLogRepository;
@Autowired
UserService userService;
@Override @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