Merge branch 'zhaoyue-dev' into 'master'
Zhaoyue dev See merge request !16
Showing
6 changed files
with
268 additions
and
3 deletions
| @@ -28,9 +28,12 @@ public enum ResultStatus { | @@ -28,9 +28,12 @@ public enum ResultStatus { | ||
| 28 | REPORT_INVALID__ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"), | 28 | REPORT_INVALID__ERROR(-11142,"报告在数据库中不存在/Report is not exist in the DB"), |
| 29 | 29 | ||
| 30 | INVALID_USER_ERROR(-11150,"报告所属用户未注册/Report user's account is not exist"), | 30 | INVALID_USER_ERROR(-11150,"报告所属用户未注册/Report user's account is not exist"), |
| 31 | - INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!/Operator can not delete this report"), | 31 | + INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!/Operator can not delete the report which is not create by him"), |
| 32 | + | ||
| 33 | + DB_ERROR(-11160,"服务器错误,无法写入数据库/Server error, can not write into database"), | ||
| 34 | + | ||
| 35 | + COMPANY_ERROR(-11170,"用户所属公司信息有误/Company infomation error"); | ||
| 32 | 36 | ||
| 33 | - DB_ERROR(-11160,"服务器错误,无法写入数据库/Server error, can not write into database"); | ||
| 34 | 37 | ||
| 35 | 38 | ||
| 36 | 39 |
| 1 | +package com.xkl.controller.uploadsoft; | ||
| 2 | + | ||
| 3 | +import com.wordnik.swagger.annotations.ApiImplicitParam; | ||
| 4 | +import com.wordnik.swagger.annotations.ApiImplicitParams; | ||
| 5 | +import com.wordnik.swagger.annotations.ApiOperation; | ||
| 6 | +import com.xkl.authorization.annotation.*; | ||
| 7 | +import com.xkl.authorization.manager.ITokenManager; | ||
| 8 | +import com.xkl.config.Constants; | ||
| 9 | +import com.xkl.config.ResultStatus; | ||
| 10 | +import com.xkl.domain.User; | ||
| 11 | +import com.xkl.domain.XklAdminEntity; | ||
| 12 | +import com.xkl.domain.XklCompanyEntity; | ||
| 13 | +import com.xkl.domain.XklMemberEntity; | ||
| 14 | +import com.xkl.model.AdminInfoModel; | ||
| 15 | +import com.xkl.model.ResultModel; | ||
| 16 | +import com.xkl.repository.AdminRepository; | ||
| 17 | +import com.xkl.repository.UserRepository; | ||
| 18 | +import com.xkl.repository.XklCompanyRepository; | ||
| 19 | +import com.xkl.repository.XklMemberRespository; | ||
| 20 | +import com.xkl.security.AntiXSS; | ||
| 21 | +import com.xkl.security.SecurityTool; | ||
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 23 | +import org.springframework.http.HttpStatus; | ||
| 24 | +import org.springframework.http.ResponseEntity; | ||
| 25 | +import org.springframework.util.Assert; | ||
| 26 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 27 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 28 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 29 | +import org.springframework.web.bind.annotation.RestController; | ||
| 30 | + | ||
| 31 | +import javax.servlet.http.HttpServletRequest; | ||
| 32 | + | ||
| 33 | +/** | ||
| 34 | + * 操作员信息查询接口 | ||
| 35 | + */ | ||
| 36 | +@RestController | ||
| 37 | +@RequestMapping("/adminInfo") | ||
| 38 | +public class AdminInfoController { | ||
| 39 | + @Autowired | ||
| 40 | + private XklCompanyRepository xklCompanyRepository; | ||
| 41 | + | ||
| 42 | + @RequestMapping(method = RequestMethod.GET) | ||
| 43 | + @Authorization | ||
| 44 | + @ApiOperation(value = "操作员信息查询接口") | ||
| 45 | + @ApiImplicitParams({ | ||
| 46 | + @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | ||
| 47 | + }) | ||
| 48 | + public ResponseEntity<ResultModel> getAdminInfo(@CurrentAdmin XklAdminEntity admin) { | ||
| 49 | + XklCompanyEntity companyEntity = xklCompanyRepository.findById(admin.getCoid()); | ||
| 50 | + if(companyEntity==null){ | ||
| 51 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.COMPANY_ERROR),HttpStatus.OK); | ||
| 52 | + } | ||
| 53 | + AdminInfoModel adminInfoModel = new AdminInfoModel(admin.getId(), admin.getAccount(), companyEntity.getId(), companyEntity.getName()); | ||
| 54 | + return new ResponseEntity<>(ResultModel.ok(adminInfoModel), HttpStatus.OK); | ||
| 55 | + } | ||
| 56 | +} |
| 1 | +package com.xkl.domain; | ||
| 2 | + | ||
| 3 | +import javax.persistence.Column; | ||
| 4 | +import javax.persistence.Entity; | ||
| 5 | +import javax.persistence.Id; | ||
| 6 | +import javax.persistence.Table; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 公司数据的domain类 | ||
| 10 | + */ | ||
| 11 | +@Entity | ||
| 12 | +@Table(name = "xkl_company") | ||
| 13 | +public class XklCompanyEntity { | ||
| 14 | + //公司id | ||
| 15 | + @Id | ||
| 16 | + @Column(name = "id") | ||
| 17 | + private long id; | ||
| 18 | + | ||
| 19 | + @Column(name = "name") | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + @Column(name = "parent_id") | ||
| 23 | + private long parentId; | ||
| 24 | + | ||
| 25 | + @Column(name = "province_id") | ||
| 26 | + private long provinceId; | ||
| 27 | + | ||
| 28 | + @Column(name = "city_id") | ||
| 29 | + private long cityId; | ||
| 30 | + | ||
| 31 | + @Column(name = "country_id") | ||
| 32 | + private long countryId; | ||
| 33 | + | ||
| 34 | + @Column(name = "company_code") | ||
| 35 | + private long companyCode; | ||
| 36 | + | ||
| 37 | + @Column(name = "company_type") | ||
| 38 | + private int companyType; | ||
| 39 | + | ||
| 40 | + @Column(name = "level") | ||
| 41 | + private int level; | ||
| 42 | + | ||
| 43 | + @Column(name = "show_level") | ||
| 44 | + private int showLevel; | ||
| 45 | + | ||
| 46 | + @Column(name = "status") | ||
| 47 | + private int status; | ||
| 48 | + | ||
| 49 | + public long getId() { | ||
| 50 | + return id; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setId(long id) { | ||
| 54 | + this.id = id; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public String getName() { | ||
| 58 | + return name; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public void setName(String name) { | ||
| 62 | + this.name = name; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public long getParentId() { | ||
| 66 | + return parentId; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setParentId(long parentId) { | ||
| 70 | + this.parentId = parentId; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public long getProvinceId() { | ||
| 74 | + return provinceId; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setProvinceId(long provinceId) { | ||
| 78 | + this.provinceId = provinceId; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public long getCityId() { | ||
| 82 | + return cityId; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setCityId(long cityId) { | ||
| 86 | + this.cityId = cityId; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public long getCountryId() { | ||
| 90 | + return countryId; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setCountryId(long countryId) { | ||
| 94 | + this.countryId = countryId; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public long getCompanyCode() { | ||
| 98 | + return companyCode; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setCompanyCode(long companyCode) { | ||
| 102 | + this.companyCode = companyCode; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public int getCompanyType() { | ||
| 106 | + return companyType; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setCompanyType(int companyType) { | ||
| 110 | + this.companyType = companyType; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public int getLevel() { | ||
| 114 | + return level; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setLevel(int level) { | ||
| 118 | + this.level = level; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public int getShowLevel() { | ||
| 122 | + return showLevel; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setShowLevel(int showLevel) { | ||
| 126 | + this.showLevel = showLevel; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public int getStatus() { | ||
| 130 | + return status; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setStatus(int status) { | ||
| 134 | + this.status = status; | ||
| 135 | + } | ||
| 136 | +} |
| 1 | +package com.xkl.model; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 管理员信息 | ||
| 8 | + */ | ||
| 9 | +@Data | ||
| 10 | +public class AdminInfoModel { | ||
| 11 | + public long adminId; | ||
| 12 | + public String adminAccount; | ||
| 13 | + public long comId; | ||
| 14 | + public String comName; | ||
| 15 | + | ||
| 16 | + public AdminInfoModel(long adminId, String adminAccount, long comId, String comName) { | ||
| 17 | + this.adminId = adminId; | ||
| 18 | + this.adminAccount = adminAccount; | ||
| 19 | + this.comId = comId; | ||
| 20 | + this.comName = comName; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public long getAdminId() { | ||
| 24 | + return adminId; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public void setAdminId(long adminId) { | ||
| 28 | + this.adminId = adminId; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public String getAdminAccount() { | ||
| 32 | + return adminAccount; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setAdminAccount(String adminAccount) { | ||
| 36 | + this.adminAccount = adminAccount; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public long getComId() { | ||
| 40 | + return comId; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void setComId(long comId) { | ||
| 44 | + this.comId = comId; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public String getComName() { | ||
| 48 | + return comName; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setComName(String comName) { | ||
| 52 | + this.comName = comName; | ||
| 53 | + } | ||
| 54 | +} |
| 1 | +package com.xkl.repository; | ||
| 2 | + | ||
| 3 | +import com.xkl.domain.XklAmpReportEntity; | ||
| 4 | +import com.xkl.domain.XklCompanyEntity; | ||
| 5 | +import org.springframework.data.repository.CrudRepository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * XklCompany类的CRUD操作 | ||
| 9 | + * | ||
| 10 | + * @see XklCompanyEntity | ||
| 11 | + */ | ||
| 12 | +public interface XklCompanyRepository extends CrudRepository<XklCompanyEntity, Long> { | ||
| 13 | + public XklCompanyEntity findById(long id); | ||
| 14 | + | ||
| 15 | +} |
-
Please register or login to post a comment