Commit d40b99e5 by manxiaoqiang

二版

parent 7f5e60bc
......@@ -144,6 +144,13 @@ public class ContractController {
return ResultModel.OK(service.checkAccount(email, platform));
}
@RequestMapping(value = "checkTime", method = RequestMethod.GET)
@ResponseBody
public ResultModel checkTime(@RequestParam String type, @RequestParam String email,
@RequestParam String platform, @RequestParam(required = false) String product) {
return ResultModel.OK(service.checkTime(email, platform,type,product));
}
@RequestMapping(value = "find/body", method = RequestMethod.GET)
@ResponseBody
public ResultModel findBody(@CurrentAccount User loginAccount) {
......
......@@ -36,6 +36,9 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and type = ?3 order by ds desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailLimit1(String platform, String email,String type);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and type = ?3 and price_level = ?4 order by ds desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailAndPricelevelLimit1(String platform, String email,String type, Long priceLevel);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2 and (status = 'wait' or status = 'executing') and type = 'main' order by ds desc limit 1",nativeQuery=true)
Contract findByPlatformAndEmailLimitVaild(String platform, String email);
......
......@@ -13,6 +13,8 @@ public interface ContractService {
Map<String, Object> checkAccount(String email, String platfrom);
Boolean checkTime(String email, String platfrom, String type, String product);
List<ContractBody> findBody();
String getContractCode(String code);
......
......@@ -100,6 +100,35 @@ public class ContractServiceImpl implements ContractService{
}
@Override
public Boolean checkTime(String email, String platfrom, String type, String product) {
Boolean flag = false;
if(ContractTypeEnum.MAIN.getKey().equals(type)){
Contract contract = contractRepository.findByPlatformAndEmailLimit1(platfrom, email, type);
if (null == contract){
flag = true;
}else{
String beforeDay = DateUtil.getBeforeDays(180);
if(beforeDay.compareTo(contract.getEndDate()) > 0){
flag = true;
}
}
}else{
ContractIncrement increment = contractIncrementRepository.findByCode(product);
Contract contract = contractRepository.findByPlatformAndEmailAndPricelevelLimit1(platfrom, email, type, increment.getId());
if (null == contract){
flag = true;
}else{
String beforeDay = DateUtil.getBeforeDays(180);
String endDate = contract.getEndDate() == null ? contract.getDs() : contract.getEndDate();
if(beforeDay.compareTo(endDate) > 0){
flag = true;
}
}
}
return flag;
}
@Override
public List<ContractBody> findBody() {
return contractBodyRepository.findAll();
}
......@@ -366,6 +395,7 @@ public class ContractServiceImpl implements ContractService{
List<User> userList = userService.findAllSons(loginAccount.getId());
List<Long> idList = new ArrayList<>();
idList.add(loginAccount.getId());
for(User u : userList){
idList.add(u.getId());
}
......@@ -414,6 +444,19 @@ public class ContractServiceImpl implements ContractService{
contract.setPriceLevelName(typeMap.containsKey(contract.getPriceLevel()) ? typeMap.get(contract.getPriceLevel()) : "");
contract.setCreateName(saleMap.containsKey(contract.getCreateAccount()) ? saleMap.get(contract.getCreateAccount()) : "");
Boolean flag = null;
if(contract.getPriceLevel().longValue() == 1l){
flag = checkTime(contract.getEmail(), contract.getPlatform(),contract.getType(), "black");
}else{
flag = checkTime(contract.getEmail(), contract.getPlatform(),contract.getType(), "analysis");
}
if(flag){
contract.setContractType("0");
}else{
contract.setContractType("1");
}
return contract;
}
......
......@@ -213,6 +213,16 @@ public class TkioAccountServiceImpl implements TkioAccountService {
if(null == aw){
return null;
}
List<SalesManLeader> roles = salesManLeaderRepository.findAll();
Map<Long, String> busMap = new HashMap<>();
for(SalesManLeader u : roles){
busMap.put((long)u.getId(),u.getName());
}
List<User> users = userRepository.findAll();
Map<String, Long> saleMap = new HashMap<>();
for(User u : users){
saleMap.put(u.getEmail(),u.getId());
}
List<BackVisit> backVisitList = backVisitRepository.findAllByPlatformAndEmail("tkio", email);
if(ValidateUtil.isValid(backVisitList)){
aw.setBackTime(backVisitList.size());
......@@ -234,6 +244,13 @@ public class TkioAccountServiceImpl implements TkioAccountService {
} else{
aw.setRemStatus(true);
}
if(busMap.containsKey(aw.getBussinessMan())){
aw.setSaleName(busMap.get(aw.getBussinessMan()));
}else{
aw.setSaleName("");
}
return aw;
}
......
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