Commit 0e62fc40 by guojuxing

审批工单修改

parent 778a36e6
......@@ -113,6 +113,16 @@ public class AuditLogDTO implements Serializable {
*/
private String remark;
/**
* 发送目标:管理员ID。审核员管理了管理员
*/
private Integer sendTargetUserId;
/**
* 审核员如果是多个,拥有统一的随机ID,一个通过,相同随机ID的数据同步审核状态
*/
private String sendRandomId;
private Date auditExpireTime;
private String enterpriseName;
private String position;
......@@ -321,6 +331,24 @@ public class AuditLogDTO implements Serializable {
return this;
}
public Integer getSendTargetUserId() {
return sendTargetUserId;
}
public AuditLogDTO setSendTargetUserId(Integer sendTargetUserId) {
this.sendTargetUserId = sendTargetUserId;
return this;
}
public String getSendRandomId() {
return sendRandomId;
}
public AuditLogDTO setSendRandomId(String sendRandomId) {
this.sendRandomId = sendRandomId;
return this;
}
@Override
public String toString() {
return "AuditLogDTO{" +
......@@ -349,6 +377,8 @@ public class AuditLogDTO implements Serializable {
", projectName='" + projectName + '\'' +
", applyUserPhone='" + applyUserPhone + '\'' +
", auditUrl='" + auditUrl + '\'' +
", sendTargetUserId='" + sendTargetUserId + '\'' +
", sendRandomId='" + sendRandomId + '\'' +
'}';
}
}
......@@ -7,6 +7,8 @@ import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
*
* @ClassName: TabAuditLogMapper
......@@ -86,4 +88,11 @@ public interface TabAuditLogMapper {
* @throws
*/
TabAuditLog getWaitAuditByProjectItem(@Param("projectItemId") Integer projectItemId, @Param("auditExpireTime") Date auditExpireTime);
/**
* 查询相同随机ID的列表
* @param sendRandomId
* @return
*/
List<TabAuditLog> listBySendRandomId(@Param("sendRandomId") String sendRandomId);
}
\ No newline at end of file
......@@ -110,6 +110,16 @@ public class TabAuditLog {
*/
private String remark;
/**
* 发送目标:管理员ID。审核员管理了管理员
*/
private Integer sendTargetUserId;
/**
* 审核员如果是多个,拥有统一的随机ID,一个通过,相同随机ID的数据同步审核状态
*/
private String sendRandomId;
public Integer getAuditLogId() {
return auditLogId;
}
......@@ -270,4 +280,22 @@ public class TabAuditLog {
this.remark = remark;
return this;
}
public Integer getSendTargetUserId() {
return sendTargetUserId;
}
public TabAuditLog setSendTargetUserId(Integer sendTargetUserId) {
this.sendTargetUserId = sendTargetUserId;
return this;
}
public String getSendRandomId() {
return sendRandomId;
}
public TabAuditLog setSendRandomId(String sendRandomId) {
this.sendRandomId = sendRandomId;
return this;
}
}
\ No newline at end of file
......@@ -5,6 +5,8 @@ import com.gic.enterprise.entity.TabAuditLog;
import com.gic.enterprise.qo.AuditLogQO;
import com.github.pagehelper.Page;
import java.util.List;
/**
*
* @Description:
......@@ -91,4 +93,11 @@ public interface AuditLogService {
* @throws
*/
boolean hasProjectItemInUse(Integer projectItemId);
/**
* 日志ID查询出sendRandomId,然后查询相同随机ID的数据列表
* @param auditLogId 日志ID
* @return
*/
List<TabAuditLog> listBySendRandomId(Integer auditLogId);
}
......@@ -9,10 +9,14 @@ import com.gic.enterprise.qo.AuditLogQO;
import com.gic.enterprise.service.AuditLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
*
......@@ -91,4 +95,18 @@ public class AuditLogServiceImpl implements AuditLogService {
public boolean hasProjectItemInUse(Integer projectItemId) {
return tabAuditLogMapper.getWaitAuditByProjectItem(projectItemId, new Date()) != null;
}
@Override
public List<TabAuditLog> listBySendRandomId(Integer auditLogId) {
TabAuditLog record = getAuditById(auditLogId);
if (record != null) {
List<TabAuditLog> list = tabAuditLogMapper.listBySendRandomId(record.getSendRandomId());
if (CollectionUtils.isNotEmpty(list)) {
return list;
} else {
return Arrays.asList(record);
}
}
return Collections.EMPTY_LIST;
}
}
......@@ -9,10 +9,7 @@ import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.AuditorApiService;
import com.gic.auth.service.UserApiService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.*;
import com.gic.enterprise.config.Config;
import com.gic.enterprise.constant.AuditTypeEnum;
import com.gic.enterprise.constant.DataSecurityAuditEnum;
......@@ -157,13 +154,23 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
auditLogDTO.setAuditExpireTime(DateUtil.addDay(auditLogDTO.getApplyTime(), projectItem.getAuditExpireDuration()));
}
auditLogDTO.setAuditResult(DataSecurityAuditEnum.WAIT.getCode());
Integer auditLogId = auditLogService.save(auditLogDTO);
auditLogDTO.setAuditLogId(auditLogId);
//审核员如果是多个,拥有统一的随机ID,一个通过,相同随机ID的数据同步审核状态
String sendRandomId = RandomUtil.getRandomString(20);
//一定有一条数据(超管)否则报错
for (AuditorDTO auditorDTO : auditorList) {
//如果审核员时候多个,则要发送进行多条
//userId可能为空
auditLogDTO.setSendTargetUserId(auditorDTO.getUserId());
auditLogDTO.setSendRandomId(sendRandomId);
Integer auditLogId = auditLogService.save(auditLogDTO);
auditLogDTO.setAuditLogId(auditLogId);
if (StringUtils.isNotBlank(auditorDTO.getOpenid())) {
// 发送微信模板消息
sendWxMessage(auditorDTO, auditLogDTO);
//重制,为了循环新增
auditLogDTO.setAuditorId(null);
}
if (auditorDTO.getUserId() != null && !AuditTypeEnum.HAOBAN.getCode().equals(auditLogDTO.getAuditType())) {
ServiceResponse<UserDTO> userResponse = userApiService.getUserInfoById(auditorDTO.getUserId());
......@@ -196,9 +203,7 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<AuditLogDTO> audit(AuditLogDTO auditLogDTO) {
// 完成待办事项
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), auditLogDTO.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT,
config.getHost() + com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT_URL + "?auditLogId=" + auditLogDTO.getAuditLogId());
List<TabAuditLog> listBySendRandomId = auditLogService.listBySendRandomId(auditLogDTO.getAuditLogId());
TabAuditLog auditLog = this.auditLogService.getAuditById(auditLogDTO.getAuditLogId());
if (auditLog == null) {
......@@ -216,11 +221,23 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
if (projectItem == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
// 记录审批流程
TabAuditProcess auditProcess = getProcess(auditLog, auditLogDTO, projectItem);
this.auditProcessService.save(auditProcess);
// todo 如果是平台级审批项 要先判断是否实施和管理员都通过了 一期先不做
auditLogService.updateAudit(auditLogDTO);
listBySendRandomId.forEach(e -> {
// 完成待办事项
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), e.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT,
config.getHost() + com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT_URL + "?auditLogId=" + e.getAuditLogId());
// 记录审批流程
//重置日志主键ID
auditLogDTO.setAuditLogId(e.getAuditLogId());
TabAuditProcess auditProcess = getProcess(auditLog, auditLogDTO, projectItem);
this.auditProcessService.save(auditProcess);
// todo 如果是平台级审批项 要先判断是否实施和管理员都通过了 一期先不做
auditLogService.updateAudit(auditLogDTO);
});
//
if (!AuditTypeEnum.HAOBAN.getCode().equals(auditLogDTO.getAuditType()) && StringUtils.isNotBlank(projectItem.getCallbackUrl())) {
// 回调
String extraInfo = auditLog.getExtraInfo();
......
......@@ -22,11 +22,13 @@
<result column="audit_type" jdbcType="INTEGER" property="auditType" />
<result column="audit_expire_time" jdbcType="TIMESTAMP" property="auditExpireTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="send_target_user_id" jdbcType="INTEGER" property="sendTargetUserId" />
<result column="send_random_id" jdbcType="VARCHAR" property="sendRandomId" />
</resultMap>
<sql id="Base_Column_List">
audit_log_id, enterprise_id, apply_user_id, apply_user_name, apply_time, project_item_id,
project_item_name, auditor_id, auditor_name, auditor_phone, audit_time, audit_result,
delete_flag, create_time, update_time, extra_info, audit_reason, audit_type, audit_expire_time, remark
delete_flag, create_time, update_time, extra_info, audit_reason, audit_type, audit_expire_time, remark, send_target_user_id, send_random_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -42,14 +44,14 @@
auditor_phone, audit_time, audit_result,
delete_flag, create_time, update_time,
extra_info, audit_reason, audit_type,
audit_expire_time, remark)
audit_expire_time, remark, send_target_user_id, send_random_id)
values (#{auditLogId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{applyUserId,jdbcType=INTEGER},
#{applyUserName,jdbcType=VARCHAR}, #{applyTime,jdbcType=TIMESTAMP}, #{projectItemId,jdbcType=INTEGER},
#{projectItemName,jdbcType=VARCHAR}, #{auditorId,jdbcType=INTEGER}, #{auditorName,jdbcType=VARCHAR},
#{auditorPhone,jdbcType=VARCHAR}, #{auditTime,jdbcType=TIMESTAMP}, #{auditResult,jdbcType=INTEGER},
#{deleteFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{extraInfo,jdbcType=VARCHAR}, #{auditReason,jdbcType=VARCHAR}, #{auditType,jdbcType=INTEGER},
#{auditExpireTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})
#{auditExpireTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{sendTargetUserId,jdbcType=INTEGER}, #{sendRandomId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabAuditLog">
<selectKey keyProperty="auditLogId" order="AFTER" resultType="java.lang.Integer">
......@@ -117,6 +119,12 @@
<if test="remark != null">
remark,
</if>
<if test="sendTargetUserId != null">
send_target_user_id,
</if>
<if test="sendRandomId != null">
send_random_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="auditLogId != null">
......@@ -179,6 +187,12 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="sendTargetUserId != null">
#{sendTargetUserId,jdbcType=INTEGER},
</if>
<if test="sendRandomId != null">
#{sendRandomId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabAuditLog">
......@@ -241,6 +255,12 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="sendTargetUserId != null">
send_target_user_id = #{sendTargetUserId,jdbcType=INTEGER},
</if>
<if test="sendRandomId != null">
send_random_id = #{sendRandomId,jdbcType=VARCHAR},
</if>
</set>
where audit_log_id = #{auditLogId,jdbcType=INTEGER}
</update>
......@@ -265,6 +285,8 @@
audit_type = #{auditType,jdbcType=INTEGER},
audit_expire_time = #{auditExpireTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR},
send_target_user_id = #{auditType,jdbcType=INTEGER},
send_random_id = #{sendRandomId,jdbcType=VARCHAR},
where audit_log_id = #{auditLogId,jdbcType=INTEGER}
</update>
<select id="getLastWaitAuditByApplyUser" resultMap="BaseResultMap">
......@@ -305,12 +327,27 @@
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 test="userId != null">
and (send_target_user_id = #{userId}
<if test="auditorList != null and auditorList.size() > 0">
or auditor_id in
<foreach collection="auditorList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
</if>
<if test="userId == null">
<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>
<if test="auditResult != null">
......@@ -350,4 +387,13 @@
and audit_expire_time &lt; #{auditExpireTime}
and project_item_id = #{projectItemId}
</select>
<select id="listBySendRandomId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_audit_log
where delete_flag = 0
and send_random_id = #{sendRandomId}
</select>
</mapper>
\ No newline at end of file
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