Commit 1fa24614 by huangZW

111

parent e84e40b6
......@@ -14,7 +14,7 @@ public interface AuditApiService {
Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,String enterpriseId,Integer auditStatus,Integer auditFlag,BasePageInfo pageInfo);
String audit(String auditId,String aduitName);
String audit(String batchId,String auditId,String aduitName);
void refuse(String auditId,String auditReason,String aduitName);
......@@ -31,4 +31,6 @@ public interface AuditApiService {
Page<AuditDTO> listByStaffId(String staffId, BasePageInfo pageInfo);
Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus);
}
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog;
public interface TabHaobanBatchAuditLogMapper {
int deleteByPrimaryKey(String batchAuditLogId);
int insert(TabHaobanBatchAuditLog record);
int insertSelective(TabHaobanBatchAuditLog record);
TabHaobanBatchAuditLog selectByPrimaryKey(String batchAuditLogId);
int updateByPrimaryKeySelective(TabHaobanBatchAuditLog record);
int updateByPrimaryKey(TabHaobanBatchAuditLog record);
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
public class TabHaobanBatchAuditLog implements Serializable {
private String batchAuditLogId;
private String auditId;
private String batchId;
private String enterpriseName;
private String commitName;
private Date commitTime;
private Integer auditResult;
private Integer auditType;
private Date createTime;
private Date updateTime;
private Integer status;
private static final long serialVersionUID = 1L;
public String getBatchAuditLogId() {
return batchAuditLogId;
}
public void setBatchAuditLogId(String batchAuditLogId) {
this.batchAuditLogId = batchAuditLogId == null ? null : batchAuditLogId.trim();
}
public String getAuditId() {
return auditId;
}
public void setAuditId(String auditId) {
this.auditId = auditId == null ? null : auditId.trim();
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId == null ? null : batchId.trim();
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName == null ? null : enterpriseName.trim();
}
public String getCommitName() {
return commitName;
}
public void setCommitName(String commitName) {
this.commitName = commitName == null ? null : commitName.trim();
}
public Date getCommitTime() {
return commitTime;
}
public void setCommitTime(Date commitTime) {
this.commitTime = commitTime;
}
public Integer getAuditResult() {
return auditResult;
}
public void setAuditResult(Integer auditResult) {
this.auditResult = auditResult;
}
public Integer getAuditType() {
return auditType;
}
public void setAuditType(Integer auditType) {
this.auditType = auditType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -22,12 +20,11 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.StringUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreDetailDTO;
import com.gic.enterprise.api.dto.StorePhotoDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.dto.MessageLogDTO;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil;
......@@ -41,12 +38,13 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanBatchAuditLogMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.message.api.dto.MessageDTO;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
......@@ -73,9 +71,12 @@ public class AuditApiServiceImpl implements AuditApiService{
private Config config;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private TabHaobanBatchAuditLogMapper tabHaobanBatchAuditLogMapper;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired
private EnterpriseService enterpriseService;
@Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
......@@ -118,30 +119,56 @@ public class AuditApiServiceImpl implements AuditApiService{
}
@Transactional
@Override
public String audit(String auditId,String auditName) {
public String audit(String batchId,String auditId,String auditName) {
TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId);
if(tab==null){
return "1";
}
int auditType = tab.getAuditType();
tab.setAuditId(auditId);
tab.setAuditStatus(1);
tab.setUpdateTime(new Date());
tab.setAuditName(auditName);
auditMapper.updateByPrimaryKeySelective(tab);
String storeId = tab.getCommitStoreId();
String oldValue = tab.getOldValue();
String newValue = tab.getNewValue();
String changeField = tab.getChangeField();
this.editStoreInfo(storeId, changeField, oldValue, newValue);
//发送消息
String title = "门店信息修改通知";
String content = StoreFieldEnum.getValueName(changeField);
content = "["+content+"]"+"修改审核通过";
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
String staffId = tab2.getCommitStaffId();
this.sendMessageByStaffId(staffId, storeId, title, content);
if(auditType == 1){
//门店信息变更
String storeId = tab.getCommitStoreId();
String oldValue = tab.getOldValue();
String newValue = tab.getNewValue();
String changeField = tab.getChangeField();
this.editStoreInfo(storeId, changeField, oldValue, newValue);
//发送消息
String title = "门店信息修改通知";
String content = StoreFieldEnum.getValueName(changeField);
content = "["+content+"]"+"修改审核通过";
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
String staffId = tab2.getCommitStaffId();
this.sendMessageByStaffId(staffId, storeId, title, content);
//插入log
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab);
}
}else if(auditType == 2){
//TODO 审核通过,处理事项
//门店导购绑定
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab);
}
}else if(auditType == 3){
//TODO 审核通过,处理事项
//门店导购新增
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab);
}
}else if(auditType == 4){
//TODO 审核通过,处理事项
//门店导购删除
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab);
}
}else if(auditType == 5){
//解绑申请,无需审核,直接通过
}
return "";
}
@Override
......@@ -345,4 +372,22 @@ public class AuditApiServiceImpl implements AuditApiService{
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(auditMapper.pageStoreListByParams(storeId,auditType,auditStatus),AuditDTO.class);
}
public void insertBatchLog(String batchId,TabHaobanAudit tab){
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(tab.getEnterpriseId());
TabHaobanBatchAuditLog batTab = new TabHaobanBatchAuditLog();
batTab.setAuditId(tab.getAuditId());
batTab.setBatchAuditLogId(UuidUtil.randomUUID());
batTab.setAuditType(tab.getAuditType());
batTab.setAuditResult(1);
batTab.setBatchId(batchId);
batTab.setCommitName(tab.getCommitName());
batTab.setCommitTime(tab.getCommitTime());
batTab.setCreateTime(new Date());
batTab.setEnterpriseName(enterprise == null ?"":enterprise.getEnterpriseName());
batTab.setStatus(1);
batTab.setUpdateTime(new Date());
tabHaobanBatchAuditLogMapper.insert(batTab);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanBatchAuditLogMapper" >
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog" >
<id column="batch_audit_log_id" property="batchAuditLogId" jdbcType="VARCHAR" />
<result column="audit_id" property="auditId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="enterprise_name" property="enterpriseName" jdbcType="VARCHAR" />
<result column="commit_name" property="commitName" jdbcType="VARCHAR" />
<result column="commit_time" property="commitTime" jdbcType="TIMESTAMP" />
<result column="audit_result" property="auditResult" jdbcType="INTEGER" />
<result column="audit_type" property="auditType" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
batch_audit_log_id, audit_id, batch_id, enterprise_name, commit_name, commit_time,
audit_result, audit_type, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_batch_audit_log
where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from tab_haoban_batch_audit_log
where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog" >
insert into tab_haoban_batch_audit_log (batch_audit_log_id, audit_id, batch_id,
enterprise_name, commit_name, commit_time,
audit_result, audit_type, create_time,
update_time, status)
values (#{batchAuditLogId,jdbcType=VARCHAR}, #{auditId,jdbcType=VARCHAR}, #{batchId,jdbcType=VARCHAR},
#{enterpriseName,jdbcType=VARCHAR}, #{commitName,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP},
#{auditResult,jdbcType=INTEGER}, #{auditType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog" >
insert into tab_haoban_batch_audit_log
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="batchAuditLogId != null" >
batch_audit_log_id,
</if>
<if test="auditId != null" >
audit_id,
</if>
<if test="batchId != null" >
batch_id,
</if>
<if test="enterpriseName != null" >
enterprise_name,
</if>
<if test="commitName != null" >
commit_name,
</if>
<if test="commitTime != null" >
commit_time,
</if>
<if test="auditResult != null" >
audit_result,
</if>
<if test="auditType != null" >
audit_type,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="batchAuditLogId != null" >
#{batchAuditLogId,jdbcType=VARCHAR},
</if>
<if test="auditId != null" >
#{auditId,jdbcType=VARCHAR},
</if>
<if test="batchId != null" >
#{batchId,jdbcType=VARCHAR},
</if>
<if test="enterpriseName != null" >
#{enterpriseName,jdbcType=VARCHAR},
</if>
<if test="commitName != null" >
#{commitName,jdbcType=VARCHAR},
</if>
<if test="commitTime != null" >
#{commitTime,jdbcType=TIMESTAMP},
</if>
<if test="auditResult != null" >
#{auditResult,jdbcType=INTEGER},
</if>
<if test="auditType != null" >
#{auditType,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog" >
update tab_haoban_batch_audit_log
<set >
<if test="auditId != null" >
audit_id = #{auditId,jdbcType=VARCHAR},
</if>
<if test="batchId != null" >
batch_id = #{batchId,jdbcType=VARCHAR},
</if>
<if test="enterpriseName != null" >
enterprise_name = #{enterpriseName,jdbcType=VARCHAR},
</if>
<if test="commitName != null" >
commit_name = #{commitName,jdbcType=VARCHAR},
</if>
<if test="commitTime != null" >
commit_time = #{commitTime,jdbcType=TIMESTAMP},
</if>
<if test="auditResult != null" >
audit_result = #{auditResult,jdbcType=INTEGER},
</if>
<if test="auditType != null" >
audit_type = #{auditType,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
</set>
where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog" >
update tab_haoban_batch_audit_log
set audit_id = #{auditId,jdbcType=VARCHAR},
batch_id = #{batchId,jdbcType=VARCHAR},
enterprise_name = #{enterpriseName,jdbcType=VARCHAR},
commit_name = #{commitName,jdbcType=VARCHAR},
commit_time = #{commitTime,jdbcType=TIMESTAMP},
audit_result = #{auditResult,jdbcType=INTEGER},
audit_type = #{auditType,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -191,7 +191,7 @@ public class AuditController extends WebBaseController{
int failCount = 0;
String batchId = UuidUtil.randomUUID();
for(String auditId : s){
String result = auditApiService.audit(auditId,auditName);
String result = auditApiService.audit(batchId,auditId,auditName);
if(StringUtils.isEmpty(result)){
successCount = successCount+1;
//TODO 插入批量日志
......@@ -224,7 +224,7 @@ public class AuditController extends WebBaseController{
if(StringUtils.isAnyBlank(auditId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
auditApiService.audit(auditId,auditName);
auditApiService.audit("",auditId,auditName);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
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