Commit 80c84e18 by qwmqiuwenmin

fix

parent 24bd27f6
......@@ -26,6 +26,8 @@ import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.ShowFrontMessageException;
import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
......@@ -46,6 +48,7 @@ import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.ClerkVo;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
@RestController
public class ClerkController extends WebBaseController{
......@@ -267,13 +270,36 @@ public class ClerkController extends WebBaseController{
if(StringUtils.isBlank(staffName)) {
return resultResponse(HaoBanErrCode.ERR_10004);
}
if(!GooglePhoneNumberUtil.checkPhoneNumber(phoneNumber, nationcode)){
return resultResponse(HaoBanErrCode.ERR_10012);
}
StaffDTO staff = staffApiService.selectByNationcodeAndPhoneNumber(wxEnterpriseId,nationcode,phoneNumber);
if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005);
}
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion);
if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010);
com.gic.enterprise.api.dto.StoreDTO store = storeService.getStoreByIdNoStatus(storeId);
//校验手机是否唯一
if (store == null) {
return resultResponse(HaoBanErrCode.ERR_400001);
}
ClerkDTO clerk = clerkService.getClerkByCodeNoDel(store.getEnterpriseId(), clerkCode);
if(clerk != null){
DepartmentDTO department = departmentApiService.selectByRelatedId(storeId);
if(department == null){
return resultResponse(HaoBanErrCode.ERR_400001);
}
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndCode(department.getDepartmentId(), clerkCode);
if(staffRelated != null){
return resultResponse(HaoBanErrCode.ERR_10013);
}
}
if(clerk != null && StringUtils.isNotBlank(clerk.getPhoneNumber())){
syncHaobanToGicServiceApi.syncHaobanClerkPhoneNumberToGic(clerk.getClerkId(), clerk.getPhoneNumber());
}else{
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staffName, phoneNumber, nationcode, postion);
if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010);
}
}
return resultResponse(HaoBanErrCode.ERR_1);
}
......
......@@ -194,9 +194,13 @@ public enum HaoBanErrCode {
ERR_10009(10009,"门店不存在"),
ERR_10010(10010,"gic新增失败"),
ERR_10011(10011,"每月最多可刷新4次"),
ERR_10012(10012,"手机号格式不正确"),
ERR_10013(10013,"code已经存在"),
ERR_999(999, "操作失败"),
ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code");
private int code;
private String msg;
......
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