This commit is contained in:
linfso 2024-07-16 07:34:52 +08:00
parent 15b94b10ed
commit 9fa1cf8830
5 changed files with 38 additions and 4 deletions

View File

@ -18,6 +18,8 @@ import javax.validation.Valid;
import com.alibaba.fastjson.JSONObject;
import com.xdadan.erp.oms.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.oms.common.utils.DateUtils;
import com.xdadan.erp.oms.common.utils.HTTPHelperV3;
import com.xdadan.erp.oms.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.oms.domain.exception.EmisBizError;
import com.xdadan.erp.oms.domain.vo.*;
import com.xdadan.erp.oms.domain.wms.WmsWarehouse;
@ -215,8 +217,19 @@ public class Oms2cWaybillController extends BaseController
@PostMapping("/bindSalesmen")
public AjaxResult bindSalesmen(String empCode)
{
emisWaybillService.bindSalesmen(empCode);
return AjaxResult.success("绑定成功");
try {
emisWaybillService.bindSalesmen(empCode);
return AjaxResult.success("绑定成功");
}catch (Exception ex){
ex.printStackTrace();
// 返回子定义异常
if(ex instanceof EmisBizError){
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
}
return AjaxResult.error("服务器异常,联系客服");
}
}

View File

@ -50,6 +50,8 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
*/
public int insertBindSalesmen(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
/**
* 检查是否绑定
* @param customerCode
@ -58,6 +60,13 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
*/
public int checkIsBindSalesmen(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
/**
* 检查业务员是否存在
* @return
*/
public int checkEmpIsExist(@Param("empCode") String empCode);
/**
* 取消绑定
* @param customerCode

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import com.xdadan.erp.oms.domain.EmisWaybill;
import com.xdadan.erp.oms.domain.exception.EmisBizError;
/**
* @ClassName EmisWaybillService
@ -33,7 +34,7 @@ public interface IEmisWaybillService
public List<Map> selectUserBindSalesmenList(String searchValue);
public int bindSalesmen(String empCode);
public int bindSalesmen(String empCode) throws EmisBizError;

View File

@ -78,7 +78,13 @@ public class EmisWaybillServiceImpl implements IEmisWaybillService
}
@Override
public int bindSalesmen(String empCode){
public int bindSalesmen(String empCode) throws EmisBizError {
int eCnt=emisWaybillMapper.checkEmpIsExist(empCode);
if(eCnt==0){
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"业务员不存在");
}
String customerCode=SecurityUtils.getLoginUser().getUser().getCustomerCode();
int cnt=emisWaybillMapper.checkIsBindSalesmen(customerCode,empCode);

View File

@ -559,6 +559,11 @@
</if>
</select>
<select id="checkEmpIsExist" resultType="int">
select count(1) from sys_user where del_flag='0' and emp_code=#{empCode}
</select>
<select id="checkIsBindSalesmen" resultType="int">
select count(1) from sys_oms_user_bind_emp where customer_code=#{customerCode} and emp_code=#{empCode}
</select>