6fd7ab95 张雷

隐患风险功能流程修改、增加密码测试验证

1 个父辈 1a612ab8
......@@ -89,7 +89,7 @@
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
......
......@@ -131,11 +131,24 @@ public class AjhRectificationInfoController {
@ApiOperation(value="隐患检查-整改", notes="隐患检查-整改")
@PostMapping(value = "/mend")
public Result mend(@Valid @RequestBody AjhRectificationInfoMendDto dto) {
Result<EmergencyRiskEvent> result = new Result<EmergencyRiskEvent>();
ajhRectificationInfoService.mend(dto);
result.success("处理成功!");
return result;
}
/**
* 整改完成
* @return
*/
@AutoLog(value = "隐患检查-整改完成")
@ApiOperation(value="隐患检查-整改完成", notes="隐患检查-整改完成")
@PostMapping(value = "/complete-task-pass")
public Result pass(@Valid @RequestBody AjhRectificationInfo dto) {
Result<AjhRectificationInfo> result = new Result<AjhRectificationInfo>();
boolean ok = ajhRectificationInfoService.pass(dto);
result.setSuccess(ok);
result.success("处理完成!");
return result;
}
......
......@@ -11,7 +11,7 @@
p.waste_name,
LEFT ( p.pro_out_date, 7 ) AS report_month,
ROUND(ifnull(SUM( p.pro_come_count ),0) , 2) AS month_produce,
ROUND(ifnull(SUM( p.pro_out_count ),0) , 2) AS month_out,
ROUND(ifnull(SUM( k.keep_out_count ),0) , 2) AS month_out,
ROUND(ifnull(SUM( k.keep_in_count ),0) , 2) AS month_keep,
d.depart_name AS depart_name,
d.id as depart_id
......@@ -44,8 +44,6 @@
p.waste_name
</select>
<select id="queryPageListByYear" resultType="com.skua.modules.ajh.entity.AjhWasteYearReport">
SELECT
p.id,
......@@ -53,7 +51,7 @@
p.waste_name,
LEFT ( p.pro_out_date, 4 ) AS report_year,
ROUND(ifnull(SUM( p.pro_come_count ),0) , 2) AS year_produce,
ROUND(ifnull(SUM( p.pro_out_count ),0) , 2) AS year_out,
ROUND(ifnull(SUM( k.keep_out_count ),0) , 2) AS year_out,
ROUND(ifnull(SUM( k.keep_in_count ),0) , 2) AS year_keep,
d.depart_name AS depart_name,
d.id as depart_id
......
......@@ -107,4 +107,6 @@ public interface IAjhRectificationInfoService extends IService<AjhRectificationI
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
Map<String,Object> getStructNoHandleDetail(String startTime,String endTime);
boolean pass(AjhRectificationInfo dto);
}
......
......@@ -505,6 +505,15 @@ public class AjhRectificationInfoServiceImpl extends ServiceImpl<AjhRectificatio
return map;
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean pass(AjhRectificationInfo updateParam) {
this.updateById(updateParam);
//调用同意接口
boolean flag = flowBusinessService.completeTask(ProcessConstant.PASS_KEY, updateParam.getFlow());
return flag;
}
@Override
public List<FlowProcessFormFieldInfoVO> buildCustomData(String s, List<FlowProcessFormFieldInfoVO> list) {
for (FlowProcessFormFieldInfoVO entity : list) {
......
......@@ -88,10 +88,10 @@ public class WorkAnalysisController {
@ApiOperation(value = "安全管理进度-数据列表", notes = "安全管理进度-数据列表 timeType = 1 表示月份,timeType=2 表示年")
@GetMapping("/analysisBySafeProgress")
public List<SafeProgressVO> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
Result<List<SafeProgressVO>> result = new Result<>();
JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
String departIds = null;
String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'";
sql += " from sys_depart d ";
sql += getSafeProgressSql(departIds, startTime,endTime);
......@@ -102,12 +102,14 @@ public class WorkAnalysisController {
sql += " order by (ifnull(aaa.count,0) + ifnull(bbb.count,0) + ifnull(ccc.count,0) + ifnull(ddd.count,0) + ifnull(fff.count,0) ) asc ";
System.out.println("sql = "+sql);
List<SafeProgressVO> dataList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class));
return dataList;
result.setResult(dataList);
result.setSuccess(true);
return result;
}
@ApiOperation(value = "安全管理进度统计-数量统计", notes = "安全管理进度-数量统计 timeType = 1 表示月份,timeType=2 表示年")
@GetMapping("/analysisTotalBySafeProgress")
public SafeProgressVO analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
Result<SafeProgressVO> result = new Result<>();
String departIds = null;//DAY(LAST_DAY('"+startTime+"'))
String sql = "select count(d.id) 'departNum', ifnull(sum(aaa.count),0) 'meet_num' ,ifnull(sum(bbb.count),0) 'meet_total' ,ifnull(sum(ccc.count),0) 'exam_num' ,ifnull(sum(ddd.count),0) 'exam_total',ifnull(sum(eee.count),0) 'frequency_num' ,ifnull(sum(fff.count),0) 'frequency_total' ";
sql += " from sys_depart d ";
......@@ -120,9 +122,10 @@ public class WorkAnalysisController {
JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
List<SafeProgressVO> dataList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class));
if(dataList != null && !dataList.isEmpty()){
return dataList.get(0);
result.setResult(dataList.get(0));
result.setSuccess(true);
}
return null;
return result;
}
private String getSafeProgressSql( String departIds,String startTime, String endTime){
JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
......
......@@ -11,6 +11,8 @@ import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.encryption.MD5Util;
import com.skua.modules.common.vo.AliCode;
import com.skua.modules.system.vo.SsoLogin;
......@@ -82,43 +84,87 @@ public class LoginController {
SysUserDepartServiceImpl sysUserDepartService;
@Autowired
private ISysBaseConfigService sysBaseConfigService;
private final String ERRORLOGIN = "errorLogin";
private static Integer ERROR_TOTAL = 5;//允许错误次数
@RequestMapping(value = "/login", method = RequestMethod.POST)
//@ApiOperation("登录接口")
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) throws Exception {
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) {
Result<JSONObject> result = new Result<JSONObject>();
String username = sysLoginModel.getUsername();
String password = sysLoginModel.getPassword();
//update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
//前端密码加密,后端进行密码解密
//password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密
//update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
//1. 校验用户是否有效
SysUser sysUser = sysUserService.getUserByName(username);
result = sysUserService.checkUserIsEffective(sysUser);
if (!result.isSuccess()) {
return result;
}
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
String syspassword = sysUser.getPassword();
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误");
return result;
//是否启用密码错误次数验证
boolean errorNumCheck = false;
SysBaseConfig sysBaseConfig = sysBaseConfigService.getOne(new QueryWrapper<>());
if(sysBaseConfig != null){
ERROR_TOTAL = sysBaseConfig.getPasswordErrorNum();
if("1".equals(sysBaseConfig.getErrorNumVerification())){
errorNumCheck = true;
}
}
if(errorNumCheck){
if (!syspassword.equals(userpassword)) {
//登录失败处理
Integer errorNum = failureHandling(sysUser);
int errNum2 = ERROR_TOTAL - errorNum;
result.error500("用户名或密码错误,已连续失败"+errorNum+"次,剩余"+errNum2+"次将被冻结!");
return result;
}else{
resetErrorNum(username);
}
}else{
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误!");
return result;
}
}
//用户登录信息
userInfo(sysUser, result);
sysBaseAPI.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
return result;
}
/**
* 密码错误数量统计
* @param user
* @return
*/
private Integer failureHandling(SysUser user){
String username = user.getUsername();
Integer errNum = (Integer) redisUtil.get(ERRORLOGIN + username);
if (ObjectUtil.isEmpty(errNum)) {
redisUtil.set(ERRORLOGIN + username,1,300);
}else{
errNum++;
if (errNum >= ERROR_TOTAL){
redisUtil.del(ERRORLOGIN + username);
user.setStatus(2);
sysUserService.updateById(user);
}else {
redisUtil.set(ERRORLOGIN + username, errNum);
}
}
return errNum;
}
/**
* 重置用户连续登录失败次数
*/
private void resetErrorNum(String username){
redisUtil.set(ERRORLOGIN + username,0);
}
@RequestMapping(value = "/appLogin", method = RequestMethod.POST)
//@ApiOperation("APP登录接口")
public Result<SysAppUserInfo> appLogin(@RequestBody SysLoginModel sysLoginModel) throws Exception {
public Result<SysAppUserInfo> appLogin(@RequestBody SysLoginModel sysLoginModel) {
Result<SysAppUserInfo> result = new Result<SysAppUserInfo>();
String username = sysLoginModel.getUsername();
String password = sysLoginModel.getPassword();
......
......@@ -24,7 +24,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@Accessors(chain = true)
@ApiModel(value="sys_base_config对象", description="基础信息配置")
public class SysBaseConfig {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
......@@ -71,7 +71,10 @@ public class SysBaseConfig {
@Excel(name = "版权信息", width = 15)
@ApiModelProperty(value = "版权信息")
private java.lang.String copyrightInformation;
@ApiModelProperty(value = "数字孪生像素流地址")
private java.lang.String pixelStreamPath;
@ApiModelProperty(value = "密码错误次数限制")
private java.lang.Integer passwordErrorNum;
@ApiModelProperty(value = "密码错误次数校验")
private java.lang.String errorNumVerification;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!