This commit is contained in:
pengjie 2023-11-02 08:57:22 +08:00
parent 3b901de067
commit cd5c5352f2
10 changed files with 65 additions and 47 deletions

View File

@ -78,15 +78,17 @@ public class SystemUserAuthController {
public Result<SystemUserAuthDto> login(@ApiIgnore @RequestBody SystemUser systemUser) {
Result<SystemUserAuthDto> result = new Result<SystemUserAuthDto>();
// 检查账户是否已被锁定
if (jwtTokenProvider.checkLock(systemUser.getAccount()) >=5 ) {
result.error500("账号已被锁定,还有" + DateUtil.formatBetween(jwtTokenProvider.getExpire(systemUser.getAccount()) * 1000L) + "解锁");
String account = Aes.decrypt(systemUser.getAccount());
String password = Aes.decrypt(systemUser.getShowPassword());
if (jwtTokenProvider.checkLock(account) >=5 ) {
result.error500("账号已被锁定,还有" + DateUtil.formatBetween(jwtTokenProvider.getExpire(account) * 1000L) + "解锁");
return result;
}
SystemUser user = systemUserService.getOne(Wrappers.<SystemUser>lambdaQuery()
.eq(SystemUser::getAccount, Aes.decrypt(systemUser.getAccount()))
.eq(SystemUser::getShowPassword, Aes.decrypt(systemUser.getShowPassword())));
.eq(SystemUser::getAccount, account)
.eq(SystemUser::getShowPassword, password));
SystemUserAuthDto userInfo = new SystemUserAuthDto();
checkLogin(user, userInfo, result, Aes.decrypt(systemUser.getAccount()));
checkLogin(user, userInfo, result, account);
if (result.getCode() != CommonConstant.SC_INTERNAL_SERVER_ERROR_500) {
String token = jwtTokenProvider.createToken(userInfo.getAccount(), 3600 * 24 * 1000L);
userInfo.setToken(token);
@ -127,7 +129,7 @@ public class SystemUserAuthController {
if (!CommonUtil.checkStrongPwd(password)) {
return Result.error("密码必须包含数字、大小写字母、特殊符号且大于8位");
}
boolean flag = systemUserService.updatePassword(user.getUserId(), Aes.encrypt(password));
boolean flag = systemUserService.updatePassword(user.getUserId(), password);
if (flag) {
return Result.ok();
}

View File

@ -4,10 +4,10 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.wisdom.dto.TeamInfoDto;
import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
import com.zhgd.xmgl.modules.wisdom.service.ITeamInfoService;
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
/**
@ -51,12 +52,12 @@ public class EntTeamInfoController {
@ApiImplicitParams({
@ApiImplicitParam(name = "teamName", value = "班组名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "engineeringSn", value = "工程sn", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "current", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "size", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"),
})
@PostMapping(value = "/page")
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore Page page, @ApiIgnore @RequestBody TeamInfo teamInfo) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(page, teamInfo);
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(PageUtil.getPage(map), map);
return Result.success(pageList);
}

View File

@ -1,11 +1,10 @@
package com.zhgd.xmgl.modules.basicdata.controller.government;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.wisdom.dto.TeamInfoDto;
import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
import com.zhgd.xmgl.modules.wisdom.service.ITeamInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -19,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* @Title: Controller
@ -44,12 +45,12 @@ public class GovTeamInfoController {
@ApiOperation(value = " 分页列表查询班组信息", notes = "分页列表查询班组信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringSn", value = "工程sn ", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "current", value = "页数", paramType = "query", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "size", value = "每页条数", paramType = "query", required = true, defaultValue = "10", dataType = "Integer")
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore Page page, @ApiIgnore @RequestBody TeamInfo teamInfo) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(page, teamInfo);
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(PageUtil.getPage(map), map);
return Result.success(pageList);
}
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
@ -114,17 +115,20 @@ public class CompanyController {
Result<Company> result = new Result<Company>();
Company companyEntity = companyService.getById(company.getId());
if (companyEntity == null) {
result.error500("未找到对应实体");
} else {
SecurityUser user = SecurityUtil.getUser();
company.setProjectSn(user.getSn());
boolean ok = companyService.updateById(company);
if (ok) {
result.success("修改成功!");
companyEntity = companyService.getOne(Wrappers.<Company>lambdaQuery().eq(Company::getCreditCode, company.getCreditCode()));
if (companyEntity == null) {
result.error500("未找到对应实体");
return result;
}
result.success("操作失败!");
company.setId(companyEntity.getId());
}
SecurityUser user = SecurityUtil.getUser();
company.setProjectSn(user.getSn());
boolean ok = companyService.updateById(company);
if (ok) {
result.success("修改成功!");
}
result.success("操作失败!");
return result;
}

View File

@ -4,10 +4,10 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.wisdom.dto.TeamInfoDto;
import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
import com.zhgd.xmgl.modules.wisdom.service.ITeamInfoService;
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
/**
@ -39,7 +40,7 @@ import java.util.List;
@RequestMapping("/project/teamInfo")
@Slf4j
@Api(tags = "班组管理")
public class TeamInfoController {
public class TeamInfoController {
@Autowired
private ITeamInfoService teamInfoService;
@ -53,12 +54,12 @@ public class TeamInfoController {
@ApiImplicitParams({
@ApiImplicitParam(name = "teamName", value = "班组名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "engineeringSn", value = "工程SN", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "current", value = "页数", paramType = "query", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "size", value = "每页条数", paramType = "query", required = true, defaultValue = "10", dataType = "Integer")
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore Page page, @ApiIgnore @RequestBody TeamInfo teamInfo) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(page, teamInfo);
public Result<IPage<TeamInfoDto>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
IPage<TeamInfoDto> pageList = teamInfoService.getPageList(PageUtil.getPage(map), map);
return Result.success(pageList);
}

View File

@ -115,21 +115,21 @@ public class Enterprise implements Serializable {
/**
* 经度
*/
@NotBlank(message = "经纬度不能为空", groups = {AddGroup.class})
// @NotBlank(message = "经纬度不能为空", groups = {AddGroup.class})
@Excel(name = "经度", width = 15)
@ApiModelProperty(value = "经度")
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "经纬度不能为空", groups = {AddGroup.class})
// @NotBlank(message = "经纬度不能为空", groups = {AddGroup.class})
@Excel(name = "纬度", width = 15)
@ApiModelProperty(value = "纬度")
private String latitude;
/**
* 企业所属的政务
*/
@NotBlank(message = "所属住建局不能为空", groups = {AddGroup.class})
// @NotBlank(message = "所属住建局不能为空", groups = {AddGroup.class})
@Excel(name = "企业所属的政务", width = 15)
@ApiModelProperty(value = "企业所属的政务")
private String governmentSn;

View File

@ -3,8 +3,6 @@ package com.zhgd.xmgl.modules.basicdata.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhgd.xmgl.sensitive.Sensitive;
import com.zhgd.xmgl.sensitive.SensitiveTypeEnum;
import com.zhgd.xmgl.valid.AddGroup;
import com.zhgd.xmgl.valid.EditGroup;
import io.swagger.annotations.ApiModel;
@ -76,7 +74,7 @@ public class SystemUser implements Serializable {
/**
* 人员电话
*/
@Sensitive(type = SensitiveTypeEnum.MOBILE_PHONE)
// @Sensitive(type = SensitiveTypeEnum.MOBILE_PHONE)
@NotBlank(message = "手机号码不能为空", groups = {AddGroup.class, EditGroup.class})
@Excel(name = "人员电话", width = 15)
@ApiModelProperty(value = "人员电话")

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.mybatis.Aes;
import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
@ -126,6 +127,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
}
SystemUser systemUser = new SystemUser();
BeanUtils.copyProperties(systemUserVo, systemUser);
systemUser.setShowPassword(systemUser.getPassword());
systemUser.setPassword(Aes.encrypt(systemUser.getPassword()));
systemUser.setCreateTime(new Date());
this.updateById(systemUser);
//新增用户角色
@ -147,7 +150,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
@Override
public boolean updatePassword(String userId, String password) {
LambdaUpdateWrapper<SystemUser> wrapper = Wrappers.<SystemUser>lambdaUpdate();
wrapper.set(SystemUser::getPassword, password);
wrapper.set(SystemUser::getPassword, Aes.encrypt(password));
wrapper.set(SystemUser::getShowPassword, password);
wrapper.eq(SystemUser::getUserId, userId);
return this.update(wrapper);

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.dto.TeamInfoDto;
import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
import java.util.Map;
/**
* @Description: 班组
* @author pengj
@ -13,7 +15,7 @@ import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
*/
public interface ITeamInfoService extends IService<TeamInfo> {
Page<TeamInfoDto> getPageList(Page page, TeamInfo teamInfo);
Page<TeamInfoDto> getPageList(Page page, Map<String, Object> map);
boolean saveInfo(TeamInfo teamInfo);
}

View File

@ -11,8 +11,11 @@ import com.zhgd.xmgl.modules.wisdom.entity.TeamInfo;
import com.zhgd.xmgl.modules.wisdom.mapper.TeamInfoMapper;
import com.zhgd.xmgl.modules.wisdom.service.ITeamInfoService;
import com.zhgd.xmgl.util.CommonUtil;
import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Description: 班组
* @author pengj
@ -23,16 +26,19 @@ import org.springframework.stereotype.Service;
public class TeamInfoServiceImpl extends ServiceImpl<TeamInfoMapper, TeamInfo> implements ITeamInfoService {
@Override
public Page<TeamInfoDto> getPageList(Page page, TeamInfo teamInfo) {
public Page<TeamInfoDto> getPageList(Page page, Map<String, Object> map) {
QueryWrapper<TeamInfo> wrapper = Wrappers.<TeamInfo>query();
if (StringUtils.isNotBlank(teamInfo.getTeamName())) {
wrapper.like("t.team_name", teamInfo.getTeamName());
String teamName = MapUtils.getString(map, "teamName");
String engineeringSn = MapUtils.getString(map, "engineeringSn");
String projectSn = MapUtils.getString(map, "projectSn");
if (StringUtils.isNotBlank(teamName)) {
wrapper.like("t.team_name", teamName);
}
if (StringUtils.isNotBlank(teamInfo.getEngineeringSn())) {
wrapper.eq("t.engineering_sn", teamInfo.getEngineeringSn());
if (StringUtils.isNotBlank(engineeringSn)) {
wrapper.eq("t.engineering_sn", engineeringSn);
}
if (StringUtils.isNotBlank(teamInfo.getProjectSn())) {
wrapper.eq("t.project_sn", teamInfo.getProjectSn()).eq("t.engineering_sn", StrUtil.EMPTY);
if (StringUtils.isNotBlank(projectSn)) {
wrapper.eq("t.project_sn", projectSn).eq("t.engineering_sn", StrUtil.EMPTY);
}
return baseMapper.getPageList(page, wrapper);
}