Commit 1a7fd02a by huangZW

111

parent bf3f468a
...@@ -20,14 +20,42 @@ public class AuditStaffDTO implements Serializable{ ...@@ -20,14 +20,42 @@ public class AuditStaffDTO implements Serializable{
private String staffName; private String staffName;
private String phoneNumber;
private String nationCode;
private Integer sex;
private String headPic; private String headPic;
private Integer bindType;
private Integer addOrDel;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNationCode() {
return nationCode;
}
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
} }
...@@ -92,21 +120,6 @@ public class AuditStaffDTO implements Serializable{ ...@@ -92,21 +120,6 @@ public class AuditStaffDTO implements Serializable{
this.headPic = headPic; this.headPic = headPic;
} }
public Integer getBindType() {
return bindType;
}
public void setBindType(Integer bindType) {
this.bindType = bindType;
}
public Integer getAddOrDel() {
return addOrDel;
}
public void setAddOrDel(Integer addOrDel) {
this.addOrDel = addOrDel;
}
} }
package com.gic.haoban.manage.api.enums;
/**
* Created by tgs on 2020/2/20.
*/
public enum AuditRsultType {
success(1, "成功"),
fail(0,"失败");
AuditRsultType(Integer type, String desc){
this.code = type;
this.desc = desc;
}
private int code;
private String desc;
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
package com.gic.haoban.manage.api.enums;
/**
* Created by tgs on 2020/2/20.
*/
public enum AuditType {
STORE_CHANGE(1, "门店信息变更"),
CLERK_BIND(2,"导购绑定"),
CLERK_ADD(3,"导购新增"),
CLERK_DEL(4,"导购删除"),
CLERK_UNBIND(5,"导购解除绑定");
AuditType(Integer type, String desc){
this.code = type;
this.desc = desc;
}
private int code;
private String desc;
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
...@@ -84,7 +84,11 @@ ...@@ -84,7 +84,11 @@
<artifactId>gic-enterprise-api</artifactId> <artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version> <version>${gic-enterprise-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-communicate-api</artifactId>
<version>${haoban-communicate-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId> <artifactId>haoban-message-api</artifactId>
......
...@@ -28,11 +28,17 @@ import com.gic.enterprise.api.service.StoreService; ...@@ -28,11 +28,17 @@ import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
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.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;
import com.gic.haoban.manage.api.enums.AuditRsultType;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.StoreFieldEnum; import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
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.DepartmentMapper; import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
...@@ -77,6 +83,11 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -77,6 +83,11 @@ public class AuditApiServiceImpl implements AuditApiService{
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService; private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired @Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Autowired
private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Override @Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId, public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
...@@ -130,7 +141,7 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -130,7 +141,7 @@ public class AuditApiServiceImpl implements AuditApiService{
tab.setUpdateTime(new Date()); tab.setUpdateTime(new Date());
tab.setAuditName(auditName); tab.setAuditName(auditName);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
if(auditType == 1){ if(auditType == AuditType.STORE_CHANGE.getCode()){
//门店信息变更 //门店信息变更
String storeId = tab.getCommitStoreId(); String storeId = tab.getCommitStoreId();
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
...@@ -146,27 +157,54 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -146,27 +157,54 @@ public class AuditApiServiceImpl implements AuditApiService{
this.sendMessageByStaffId(staffId, storeId, title, content); this.sendMessageByStaffId(staffId, storeId, title, content);
//插入log //插入log
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab); insertBatchLog( batchId,AuditRsultType.success.getCode(), tab);
}
}else if(auditType == AuditType.CLERK_BIND.getCode()){
String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue,AuditStaffDTO.class);
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(obj.getClerkCode(),tab.getEnterpriseId());
if(staffClerkRelation != null){
logger.info("code已存在");
return "0";
}else{
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());
staffClerkRelationApiService.insert(staffClerkRelation);
} }
}else if(auditType == 2){
//TODO 审核通过,处理事项
//门店导购绑定 //门店导购绑定
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab); insertBatchLog( batchId,AuditRsultType.success.getCode(), tab);
}
}else if(auditType == AuditType.CLERK_ADD.getCode()){
String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue,AuditStaffDTO.class);
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(tab.getCommitStoreId(), obj.getClerkCode(), obj.getSex(), obj.getStaffName(), obj.getPhoneNumber(), obj.getNationCode(), null);
if(!flag){
//门店导购新增
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId,AuditRsultType.fail.getCode(), tab);
return "0";
}
} }
}else if(auditType == 3){
//TODO 审核通过,处理事项
//门店导购新增 //门店导购新增
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab); insertBatchLog( batchId,1, tab);
} }
}else if(auditType == 4){ }else if(auditType == AuditType.CLERK_DEL.getCode()){
//TODO 审核通过,处理事项 String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue,AuditStaffDTO.class);
syncHaobanToGicServiceApi.delGicClerk(obj.getClerkId());
//门店导购删除 //门店导购删除
if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){ if(org.apache.commons.lang.StringUtils.isNotBlank(batchId)){
insertBatchLog( batchId, tab); insertBatchLog( batchId,AuditRsultType.success.getCode(),tab);
} }
}else if(auditType == 5){ }else if(auditType == AuditType.CLERK_UNBIND.getCode()){
//解绑申请,无需审核,直接通过 //解绑申请,无需审核,直接通过
} }
return ""; return "";
...@@ -373,13 +411,13 @@ public class AuditApiServiceImpl implements AuditApiService{ ...@@ -373,13 +411,13 @@ public class AuditApiServiceImpl implements AuditApiService{
return PageUtil.changePageHelperToCurrentPage(auditMapper.pageStoreListByParams(storeId,auditType,auditStatus),AuditDTO.class); return PageUtil.changePageHelperToCurrentPage(auditMapper.pageStoreListByParams(storeId,auditType,auditStatus),AuditDTO.class);
} }
public void insertBatchLog(String batchId,TabHaobanAudit tab){ public void insertBatchLog(String batchId,int auditResult,TabHaobanAudit tab){
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(tab.getEnterpriseId()); EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(tab.getEnterpriseId());
TabHaobanBatchAuditLog batTab = new TabHaobanBatchAuditLog(); TabHaobanBatchAuditLog batTab = new TabHaobanBatchAuditLog();
batTab.setAuditId(tab.getAuditId()); batTab.setAuditId(tab.getAuditId());
batTab.setBatchAuditLogId(UuidUtil.randomUUID()); batTab.setBatchAuditLogId(UuidUtil.randomUUID());
batTab.setAuditType(tab.getAuditType()); batTab.setAuditType(tab.getAuditType());
batTab.setAuditResult(1); batTab.setAuditResult(auditResult);
batTab.setBatchId(batchId); batTab.setBatchId(batchId);
batTab.setCommitName(tab.getCommitName()); batTab.setCommitName(tab.getCommitName());
batTab.setCommitTime(tab.getCommitTime()); batTab.setCommitTime(tab.getCommitTime());
......
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