Commit 5b5858d3 by guojuxing

审批加备注字段

parent a40b04a9
......@@ -23,7 +23,11 @@ public enum DataSecurityAuditEnum {
/**
* 超时
*/
OVER_TIME(3, "超时")
OVER_TIME(3, "超时"),
/**
* 关闭
*/
CLOSE(4, "关闭"),
;
private Integer code;
private String msg;
......
package com.gic.enterprise.qo;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
*
......@@ -29,6 +30,23 @@ public class AuditLogQO extends PageQO {
private Integer auditResult;
private String auditReason;
/**
* 1:我发起的 2:我收到的
*/
private Integer searchType;
/**
* 当前登录人
*/
private Integer userId;
private List<Integer> auditorList;
/**
* 是否是超管
*/
private boolean isAdminUser;
public Integer getEnterpriseId() {
return enterpriseId;
}
......@@ -92,4 +110,40 @@ public class AuditLogQO extends PageQO {
public void setAuditReason(String auditReason) {
this.auditReason = auditReason;
}
public Integer getSearchType() {
return searchType;
}
public AuditLogQO setSearchType(Integer searchType) {
this.searchType = searchType;
return this;
}
public Integer getUserId() {
return userId;
}
public AuditLogQO setUserId(Integer userId) {
this.userId = userId;
return this;
}
public List<Integer> getAuditorList() {
return auditorList;
}
public AuditLogQO setAuditorList(List<Integer> auditorList) {
this.auditorList = auditorList;
return this;
}
public boolean isAdminUser() {
return isAdminUser;
}
public AuditLogQO setAdminUser(boolean adminUser) {
isAdminUser = adminUser;
return this;
}
}
......@@ -57,4 +57,11 @@ public interface AuditLogApiService {
* @throws
*/
ServiceResponse<Page<AuditLogDTO>> listAuditLog(AuditLogQO auditLogQO);
/**
* 关闭
* @param auditLogId
* @return
*/
ServiceResponse<Void> closeAuditLog(Integer auditLogId);
}
......@@ -64,6 +64,13 @@ public interface AuditLogService {
* @throws
*/
void updateAudit(AuditLogDTO auditLogDTO);
/**
* 关闭
* @param auditLogId
* @return
*/
int closeAudit(Integer auditLogId);
/**
* listAuditLog
* @Title: listAuditLog
......
package com.gic.enterprise.service.impl;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.constant.DataSecurityAuditEnum;
import com.gic.enterprise.dao.mapper.TabAuditLogMapper;
import com.gic.enterprise.dto.AuditLogDTO;
import com.gic.enterprise.entity.TabAuditLog;
......@@ -72,6 +73,14 @@ public class AuditLogServiceImpl implements AuditLogService {
}
@Override
public int closeAudit(Integer auditLogId) {
TabAuditLog auditLog = new TabAuditLog();
auditLog.setUpdateTime(new Date());
auditLog.setAuditResult(DataSecurityAuditEnum.CLOSE.getCode());
return tabAuditLogMapper.updateByPrimaryKeySelective(auditLog);
}
@Override
public Page<TabAuditLog> listAuditLog(AuditLogQO auditLogQO) {
PageHelper.startPage(auditLogQO.getCurrentPage(), auditLogQO.getPageSize());
return tabAuditLogMapper.listAuditLog(auditLogQO);
......
......@@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -310,6 +311,21 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
@Override
public ServiceResponse<Page<AuditLogDTO>> listAuditLog(AuditLogQO auditLogQO) {
List<Integer> auditorList = new ArrayList<>();
boolean isNeedSearchAuditor = !auditLogQO.isAdminUser() && auditLogQO.getSearchType() != null && auditLogQO.getSearchType() == 2;
if (isNeedSearchAuditor){
ServiceResponse<AuditorDTO> auditorDTOServiceResponse = auditorApiService.getAuditorByUserId(auditLogQO.getEnterpriseId(), auditLogQO.getUserId());
if (auditorDTOServiceResponse.isSuccess()) {
AuditorDTO auditorDTO = auditorDTOServiceResponse.getResult();
if (auditorDTO != null) {
auditorList.add(auditorDTO.getAuditorId());
}
}
if (auditLogQO.getUserId() != null && auditorList.isEmpty()) {
auditorList.add(-1);
}
}
auditLogQO.setAuditorList(auditorList);
com.github.pagehelper.Page<TabAuditLog> auditLogList = this.auditLogService.listAuditLog(auditLogQO);
Date currDate = new Date();
if (CollectionUtils.isNotEmpty(auditLogList)) {
......@@ -323,6 +339,23 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
return EnterpriseServiceResponse.success(page);
}
@Override
public ServiceResponse<Void> closeAuditLog(Integer auditLogId) {
TabAuditLog record = auditLogService.getAuditById(auditLogId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "工单不存在");
}
boolean isCanCloseStatus = DataSecurityAuditEnum.WAIT.getCode().equals(record.getAuditResult());
if (!isCanCloseStatus) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "工单不能关闭");
}
int updateNum = auditLogService.closeAudit(auditLogId);
if (updateNum > 0) {
return ServiceResponse.success();
}
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "更新失败");
}
private void sendWxMessage(AuditorDTO auditorDTO, AuditLogDTO auditLogDTO) {
TabEnterprise enterprise = enterpriseService.getEnterpriseById(auditLogDTO.getEnterpriseId());
......
......@@ -290,6 +290,7 @@
<include refid="Base_Column_List" />
from tab_audit_log
where delete_flag = 0
and audit_type != 3
<if test="enterpriseId != null ">
and enterprise_id = #{enterpriseId}
</if>
......@@ -299,11 +300,31 @@
<if test="endTime != null ">
and apply_time &lt;= #{endTime}
</if>
<if test="searchType != null">
<if test="searchType == 1">
and apply_user_id = #{userId}
</if>
<if test="searchType == 2">
<if test="auditorList != null and auditorList.size() > 0">
and auditor_id in
<foreach collection="auditorList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
</if>
<if test="auditResult != null">
<if test="auditResult == 3">
and audit_expire_time &lt; now()
</if>
<if test="auditResult != 3">
and audit_result = #{auditResult}
</if>
</if>
<if test="search != null and search != '' ">
and ( apply_user_id like concat('%', #{search},'%')
or project_item_name like concat('%', #{search},'%')
and ( project_item_name like concat('%', #{search},'%')
or auditor_name like concat('%', #{search},'%')
or auditor_phone like concat('%', #{search},'%')
)
</if>
order by create_time desc
......
......@@ -41,20 +41,29 @@ public class AuditLogController {
@RequestMapping("/audit")
@IgnoreLogin
public RestResponse audit(@Validated(AuditLogQO.AuditView.class) AuditLogQO auditLogQO) {
ServiceResponse<AuditLogDTO> auditorLogRes = auditLogApiService.getAuditLog(auditLogQO.getAuditLogId());
if (!auditorLogRes.isSuccess()) {
return RestResponse.failure(auditorLogRes.getCode(), auditorLogRes.getMessage());
}
AuditLogDTO oldAuditLog = auditorLogRes.getResult();
AuditLogDTO auditLogDTO = new AuditLogDTO();
auditLogDTO.setAuditLogId(auditLogQO.getAuditLogId());
auditLogDTO.setAuditResult(auditLogQO.getAuditResult());
auditLogDTO.setAuditReason(auditLogQO.getAuditReason());
UserDetail userDetail = UserDetailUtils.getUserDetail();
AuditorDTO auditorDTO;
if (StringUtils.isNotBlank(auditLogQO.getOpenid())) {
ServiceResponse<AuditorDTO> auditorServiceResponse = auditorApiService.getAuditorByOpenid(auditLogQO.getOpenid());
//微信端审核
ServiceResponse<AuditorDTO> auditorServiceResponse = auditorApiService.getAuditorByOpenid(auditLogQO.getOpenid(), oldAuditLog.getEnterpriseId());
if (!auditorServiceResponse.isSuccess()) {
return ResultControllerUtils.commonResult(auditorServiceResponse);
}
auditorDTO = auditorServiceResponse.getResult();
} else if (userDetail != null) {
if (userDetail.getUserInfo().getSuperAdmin() == 0) {
//后端审核的情况,一定是关联管理员的审核员
ServiceResponse<AuditorDTO> auditorServiceResponse = auditorApiService.getAuditorByUserId(userDetail.getEnterpriseId(), userDetail.getUserId());
if (!auditorServiceResponse.isSuccess()) {
return ResultControllerUtils.commonResult(auditorServiceResponse);
......@@ -62,18 +71,22 @@ public class AuditLogController {
auditorDTO = auditorServiceResponse.getResult();
} else {
auditorDTO = new AuditorDTO();
//超管没有审核员ID
auditorDTO.setAuditorId(null);
auditLogDTO.setAuditorName(userDetail.getUserInfo().getUserName());
auditLogDTO.setAuditorPhone(userDetail.getUserInfo().getPhoneNumber());
auditorDTO.setAuditorName(userDetail.getUserInfo().getUserName());
auditorDTO.setPhone(userDetail.getUserInfo().getPhoneNumber());
}
} else {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数错误");
}
auditLogDTO.setAuditorName(auditorDTO.getAuditorName());
auditLogDTO.setAuditorPhone(auditorDTO.getPhone());
auditLogDTO.setAuditorId(auditorDTO.getAuditorId());
ServiceResponse<AuditLogDTO> serviceResponse = auditLogApiService.audit(auditLogDTO);
if (serviceResponse.isSuccess()) {
createLog(auditLogDTO);
}
if (serviceResponse.isSuccess()) {
return RestResponse.success();
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage(), serviceResponse.getResult());
......@@ -96,10 +109,16 @@ public class AuditLogController {
@RequestMapping("/list-audit-log")
public RestResponse listAuditLog(AuditLogQO auditLogQO) {
auditLogQO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
auditLogQO.setUserId(UserDetailUtils.getUserDetail().getUserId());
ServiceResponse<Page<AuditLogDTO>> serviceResponse = this.auditLogApiService.listAuditLog(auditLogQO);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/list-audit-log")
public RestResponse close(Integer auditLogId) {
return ResultControllerUtils.commonResult(auditLogApiService.closeAuditLog(auditLogId));
}
@RequestMapping("/project-item-info")
public RestResponse projectItemInfo(String projectItemCode) {
ServiceResponse<ProjectItemDTO> serviceResponse = this.projectItemApiService.getByProjectItemCode(projectItemCode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment