package com.gk.hotwork.Controller;
|
import java.util.Date;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.gk.hotwork.Controller.Base.BaseController;
|
import com.gk.hotwork.Domain.*;
|
import com.gk.hotwork.Domain.Enum.ErrorCode;
|
import com.gk.hotwork.Domain.Exception.BusinessException;
|
import com.gk.hotwork.Domain.Utils.*;
|
import com.gk.hotwork.Domain.Utils.Properties;
|
import com.gk.hotwork.Domain.Vo.DepartmentVo;
|
import com.gk.hotwork.Domain.Vo.UserVo;
|
import com.gk.hotwork.Domain.Vo.WorkCertVo;
|
import com.gk.hotwork.Service.*;
|
import io.swagger.annotations.*;
|
import io.swagger.models.auth.In;
|
import org.apache.catalina.User;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import java.io.File;
|
import java.io.FileInputStream;
|
import java.io.InputStream;
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
|
@Api(tags = "用户管理数据接口")
|
@RestController
|
public class UserController extends BaseController {
|
|
@Autowired
|
UserService userService;
|
@Autowired
|
RoleService roleService;
|
@Autowired
|
UserRolesService userRolesService;
|
@Autowired
|
RolePermissionsService rolePermissionsService;
|
@Autowired
|
ExcelExportService excelExportService;
|
@Autowired
|
DistrictService districtService;
|
@Autowired
|
UserRolesService userRolesInfoService;
|
@Autowired
|
CompanyService companyService;
|
@Autowired
|
DepartmentService departmentService;
|
@Autowired
|
InvolveDepService involveDepService;
|
@Autowired
|
ExamScoreService examscoreService;
|
@Autowired
|
WorkCertService workCertService;
|
@Autowired
|
private BlackListService blackListService;
|
@Autowired
|
private DeviceLocationService deviceLocationService;
|
@Autowired
|
private SpecialityService specialityService;
|
@Value("${workname}")
|
private String workname;
|
@Value("${workCert}")
|
private String workCert;
|
|
@Value("${filePath}")
|
private String filePath; //配置文件配置的物理保存地址
|
@Value("${slice.size}")
|
private Integer sliceSize;
|
|
@GetMapping("/user")
|
@ApiOperation(value = "获取用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证号"),
|
@ApiImplicitParam(name = "ispass",value = "是否通过考试"),
|
})
|
public Msg getUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String username,String company, String department,String realname, String idcard,Byte ispass,@RequestParam(required = false,defaultValue = "true") Boolean isMain){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(username)) {
|
condition.put("username", username.trim());
|
}
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
|
if (StringUtils.isNotBlank(department)) {
|
condition.put("department", department.trim());
|
}
|
|
if (StringUtils.isNotBlank(realname)){
|
condition.put("realname",realname.trim());
|
}
|
|
if (StringUtils.isNotBlank(idcard)){
|
condition.put("idcard",idcard.trim());
|
}
|
|
if (ispass != null){
|
condition.put("ispass",ispass);
|
}
|
|
UserInfo userInfo = userService.selectByUser(getUser().getUsername());
|
if (userInfo.getType() == 3){
|
condition.put("username", userInfo.getUsername());
|
}
|
|
// if (!companyService.isMain(userInfo.getCompany())){
|
// condition.put("company", userInfo.getCompany());
|
// }
|
//是系统菜单下的就显示主体,否则非主体
|
// if (isMain) {
|
// condition.put("isMain", 1);
|
// } else {
|
// condition.put("isMain", 0);
|
// }
|
|
pageInfo.setCondition(condition);
|
userService.selectUserDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
@GetMapping("/company/user/list")
|
@ApiOperation(value = "获取企业用户数据-分页",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "company",value = "企业名称"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证号"),
|
@ApiImplicitParam(name = "job",value = "身份证号"),
|
})
|
public Msg getCompanyUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String username,String company,String realname, String idcard, String job){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(username)) {
|
condition.put("username", username.trim());
|
}
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
|
if (StringUtils.isNotBlank(realname)){
|
condition.put("realname",realname.trim());
|
}
|
|
if (StringUtils.isNotBlank(idcard)){
|
condition.put("idcard",idcard.trim());
|
}
|
if (StringUtils.isNotBlank(job)){
|
condition.put("job",job.trim());
|
}
|
Integer type = getUser().getType();
|
if(type.equals(3)){
|
condition.put("companyid",getUser().getCompanyid());
|
}
|
|
pageInfo.setCondition(condition);
|
userService.selectCompanyUserDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
@GetMapping("/supervise/user/list")
|
@ApiOperation(value = "获取监管用户数据-分页",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证号"),
|
@ApiImplicitParam(name = "province",value = "省"),
|
@ApiImplicitParam(name = "city",value = "市"),
|
@ApiImplicitParam(name = "county",value = "县"),
|
})
|
public Msg getSuperviseUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String username,String company,String realname, String idcard, String province,String city,String county){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfoCurrent = userService.selectByUser(getUser().getUsername());
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(username)) {
|
condition.put("username", username.trim());
|
}
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
|
if (StringUtils.isNotBlank(realname)){
|
condition.put("realname",realname.trim());
|
}
|
|
if (StringUtils.isNotBlank(idcard)){
|
condition.put("idcard",idcard.trim());
|
}
|
if (StringUtils.isNotBlank(province)){
|
condition.put("province",province.trim());
|
|
if(StringUtils.isNotBlank(city)){
|
condition.put("city", city);
|
}
|
if(StringUtils.isNotBlank(county)){
|
condition.put("county", county);
|
}
|
|
}else {
|
if(StringUtils.isNotBlank(userInfoCurrent.getProvince())){
|
condition.put("province", userInfoCurrent.getProvince());
|
}
|
if(StringUtils.isNotBlank(userInfoCurrent.getCity())){
|
condition.put("city", userInfoCurrent.getCity());
|
}
|
if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
|
condition.put("county", userInfoCurrent.getCounty());
|
}
|
}
|
|
|
|
pageInfo.setCondition(condition);
|
userService.selectSuperviseUserDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
|
@GetMapping("/expert/user/list")
|
@ApiOperation(value = "获取专家用户数据-分页",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证号"),
|
})
|
public Msg getExpertUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String username,String company,String realname, String idcard){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(username)) {
|
condition.put("username", username.trim());
|
}
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
|
if (StringUtils.isNotBlank(realname)){
|
condition.put("realname",realname.trim());
|
}
|
|
if (StringUtils.isNotBlank(idcard)){
|
condition.put("idcard",idcard.trim());
|
}
|
|
|
pageInfo.setCondition(condition);
|
userService.selectExpertUserDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
|
@ApiOperation("/获取所有未被删除的人员")
|
@PostMapping("/getUserList")
|
@ApiImplicitParams({
|
})
|
public Msg getUserList() {
|
return success(userService.getUserList());
|
}
|
|
|
@GetMapping("/userList")
|
@ApiOperation(value = "获取对应单位、部门的人员",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
})
|
public Msg getUserList(String company,String department){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
if (StringUtils.isNotBlank(department)) {
|
condition.put("department", department.trim());
|
}
|
condition.put("examtype",workname);
|
List<UserVo> userVoList = new ArrayList<>();
|
List<UserVo> userInfoList = userService.selectAll(condition);
|
// for (UserVo userVo : userInfoList){
|
// List<WorkCertInfo> workCertInfo = workCertService.selectByMobile(userVo.getUsername());
|
// if (workCertInfo.size() > 0){
|
// userVo.setBranch(workCertInfo.get(0).getBranch());
|
// userVo.setNumber(workCertInfo.get(0).getCertname());
|
// userVoList.add(userVo);
|
// }
|
// }
|
msg.setResult(userInfoList);
|
return msg;
|
}
|
|
|
@PostMapping("/adduser")
|
@ApiOperation(value = "添加用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "type",value = "用户类型",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "iscompany",value = "是否单位负责人"),
|
@ApiImplicitParam(name = "isdepartment",value = "是否部门负责人"),
|
@ApiImplicitParam(name = "status",value = "状态"),
|
})
|
public Msg addUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
UserInfo userInfoCurrent = userService.selectByUser(getUser().getUsername());
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
try {
|
userInfo.setType(jsonObject.getInteger("type"));
|
}catch (Exception e) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户类型必须为数字");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(null,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
Long companyid = jsonObject.getLong("companyid");
|
if (companyid == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位参数为空");
|
return msg;
|
}
|
CompanyInfo companyInfo = companyService.getById(companyid);
|
if (companyInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位不存在");
|
return msg;
|
}
|
if (jsonObject.getLong("department") != null) {
|
DepartmentInfo department = departmentService.getById(jsonObject.getLong("department"));
|
if (department == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("部门不存在");
|
return msg;
|
}
|
userInfo.setDepartment(department.getId());
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(companyInfo.getCompany());
|
userInfo.setCompanyid(companyid);
|
if (!companyService.isMain(userInfoCurrent.getCompany())){
|
userInfo.setCompany(userInfoCurrent.getCompany());
|
}
|
|
|
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setIscompany(jsonObject.getByte("iscompany"));
|
userInfo.setIsdepartment(jsonObject.getByte("isdepartment"));
|
userInfo.setStatus(jsonObject.getByte("status"));
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setIssecurityofficer(jsonObject.getByte("issecurityofficer"));
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
String empNo = jsonObject.getString("empNo");
|
String deviceNo = jsonObject.getString("deviceNo");
|
if (StringUtils.isNotBlank(empNo)
|
&& StringUtils.isNotBlank(deviceNo)){
|
try {
|
Msg msg1 = userService.saveEmployee(realname,empNo,deviceNo);
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg1;
|
}
|
userInfo.setEmpNo(empNo);
|
userInfo.setDeviceNo(deviceNo);
|
userInfo.setCardId(msg.getResult().toString());
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
|
}
|
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.save(userInfo);
|
return msg;
|
}
|
/**
|
* 专家用户-新增
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/add/expert/user")
|
@ApiOperation(value = "添加专家用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "specialityId",value = "专业方向id"),
|
@ApiImplicitParam(name = "professionalLevel",value = "职称"),
|
})
|
public Msg addExpertUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(null,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
Integer professionalLevel = jsonObject.getInteger("professionalLevel");
|
if (professionalLevel == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("职称参数为空");
|
return msg;
|
}
|
Long specialityId = jsonObject.getLong("specialityId");
|
if (specialityId == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("专业参数为空");
|
return msg;
|
}
|
|
SpecialityInfo specialityInfo = specialityService.getById(specialityId);
|
if (specialityInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("专业不存在");
|
return msg;
|
}
|
userInfo.setCompany(jsonObject.getString("company"));
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setSpecialityId(specialityId);
|
userInfo.setProfessionalLevel(professionalLevel);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setStatus((byte)1);
|
userInfo.setType(4);
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.save(userInfo);
|
UserInfo user = userService.selectByUser(userInfo.getUsername());
|
//默认配置企业用户角色
|
UserRolesInfo userRolesInfo = new UserRolesInfo();
|
userRolesInfo.setRoleid(36l);
|
userRolesInfo.setUserid(user.getId());
|
userRolesService.save(userRolesInfo);
|
return msg;
|
}
|
/**
|
* 专家用户-修改
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/put/expert/user")
|
@ApiOperation(value = "修改专家用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "主键",required = true),
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "specialityId",value = "专业方向id"),
|
@ApiImplicitParam(name = "professionalLevel",value = "职称"),
|
})
|
public Msg putExpertUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
|
Long id = jsonObject.getLong("id");
|
if (id == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("主键参数为空");
|
return msg;
|
}else {
|
userInfo.setId(id);
|
}
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (StringUtils.isNotBlank(password)){
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(id,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
Integer professionalLevel = jsonObject.getInteger("professionalLevel");
|
if (professionalLevel == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("职称参数为空");
|
return msg;
|
}
|
Long specialityId = jsonObject.getLong("specialityId");
|
if (specialityId == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("专业参数为空");
|
return msg;
|
}
|
|
SpecialityInfo specialityInfo = specialityService.getById(specialityId);
|
if (specialityInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("专业不存在");
|
return msg;
|
}
|
List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
|
userInfo.setCompany(jsonObject.getString("company"));
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setSpecialityId(specialityId);
|
userInfo.setProfessionalLevel(professionalLevel);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setStatus((byte)1);
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
|
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.updateById(userInfo);
|
return msg;
|
}
|
/**
|
* 企业用户-新增
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/add/company/user")
|
@ApiOperation(value = "添加企业用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "companyid",value = "单位"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
})
|
public Msg addCompanyUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(null,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
Long companyid = jsonObject.getLong("companyid");
|
if (companyid == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位参数为空");
|
return msg;
|
}
|
CompanyInfo companyInfo = companyService.getById(companyid);
|
if (companyInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位不存在");
|
return msg;
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(companyInfo.getCompany());
|
userInfo.setCompanyid(companyid);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setStatus((byte)1);
|
userInfo.setType(3);
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.save(userInfo);
|
UserInfo user = userService.selectByUser(userInfo.getUsername());
|
//默认配置企业用户角色
|
UserRolesInfo userRolesInfo = new UserRolesInfo();
|
userRolesInfo.setRoleid(35l);
|
userRolesInfo.setUserid(user.getId());
|
userRolesService.save(userRolesInfo);
|
return msg;
|
}
|
|
/**
|
* 企业用户-修改
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/put/company/user")
|
@ApiOperation(value = "修改企业用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "用户id",required = true),
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "companyid",value = "单位"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
})
|
public Msg putCompanyUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
Long id = jsonObject.getLong("id");
|
if (id == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("主键参数为空");
|
return msg;
|
}else {
|
userInfo.setId(id);
|
}
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
|
if (StringUtils.isNotBlank(password)){
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
}
|
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(userInfo.getId(),idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
|
Long companyid = jsonObject.getLong("companyid");
|
if (companyid == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位参数为空");
|
return msg;
|
}
|
CompanyInfo companyInfo = companyService.getById(companyid);
|
if (companyInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位不存在");
|
return msg;
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(companyInfo.getCompany());
|
userInfo.setCompanyid(companyInfo.getId());
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setRealname(realname);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
userService.updateById(userInfo);
|
return msg;
|
|
}
|
/**
|
* 监管用户-新增
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/add/supervise/user")
|
@ApiOperation(value = "添加企业用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "executiveLevel",value = "行政级别 "),
|
@ApiImplicitParam(name = "province",value = "省(自治区)"),
|
@ApiImplicitParam(name = "city",value = "地(市、州)"),
|
@ApiImplicitParam(name = "county",value = "区/县"),
|
})
|
public Msg addSuperviseUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
UserInfo userInfoCurrent = userService.selectByUser(getUser().getUsername());
|
|
Integer executiveLevel = jsonObject.getInteger("executiveLevel");
|
if (executiveLevel == null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("行政级别不能为空");
|
return msg;
|
}
|
String province = jsonObject.getString("province");
|
if (StringUtils.isBlank(province)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("省(自治区)不能为空");
|
return msg;
|
}
|
|
String city = jsonObject.getString("city");
|
if (executiveLevel == 2 && StringUtils.isBlank(city)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("地(市、州)不能为空");
|
return msg;
|
}else {
|
userInfo.setCity(city);
|
}
|
String county = jsonObject.getString("county");
|
if (executiveLevel == 3 && (StringUtils.isBlank(city) || StringUtils.isBlank(county))){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("区/县不能为空");
|
return msg;
|
}else {
|
userInfo.setCounty(county);
|
}
|
if(userInfoCurrent.getType().equals(3) || userInfoCurrent.getType().equals(4)){
|
msg.setCode(ErrorCode.ERROR_70001.getCode());
|
msg.setMessage("专家或企业用户无权限新增监管用户信息");
|
return msg;
|
}
|
//管理员(监管)
|
if(userInfoCurrent.getType().equals(2)){
|
//判断当前用户是否有权限新增其管辖下监管机构用户
|
Integer currentUserExLevl = userInfoCurrent.getExecutiveLevel();
|
if(currentUserExLevl < executiveLevel){
|
if(currentUserExLevl == 1){
|
if(!userInfoCurrent.getProvince().equals(province)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("无权新增非自己管辖地区");
|
return msg;
|
}
|
}
|
if(currentUserExLevl == 2){
|
if(!userInfoCurrent.getProvince().equals(province) || !userInfoCurrent.getCity().equals(city)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("无权新增非自己管辖地区");
|
return msg;
|
}
|
}
|
if(currentUserExLevl == 3){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("当前用户是区县级,无法再新增下一级监管部门");
|
return msg;
|
}
|
}else {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("当前用户是无权限新增同级、上一级监管部门");
|
return msg;
|
}
|
}
|
|
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(null,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
String companyName = province + (StringUtils.isBlank(city) ? "" : city) + (StringUtils.isBlank(county) ? "" : county) + "应急管理局";
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setProvince(province);
|
userInfo.setExecutiveLevel(executiveLevel);
|
userInfo.setCompany(companyName);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setStatus((byte)1);
|
userInfo.setType(2);
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.save(userInfo);
|
UserInfo user = userService.selectByUser(userInfo.getUsername());
|
//默认配置企业用户角色
|
UserRolesInfo userRolesInfo = new UserRolesInfo();
|
userRolesInfo.setRoleid(38l);
|
userRolesInfo.setUserid(user.getId());
|
userRolesService.save(userRolesInfo);
|
return msg;
|
}
|
|
/**
|
* 监管用户-修改
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/put/supervise/user")
|
@ApiOperation(value = "修改监管用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "用户id",required = true),
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码"),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "executiveLevel",value = "行政级别"),
|
@ApiImplicitParam(name = "province",value = "省(自治区)"),
|
@ApiImplicitParam(name = "city",value = "地(市、州)"),
|
@ApiImplicitParam(name = "county",value = "区/县"),
|
})
|
public Msg putSuperviseUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
UserInfo userInfoCurrent = userService.selectByUser(getUser().getUsername());
|
Integer executiveLevel = jsonObject.getInteger("executiveLevel");
|
if (executiveLevel == null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("行政级别不能为空");
|
return msg;
|
}
|
String province = jsonObject.getString("province");
|
if (StringUtils.isBlank(province)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("省(自治区)不能为空");
|
return msg;
|
}
|
String city = jsonObject.getString("city");
|
if (executiveLevel == 2 && StringUtils.isBlank(city)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("地(市、州)不能为空");
|
return msg;
|
}
|
String county = jsonObject.getString("county");
|
if (executiveLevel == 3 && (StringUtils.isBlank(city) || StringUtils.isBlank(county))){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("区/县不能为空");
|
return msg;
|
}else {
|
userInfo.setCounty(county);
|
}
|
Long id = jsonObject.getLong("id");
|
if(id == null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户主键id不能为空");
|
return msg;
|
}
|
userInfo.setId(id);
|
|
if(userInfoCurrent.getType().equals(3) || userInfoCurrent.getType().equals(4)){
|
msg.setCode(ErrorCode.ERROR_70001.getCode());
|
msg.setMessage("专家或企业用户无权限新增监管用户信息");
|
return msg;
|
}
|
//监管用户 、自己要验证
|
if(userInfoCurrent.getType().equals(2) && (!id .equals(userInfoCurrent.getId()))){
|
//判断当前用户是否有权限新增其管辖下监管机构用户
|
Integer currentUserExLevl = userInfoCurrent.getExecutiveLevel();
|
if(currentUserExLevl < executiveLevel){
|
if(currentUserExLevl == 1){
|
if(!userInfoCurrent.getProvince().equals(province)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("无权新增非自己管辖地区");
|
return msg;
|
}
|
}
|
if(currentUserExLevl == 2){
|
if(!userInfoCurrent.getProvince().equals(province) || !userInfoCurrent.getCity().equals(city)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("无权新增非自己管辖地区");
|
return msg;
|
}
|
}
|
if(currentUserExLevl == 3){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("当前用户是区县级,无权修改监管部门");
|
return msg;
|
}
|
}else {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("当前用户是无权限修改同级、上一级监管部门");
|
return msg;
|
}
|
}
|
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
|
if (StringUtils.isNotBlank(password)){
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
}
|
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(userInfo.getId(),idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
|
//自己无法修改行政级别
|
if (userInfoCurrent.getId().equals(id) && !userInfoCurrent.getExecutiveLevel().equals(executiveLevel)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("自己无法修改行政级别");
|
return msg;
|
}else{
|
userInfo.setExecutiveLevel(executiveLevel);
|
}
|
|
String companyName = province + (StringUtils.isBlank(city) ? "" : city) + (StringUtils.isBlank(county) ? "" : county) + "应急管理局";
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setProvince(province);
|
userInfo.setCity(StringUtils.isBlank(city) ? "" :city);
|
userInfo.setCounty(StringUtils.isBlank(county) ? "" :county);
|
userInfo.setCompany(companyName);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setRealname(realname);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
userService.updateById(userInfo);
|
return msg;
|
|
}
|
|
|
|
|
@PostMapping("/importUser")
|
@ApiOperation(value = "导入用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "file",value = "文件",required = true),
|
})
|
@ResponseBody
|
public Msg importUser(MultipartFile file){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
String filesave ="";
|
try {
|
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddHHmmssSSS" );
|
if (file == null)
|
{
|
msg.setCode("404");
|
msg.setMessage("未找到上传文件");
|
return msg;
|
}
|
|
long size = file.getSize();
|
if(0 == size)
|
{
|
msg.setCode("404");
|
msg.setMessage("上传文件大小为空");
|
return msg;
|
}
|
|
if (!FileOptUtils.isDirExists(filePath)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("发生错误或不为目录");
|
return msg;
|
}
|
|
filesave = filePath + getUser().getRealname() + "_" + sdf.format(new Date()) + ".xlsx";
|
|
file.transferTo(new File(filesave));
|
InputStream in = new FileInputStream(filesave);
|
String name = file.getOriginalFilename();
|
Boolean isExcel2007 = name.substring(name.lastIndexOf(".") + 1).endsWith("xlsx") ? true : false;
|
excelExportService.importUserExcel(in, getUser().getRealname(), isExcel2007);
|
|
} catch (BusinessException e) {
|
e.printStackTrace();
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage(e.getMessage());
|
} catch (Exception e) {
|
e.printStackTrace();
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("导入发生错误");
|
}
|
|
return msg;
|
}
|
|
@PostMapping("/importSupplierUser")
|
@ApiOperation(value = "导入供应商用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "file",value = "文件",required = true),
|
})
|
@ResponseBody
|
public Msg importSupplierUser(MultipartFile file){
|
UserInfo userInfo = userService.selectByUser(getUser().getUsername());
|
String filesave ="";
|
try {
|
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddHHmmssSSS" );
|
if (file == null)
|
{
|
return new Msg(ErrorCode.ERROR_10001,"未找到上传文件");
|
}
|
|
long size = file.getSize();
|
if(0 == size)
|
{
|
return new Msg(ErrorCode.ERROR_10004,"上传文件大小为空");
|
}
|
|
if(!FileOptUtils.isDirExists(filePath)){
|
return new Msg(ErrorCode.ERROR_40001,"发生错误或不为目录");
|
}
|
|
filesave = filePath + getUser().getRealname() + "_" + sdf.format(new Date()) +".xlsx";
|
|
file.transferTo(new File(filesave));
|
InputStream in = new FileInputStream(filesave);
|
String name = file.getOriginalFilename();
|
Boolean isExcel2007 = name.substring(name.lastIndexOf(".") + 1).endsWith("xlsx")? true:false;
|
BooleanReason blret = excelExportService.importSupplierUserExcel(in,userInfo.getRealname(),userInfo.getCompany(),isExcel2007);
|
if(blret.getValue().equals(false))
|
{
|
return new Msg(ErrorCode.ERROR_10004,blret.getResultmsg());
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_10004,"导入发生错误");
|
}
|
|
return success();
|
}
|
|
@PostMapping("/putuser")
|
@ApiOperation(value = "修改用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "用户id",required = true),
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "type",value = "用户类型",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "iscompany",value = "是否单位负责人"),
|
@ApiImplicitParam(name = "isdepartment",value = "是否部门负责人"),
|
@ApiImplicitParam(name = "status",value = "状态"),
|
})
|
public Msg putUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
userInfo.setId(jsonObject.getLong("id"));
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
|
if (StringUtils.isNotBlank(password)){
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
}
|
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
try {
|
userInfo.setType(jsonObject.getInteger("type"));
|
}catch (Exception e) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户类型必须为数字");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(userInfo.getId(),idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
|
Long companyid = jsonObject.getLong("companyid");
|
if (companyid == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位参数为空");
|
return msg;
|
}
|
CompanyInfo companyInfo = companyService.getById(companyid);
|
if (companyInfo == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位不存在");
|
return msg;
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(companyInfo.getCompany());
|
userInfo.setCompanyid(companyInfo.getId());
|
userInfo.setDepartment(jsonObject.getLong("department"));
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setIscompany(jsonObject.getByte("iscompany"));
|
userInfo.setIsdepartment(jsonObject.getByte("isdepartment"));
|
userInfo.setIssecurityofficer(jsonObject.getByte("issecurityofficer"));
|
userInfo.setStatus(jsonObject.getByte("status"));
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setRealname(realname);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
|
userService.updateById(userInfo);
|
return msg;
|
|
}
|
|
@PostMapping("/userroles")
|
@ApiOperation(value = "修改用户角色",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "用户id",required = true),
|
@ApiImplicitParam(name = "roles",value = "用户名",required = true),
|
|
})
|
public Msg updateUserRole(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
Long userid = jsonObject.getLong("id");
|
String roles = jsonObject.getString("roles");
|
if (StringUtils.isNotBlank(roles)){
|
userRolesInfoService.deleteByUserId(userid);
|
roles = roles.replace("[","").replace("]","");
|
List<String> list = StringUtils.toList(roles);
|
for (String role : list){
|
UserRolesInfo userRolesInfo = new UserRolesInfo();
|
userRolesInfo.setUserid(userid);
|
userRolesInfo.setRoleid(Long.parseLong(role.trim()));
|
userRolesInfoService.save(userRolesInfo);
|
}
|
}
|
return msg;
|
|
}
|
|
@PostMapping("/deluser")
|
@ApiOperation(value = "删除用户数据", notes = "删除用户数据", response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType="query",name = "id",value = "id",required = true),
|
@ApiImplicitParam(paramType="body",name = "lastmodifiedby",value = "更新人"),
|
|
})
|
public Msg delUserInfo(@ApiParam(value = "id")
|
@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
userInfo.setId(jsonObject.getLong("id"));
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setStatus((byte)0);
|
userService.updateById(userInfo);
|
String cardId = userInfo.getCardId();
|
if (StringUtils.isNotBlank(cardId)){
|
try {
|
String isValid = "1";
|
Msg msg1 = userService.setCardValid(isValid,cardId);
|
if (!msg1.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg1;
|
}
|
Msg msg2 = userService.delEmployee(cardId);
|
if (!msg2.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg2;
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
userInfo.setDeviceNo("");
|
userInfo.setEmpNo("");
|
userInfo.setCardId("");
|
}
|
|
return msg;
|
}
|
|
@PostMapping("/importDistrict")
|
@ApiOperation(value = "导入省市数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "file",value = "文件",required = true),
|
@ApiImplicitParam(name = "operator",value = "操作人",required = true),
|
})
|
@ResponseBody
|
public Msg importDistrict(String operator,MultipartFile file){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
String filesave ="";
|
try {
|
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddHHmmssSSS" );
|
if (file == null)
|
{
|
msg.setCode("404");
|
msg.setMessage("未找到上传文件");
|
return msg;
|
}
|
|
long size = file.getSize();
|
if(0 == size)
|
{
|
msg.setCode("404");
|
msg.setMessage("上传文件大小为空");
|
return msg;
|
}
|
|
if(!FileOptUtils.isDirExists(filePath)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("发生错误或不为目录");
|
return msg;
|
}
|
|
filesave = filePath + operator + "_" + sdf.format(new Date()) +".xlsx";
|
|
file.transferTo(new File(filesave));
|
InputStream in = new FileInputStream(filesave);
|
String name = file.getOriginalFilename();
|
Boolean isExcel2007 = name.substring(name.lastIndexOf(".") + 1).endsWith("xlsx")? true:false;
|
BooleanReason blret = excelExportService.importDistrictExcel(in,operator,isExcel2007);
|
if(blret.getValue().equals(false))
|
{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage(blret.getResultmsg());
|
return msg;
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("导入发生错误");
|
return msg;
|
}
|
|
return msg;
|
}
|
|
@GetMapping("/district")
|
@ApiOperation(value = "获取省市区数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "type",value = "类型"),
|
@ApiImplicitParam(name = "parentname",value = "上级名称"),
|
@ApiImplicitParam(name = "parenttype",value = "上级类型"),
|
})
|
public Msg getdistrictInfo(String type,String parentname,String parenttype){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
List<DistrictInfo> districtInfoList = new ArrayList<> ();
|
if (parenttype.equals("0")){
|
districtInfoList = districtService.selectDistrictInfo(type, parenttype);
|
}else {
|
districtInfoList = districtService.selectDistrictByName(type,parentname,parenttype);
|
}
|
msg.setResult(districtInfoList);
|
return msg;
|
}
|
|
@GetMapping("/districtByName")
|
@ApiOperation(value = "获取省市区数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
})
|
public Msg getDistrictByName(String province,String city,String area,String town,String community){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
if (StringUtils.isBlank(province)){
|
List<DistrictInfo> provinceList = districtService.selectDistrictInfo("1", "0");
|
Map<String,Object> map = new HashMap<> ();
|
map.put("provinceList",provinceList);
|
msg.setResult(map);
|
}else if (StringUtils.isBlank(city)){
|
List<DistrictInfo> provinceList = districtService.selectDistrictInfo("1", "0");
|
DistrictInfo provinceInfo = districtService.selectInfoByName(province,(byte)1);
|
List<DistrictInfo> cityList = districtService.selectDistrictInfo("2", provinceInfo.getCode());
|
Map<String,Object> map = new HashMap<> ();
|
map.put("provinceList",provinceList);
|
map.put("cityList",cityList);
|
msg.setResult(map);
|
}else if (StringUtils.isBlank(area)){
|
List<DistrictInfo> provinceList = districtService.selectDistrictInfo("1", "0");
|
DistrictInfo provinceInfo = districtService.selectInfoByName(province,(byte)1);
|
List<DistrictInfo> cityList = districtService.selectDistrictInfo("2", provinceInfo.getCode());
|
DistrictInfo cityInfo = districtService.selectInfoByName(city,(byte)2);
|
List<DistrictInfo> areaList = districtService.selectDistrictInfo("3", cityInfo.getCode());
|
Map<String,Object> map = new HashMap<> ();
|
map.put("provinceList",provinceList);
|
map.put("cityList",cityList);
|
map.put("areaList",areaList);
|
msg.setResult(map);
|
}else if (StringUtils.isBlank(town)){
|
List<DistrictInfo> provinceList = districtService.selectDistrictInfo("1", "0");
|
DistrictInfo provinceInfo = districtService.selectInfoByName(province,(byte)1);
|
List<DistrictInfo> cityList = districtService.selectDistrictInfo("2", provinceInfo.getCode());
|
DistrictInfo cityInfo = districtService.selectInfoByName(city,(byte)2);
|
List<DistrictInfo> areaList = districtService.selectDistrictInfo("3", cityInfo.getCode());
|
DistrictInfo areaInfo = districtService.selectInfoByName(area,(byte)3);
|
List<DistrictInfo> townList = districtService.selectDistrictInfo("4", areaInfo.getCode());
|
|
Map<String,Object> map = new HashMap<> ();
|
map.put("provinceList",provinceList);
|
map.put("cityList",cityList);
|
map.put("areaList",areaList);
|
map.put("townList",townList);
|
msg.setResult(map);
|
}else{
|
List<DistrictInfo> provinceList = districtService.selectDistrictInfo("1", "0");
|
DistrictInfo provinceInfo = districtService.selectInfoByName(province,(byte)1);
|
List<DistrictInfo> cityList = districtService.selectDistrictInfo("2", provinceInfo.getCode());
|
DistrictInfo cityInfo = districtService.selectInfoByName(city,(byte)2);
|
List<DistrictInfo> areaList = districtService.selectDistrictInfo("3", cityInfo.getCode());
|
DistrictInfo areaInfo = districtService.selectInfoByName(area,(byte)3);
|
List<DistrictInfo> townList = districtService.selectDistrictInfo("4", areaInfo.getCode());
|
DistrictInfo townInfo = districtService.selectInfoByName(town,(byte)4);
|
List<DistrictInfo> communityList = districtService.selectDistrictInfo("5", townInfo.getCode());
|
|
Map<String,Object> map = new HashMap<> ();
|
map.put("provinceList",provinceList);
|
map.put("cityList",cityList);
|
map.put("areaList",areaList);
|
map.put("townList",townList);
|
map.put("communityList",communityList);
|
msg.setResult(map);
|
}
|
return msg;
|
}
|
|
@GetMapping("/company")
|
@ApiOperation(value = "获取单位数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "code",value = "单位代码"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
@ApiImplicitParam(name = "isMain",value = "是否是主体"),
|
})
|
public Msg getCompanyInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String code,String company,String province,String city,String area,String town,String community,@RequestParam(defaultValue = "true") Boolean isMain){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(code)) {
|
condition.put("code", code.trim());
|
}
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
if(getUser().getType() == 3){
|
condition.put("companyid", getUser().getCompanyid());
|
}
|
if(getUser().getType() == 2){
|
condition.put("province", getUser().getProvince());
|
condition.put("city", getUser().getCity());
|
condition.put("area", getUser().getCounty());
|
}
|
/*if (StringUtils.isNotBlank(province)) {
|
condition.put("province", province.trim());
|
}
|
|
if (StringUtils.isNotBlank(city)) {
|
condition.put("city", city.trim());
|
}
|
|
if (StringUtils.isNotBlank(area)) {
|
condition.put("area", area.trim());
|
}
|
|
if (StringUtils.isNotBlank(town)) {
|
condition.put("town", town.trim());
|
}
|
|
if (StringUtils.isNotBlank(community)) {
|
condition.put("community", community.trim());
|
}*/
|
/*UserInfo userInfo = userService.selectByUser(getUser().getUsername());
|
if (!companyService.isMain(userInfo.getCompany())){
|
condition.put("company",userInfo.getCompany());
|
}*/
|
//是系统菜单下的就显示主体,否则非主体
|
// if (isMain) {
|
// condition.put("isMain", 1);
|
// } else {
|
// condition.put("isMain", 0);
|
// }
|
pageInfo.setCondition(condition);
|
companyService.selectDataGrid(pageInfo);
|
if(getUser().getType() ==4 ){
|
pageInfo.setResult(new ArrayList());
|
}
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
|
@GetMapping("/companyList")
|
@ApiOperation(value = "获取所有单位",response = Msg.class)
|
public Msg getCompanyList(){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
List<CompanyInfo> companyList = companyService.selectByAll();
|
msg.setResult(companyList);
|
return msg;
|
}
|
|
/**
|
* 企业-新增
|
* @param jsonObject
|
* @return
|
*/
|
|
@PostMapping("/addCompany")
|
@ApiOperation(value = "添加企业信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "code",value = "单位代码"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "contactname",value = "联系人"),
|
@ApiImplicitParam(name = "contactphone",value = "联系电话"),
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
})
|
public Msg addCompanyInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
CompanyInfo companyInfo = new CompanyInfo();
|
companyInfo.setCode(jsonObject.getString("code"));
|
companyInfo.setCompany(jsonObject.getString("company"));
|
companyInfo.setContactname(jsonObject.getString("contactname"));
|
companyInfo.setContactphone(jsonObject.getString("contactphone"));
|
companyInfo.setProvince(jsonObject.getString("province"));
|
companyInfo.setCity(jsonObject.getString("city"));
|
companyInfo.setArea(jsonObject.getString("area"));
|
companyInfo.setTown(jsonObject.getString("town"));
|
companyInfo.setCommunity(jsonObject.getString("community"));
|
companyInfo.setCreatedby(getUser().getRealname());
|
companyInfo.setCreateddate(new Date());
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyInfo.setIsdel((byte)0);
|
|
CompanyInfo companyInfoExist = companyService.selectExistByName(null,companyInfo.getCompany());
|
if (null != companyInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位名称重复");
|
return msg;
|
}else {
|
companyService.save(companyInfo);
|
}
|
return msg;
|
}
|
|
/**
|
* 企业-修改
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/putCompany")
|
@ApiOperation(value = "修改企业信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "单位主键"),
|
@ApiImplicitParam(name = "code",value = "单位代码"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "contactname",value = "联系人"),
|
@ApiImplicitParam(name = "contactphone",value = "联系电话"),
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
})
|
public Msg putCompanyInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
CompanyInfo companyInfo = new CompanyInfo();
|
companyInfo.setId(jsonObject.getLong("id"));
|
companyInfo.setCode(jsonObject.getString("code"));
|
companyInfo.setCompany(jsonObject.getString("company"));
|
companyInfo.setContactname(jsonObject.getString("contactname"));
|
companyInfo.setContactphone(jsonObject.getString("contactphone"));
|
companyInfo.setProvince(jsonObject.getString("province"));
|
companyInfo.setCity(jsonObject.getString("city"));
|
companyInfo.setArea(jsonObject.getString("area"));
|
companyInfo.setTown(jsonObject.getString("town"));
|
companyInfo.setCommunity(jsonObject.getString("community"));
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyInfo.setIsdel((byte)0);
|
|
CompanyInfo companyInfoExist = companyService.selectExistByName(companyInfo.getId(),companyInfo.getCompany());
|
if (null != companyInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位名称重复");
|
return msg;
|
}else {
|
companyService.updateById(companyInfo);
|
}
|
return msg;
|
}
|
|
/*@PostMapping("/addCompany")
|
@ApiOperation(value = "添加单位信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "code",value = "单位代码"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "contactname",value = "联系人"),
|
@ApiImplicitParam(name = "contactphone",value = "联系电话"),
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
})
|
public Msg addCompanyInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
CompanyInfo companyInfo = new CompanyInfo();
|
companyInfo.setCode(jsonObject.getString("code"));
|
companyInfo.setCompany(jsonObject.getString("company"));
|
companyInfo.setContactname(jsonObject.getString("contactname"));
|
companyInfo.setContactphone(jsonObject.getString("contactphone"));
|
companyInfo.setIsmain(jsonObject.getByte("ismain"));
|
companyInfo.setProvince(jsonObject.getString("province"));
|
companyInfo.setCity(jsonObject.getString("city"));
|
companyInfo.setArea(jsonObject.getString("area"));
|
companyInfo.setTown(jsonObject.getString("town"));
|
companyInfo.setCommunity(jsonObject.getString("community"));
|
companyInfo.setCreatedby(getUser().getRealname());
|
companyInfo.setCreateddate(new Date());
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyInfo.setIsdel((byte)0);
|
if(StringUtils.isNotBlank(companyInfo.getCode())){
|
if (companyInfo.getCode().length() > 6){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位代码不能超过6位");
|
return msg;
|
}else {
|
companyInfo.setCode(companyInfo.getCode().toUpperCase());
|
}
|
}
|
if (companyInfo.getIsmain() == 1){
|
CompanyInfo companyMain = companyService.selectExistMain(null);
|
if (companyMain != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在主体单位");
|
return msg;
|
}
|
}
|
CompanyInfo companyInfoExist = companyService.selectExistByName(null,companyInfo.getCompany());
|
if (null != companyInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位名称重复");
|
return msg;
|
}else {
|
companyService.save(companyInfo);
|
}
|
return msg;
|
}
|
|
@PostMapping("/putCompany")
|
@ApiOperation(value = "修改单位信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "code",value = "单位代码"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "contactname",value = "联系人"),
|
@ApiImplicitParam(name = "contactphone",value = "联系电话"),
|
@ApiImplicitParam(name = "province",value = "省份"),
|
@ApiImplicitParam(name = "city",value = "城市"),
|
@ApiImplicitParam(name = "area",value = "区县"),
|
@ApiImplicitParam(name = "town",value = "街道"),
|
@ApiImplicitParam(name = "community",value = "社区"),
|
})
|
public Msg putCompanyInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
CompanyInfo companyInfo = new CompanyInfo();
|
companyInfo.setId(jsonObject.getLong("id"));
|
companyInfo.setCode(jsonObject.getString("code"));
|
companyInfo.setCompany(jsonObject.getString("company"));
|
companyInfo.setContactname(jsonObject.getString("contactname"));
|
companyInfo.setContactphone(jsonObject.getString("contactphone"));
|
companyInfo.setIsmain(jsonObject.getByte("ismain"));
|
companyInfo.setProvince(jsonObject.getString("province"));
|
companyInfo.setCity(jsonObject.getString("city"));
|
companyInfo.setArea(jsonObject.getString("area"));
|
companyInfo.setTown(jsonObject.getString("town"));
|
companyInfo.setCommunity(jsonObject.getString("community"));
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyInfo.setIsdel((byte)0);
|
if(StringUtils.isNotBlank(companyInfo.getCode())){
|
if (companyInfo.getCode().length() > 6){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位代码不能超过6位");
|
return msg;
|
}else {
|
companyInfo.setCode(companyInfo.getCode().toUpperCase());
|
}
|
}
|
if (companyInfo.getIsmain() == 1){
|
CompanyInfo companyMain = companyService.selectExistMain(companyInfo.getId());
|
if (companyMain != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在主体单位");
|
return msg;
|
}
|
}
|
CompanyInfo companyInfoExist = companyService.selectExistByName(companyInfo.getId(),companyInfo.getCompany());
|
if (null != companyInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("单位名称重复");
|
return msg;
|
}else {
|
companyService.updateById(companyInfo);
|
}
|
return msg;
|
}
|
*/
|
|
@PostMapping("/delCompany")
|
@ApiOperation(value = "删除单位信息", notes = "删除单位信息", response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType="query",name = "id",value = "id",required = true)
|
})
|
public Msg delCompanyInfo(@ApiParam(value = "id")
|
@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
CompanyInfo companyInfo = new CompanyInfo();
|
companyInfo.setId(jsonObject.getLong("id"));
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyInfo.setIsdel((byte)1);
|
companyService.updateById(companyInfo);
|
return msg;
|
}
|
|
@GetMapping("/department")
|
@ApiOperation(value = "获取部门信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "department",value = "部门")
|
})
|
public Msg getDepartmentInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String department){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(department)) {
|
condition.put("department", department.trim());
|
}
|
|
pageInfo.setCondition(condition);
|
departmentService.selectDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
|
@GetMapping("/departmentList")
|
@ApiOperation(value = "获取所有部门",response = Msg.class)
|
public Msg getDepartmentList(){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
List<DepartmentVo> departmentVoList = departmentService.selectByAll();
|
msg.setResult(departmentVoList);
|
return msg;
|
}
|
|
@PostMapping("/addDepartment")
|
@ApiOperation(value = "添加部门信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "department",value = "部门"),
|
@ApiImplicitParam(name = "issafety",value = "是否为安全部门 1或0"),
|
@ApiImplicitParam(name = "isinvolve",value = "是否为涉及部门 1或0"),
|
@ApiImplicitParam(name = "isanalysis",value = "是否为检测中心 1或0"),
|
})
|
public Msg addDepartmentInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
DepartmentInfo departmentInfo = new DepartmentInfo();
|
departmentInfo.setDepartment(jsonObject.getString("department"));
|
departmentInfo.setCreatedby(getUser().getRealname());
|
departmentInfo.setCreateddate(new Date());
|
departmentInfo.setLastmodifiedby(getUser().getRealname());
|
departmentInfo.setLastmodifieddate(new Date());
|
departmentInfo.setIsdel((byte)0);
|
|
Byte issafety = jsonObject.getByte("issafety");
|
if (issafety == 1){
|
DepartmentInfo department = departmentService.selectSafety(null);
|
if (department != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在安全管理部门");
|
return msg;
|
}
|
}
|
departmentInfo.setIssafety(issafety);
|
|
Byte isanalysis = jsonObject.getByte("isanalysis");
|
if (isanalysis == 1){
|
DepartmentInfo department = departmentService.selectAnalysis(null);
|
if (department != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在检测中心");
|
return msg;
|
}
|
}
|
departmentInfo.setIsanalysis(isanalysis);
|
|
DepartmentInfo departmentInfoExist = departmentService.selectExistByName(null,departmentInfo.getDepartment());
|
if (null != departmentInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("部门名称重复");
|
return msg;
|
}else {
|
departmentService.save(departmentInfo);
|
}
|
|
Byte isinvole = jsonObject.getByte("isinvolve");
|
if (isinvole != null && isinvole == 1){
|
InvolveDepInfo involveDepInfo = new InvolveDepInfo();
|
involveDepInfo.setDepartment(departmentInfo.getDepartment());
|
involveDepInfo.setLastmodifiedby(getUser().getRealname());
|
involveDepInfo.setLastmodifieddate(new Date());
|
involveDepService.save(involveDepInfo);
|
}
|
|
return msg;
|
}
|
|
@PostMapping("/putDepartment")
|
@ApiOperation(value = "修改部门信息",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "id"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
@ApiImplicitParam(name = "issafety",value = "是否为安全部门 1或0"),
|
@ApiImplicitParam(name = "isinvolve",value = "是否为涉及部门 1或0"),
|
})
|
public Msg putDepartmentInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
DepartmentInfo departmentInfo = departmentService.getById(jsonObject.getLong("id"));
|
departmentInfo.setDepartment(jsonObject.getString("department"));
|
departmentInfo.setIssafety(jsonObject.getByte("issafety"));
|
departmentInfo.setLastmodifiedby(getUser().getRealname());
|
departmentInfo.setLastmodifieddate(new Date());
|
|
Byte issafety = jsonObject.getByte("issafety");
|
if (issafety == 1){
|
DepartmentInfo department = departmentService.selectSafety(departmentInfo.getId());
|
if (department != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在安全管理部门");
|
return msg;
|
}
|
}
|
|
Byte isanalysis = jsonObject.getByte("isanalysis");
|
if (isanalysis == 1){
|
DepartmentInfo department = departmentService.selectAnalysis(departmentInfo.getId());
|
if (department != null && department.getId() != null){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("已存在检测中心");
|
return msg;
|
}
|
}
|
departmentInfo.setIsanalysis(isanalysis);
|
|
DepartmentInfo departmentInfoExist = departmentService.selectExistByName(departmentInfo.getId(),departmentInfo.getDepartment());
|
if (null != departmentInfoExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("部门名称重复");
|
return msg;
|
}else {
|
departmentService.updateById(departmentInfo);
|
}
|
|
involveDepService.deleteByName(departmentInfo.getDepartment());
|
Byte isinvole = jsonObject.getByte("isinvolve");
|
if (isinvole != null && isinvole == 1){
|
InvolveDepInfo involveDepInfo = new InvolveDepInfo();
|
involveDepInfo.setDepartment(departmentInfo.getDepartment());
|
involveDepInfo.setLastmodifiedby(getUser().getRealname());
|
involveDepInfo.setLastmodifieddate(new Date());
|
involveDepService.save(involveDepInfo);
|
}
|
return msg;
|
}
|
|
@PostMapping("/delDepartment")
|
@ApiOperation(value = "删除部门信息", notes = "删除部门信息", response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType="query",name = "id",value = "id",required = true)
|
})
|
public Msg delDepartmentInfo(@ApiParam(value = "id")
|
@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
DepartmentInfo departmentInfo = departmentService.getById(jsonObject.getLong("id"));
|
departmentInfo.setLastmodifiedby(getUser().getRealname());
|
departmentInfo.setLastmodifieddate(new Date());
|
departmentInfo.setIsdel((byte)1);
|
departmentService.updateById(departmentInfo);
|
involveDepService.deleteByName(departmentInfo.getDepartment());
|
return msg;
|
}
|
|
|
@GetMapping(value = "/getWorkCert")
|
@ApiOperation(value = "获取作业证书",httpMethod = "GET")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "mobile",value = "手机号",required = true),
|
})
|
public Msg getWorkCert(String mobile){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
if (StringUtils.isBlank(mobile)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号不能为空");
|
return msg;
|
}
|
List<WorkCertInfo> workCertInfos = workCertService.selectByMobile(mobile);
|
msg.setResult(workCertInfos);
|
return msg;
|
}
|
|
@PostMapping(value = "/addWorkCert")
|
@ApiOperation(value = "新增作业证书",httpMethod = "POST")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "realname",value = "姓名",required = true),
|
@ApiImplicitParam(name = "mobile",value = "手机号",required = true),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
@ApiImplicitParam(name = "certname",value = "文件名"),
|
@ApiImplicitParam(name = "starttime",value = "有效开始时间"),
|
@ApiImplicitParam(name = "endtime",value = "有效结束时间"),
|
@ApiImplicitParam(name = "file",value = "上传文件,单个"),
|
})
|
Object addWorkCert(WorkCertVo workCertVo){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
try {
|
WorkCertInfo workCertInfo = BeanUtils.copy(workCertVo,WorkCertInfo.class);
|
if (workCertVo.getFile() != null) {
|
String name = UploadUtil.uploadFile(workCertVo.getFile(), Properties.workCertPath);
|
workCertInfo.setCertpath(workCert+name);
|
}else {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("上传文件不能为空");
|
}
|
workCertInfo.setCreateby(getUser().getRealname());
|
workCertInfo.setCreatetime(new Date());
|
workCertInfo.setIsdel((byte)0);
|
workCertService.save(workCertInfo);
|
} catch (Exception e) {
|
e.printStackTrace();
|
msg.setCode("400");
|
msg.setMessage(e.getMessage());
|
}
|
return msg;
|
}
|
|
@PostMapping(value = "/editWorkCert")
|
@ApiOperation(value = "修改作业证书",httpMethod = "POST")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "id",required = true),
|
@ApiImplicitParam(name = "certname",value = "文件名"),
|
@ApiImplicitParam(name = "starttime",value = "有效开始时间"),
|
@ApiImplicitParam(name = "endtime",value = "有效结束时间"),
|
@ApiImplicitParam(name = "file",value = "上传文件,单个"),
|
})
|
Object editWorkCert(WorkCertVo workCertVo){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
try {
|
WorkCertInfo workCertInfo = workCertService.getById(workCertVo.getId());
|
if (workCertVo.getFile() != null) {
|
String name = UploadUtil.uploadFile(workCertVo.getFile(), Properties.workCertPath);
|
workCertInfo.setCertpath(workCert+name);
|
}
|
workCertInfo.setStarttime(workCertVo.getStarttime());
|
workCertInfo.setEndtime(workCertVo.getEndtime());
|
workCertInfo.setCreateby(getUser().getRealname());
|
workCertInfo.setCreatetime(new Date());
|
workCertService.updateById(workCertInfo);
|
} catch (Exception e) {
|
e.printStackTrace();
|
msg.setCode("400");
|
msg.setMessage(e.getMessage());
|
}
|
return msg;
|
}
|
|
@PostMapping(value = "/delWorkCert")
|
@ApiOperation(value = "删除作业证书",httpMethod = "POST")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "id",required = true),
|
})
|
public Msg delWorkCert(@RequestBody WorkCertVo workCertVo){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
try {
|
WorkCertInfo workCertInfo = workCertService.getById(workCertVo.getId());
|
workCertInfo.setCreateby(getUser().getRealname());
|
workCertInfo.setCreatetime(new Date());
|
workCertInfo.setIsdel((byte)1);
|
workCertService.updateById(workCertInfo);
|
} catch (Exception e) {
|
e.printStackTrace();
|
msg.setCode("400");
|
msg.setMessage(e.getMessage());
|
}
|
return msg;
|
}
|
|
@GetMapping("/blackList")
|
@ApiOperation(value = "获取黑名单详情",httpMethod = "POST")
|
public Msg getBlackList(@RequestParam(defaultValue = "0") Integer pageIndex,
|
@RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String company){
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<>();
|
|
if (StringUtils.isNotBlank(company)) {
|
condition.put("company", company.trim());
|
}
|
|
pageInfo.setCondition(condition);
|
blackListService.selectDataGrid(pageInfo);
|
return success(pageInfo);
|
}
|
|
@PostMapping("/banCompany")
|
@ApiOperation(value = "添加黑名单",httpMethod = "POST")
|
public Msg banCompanyByName(@RequestBody JSONObject object){
|
String company = object.getString("company");
|
if (StringUtils.isBlank(company)){
|
return new Msg(ErrorCode.ERROR_10001);
|
}
|
BlackListInfo blackListInfoExist = blackListService.getBlackListByName(company);
|
if (blackListInfoExist != null){return new Msg(ErrorCode.ERROR_50003,"指定公司已存在黑名单");}
|
|
CompanyInfo companyInfo = companyService.selectByName(company);
|
if (companyInfo != null){
|
List<UserInfo> userInfos = userService.selectByCompany(company);
|
userInfos.forEach(item -> {
|
item.setStatus((byte)0);
|
item.setLastmodifiedby(getUser().getRealname());
|
item.setLastmodifieddate(new Date());
|
});
|
userService.updateBatchById(userInfos);
|
|
companyInfo.setIsbanned((byte)1);
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyService.updateById(companyInfo);
|
}
|
BlackListInfo blackListInfo = new BlackListInfo();
|
blackListInfo.setCompany(company);
|
blackListInfo.setCreatedat(new Date());
|
blackListInfo.setCreatedby(getUser().getRealname());
|
blackListService.save(blackListInfo);
|
return success();
|
}
|
|
@PostMapping("/cancelBan")
|
@ApiOperation(value = "添加黑名单",httpMethod = "POST")
|
public Msg cancelBanCompanyByName(@RequestBody JSONObject object){
|
String company = object.getString("company");
|
if (StringUtils.isBlank(company)){
|
return new Msg(ErrorCode.ERROR_10001);
|
}
|
BlackListInfo blackListInfoExist = blackListService.getBlackListByName(company);
|
if (blackListInfoExist == null){return new Msg(ErrorCode.ERROR_50003,"指定公司不存在黑名单");}
|
|
CompanyInfo companyInfo = companyService.selectByName(company);
|
if (companyInfo != null){
|
List<UserInfo> userInfos = userService.selectByCompany(company);
|
userInfos.forEach(item -> {
|
item.setStatus((byte)1);
|
item.setLastmodifiedby(getUser().getRealname());
|
item.setLastmodifieddate(new Date());
|
});
|
userService.updateBatchById(userInfos);
|
|
companyInfo.setIsbanned((byte)0);
|
companyInfo.setLastmodifiedby(getUser().getRealname());
|
companyInfo.setLastmodifieddate(new Date());
|
companyService.updateById(companyInfo);
|
}
|
blackListService.removeById(blackListInfoExist);
|
return success();
|
}
|
|
@PostMapping("/bindCard")
|
@ApiOperation(value = "绑定人员卡",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "empNo",value = "人员卡编号"),
|
@ApiImplicitParam(name = "deviceNo",value = "人员卡MC地址"),
|
})
|
public Msg test(@RequestBody JSONObject jsonObject){
|
String empNo = jsonObject.getString("empNo");
|
String deviceNo = jsonObject.getString("deviceNo");
|
String username = jsonObject.getString("username");
|
|
UserInfo userInfo = userService.selectByUser(username);
|
|
if (userInfo == null || StringUtils.isBlank(userInfo.getRealname())){
|
return new Msg(ErrorCode.ERROR_20001);
|
}
|
String realname = userInfo.getRealname();
|
// String realname = jsonObject.getString("username");
|
if (StringUtils.isBlank(empNo)
|
|| StringUtils.isBlank(deviceNo)){
|
return new Msg(ErrorCode.ERROR_10002);
|
}
|
|
try {
|
Msg msg = userService.saveEmployee(realname,empNo,deviceNo);
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg;
|
}
|
userInfo.setEmpNo(empNo);
|
userInfo.setDeviceNo(deviceNo);
|
userInfo.setCardId(msg.getResult().toString());
|
userService.updateById(userInfo);
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
|
return success();
|
}
|
|
@PostMapping("/setCardValid")
|
@ApiOperation(value = "设置人员卡无效",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "isValid",value = "有效标记(0.有效,1.无效)"),
|
})
|
public Msg setCardValid(@RequestBody JSONObject jsonObject){
|
String username = jsonObject.getString("username");
|
|
UserInfo userInfo = userService.selectByUser(username);
|
|
if (userInfo == null || StringUtils.isBlank(userInfo.getRealname())){
|
return new Msg(ErrorCode.ERROR_20001);
|
}
|
String isValid = jsonObject.getString("isValid");
|
String cardId = userInfo.getCardId();
|
try {
|
Msg msg = userService.setCardValid(isValid,cardId);
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg;
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
|
return success();
|
}
|
|
@ApiOperation(value = "删除人员卡",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
})
|
@PostMapping("/deleteEmp")
|
public Msg deleteEmp(@RequestBody JSONObject jsonObject){
|
String username = jsonObject.getString("username");
|
|
UserInfo userInfo = userService.selectByUser(username);
|
|
if (userInfo == null || StringUtils.isBlank(userInfo.getRealname())){
|
return new Msg(ErrorCode.ERROR_20001);
|
}
|
String cardId = userInfo.getCardId();
|
try {
|
Msg msg = userService.delEmployee(cardId);
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg;
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
userInfo.setDeviceNo("");
|
userInfo.setEmpNo("");
|
userInfo.setCardId("");
|
userService.updateById(userInfo);
|
|
return success();
|
}
|
|
@PostMapping("/setInvalidDel")
|
@ApiOperation(value = "设置人员卡无效并删除",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
})
|
public Msg setInvalidDel(@RequestBody JSONObject jsonObject){
|
String username = jsonObject.getString("username");
|
|
UserInfo userInfo = userService.selectByUser(username);
|
|
if (userInfo == null || StringUtils.isBlank(userInfo.getRealname())){
|
return new Msg(ErrorCode.ERROR_20001);
|
}
|
String isValid = "1";
|
String cardId = userInfo.getCardId();
|
if (StringUtils.isBlank(cardId)){
|
return new Msg(ErrorCode.ERROR_50001,"当前用户没有绑定人员卡");
|
}
|
try {
|
Msg msg = userService.setCardValid(isValid,cardId);
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg;
|
}
|
Msg msg1 = userService.delEmployee(cardId);
|
if (!msg1.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg1;
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
|
userInfo.setDeviceNo("");
|
userInfo.setEmpNo("");
|
userInfo.setCardId("");
|
userService.updateById(userInfo);
|
return success();
|
}
|
|
@PostMapping("/getRealGps")
|
public Msg getRealGps(@RequestBody JSONObject jsonObject){
|
try {
|
Msg msg = userService.getRealGps();
|
if (!msg.getCode().equals(ErrorCode.SUCCESS.getCode())){
|
return msg;
|
}
|
return success(msg);
|
} catch (Exception e) {
|
e.printStackTrace();
|
return new Msg(ErrorCode.ERROR_60002);
|
}
|
|
}
|
|
@PostMapping("/getGps")
|
@ApiOperation(value = "获取当前所有绑卡用户位置",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名(非必填)"),
|
})
|
public Msg getGps(@RequestBody JSONObject jsonObject){
|
String username = jsonObject.getString("username");
|
List<UserInfo> userInfo = userService.getGps(username);
|
return success(userInfo);
|
}
|
|
|
/**
|
* @Description: 通过用户名能查location表最新一条位置数据
|
* @date 2021/12/27 9:06
|
*/
|
@PostMapping("/location")
|
@ApiOperation(value = "查询人员实时位置接口", response = Msg.class)
|
public Msg getLocation(@RequestBody String username) {
|
UserInfo user = userService.selectByUser(username);
|
if (user == null)
|
throw new BusinessException("用户不存在");
|
DeviceLocation deviceLocation = deviceLocationService.selectByUser(user);
|
return success(deviceLocation);
|
}
|
|
/**
|
* @Description: 通过开始时间、结束时间、用户名查到location表一段坐标lis
|
* @date 2021/12/27 9:35
|
*/
|
@PostMapping("/location-list")
|
@ApiOperation(value = "查询人员轨迹接口")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "starttime",value = "开始时间"),
|
@ApiImplicitParam(name = "endtime",value = "结束时间")
|
})
|
public Msg getLocationList(@RequestBody JSONObject jsonObj) {
|
String username = jsonObj.getString("username");
|
Date starttime = jsonObj.getDate("starttime");
|
Date endtime = jsonObj.getDate("endtime");
|
List<DeviceLocation> locationList = deviceLocationService.selectUserLocations(username, starttime, endtime);
|
return success(locationList);
|
}
|
|
@PostMapping("/department-userList")
|
@ApiOperation("/查找部门下的人员进行分页")
|
public Msg getUserPageInDepartment(@RequestBody FilterObject filterObject){
|
Integer pageIndex = filterObject.getPageIndex();
|
Integer pageSize = filterObject.getPageSize();
|
IPage<UserVo> page = userService.selectUserPageInDepartment(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
|
return success(page);
|
}
|
|
|
/**
|
* @Description: 忘记密码 <=> 修改密码
|
* @date 2022/5/6 15:19
|
*/
|
@PostMapping("/pwd-change")
|
@ApiOperation("修改密码")
|
public Msg pwdChange(@RequestBody JSONObject pwdBody) {
|
String username = pwdBody.getString("username");
|
String password = pwdBody.getString("password");
|
String phone = pwdBody.getString("phone");
|
userService.pwdChange(username, password, phone);
|
return success();
|
}
|
|
/**
|
* @Description: 换取账号
|
*/
|
@PostMapping("/getAccount")
|
@ApiOperation("换取账号")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "department",value = "部门"),
|
})
|
public Msg getAccount(@RequestBody JSONObject accountBody) {
|
String username = accountBody.getString("username");
|
String password = accountBody.getString("department");
|
return success(userService.getAccount(username, password));
|
}
|
/**
|
* 获取专家用户列表
|
*/
|
@GetMapping("/expert/list")
|
@ApiOperation(value = "获取专家用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
})
|
public Msg getExpertUserList(String realname){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
msg.setResult(userService.selectExpertList(realname));
|
return msg;
|
}
|
|
/**
|
* 获取监管辖区内的企业
|
*/
|
@GetMapping("/company/list")
|
@ApiOperation(value = "获取监管辖区企业数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "companyName",value = "企业名称"),
|
})
|
public Msg getCompanyList(String companyName){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
msg.setResult(companyService.selectCompanyList(companyName,getUser()));
|
return msg;
|
}
|
|
|
/**
|
* 安科院用户-新增
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/add/safetyInstitute/user")
|
@ApiOperation(value = "添加安科院用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位名称"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
})
|
public Msg addSafetyInstituteUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(null,idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
String company = jsonObject.getString("company");
|
CompanyInfo companyInfo = companyService.selectByName(company);
|
if (companyInfo != null) {
|
userInfo.setCompanyid(companyInfo.getId());
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(companyInfo.getCompany());
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setStatus((byte)1);
|
userInfo.setType(2);
|
userInfo.setCreatedby(getUser().getRealname());
|
userInfo.setRealname(realname);
|
userInfo.setCreateddate(new Date());
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setIsupload((byte)0);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
|
int userSize = userService.selectUserSize();
|
int sli = (userSize + 1) % sliceSize;
|
userInfo.setSlice(sli + "");
|
if (sli == 0)
|
userInfo.setSlice(sliceSize + "");
|
userService.save(userInfo);
|
UserInfo user = userService.selectByUser(userInfo.getUsername());
|
UserRolesInfo userRolesInfo = new UserRolesInfo();
|
List<RoleInfo> list = roleService.selectPageForRole("安科院", 0, 10000);
|
if(list.isEmpty() || list.size()==0){
|
msg.setCode(ErrorCode.ERROR_50004.getCode());
|
msg.setMessage("安科院角色不存在");
|
}
|
userRolesInfo.setRoleid(list.get(0).getId());
|
userRolesInfo.setUserid(user.getId());
|
userRolesService.save(userRolesInfo);
|
return msg;
|
}
|
|
/**
|
* 安科院用户-修改
|
* @param jsonObject
|
* @return
|
*/
|
@PostMapping("/put/safetyInstitute/user")
|
@ApiOperation(value = "修改安科院用户数据",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "用户id",required = true),
|
@ApiImplicitParam(name = "username",value = "手机号",required = true),
|
@ApiImplicitParam(name = "password",value = "密码",required = true),
|
@ApiImplicitParam(name = "email",value = "邮箱"),
|
@ApiImplicitParam(name = "company",value = "单位"),
|
@ApiImplicitParam(name = "job",value = "职务"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证"),
|
})
|
public Msg putSafetyInstituteUserInfo(@RequestBody JSONObject jsonObject){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
UserInfo userInfo = new UserInfo();
|
Long id = jsonObject.getLong("id");
|
if (id == null) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("主键参数为空");
|
return msg;
|
}else {
|
userInfo.setId(id);
|
}
|
String password = jsonObject.getString("password");
|
String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
|
|
if (StringUtils.isNotBlank(password)){
|
if (!password.matches(PW_PATTERN)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
|
return msg;
|
}else {
|
userInfo.setPassword(MD5Utils.encode(password));
|
}
|
}
|
|
String username = jsonObject.getString("username");
|
if (StringUtils.isNotBlank(username) && username.length() == 11){
|
userInfo.setUsername(username);
|
}else{
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("手机号必须为11位数");
|
return msg;
|
}
|
|
String realname = jsonObject.getString("realname");
|
if (StringUtils.isBlank(realname)){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("姓名不能为空");
|
return msg;
|
}
|
|
String idcard = jsonObject.getString("idcard");
|
if (StringUtils.isNotBlank(idcard)){
|
UserInfo idCardExist = userService.selectByIdCard(userInfo.getId(),idcard);
|
if (null != idCardExist){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证重复");
|
return msg;
|
}else{
|
userInfo.setIdcard(idcard);
|
}
|
if (!IdCardUtil.strongVerifyIdNumber(idcard)) {
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("身份证非法");
|
return msg;
|
}
|
}
|
|
String company = jsonObject.getString("company");
|
CompanyInfo companyInfo = companyService.selectByName(company);
|
if (companyInfo != null) {
|
userInfo.setCompanyid(companyInfo.getId());
|
}
|
|
userInfo.setEmail(jsonObject.getString("email"));
|
userInfo.setCompany(company);
|
userInfo.setJob(jsonObject.getString("job"));
|
userInfo.setLastmodifiedby(getUser().getRealname());
|
userInfo.setLastmodifieddate(new Date());
|
userInfo.setIsdel((byte)0);
|
userInfo.setRealname(realname);
|
List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
|
if (userInfoExist.size() > 0){
|
msg.setCode(ErrorCode.ERROR_10004.getCode());
|
msg.setMessage("用户名重复");
|
return msg;
|
}
|
userService.updateById(userInfo);
|
return msg;
|
|
}
|
|
@GetMapping("/safetyInstitute/user/list")
|
@ApiOperation(value = "获取安科院用户数据-分页",response = Msg.class)
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "sort",value = "排序规则"),
|
@ApiImplicitParam(name = "order",value = "排序字段"),
|
@ApiImplicitParam(name = "username",value = "用户名"),
|
@ApiImplicitParam(name = "realname",value = "姓名"),
|
@ApiImplicitParam(name = "idcard",value = "身份证号"),
|
})
|
public Msg getSafetyInstituteUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
|
String username,String realname, String idcard){
|
Msg msg = new Msg();
|
msg.setCode("200");
|
msg.setMessage("success");
|
|
PageInfo pageInfo = new PageInfo(pageIndex, pageSize,sort,order);
|
HashMap<String, Object> condition = new HashMap<String, Object>();
|
|
if (StringUtils.isNotBlank(username)) {
|
condition.put("username", username.trim());
|
}
|
|
condition.put("company", "安科院");
|
|
|
if (StringUtils.isNotBlank(realname)){
|
condition.put("realname",realname.trim());
|
}
|
|
if (StringUtils.isNotBlank(idcard)){
|
condition.put("idcard",idcard.trim());
|
}
|
|
pageInfo.setCondition(condition);
|
userService.selectUserDataGrid(pageInfo);
|
msg.setResult(pageInfo);
|
return msg;
|
}
|
}
|