Commit e19520c8 by fudahua

Merge remote-tracking branch 'origin/developer' into developer

parents b398bded e1e6e6e2
...@@ -43,10 +43,21 @@ public class AuditDTO implements Serializable { ...@@ -43,10 +43,21 @@ public class AuditDTO implements Serializable {
private Integer statusFlag; private Integer statusFlag;
private String detail; private String detail;
private String wxEnterpriseId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getCommitStoreName() { public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getCommitStoreName() {
return commitStoreName; return commitStoreName;
} }
......
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class BatchAuditLogDTO 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
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
/** /**
...@@ -28,11 +29,13 @@ public interface AuditApiService { ...@@ -28,11 +29,13 @@ public interface AuditApiService {
void insert(AuditDTO audit); void insert(AuditDTO audit);
Page<AuditDTO> listByStaffId(String staffId, BasePageInfo pageInfo); Page<AuditDTO> listByStaffId(String staffId,Integer auditType,Integer auditStatus, BasePageInfo pageInfo);
Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus); Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus);
AuditDTO findById(String auditId); AuditDTO findById(String auditId);
void update(AuditDTO audit); void update(AuditDTO audit);
List<BatchAuditLogDTO> listBatchLog(String batchId);
} }
...@@ -30,4 +30,16 @@ public interface StaffClerkRelationApiService { ...@@ -30,4 +30,16 @@ public interface StaffClerkRelationApiService {
String insert(StaffClerkRelationDTO staffClerkRelation); String insert(StaffClerkRelationDTO staffClerkRelation);
/**
* 解绑
* @param storeId
* @param clerkCode
* @return
*/
String delByStoreIdAndCode(String storeId,String clerkCode);
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkIds);
} }
...@@ -2,13 +2,13 @@ package com.gic.haoban.manage.web.controller; ...@@ -2,13 +2,13 @@ package com.gic.haoban.manage.web.controller;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.MaidianDictDTO; import com.gic.haoban.manage.api.dto.MaidianDictDTO;
import com.gic.haoban.manage.api.dto.MaidianDictModuleDTO; import com.gic.haoban.manage.api.dto.MaidianDictModuleDTO;
...@@ -35,7 +35,7 @@ public class MaidianDictController extends WebBaseController{ ...@@ -35,7 +35,7 @@ public class MaidianDictController extends WebBaseController{
//保存字典 //保存字典
@RequestMapping("save-page") @RequestMapping("save-page")
public HaobanResponse savePage(MaidianDictDTO dto) { public HaobanResponse savePage(MaidianDictDTO dto) {
if(StringUtil.isEmpty(dto.getModuleId())){ if(StringUtils.isEmpty(dto.getModuleId())){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
maidianDictApiService.savePage(dto); maidianDictApiService.savePage(dto);
......
...@@ -29,7 +29,7 @@ public interface TabHaobanAuditMapper { ...@@ -29,7 +29,7 @@ public interface TabHaobanAuditMapper {
TabHaobanAudit findByStoreIdAndChangeField(@Param("storeId")String storeId,@Param("changeField")String changeField); TabHaobanAudit findByStoreIdAndChangeField(@Param("storeId")String storeId,@Param("changeField")String changeField);
com.github.pagehelper.Page listByStaffId(@Param("staffId")String staffId); com.github.pagehelper.Page listByStaffId(@Param("staffId")String staffId,@Param("auditType")Integer auditType,@Param("auditStatus")Integer auditStatus);
com.github.pagehelper.Page pageStoreListByParams(@Param("storeId")String storeId, @Param("auditType")Integer auditType, @Param("auditStatus")Integer auditStatus); com.github.pagehelper.Page pageStoreListByParams(@Param("storeId")String storeId, @Param("auditType")Integer auditType, @Param("auditStatus")Integer auditStatus);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog; import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog;
public interface TabHaobanBatchAuditLogMapper { public interface TabHaobanBatchAuditLogMapper {
...@@ -14,4 +16,6 @@ public interface TabHaobanBatchAuditLogMapper { ...@@ -14,4 +16,6 @@ public interface TabHaobanBatchAuditLogMapper {
int updateByPrimaryKeySelective(TabHaobanBatchAuditLog record); int updateByPrimaryKeySelective(TabHaobanBatchAuditLog record);
int updateByPrimaryKey(TabHaobanBatchAuditLog record); int updateByPrimaryKey(TabHaobanBatchAuditLog record);
List<TabHaobanBatchAuditLog> listByBatchId(String batchId);
} }
\ No newline at end of file
...@@ -23,7 +23,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -23,7 +23,8 @@ public interface TabHaobanStaffClerkRelationMapper {
List<TabHaobanStaffClerkRelation> listBindCode(@Param("enterpriseId")String enterpriseId, @Param("clerkCodeList")Set<String> clerkCodeList); List<TabHaobanStaffClerkRelation> listBindCode(@Param("enterpriseId")String enterpriseId, @Param("clerkCodeList")Set<String> clerkCodeList);
List<TabHaobanStaffClerkRelation> listBindCodeByStaffId(@Param("enterpriseIdList")List<String> enterpriseIdList, @Param("staffId")String staffId); List<TabHaobanStaffClerkRelation> listBindCodeByStaffId(@Param("enterpriseIdList")List<String> enterpriseIdList, @Param("staffId")String staffId);
TabHaobanStaffClerkRelation getOneByClerkId(@Param("clerkId")String clerkId);
/** /**
* 改变状态 格局clerkId * 改变状态 格局clerkId
* @param clerkId * @param clerkId
...@@ -49,4 +50,11 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -49,4 +50,11 @@ public interface TabHaobanStaffClerkRelationMapper {
TabHaobanStaffClerkRelation getBindByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId); TabHaobanStaffClerkRelation getBindByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaffClerkRelation getByCodeAndEnterpriseId(@Param("clerkCode")String clerkCode, @Param("enterpriseId")String enterpriseId); TabHaobanStaffClerkRelation getByCodeAndEnterpriseId(@Param("clerkCode")String clerkCode, @Param("enterpriseId")String enterpriseId);
/**
* 解绑
*/
void delByStoreIdAndCode( @Param("storeId")String storeId,@Param("clerkCode")String clerkCode);
List<TabHaobanStaffClerkRelation> listByClerkIds(@Param("clerkIds") List<String> clerkIds);
} }
\ No newline at end of file
...@@ -31,6 +31,7 @@ import com.gic.haoban.common.utils.UuidUtil; ...@@ -31,6 +31,7 @@ import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi; import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditStaffDTO; import com.gic.haoban.manage.api.dto.AuditStaffDTO;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO; import com.gic.haoban.manage.api.dto.StoreAddressDTO;
import com.gic.haoban.manage.api.enums.AppPageType; import com.gic.haoban.manage.api.enums.AppPageType;
...@@ -403,9 +404,9 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -403,9 +404,9 @@ public class AuditApiServiceImpl implements AuditApiService{
auditMapper.insertSelective(EntityUtil.changeEntityByJSON(TabHaobanAudit.class, audit)); auditMapper.insertSelective(EntityUtil.changeEntityByJSON(TabHaobanAudit.class, audit));
} }
@Override @Override
public Page<AuditDTO> listByStaffId(String staffId, BasePageInfo pageInfo) { public Page<AuditDTO> listByStaffId(String staffId, Integer auditType,Integer auditStatus,BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize()); PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(auditMapper.listByStaffId(staffId),AuditDTO.class); return PageUtil.changePageHelperToCurrentPage(auditMapper.listByStaffId(staffId,auditType,auditStatus),AuditDTO.class);
} }
@Override @Override
public Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, public Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType,
...@@ -422,7 +423,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -422,7 +423,7 @@ public class AuditApiServiceImpl implements AuditApiService{
batTab.setAuditType(tab.getAuditType()); batTab.setAuditType(tab.getAuditType());
batTab.setAuditResult(auditResult); batTab.setAuditResult(auditResult);
batTab.setBatchId(batchId); batTab.setBatchId(batchId);
batTab.setCommitName(tab.getCommitName()); batTab.setCommitName(tab.getCommitStaffName());
batTab.setCommitTime(tab.getCommitTime()); batTab.setCommitTime(tab.getCommitTime());
batTab.setCreateTime(new Date()); batTab.setCreateTime(new Date());
batTab.setEnterpriseName(enterprise == null ?"":enterprise.getEnterpriseName()); batTab.setEnterpriseName(enterprise == null ?"":enterprise.getEnterpriseName());
...@@ -440,5 +441,10 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -440,5 +441,10 @@ public class AuditApiServiceImpl implements AuditApiService{
audit.setUpdateTime(new Date()); audit.setUpdateTime(new Date());
auditMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanAudit.class, audit)); auditMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanAudit.class, audit));
} }
@Override
public List<BatchAuditLogDTO> listBatchLog(String batchId) {
List<TabHaobanBatchAuditLog > list = tabHaobanBatchAuditLogMapper.listByBatchId(batchId);
return EntityUtil.changeEntityListByJSON(BatchAuditLogDTO.class, list);
}
} }
...@@ -47,7 +47,11 @@ public class AuditSettingApiServiceImpl implements AuditSettingApiService{ ...@@ -47,7 +47,11 @@ public class AuditSettingApiServiceImpl implements AuditSettingApiService{
String wxEnterpriseId) { String wxEnterpriseId) {
TabHaobanAuditSetting tab = auditSettingMapper.findSetting(wxEnterpriseId); TabHaobanAuditSetting tab = auditSettingMapper.findSetting(wxEnterpriseId);
if(tab == null){ if(tab == null){
return null; AuditSettingDTO dto = new AuditSettingDTO();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setAuditFlag(1);
dto.setClerkChangeFlag(0);
return dto;
} }
AuditSettingDTO dto = EntityUtil.changeEntity(AuditSettingDTO.class, tab); AuditSettingDTO dto = EntityUtil.changeEntity(AuditSettingDTO.class, tab);
return dto; return dto;
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -14,12 +17,15 @@ import com.gic.enterprise.api.service.EnterpriseService; ...@@ -14,12 +17,15 @@ import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO; import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
@Service @Service
...@@ -36,7 +42,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -36,7 +42,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) { public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
return staffClerkRelatinService.listBindCode(enterpriseId,clerkCodeList); return staffClerkRelatinService.listBindCode(enterpriseId,clerkCodeList);
...@@ -113,4 +120,18 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -113,4 +120,18 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
public String insert(StaffClerkRelationDTO staffClerkRelation) { public String insert(StaffClerkRelationDTO staffClerkRelation) {
return staffClerkRelatinService.insert(staffClerkRelation); return staffClerkRelatinService.insert(staffClerkRelation);
} }
@Override
public String delByStoreIdAndCode(String storeId, String clerkCode) {
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
return null;
}
@Override
public List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkIds) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds);
if(CollectionUtil.isEmpty(list)){
return new ArrayList<StaffClerkRelationDTO>();
}
List<StaffClerkRelationDTO> result = EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
return result;
}
} }
...@@ -27,10 +27,12 @@ import com.gic.haoban.manage.api.service.ApplicationApiService; ...@@ -27,10 +27,12 @@ import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanApplication; import com.gic.haoban.manage.service.entity.TabHaobanApplication;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
...@@ -63,6 +65,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -63,6 +65,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private Config config; private Config config;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId( public List<StaffDepartmentRelatedDTO> listByDepartmentId(
...@@ -227,6 +231,5 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -227,6 +231,5 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
url = url+encodeData; url = url+encodeData;
return url; return url;
} }
} }
...@@ -362,7 +362,15 @@ ...@@ -362,7 +362,15 @@
where 1=1 where 1=1
and commit_staff_id = #{staffId,jdbcType=VARCHAR} and commit_staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
and audit_type in (2,3,4,5) <if test="auditType == null">
and audit_type in (2,3,4,5)
</if>
<if test="auditType != null">
and audit_type = #{auditType}
</if>
<if test="auditStatus != null">
and audit_status = #{auditStatus}
</if>
order by create_time desc order by create_time desc
</select> </select>
......
...@@ -161,4 +161,13 @@ ...@@ -161,4 +161,13 @@
status = #{status,jdbcType=INTEGER} status = #{status,jdbcType=INTEGER}
where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR} where batch_audit_log_id = #{batchAuditLogId,jdbcType=VARCHAR}
</update> </update>
<select id="listByBatchId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_batch_audit_log
where batch_id = #{batchId,jdbcType=VARCHAR}
and status = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -187,12 +187,21 @@ ...@@ -187,12 +187,21 @@
</if> </if>
</select> </select>
<select id="getOneByClerkId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where
status_flag = 1
and clerk_id = #{clerkId}
</select>
<update id="changeStatusByClerkId" > <update id="changeStatusByClerkId" >
update tab_haoban_staff_clerk_relation update tab_haoban_staff_clerk_relation
set set
status_flag = #{status}, status_flag = #{status},
update_time = now() update_time = now()
where clerk_id = #{clerkId,jdbcType=VARCHAR} and status!=#{status} where clerk_id = #{clerkId,jdbcType=VARCHAR} and status_flag!=#{status}
</update> </update>
<update id="updateByClerkId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation" > <update id="updateByClerkId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation" >
...@@ -209,16 +218,38 @@ ...@@ -209,16 +218,38 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation
where clerk_id = #{clerkId,jdbcType=VARCHAR} and wx_enterprise_id=#{wxEnterpriseId} and status=1 where clerk_id = #{clerkId,jdbcType=VARCHAR} and wx_enterprise_id=#{wxEnterpriseId} and status_flag=1
</select> </select>
<select id="getByCodeAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="getByCodeAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation
where staff_id = #{staffId,jdbcType=VARCHAR} where
and status_flag = 1 status_flag = 1
and enterprise_id = #{enterpriseId} and enterprise_id = #{enterpriseId}
and clerk_code = #{clerkCode} and clerk_code = #{clerkCode}
</select> </select>
<update id="delByStoreIdAndCode" >
update tab_haoban_staff_clerk_relation
set
status_flag = 0,
update_time = now()
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and store_id = #{storeId,jdbcType=VARCHAR}
and status_flag =1
</update>
<select id="listByClerkIds" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where status_flag=1
and clerk_id in
<foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -200,4 +200,15 @@ public class AuditController extends WebBaseController{ ...@@ -200,4 +200,15 @@ public class AuditController extends WebBaseController{
auditApiService.audit("",auditId,auditName); auditApiService.audit("",auditId,auditName);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//批量审核详情
@HttpLimit
@RequestMapping("audit-detail-list")
public HaobanResponse auditDetailList(String batchId ) {
if(StringUtils.isAnyBlank(batchId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
List<BatchAuditLogDTO> list = auditApiService.listBatchLog(batchId);
return resultResponse(HaoBanErrCode.ERR_1,list);
}
} }
...@@ -23,6 +23,7 @@ import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi; ...@@ -23,6 +23,7 @@ import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
...@@ -46,14 +47,14 @@ public class AuditController extends WebBaseController{ ...@@ -46,14 +47,14 @@ public class AuditController extends WebBaseController{
@Autowired @Autowired
private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi; private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi;
//关联记录列表
@RequestMapping("clerk-apply-list") @RequestMapping("clerk-apply-list")
public HaobanResponse staffStoreList(String staffId,String wxEnterpriseId,BasePageInfo pageInfo){ public HaobanResponse staffStoreList(String staffId,Integer auditType,Integer auditStatus,String wxEnterpriseId,BasePageInfo pageInfo){
if(StringUtils.isAnyBlank(staffId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(staffId,wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
Page<AuditDTO> page = auditApiService.listByStaffId(staffId,pageInfo); Page<AuditDTO> page = auditApiService.listByStaffId(staffId,auditType,auditStatus,pageInfo);
List<AuditDTO> list = page.getResult(); List<AuditDTO> list = page.getResult();
List<AuditVO> voList = new ArrayList<AuditVO>(); List<AuditVO> voList = new ArrayList<AuditVO>();
for (AuditDTO auditDTO : list) { for (AuditDTO auditDTO : list) {
...@@ -83,7 +84,7 @@ public class AuditController extends WebBaseController{ ...@@ -83,7 +84,7 @@ public class AuditController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,pageResult2); return resultResponse(HaoBanErrCode.ERR_1,pageResult2);
} }
//门店记录列表
@RequestMapping("store-apply-list") @RequestMapping("store-apply-list")
public HaobanResponse storeApplyList(String storeId,String wxEnterpriseId,BasePageInfo pageInfo,Integer auditType,Integer auditStatus){ public HaobanResponse storeApplyList(String storeId,String wxEnterpriseId,BasePageInfo pageInfo,Integer auditType,Integer auditStatus){
if(StringUtils.isAnyBlank(storeId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(storeId,wxEnterpriseId)){
...@@ -122,7 +123,7 @@ public class AuditController extends WebBaseController{ ...@@ -122,7 +123,7 @@ public class AuditController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,pageResult2); return resultResponse(HaoBanErrCode.ERR_1,pageResult2);
} }
//审核,1同意,2拒绝,3取消审核
@RequestMapping("clerk-audit") @RequestMapping("clerk-audit")
public HaobanResponse clerkAudit(String auditId,String auditReason,Integer auditStatus,String wxEnterpriseId,String staffId){ public HaobanResponse clerkAudit(String auditId,String auditReason,Integer auditStatus,String wxEnterpriseId,String staffId){
if(StringUtils.isAnyBlank(auditId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(auditId,wxEnterpriseId)){
...@@ -142,6 +143,7 @@ public class AuditController extends WebBaseController{ ...@@ -142,6 +143,7 @@ public class AuditController extends WebBaseController{
audit.setAuditName(staff.getStaffName()); audit.setAuditName(staff.getStaffName());
} }
if(auditStatus == 1){ if(auditStatus == 1){
//审核同意
String oldValue = audit.getOldValue(); String oldValue = audit.getOldValue();
String clerkCode = ""; String clerkCode = "";
String enterpriseId = ""; String enterpriseId = "";
...@@ -159,7 +161,8 @@ public class AuditController extends WebBaseController{ ...@@ -159,7 +161,8 @@ public class AuditController extends WebBaseController{
phoneNumber = json.getString("phoneNumber"); phoneNumber = json.getString("phoneNumber");
nationCode = json.getString("nationCode"); nationCode = json.getString("nationCode");
String storeId = audit.getCommitStoreId(); String storeId = audit.getCommitStoreId();
if(audit.getAuditType() == 2){ if(audit.getAuditType() == AuditType.CLERK_BIND.getCode()){
//导购绑定
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,enterpriseId); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
if(staffClerkRelation != null){ if(staffClerkRelation != null){
return resultResponse(HaoBanErrCode.ERR_111117); return resultResponse(HaoBanErrCode.ERR_111117);
...@@ -175,21 +178,25 @@ public class AuditController extends WebBaseController{ ...@@ -175,21 +178,25 @@ public class AuditController extends WebBaseController{
audit.setAuditStatus(1); audit.setAuditStatus(1);
} }
} }
if(audit.getAuditType() == 3){ if(audit.getAuditType() == AuditType.CLERK_ADD.getCode()){
//导购新增
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staff.getStaffName(), phoneNumber, nationCode, null); boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staff.getStaffName(), phoneNumber, nationCode, null);
if(!flag){ if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010); return resultResponse(HaoBanErrCode.ERR_10010);
} }
audit.setAuditStatus(1); audit.setAuditStatus(1);
} }
if(audit.getAuditType() == 4){ if(audit.getAuditType() == AuditType.CLERK_DEL.getCode()){
//导购删除
syncHaobanToGicServiceApi.delGicClerk(clerkId); syncHaobanToGicServiceApi.delGicClerk(clerkId);
audit.setAuditStatus(1); audit.setAuditStatus(1);
} }
}else if(auditStatus == 2){ }else if(auditStatus == 2){
//审核拒绝
audit.setAuditReason(auditReason); audit.setAuditReason(auditReason);
audit.setAuditStatus(2); audit.setAuditStatus(2);
}else if(auditStatus == 3){ }else if(auditStatus == 3){
//取消审核
audit.setAuditStatus(3); audit.setAuditStatus(3);
} }
auditApiService.update(audit); auditApiService.update(audit);
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -35,6 +36,8 @@ import com.gic.haoban.common.utils.GooglePhoneNumberUtil; ...@@ -35,6 +36,8 @@ import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi; import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditSettingDTO;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
...@@ -43,6 +46,7 @@ import com.gic.haoban.manage.api.dto.StaffDTO; ...@@ -43,6 +46,7 @@ import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.BindApiService; import com.gic.haoban.manage.api.service.BindApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService; import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
...@@ -58,6 +62,7 @@ import com.gic.haoban.manage.web.interceptor.WebInterceptor; ...@@ -58,6 +62,7 @@ import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.BindClerkVO; import com.gic.haoban.manage.web.vo.BindClerkVO;
import com.gic.haoban.manage.web.vo.ClerkStoreVO; import com.gic.haoban.manage.web.vo.ClerkStoreVO;
import com.gic.haoban.manage.web.vo.ClerkVo; import com.gic.haoban.manage.web.vo.ClerkVo;
import com.gic.haoban.manage.web.vo.StaffStoreVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.PhoneNumberUtil;
...@@ -96,6 +101,8 @@ public class ClerkController extends WebBaseController{ ...@@ -96,6 +101,8 @@ public class ClerkController extends WebBaseController{
private StaffClerkRelationApiService staffClerkRelationApiService; private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired @Autowired
private ClerkNewService clerkNewService; private ClerkNewService clerkNewService;
@Autowired
private AuditSettingApiService auditSettingApiService;
//导购列表 //导购列表
@RequestMapping("/clerk-list") @RequestMapping("/clerk-list")
...@@ -287,7 +294,6 @@ public class ClerkController extends WebBaseController{ ...@@ -287,7 +294,6 @@ public class ClerkController extends WebBaseController{
String nationcode = staffDTO.getNationCode(); String nationcode = staffDTO.getNationCode();
String postion = staffDTO.getPostion(); String postion = staffDTO.getPostion();
Integer sex = staffDTO.getSex(); Integer sex = staffDTO.getSex();
staffDTO.setWxEnterpriseId(wxEnterpriseId);
if(StringUtils.isBlank(staffName)) { if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004); return resultResponse(HaoBanErrCode.ERR_10004);
} }
...@@ -306,69 +312,57 @@ public class ClerkController extends WebBaseController{ ...@@ -306,69 +312,57 @@ public class ClerkController extends WebBaseController{
com.gic.enterprise.api.dto.StoreDTO store = storeService.getStoreByIdNoStatus(storeId); com.gic.enterprise.api.dto.StoreDTO store = storeService.getStoreByIdNoStatus(storeId);
//校验手机是否唯一 //校验手机是否唯一
if (store == null) { if (store == null) {
return resultResponse(HaoBanErrCode.ERR_400001); return resultResponse(HaoBanErrCode.ERR_10009);
} }
ClerkDTO clerk = clerkService.getClerkByCodeNoDel(store.getEnterpriseId(), clerkCode); ClerkDTO clerk = clerkService.getClerkByCodeNoDel(store.getEnterpriseId(), clerkCode);
logger.info("【新增店员】clerk={}",JSON.toJSONString(clerk)); logger.info("【新增店员】clerk={}",JSON.toJSONString(clerk));
if(clerk != null){ if(clerk != null){
DepartmentDTO department = departmentApiService.selectByRelatedId(storeId); return resultResponse(HaoBanErrCode.ERR_10013);
if(department == null){
return resultResponse(HaoBanErrCode.ERR_400001);
}
//StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndCode(department.getDepartmentId(), clerkCode);
if(null != clerk && StringUtils.isNotBlank(clerk.getPhoneNumber()) && !"--".equals(clerk.getPhoneNumber())){
return resultResponse(HaoBanErrCode.ERR_10013);
}
} }
if(version == 1){ if(version == 1){
boolean needAudit = true; AuditSettingDTO dto = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId);
if(needAudit){ if(dto.getClerkChangeFlag() == 1){
//需要审核
StaffDTO staff = staffApiService.selectById(staffDTO.getStaffId()); StaffDTO staff = staffApiService.selectById(staffDTO.getStaffId());
//是否需要审核
AuditDTO audit = new AuditDTO(); AuditDTO audit = new AuditDTO();
audit.setCommitName(clerk.getClerkName()); audit.setCommitStaffName(staffName);
audit.setCommitStaffId(staffDTO.getStaffId()); audit.setCommitStaffId(staffDTO.getStaffId());
audit.setCommitStaffImg(staff.getHeadImg()); audit.setCommitStaffImg(staff.getHeadImg());
audit.setCommitStoreId(clerk.getStoreId()); audit.setCommitStoreId(storeId);
audit.setCommitStoreName(store.getStoreName()); audit.setCommitStoreName(store.getStoreName());
audit.setAuditStatus(0); audit.setAuditStatus(0);
audit.setWxEnterpriseId(wxEnterpriseId);
audit.setEnterpriseId(store.getEnterpriseId());
audit.setStatusFlag(1);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("clerkCode", clerkCode); json.put("clerkCode", clerkCode);
json.put("clerkName", clerk.getClerkName()); json.put("clerkName", staffName);
json.put("headPic", staff.getHeadImg()); json.put("headPic", staff.getHeadImg());
json.put("sex", sex); json.put("sex", sex);
json.put("postion", postion); json.put("postion", postion);
audit.setOldValue(json.toJSONString()); audit.setOldValue(json.toJSONString());
audit.setCommitTime(new Date()); audit.setCommitTime(new Date());
audit.setAuditType(3); audit.setAuditType(3);
auditApiService.insert(audit); auditApiService.insert(audit);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
} }
// if(clerk != null && StringUtils.isNotBlank(clerk.getPhoneNumber())){
// syncHaobanToGicServiceApi.syncHaobanClerkPhoneNumberToGic(clerk.getClerkId(), phoneNumber);
// }else{
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion); boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion);
if(!flag){ if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010); return resultResponse(HaoBanErrCode.ERR_10010);
} }
// }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//删除店员 //删除店员
@HttpLimit @HttpLimit
@RequestMapping("/staff-del") @RequestMapping("/staff-del")
public HaobanResponse staffDel(String staffDepartmentRelatedIds,String storeId,Integer version,String clerkIds,String staffId) { public HaobanResponse staffDel(String staffDepartmentRelatedIds,String wxEnterpriseId,String storeId,Integer version,String clerkIds,String staffId) {
boolean needAudit = true;
//是否需要审核
if(version != null && version == 1){ if(version != null && version == 1){
if(needAudit){ AuditSettingDTO dto = auditSettingApiService.findSettingByWxEnterpriseId(wxEnterpriseId);
if(dto.getClerkChangeFlag() == 1){
//需要审核
com.gic.enterprise.api.dto.StoreDTO store = storeService.getStoreByIdNoStatus(storeId); com.gic.enterprise.api.dto.StoreDTO store = storeService.getStoreByIdNoStatus(storeId);
//校验手机是否唯一 //校验手机是否唯一
if (store == null) { if (store == null) {
...@@ -378,12 +372,15 @@ public class ClerkController extends WebBaseController{ ...@@ -378,12 +372,15 @@ public class ClerkController extends WebBaseController{
String[] clerkIdArr = clerkIds.split(","); String[] clerkIdArr = clerkIds.split(",");
for (String clerkId : clerkIdArr) { for (String clerkId : clerkIdArr) {
AuditDTO audit = new AuditDTO(); AuditDTO audit = new AuditDTO();
audit.setCommitName(staff.getStaffName()); audit.setCommitStaffName(staff.getStaffName());
audit.setCommitStaffId(staffId); audit.setCommitStaffId(staffId);
audit.setCommitStaffImg(staff.getHeadImg()); audit.setCommitStaffImg(staff.getHeadImg());
audit.setCommitStoreId(storeId); audit.setCommitStoreId(storeId);
audit.setCommitStoreName(store.getStoreName()); audit.setCommitStoreName(store.getStoreName());
audit.setAuditStatus(0); audit.setAuditStatus(0);
audit.setWxEnterpriseId(wxEnterpriseId);
audit.setEnterpriseId(store.getEnterpriseId());
audit.setStatusFlag(1);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("clerkId", clerkId); json.put("clerkId", clerkId);
...@@ -401,37 +398,37 @@ public class ClerkController extends WebBaseController{ ...@@ -401,37 +398,37 @@ public class ClerkController extends WebBaseController{
} }
DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(storeId); // DepartmentDTO departmentDTO = departmentApiService.selectByRelatedId(storeId);
if(departmentDTO == null){ // if(departmentDTO == null){
return resultResponse(HaoBanErrCode.ERR_10009); // return resultResponse(HaoBanErrCode.ERR_10009);
} // }
if(StringUtils.isBlank(staffDepartmentRelatedIds)){ // if(StringUtils.isBlank(staffDepartmentRelatedIds)){
return resultResponse(HaoBanErrCode.ERR_2); // return resultResponse(HaoBanErrCode.ERR_2);
} // }
String[] staffDepartmentRelatedIdArr = staffDepartmentRelatedIds.split(","); // String[] staffDepartmentRelatedIdArr = staffDepartmentRelatedIds.split(",");
boolean flag = false; // boolean flag = false;
for (String staffDepartmentRelatedId : staffDepartmentRelatedIdArr) { // for (String staffDepartmentRelatedId : staffDepartmentRelatedIdArr) {
StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId); // StaffDepartmentRelatedDTO related = staffDepartmentRelatedApiService.getByStaffDepartmentRelatedId(staffDepartmentRelatedId);
if(related == null){ // if(related == null){
flag = true; // flag = true;
continue; // continue;
} // }
if(StringUtils.isBlank(related.getClerkCode())){ // if(StringUtils.isBlank(related.getClerkCode())){
staffApiService.del(staffDepartmentRelatedId); // staffApiService.del(staffDepartmentRelatedId);
}else{ // }else{
ClerkDTO clerk = clerkService.getClerkByClerkCode(departmentDTO.getEnterpriseId(), related.getClerkCode()); // ClerkDTO clerk = clerkService.getClerkByClerkCode(departmentDTO.getEnterpriseId(), related.getClerkCode());
if(clerk != null && distributeApiService.getClerkMemberCount(departmentDTO.getEnterpriseId(), clerk.getClerkId(), storeId) == 0){ // if(clerk != null && distributeApiService.getClerkMemberCount(departmentDTO.getEnterpriseId(), clerk.getClerkId(), storeId) == 0){
if(clerk.getClerkType() == 1){ // if(clerk.getClerkType() == 1){
continue; // continue;
} // }
syncHaobanToGicServiceApi.delGicClerk(clerk.getClerkId()); // syncHaobanToGicServiceApi.delGicClerk(clerk.getClerkId());
staffApiService.del(staffDepartmentRelatedId); // staffApiService.del(staffDepartmentRelatedId);
} // }
} // }
} // }
if(flag){ // if(flag){
return resultResponse(HaoBanErrCode.ERR_999); // return resultResponse(HaoBanErrCode.ERR_999);
} // }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
...@@ -493,10 +490,17 @@ public class ClerkController extends WebBaseController{ ...@@ -493,10 +490,17 @@ public class ClerkController extends WebBaseController{
} }
List<EnterpriseDTO> enterpriselist = enterpriseService.listEnterpriseByIds(enterpriseIdList); List<EnterpriseDTO> enterpriselist = enterpriseService.listEnterpriseByIds(enterpriseIdList);
Map<String,EnterpriseDTO> map = com.gic.commons.util.CollectionUtil.toMap(enterpriselist,"enterpriseId"); Map<String,EnterpriseDTO> map = com.gic.commons.util.CollectionUtil.toMap(enterpriselist,"enterpriseId");
List<String> clerkIds = clerkList.stream().map(s->s.getClerkId()).collect(Collectors.toList());
List<StaffClerkRelationDTO> clerkRelations = staffClerkRelationApiService.listByClerkIds(clerkIds);
Map<String,StaffClerkRelationDTO> clerkBindMap = com.gic.commons.util.CollectionUtil.toMap(clerkRelations, "clerkId");
for (ClerkDTO clerk : clerkList) { for (ClerkDTO clerk : clerkList) {
String enterpriseId = clerk.getEnterpriseId(); String enterpriseId = clerk.getEnterpriseId();
EnterpriseDTO enterpriseDTO = map.get(enterpriseId); EnterpriseDTO enterpriseDTO = map.get(enterpriseId);
StaffClerkRelationDTO staffClerkRelationDTO = clerkBindMap.get(clerk.getClerkId());
ClerkStoreVO vo = new ClerkStoreVO(); ClerkStoreVO vo = new ClerkStoreVO();
vo.setClerkId(clerk.getClerkId());
vo.setClerkCode(clerk.getClerkCode()); vo.setClerkCode(clerk.getClerkCode());
vo.setClerkName(clerk.getClerkName()); vo.setClerkName(clerk.getClerkName());
vo.setClerkType(clerk.getClerkType()); vo.setClerkType(clerk.getClerkType());
...@@ -506,17 +510,20 @@ public class ClerkController extends WebBaseController{ ...@@ -506,17 +510,20 @@ public class ClerkController extends WebBaseController{
vo.setNationCode(clerk.getNationcode()); vo.setNationCode(clerk.getNationcode());
StoreDTO store = storeService.getStore(clerk.getStoreId()); StoreDTO store = storeService.getStore(clerk.getStoreId());
vo.setStoreName(store == null?"":store.getStoreName()); vo.setStoreName(store == null?"":store.getStoreName());
vo.setStoreAddress(store == null?"":store.getStoreAddress());
vo.setBindFlag(staffClerkRelationDTO==null ? 0:1);
vo.setStaffId(staffClerkRelationDTO==null ? "":staffClerkRelationDTO.getStaffId());
clerkStoreList.add(vo); clerkStoreList.add(vo);
} }
return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList); return resultResponse(HaoBanErrCode.ERR_1,clerkStoreList);
} }
//绑定
@RequestMapping("bind-staff") @RequestMapping("bind-staff")
public HaobanResponse bindStaff(String clerkId,String clerkCode,String staffId,String wxUserId,String wxEnterpriseId,Integer auditType,Integer commitType){ public HaobanResponse bindStaff(String clerkId,String staffId,Integer auditType){
if(StringUtils.isAnyBlank(clerkId,clerkCode,staffId,wxUserId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(clerkId,staffId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
if(auditType == null || commitType == null){ if(auditType == null ){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
ClerkDTO clerk = clerkService.getclerkById(clerkId); ClerkDTO clerk = clerkService.getclerkById(clerkId);
...@@ -528,39 +535,57 @@ public class ClerkController extends WebBaseController{ ...@@ -528,39 +535,57 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
StoreDTO store = storeService.getStore(clerk.getStoreId()); StoreDTO store = storeService.getStore(clerk.getStoreId());
AuditDTO audit = new AuditDTO(); String clerkCode = clerk.getClerkCode();
audit.setCommitName(clerk.getClerkName()); String wxEnterpriseId = staff.getWxEnterpriseId();
audit.setCommitStaffId(staffId); String wxUserId = staff.getWxUserId();
audit.setCommitStaffImg(staff.getHeadImg()); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,store.getEnterpriseId());
audit.setCommitStoreId(clerk.getStoreId()); if(staffClerkRelation != null){
audit.setCommitStoreName(store.getStoreName()); return resultResponse(HaoBanErrCode.ERR_111117);
audit.setAuditStatus(0);
JSONObject json = new JSONObject();
json.put("clerkId", clerkId);
json.put("clerkCode", clerkCode);
json.put("clerkName", clerk.getClerkName());
json.put("staffName", staff.getStaffName());
json.put("staffId", staffId);
json.put("wxUserId", wxUserId);
json.put("headPic", staff.getHeadImg());
audit.setOldValue(json.toJSONString());
audit.setCommitTime(new Date());
audit.setAuditType(2);
auditApiService.insert(audit);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("clerk-bind-staff")
public HaobanResponse clerkBindStaff(String clerkId,String clerkCode,String staffId,String wxUserId,String wxEnterpriseId,Integer auditType,Integer commitType){
if(StringUtils.isAnyBlank(clerkId,clerkCode,staffId,wxUserId,wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2);
} }
if(auditType == null || commitType == null){ if(auditType == 2){
//无需审核
staffClerkRelation = new StaffClerkRelationDTO();
staffClerkRelation.setClerkId(clerkId);
staffClerkRelation.setClerkCode(clerkCode);
staffClerkRelation.setStoreId(clerk.getStoreId());
staffClerkRelation.setEnterpriseId(clerk.getEnterpriseId());
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insert(staffClerkRelation);
return resultResponse(HaoBanErrCode.ERR_1);
}else{
//需要审核
AuditDTO audit = new AuditDTO();
audit.setCommitStaffName(clerk.getClerkName());
audit.setCommitStaffId(staffId);
audit.setCommitStaffImg(staff.getHeadImg());
audit.setCommitStoreId(clerk.getStoreId());
audit.setCommitStoreName(store.getStoreName());
audit.setAuditStatus(0);
audit.setWxEnterpriseId(wxEnterpriseId);
audit.setEnterpriseId(store.getEnterpriseId());
audit.setStatusFlag(1);
JSONObject json = new JSONObject();
json.put("clerkId", clerkId);
json.put("clerkCode", clerkCode);
json.put("clerkName", clerk.getClerkName());
json.put("staffName", staff.getStaffName());
json.put("staffId", staffId);
json.put("wxUserId", wxUserId);
json.put("headPic", staff.getHeadImg());
audit.setOldValue(json.toJSONString());
audit.setCommitTime(new Date());
audit.setAuditType(2);
auditApiService.insert(audit);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
//解绑
@RequestMapping("unbind-staff")
public HaobanResponse unBindStaff(String clerkId,String clerkCode,String staffId,String storeId){
if(StringUtils.isAnyBlank(clerkId,clerkCode,staffId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
ClerkDTO clerk = clerkService.getclerkById(clerkId); ClerkDTO clerk = clerkService.getclerkById(clerkId);
...@@ -572,18 +597,22 @@ public class ClerkController extends WebBaseController{ ...@@ -572,18 +597,22 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
StoreDTO store = storeService.getStore(clerk.getStoreId()); StoreDTO store = storeService.getStore(clerk.getStoreId());
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,store.getEnterpriseId());
if(staffClerkRelation == null){
return resultResponse(HaoBanErrCode.ERR_111145);
}
//解绑无需审核,只插入记录即可
AuditDTO audit = new AuditDTO(); AuditDTO audit = new AuditDTO();
audit.setCommitName(clerk.getClerkName()); audit.setCommitStaffName(clerk.getClerkName());
audit.setCommitStaffId(staffId); audit.setCommitStaffId(staffId);
audit.setCommitStaffImg(staff.getHeadImg()); audit.setCommitStaffImg(staff.getHeadImg());
audit.setCommitStoreId(clerk.getStoreId()); audit.setCommitStoreId(clerk.getStoreId());
audit.setCommitStoreName(store.getStoreName()); audit.setCommitStoreName(store.getStoreName());
audit.setAuditStatus(0); audit.setAuditStatus(1);
audit.setWxEnterpriseId(staffClerkRelation.getWxEnterpriseId());
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,store.getEnterpriseId()); audit.setEnterpriseId(store.getEnterpriseId());
if(staffClerkRelation != null){ audit.setStatusFlag(1);
return resultResponse(HaoBanErrCode.ERR_111117);
}
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("clerkId", clerkId); json.put("clerkId", clerkId);
...@@ -591,19 +620,18 @@ public class ClerkController extends WebBaseController{ ...@@ -591,19 +620,18 @@ public class ClerkController extends WebBaseController{
json.put("clerkName", clerk.getClerkName()); json.put("clerkName", clerk.getClerkName());
json.put("staffName", staff.getStaffName()); json.put("staffName", staff.getStaffName());
json.put("staffId", staffId); json.put("staffId", staffId);
json.put("wxUserId", wxUserId);
json.put("headPic", staff.getHeadImg()); json.put("headPic", staff.getHeadImg());
json.put("enterpriseId", clerk.getEnterpriseId());
audit.setOldValue(json.toJSONString()); audit.setOldValue(json.toJSONString());
audit.setCommitTime(new Date()); audit.setCommitTime(new Date());
audit.setAuditName(staff.getStaffName());
audit.setAuditType(2); audit.setAuditType(5);
auditApiService.insert(audit); auditApiService.insert(audit);
staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
//门店导购列表
@RequestMapping("store-clerk-list") @RequestMapping("store-clerk-list")
public HaobanResponse storeClerkList(String storeId,String wxEnterpriseId){ public HaobanResponse storeClerkList(String storeId,String wxEnterpriseId){
if(StringUtils.isAnyBlank(storeId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(storeId,wxEnterpriseId)){
...@@ -611,7 +639,7 @@ public class ClerkController extends WebBaseController{ ...@@ -611,7 +639,7 @@ public class ClerkController extends WebBaseController{
} }
StoreDTO store = storeService.getStore(storeId); StoreDTO store = storeService.getStore(storeId);
if(store == null){ if(store == null){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_10009);
} }
List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId); List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId);
Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet()); Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet());
...@@ -628,27 +656,52 @@ public class ClerkController extends WebBaseController{ ...@@ -628,27 +656,52 @@ public class ClerkController extends WebBaseController{
unBindList.add(vo); unBindList.add(vo);
} }
} }
return resultResponse(HaoBanErrCode.ERR_10009); Map<String,Object> map = new HashMap<>();
map.put("bindList", bindList);
map.put("unBindList", unBindList);
return resultResponse(HaoBanErrCode.ERR_1,map);
} }
//门店列表
@RequestMapping("staff-store-list") @RequestMapping("staff-store-list")
public HaobanResponse staffStoreList(String staffId,String wxEnterpriseId){ public HaobanResponse staffStoreList(String staffId,String wxEnterpriseId){
if(StringUtils.isAnyBlank(staffId,wxEnterpriseId)){ if(StringUtils.isAnyBlank(staffId,wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
List<StaffStoreVO> list = new ArrayList<>();
List<EnterpriseDetailDTO> enterpriseList = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId); List<EnterpriseDetailDTO> enterpriseList = wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(wxEnterpriseId);
List<String> enterpriseIdList = enterpriseList.stream().map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList()); List<String> enterpriseIdList = enterpriseList.stream().map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCodeByStaffId(enterpriseIdList, staffId); List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCodeByStaffId(enterpriseIdList, staffId);
//主门店
ClerkMainStoreRelatedDTO mainDTO = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(wxEnterpriseId, staffId);
String storeId = mainDTO.getStoreId();
for (StaffClerkRelationDTO staffClerkRelationDTO : bindRelationList) { for (StaffClerkRelationDTO staffClerkRelationDTO : bindRelationList) {
ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode()); ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode());
if(clerk != null){ if(clerk != null){
StoreDTO store = storeService.getStore(clerk.getStoreId()); StoreDTO store = storeService.getStore(clerk.getStoreId());
//主门店标志
int mainStoreFlag = 0;
if(storeId.equals(store.getStoreId())){
mainStoreFlag = 1;
}
staffDepartmentRelatedApiService.listByStaffId(staffId);
StaffStoreVO vo = new StaffStoreVO();
vo.setClerkCode(clerk.getClerkCode());
vo.setClerkId(clerk.getClerkId());
vo.setClerkType(clerk.getClerkType());
vo.setEnterpriseId(clerk.getEnterpriseId());
vo.setMainStoreFlag(mainStoreFlag);
vo.setPhoneNumber(clerk.getPhoneNumber());
vo.setStaffId(staffId);
vo.setStoreId(clerk.getStoreId());
vo.setStoreImg(store.getStoreImage());
vo.setStoreName(store.getStoreName());
vo.setWxEnterpriseId(wxEnterpriseId);
list.add(vo);
} }
} }
return resultResponse(HaoBanErrCode.ERR_1,list);
return resultResponse(HaoBanErrCode.ERR_1);
} }
} }
...@@ -177,6 +177,7 @@ public enum HaoBanErrCode { ...@@ -177,6 +177,7 @@ public enum HaoBanErrCode {
ERR_111143(111143,"code或者手机号码已存在"), ERR_111143(111143,"code或者手机号码已存在"),
ERR_111144(111144,"该企业或品牌已关联"), ERR_111144(111144,"该企业或品牌已关联"),
ERR_111145(111145, "已经解绑过了"),
// 企业设置 // 企业设置
ERR_200001(200001, "员工不存在"), ERR_200001(200001, "员工不存在"),
......
...@@ -9,7 +9,7 @@ public class AuditVO implements Serializable{ ...@@ -9,7 +9,7 @@ public class AuditVO implements Serializable{
private String auditReason; private String auditReason;
private Integer applyStatus; private Integer auditStatus;
private Date commitTime; private Date commitTime;
...@@ -50,12 +50,13 @@ public class AuditVO implements Serializable{ ...@@ -50,12 +50,13 @@ public class AuditVO implements Serializable{
this.auditReason = auditReason; this.auditReason = auditReason;
} }
public Integer getApplyStatus() {
return applyStatus; public Integer getAuditStatus() {
return auditStatus;
} }
public void setApplyStatus(Integer applyStatus) { public void setAuditStatus(Integer auditStatus) {
this.applyStatus = applyStatus; this.auditStatus = auditStatus;
} }
public Date getCommitTime() { public Date getCommitTime() {
......
...@@ -4,6 +4,8 @@ import java.io.Serializable; ...@@ -4,6 +4,8 @@ import java.io.Serializable;
public class ClerkStoreVO implements Serializable{ public class ClerkStoreVO implements Serializable{
private String clerkId;
private String clerkName; private String clerkName;
private String clerkCode; private String clerkCode;
...@@ -20,8 +22,47 @@ public class ClerkStoreVO implements Serializable{ ...@@ -20,8 +22,47 @@ public class ClerkStoreVO implements Serializable{
private Integer clerkType; private Integer clerkType;
private String staffId;
private String headImg; private String headImg;
private String storeAddress;
private Integer bindFlag;
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStoreAddress() {
return storeAddress;
}
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
public Integer getBindFlag() {
return bindFlag;
}
public void setBindFlag(Integer bindFlag) {
this.bindFlag = bindFlag;
}
public String getClerkName() { public String getClerkName() {
return clerkName; return clerkName;
} }
......
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
import java.util.Date;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class StaffStoreVO implements Serializable {
private static final long serialVersionUID = 1L;
private String storeId;
private String staffId;
private String storeName;
private String wxEnterpriseId;
private String enterpriseId;
private String clerkCode;
private String clerkId;
private String storeImg;
private int clerkType;
private Integer mainStoreFlag;
private String phoneNumber;
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStoreImg() {
return storeImg;
}
public void setStoreImg(String storeImg) {
this.storeImg = storeImg;
}
public int getClerkType() {
return clerkType;
}
public void setClerkType(int clerkType) {
this.clerkType = clerkType;
}
public Integer getMainStoreFlag() {
return mainStoreFlag;
}
public void setMainStoreFlag(Integer mainStoreFlag) {
this.mainStoreFlag = mainStoreFlag;
}
}
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