Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from TGclub/jc
Browse files Browse the repository at this point in the history
Jc
  • Loading branch information
Kikyou1997 authored Nov 25, 2018
2 parents 7bbaab3 + 861b24c commit 4ebff9b
Show file tree
Hide file tree
Showing 13 changed files with 404 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,7 @@ public ResponseEntity handledFeedBack(@PathVariable int id) {
return ResultUtil.success();
}

@Secured("ROLE_ADMIN_1")
@PostMapping("/create")
public ResponseEntity createNewAdmin(@RequestBody AdminInfo adminInfo) {
adminService.addNewAdmin(adminInfo);
return ResultUtil.success();
}


@Secured("ROLE_ADMIN_1")
@GetMapping("/delete/{id}")
Expand All @@ -147,6 +142,7 @@ public ResponseEntity setBoss(@PathVariable int id) {
adminService.modifyIsBossAttribute(id, true);
return ResultUtil.success();
}

@Secured("ROLE_ADMIN_1")
@GetMapping("/midify/setSchool/{id}/{schoolId}")
public ResponseEntity setSchoolId(@PathVariable int id, @PathVariable int schooId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.io.IOException;
import java.security.Principal;

@Controller
@RestController
@Slf4j
public class LoginController extends BaseController{

Expand Down Expand Up @@ -104,6 +104,13 @@ public void logout(HttpServletRequest request, HttpServletResponse response) thr
response.sendRedirect("/login/admin");
}

/*
@PostMapping("/test")
public String test(@RequestBody AdminLoginDTO dto) {
return "Heoo " + dto.getAdminName();
}*/



}
4 changes: 2 additions & 2 deletions src/main/java/com/wizzstudio/substitute/dao/IndentDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public interface IndentDao extends JpaRepository<Indent, Integer>,IndentDaoCusto
List<Indent> findAllByIndentStateOrderByIndentPriceDesc(IndentStateEnum state);
List<Indent> findAllByIndentStateOrderByCreateTimeDesc(IndentStateEnum state);

@Query(value = "select Indent from Indent i where i.isSolved = ?1 and i.urgentType > ?2")
List<Indent> findAllByIsSolvedAndUrgentType(Boolean isSolved, Integer type);
//@Query(value = "select Indent from Indent i where i.isSolved = ?1 and i.urgentType > ?2")
List<Indent> findAllByIsSolvedAndUrgentTypeGreaterThanOrderByCreateTimeDesc(Boolean isSolved, Integer type);



Expand Down
64 changes: 39 additions & 25 deletions src/main/java/com/wizzstudio/substitute/domain/AdminInfo.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.wizzstudio.substitute.domain;

import com.wizzstudio.substitute.enums.Role;
import lombok.Builder;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.constraints.*;

/**
* Created by Kikyou on 18-11-18
Expand All @@ -20,7 +19,6 @@ public class AdminInfo {
//管理员电话
@Column
@NotNull
@Size(min = 7, max = 11)
private Long adminPhone;
//管理员账号,唯一
@Column
Expand All @@ -41,20 +39,8 @@ public class AdminInfo {
@Column
private Integer adminSchoolId;

public AdminInfo(Integer adminId, Long adminPhone, String adminName, String adminPass, Role adminRole, Boolean isBoss, Integer adminSchoolId) {
this.adminId = adminId;
this.adminPhone = adminPhone;
this.adminName = adminName;
this.adminPass = adminPass;
this.adminRole = adminRole;
this.isBoss = isBoss;
this.adminSchoolId = adminSchoolId;
}

public AdminInfo() {
}

private AdminInfo(Builder builder) {
setAdminId(builder.adminId);
setAdminPhone(builder.adminPhone);
setAdminName(builder.adminName);
setAdminPass(builder.adminPass);
Expand All @@ -69,6 +55,7 @@ public static Builder newBuilder() {

public static Builder newBuilder(AdminInfo copy) {
Builder builder = new Builder();
builder.adminId = copy.getAdminId();
builder.adminPhone = copy.getAdminPhone();
builder.adminName = copy.getAdminName();
builder.adminPass = copy.getAdminPass();
Expand All @@ -78,34 +65,61 @@ public static Builder newBuilder(AdminInfo copy) {
return builder;
}

public Integer getAdminId() {
return adminId;
}

public void setAdminId(Integer adminId) {
this.adminId = adminId;
}

public AdminInfo(Integer adminId, Long adminPhone, String adminName, String adminPass, Role adminRole, Boolean isBoss, Integer adminSchoolId) {
this.adminId = adminId;
this.adminPhone = adminPhone;
this.adminName = adminName;
this.adminPass = adminPass;
this.adminRole = adminRole;
this.isBoss = isBoss;
this.adminSchoolId = adminSchoolId;
}

public AdminInfo() {
}


public static final class Builder {
private Long adminPhone;
private String adminName;
private String adminPass;
private Role adminRole;
private Integer adminId;
private @NotNull @Size(min = 7, max = 11) Long adminPhone;
private @NotNull String adminName;
private @NotNull @Size(min = 8) String adminPass;
private @NotNull Role adminRole;
private Boolean isBoss;
private Integer adminSchoolId;

private Builder() {
}

public Builder setAdminPhone(Long adminPhone) {
public Builder setAdminId(Integer adminId) {
this.adminId = adminId;
return this;
}

public Builder setAdminPhone(@NotNull @Size(min = 7, max = 11) Long adminPhone) {
this.adminPhone = adminPhone;
return this;
}

public Builder setAdminName(String adminName) {
public Builder setAdminName(@NotNull String adminName) {
this.adminName = adminName;
return this;
}

public Builder setAdminPass(String adminPass) {
public Builder setAdminPass(@NotNull @Size(min = 8) String adminPass) {
this.adminPass = adminPass;
return this;
}

public Builder setAdminRole(Role adminRole) {
public Builder setAdminRole(@NotNull Role adminRole) {
this.adminRole = adminRole;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
@Entity
@Data
@Builder
//@Builder
public class CouponInfo {
//优惠券ID
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,83 @@ public interface AdminService {
*/
void allocatePrivilege(Integer userId, Role role);


AdminInfo getAdminInfo(Integer adminId);

void createNewAdmin(AdminInfo admin);


/**
* 检验是否是合法的登录请求
* @param loginDTO 登录信息
* @return
*/
boolean isValidAdmin(AdminLoginDTO loginDTO);

/**
* 获取用户基本信息
* @param admin 用于保存的信息
* @return
*/
void addNewAdmin(AdminInfo admin);

/**
* 获取未被接单的订单
* @return 订单信息
*/
List<Indent> getUnPickedIndent();

/**
* 获取未处理的紧急订单
* @return 订单列表
*/
List<Indent> getUnHandledUrgentIndents();

/**
* 获取已处理的紧急订单
* @return 订单列表
*/
List<Indent> getHandledUrgentIndents();

/**
* 获取所有的优惠券信息
* @return 所有的优惠券
*/
List<CouponInfo> getAllCoupon();

/**
* 将紧急订单设置为已处理
* @param id 订单id
*/
void handleUrgent(int id);

/**
* 添加新的优惠券
* @param coupon 优惠券信息
*/
void addNewCoupon(CouponInfo coupon);

/**
* 删除优惠券
* @param couponId
*/
void deleteCoupon(int couponId);

/**
* 获取所有未处理的意见反馈
* @return
*/
List<Feedback> getUnHandledFeedBack();

/**
* 获取所有未处理的意见反馈
* @return
*/
List<Feedback> getHandledFeedBack();

/**
* 将反馈设置为已处理
* @param id
*/
void handleFeedBack(int id);


Expand All @@ -52,16 +104,45 @@ public interface AdminService {
*/
void handleWithDrawDeposit(String userId);

/**
* 获取所有的二级管理员
* @return
*/
List<AdminInfo> getAllSecondAdmin();

/**
* 修改二级管理员学校
* @param adminId 被修改的管理员id
* @param schoolId 学校id
*/
void modifySecondAdminSchool(int adminId, int schoolId);

/**
* 将管理员设置为区域负责人
* @param secondAdminId 二级管理员id
* @param isBoss
*/
void modifyIsBossAttribute(int secondAdminId, boolean isBoss);

/**
* 删除二级管理员
* @param adminId 被删管理员id
*/
void deleteSecondAdmin(int adminId);

/**
* 获取详细监控信息
* @param from 起始日期
* @param to 结束日期
* @return 指定日期范围内的每日信息
*/
List<CountInfo> getConcreteCountInfo(Integer from, Integer to);

/**
* 查看指定状态的所有提现请求
* @param status true 已处理, false 未处理
* @return
*/
List<WithdrawRequest> viewAllWithDrawRequestByStatus(boolean status);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.wizzstudio.substitute.domain.School;
import com.wizzstudio.substitute.domain.User;
import com.wizzstudio.substitute.service.AddressService;
import com.wizzstudio.substitute.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down
Loading

0 comments on commit 4ebff9b

Please sign in to comment.