Commit 2bd1fd1e by huangZW

111

parent 01c76d49
...@@ -29,6 +29,8 @@ public interface StaffClerkRelationApiService { ...@@ -29,6 +29,8 @@ public interface StaffClerkRelationApiService {
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId); StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation); String insert(StaffClerkRelationDTO staffClerkRelation);
void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation);
/** /**
* 解绑 * 解绑
......
...@@ -178,35 +178,27 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -178,35 +178,27 @@ public class AuditApiServiceImpl implements AuditApiService{
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue,AuditStaffDTO.class); AuditStaffDTO obj = JSONObject.parseObject(oldValue,AuditStaffDTO.class);
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(obj.getClerkCode(),tab.getEnterpriseId()); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(obj.getClerkCode(),tab.getEnterpriseId());
if(staffClerkRelation != null){ ClerkDTO clerkDTO = clerkService.getClerkByClerkId(obj.getClerkId());
logger.info("code已存在"); if(clerkDTO == null){
tab.setAuditStatus(5); tab.setAuditStatus(5);
tab.setAuditReason("gic已删除该导购");
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.fail.getCode(),tab); insertBatchLog( batchId,AuditRsultType.fail.getCode(),tab);
} }
return "0"; return "0";
}else{ }else{
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(obj.getClerkId()); if(staffClerkRelation == null){
if(clerkDTO == null){
tab.setAuditStatus(5);
tab.setAuditReason("gic已删除该导购");
auditMapper.updateByPrimaryKeySelective(tab);
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.fail.getCode(),tab);
}
return "0";
}else{
staffClerkRelation = new StaffClerkRelationDTO(); staffClerkRelation = new StaffClerkRelationDTO();
staffClerkRelation.setEnterpriseId(tab.getEnterpriseId());
staffClerkRelation.setClerkCode(obj.getClerkCode());
staffClerkRelation.setClerkId(obj.getClerkId());
staffClerkRelation.setStoreId(tab.getCommitStoreId());
staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId());
staffClerkRelation.setWxUserId(obj.getWxUserId());
staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.insert(staffClerkRelation);
} }
staffClerkRelation.setEnterpriseId(tab.getEnterpriseId());
staffClerkRelation.setClerkCode(obj.getClerkCode());
staffClerkRelation.setClerkId(obj.getClerkId());
staffClerkRelation.setStoreId(tab.getCommitStoreId());
staffClerkRelation.setWxEnterpriseId(tab.getWxEnterpriseId());
staffClerkRelation.setWxUserId(obj.getWxUserId());
staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.insertOrUpdate(staffClerkRelation);
} }
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.success.getCode(), tab); insertBatchLog( batchId,AuditRsultType.success.getCode(), tab);
......
...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; ...@@ -22,6 +22,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
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;
...@@ -144,6 +145,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -144,6 +145,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return staffClerkRelatinService.insert(staffClerkRelation); return staffClerkRelatinService.insert(staffClerkRelation);
} }
@Override @Override
public void insertOrUpdate(StaffClerkRelationDTO staffClerkRelation) {
if(StringUtils.isEmpty(staffClerkRelation.getStaffClerkRelationId())){
staffClerkRelatinService.insert(staffClerkRelation);
}else{
TabHaobanStaffClerkRelation tab = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
tabHaobanStaffClerkRelationMapper.updateByPrimaryKeySelective(tab);
}
}
@Override
public String delByStoreIdAndCode(String storeId, String clerkCode) { public String delByStoreIdAndCode(String storeId, String clerkCode) {
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode); tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
return null; return null;
......
...@@ -208,27 +208,25 @@ public class AuditController extends WebBaseController{ ...@@ -208,27 +208,25 @@ public class AuditController extends WebBaseController{
if(audit.getAuditType() == AuditType.CLERK_BIND.getCode()){ if(audit.getAuditType() == AuditType.CLERK_BIND.getCode()){
//导购绑定 //导购绑定
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,enterpriseId); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
if(staffClerkRelation != null){ ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
return resultResponse(HaoBanErrCode.ERR_111117); if(clerkDTO == null){
audit.setAuditStatus(5);
audit.setAuditReason("gic已删除该导购");
}else{ }else{
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); if(staffClerkRelation == null){
if(clerkDTO == null){
audit.setAuditStatus(5);
audit.setAuditReason("gic已删除该导购");
}else{
staffClerkRelation = new StaffClerkRelationDTO(); staffClerkRelation = new StaffClerkRelationDTO();
staffClerkRelation.setEnterpriseId(enterpriseId);
staffClerkRelation.setClerkCode(clerkCode);
staffClerkRelation.setClerkId(clerkId);
staffClerkRelation.setStoreId(storeId);
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insert(staffClerkRelation);
audit.setAuditStatus(1);
//发送消息
staffDepartmentRelatedApiService.sendClerkBind(clerkId, clerkCode, auditStatus, auditReason);
} }
staffClerkRelation.setEnterpriseId(enterpriseId);
staffClerkRelation.setClerkCode(clerkCode);
staffClerkRelation.setClerkId(clerkId);
staffClerkRelation.setStoreId(storeId);
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insertOrUpdate(staffClerkRelation);
audit.setAuditStatus(1);
//发送消息
staffDepartmentRelatedApiService.sendClerkBind(clerkId, clerkCode, auditStatus, auditReason);
} }
} }
if(audit.getAuditType() == AuditType.CLERK_ADD.getCode()){ if(audit.getAuditType() == AuditType.CLERK_ADD.getCode()){
......
...@@ -434,11 +434,14 @@ public class ClerkController extends WebBaseController{ ...@@ -434,11 +434,14 @@ public class ClerkController extends WebBaseController{
String wxEnterpriseId = staff.getWxEnterpriseId(); String wxEnterpriseId = staff.getWxEnterpriseId();
String wxUserId = staff.getWxUserId(); String wxUserId = staff.getWxUserId();
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,store.getEnterpriseId()); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,store.getEnterpriseId());
if(staffClerkRelation != null){ // if(staffClerkRelation != null){
return resultResponse(HaoBanErrCode.ERR_111117); // return resultResponse(HaoBanErrCode.ERR_111117);
} // }
if(auditType == 2){ if(auditType == 2){
//无需审核 //无需审核
if(staffClerkRelation == null){
staffClerkRelation = new StaffClerkRelationDTO();
}
staffClerkRelation = new StaffClerkRelationDTO(); staffClerkRelation = new StaffClerkRelationDTO();
staffClerkRelation.setClerkId(clerkId); staffClerkRelation.setClerkId(clerkId);
staffClerkRelation.setClerkCode(clerkCode); staffClerkRelation.setClerkCode(clerkCode);
...@@ -447,7 +450,8 @@ public class ClerkController extends WebBaseController{ ...@@ -447,7 +450,8 @@ public class ClerkController extends WebBaseController{
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId); staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId); staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelation.setStaffId(staffId); staffClerkRelation.setStaffId(staffId);
staffClerkRelationApiService.insert(staffClerkRelation);
staffClerkRelationApiService.insertOrUpdate(staffClerkRelation);
//无需审核 //无需审核
AuditDTO audit = new AuditDTO(); AuditDTO audit = new AuditDTO();
......
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