md
This commit is contained in:
parent
bf5348e94b
commit
25de31fb12
@ -195,42 +195,6 @@ public class EmisWaybillController extends EmisBaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 该方方法不要使用,跳转到开单界面
|
||||
* @param waybillOrder
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "确认接单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/confirmOrder1")
|
||||
public AjaxResult confirmOrder1(@Valid @RequestBody WaybillOrder waybillOrder)
|
||||
{
|
||||
try {
|
||||
|
||||
if(StringUtils.isEmpty(waybillOrder.getOrderSn()) ){
|
||||
return AjaxResult.error("订单号不能为空");
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybill = new EmisWaybill();
|
||||
emisWaybill.setOrderSn(waybillOrder.getOrderSn());
|
||||
// emisWaybill.setOrderRemark(waybillOrder.getOrderRemark());
|
||||
emisWaybillService.confirmOrder(emisWaybill);
|
||||
|
||||
return AjaxResult.success("保存成功");
|
||||
}catch(EmisBizError ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "取消运单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/cancelOrder")
|
||||
public AjaxResult cancelOrder(@Valid @RequestBody WaybillOrder waybillOrder)
|
||||
|
||||
@ -176,4 +176,69 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
*/
|
||||
public List<Map> getSiteDestStatInfoMap(EmisWaybill emisWaybill);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 专属业务员列表
|
||||
* @param customerCode
|
||||
* @param searchValue
|
||||
* @return
|
||||
*/
|
||||
public List<Map> selectUserBindSalesmenList(@Param("customerCode") String customerCode,@Param("searchValue")String searchValue);
|
||||
|
||||
|
||||
/**
|
||||
* 业务员信息查询
|
||||
* @param searchValue
|
||||
* @return
|
||||
*/
|
||||
public List<Map> queryNewSalesmen(@Param("searchValue")String searchValue);
|
||||
|
||||
|
||||
/**
|
||||
* 绑定专属业务员
|
||||
* @param customerCode
|
||||
* @param empCode
|
||||
* @return
|
||||
*/
|
||||
public int insertBindSalesmen(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否绑定
|
||||
* @param customerCode
|
||||
* @param empCode
|
||||
* @return
|
||||
*/
|
||||
public int checkIsBindSalesmen(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
|
||||
|
||||
|
||||
/**
|
||||
* 检查业务员是否存在
|
||||
* @return
|
||||
*/
|
||||
public int checkEmpIsExist(@Param("empCode") String empCode);
|
||||
|
||||
/**
|
||||
* 取消绑定
|
||||
* @param customerCode
|
||||
* @return
|
||||
*/
|
||||
public int cancelBindSalesmenDefault(@Param("customerCode") String customerCode);
|
||||
|
||||
/**
|
||||
* 删除绑定
|
||||
* @param customerCode
|
||||
* @param empCode
|
||||
* @return
|
||||
*/
|
||||
public int deleteBindSalesmen(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
|
||||
|
||||
|
||||
public int setBindSalesmenDefault(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -667,7 +667,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
}
|
||||
|
||||
// 新开单
|
||||
// OMS新开单,不允许修改
|
||||
if(isNew){
|
||||
addNewWaybillByOms(emisWaybillSave);
|
||||
}
|
||||
@ -758,7 +758,16 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
// 基础信息更新
|
||||
emisWaybillMapper.updateEmisWaybill(emisWaybillSave);
|
||||
// 绑定专属业务员
|
||||
String bindEmpCode=emisWaybillSave.getTakePieceEmployeeCode();
|
||||
if(StringUtils.isEmpty(bindEmpCode)){
|
||||
bindEmpCode=emisWaybillSave.getOperateEmployeeCode();
|
||||
}
|
||||
String customerCode=emisWaybillSave.getCustomerCode();
|
||||
|
||||
if(!StringUtils.isEmpty(bindEmpCode)&&!StringUtils.isEmpty(customerCode)) {
|
||||
bindSalesmen(bindEmpCode,customerCode);
|
||||
}
|
||||
// 扣减子单
|
||||
emisElectronicSitePagService.realMatchSubBill(emisWaybillSave.getSendSiteCode(),"T7080",emisWaybillSave.getParcelQty());
|
||||
|
||||
@ -899,12 +908,17 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
emisWaybillSave.setOrderSn(orderSn);
|
||||
}
|
||||
|
||||
if( StringUtils.isAnyEmpty(
|
||||
emisWaybillSave.getTransLineType(),
|
||||
emisWaybillSave.getProductType()
|
||||
)
|
||||
) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"线路、产品必填");
|
||||
// 下单用户必须存在
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getCustomerCode())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"下单客户不存在");
|
||||
}
|
||||
|
||||
if( StringUtils.isEmpty(emisWaybillSave.getTransLineType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"线路必填");
|
||||
}
|
||||
|
||||
if( StringUtils.isAnyEmpty(emisWaybillSave.getProductType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"产品必填");
|
||||
}
|
||||
|
||||
// 检查数据
|
||||
@ -933,9 +947,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"支付方式必填");
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getCalcFeeType())){
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"计费方式必填");
|
||||
emisWaybillSave.setCalcFeeType("1");
|
||||
}
|
||||
|
||||
@ -964,25 +976,28 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收货人信息不完整,名称, 电话,国家,省份,地址必填");
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getPackType())){
|
||||
emisWaybillSave.setPackType("2");
|
||||
// 目的网点
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getDispatchUnderlingSiteCode())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收件地址不在服务区域");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 寄件网点判断,若果没有寄件网点则使用南京分拨中心
|
||||
if(!StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())) {
|
||||
emisWaybillSave.setSendSiteCode("25000");
|
||||
}
|
||||
|
||||
|
||||
if(isNew) {
|
||||
if( emisWaybillSave.getSendDate()==null ){
|
||||
if( emisWaybillSave.getSendDate()==null ){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"发件日期必填");
|
||||
}
|
||||
}
|
||||
|
||||
// 登记网点
|
||||
// 登记网点,总部
|
||||
if(isNew) {
|
||||
if(!StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())) {
|
||||
emisWaybillSave.setRegisterSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
}else{
|
||||
// 没有寄件网点则登记网点放到总部
|
||||
emisWaybillSave.setRegisterSiteCode("88888");
|
||||
}
|
||||
emisWaybillSave.setRegisterSiteCode("88888");
|
||||
emisWaybillSave.setRegisterManCode("1");
|
||||
emisWaybillSave.setRegisterDate(new Date());
|
||||
}
|
||||
@ -991,11 +1006,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
emisWaybillSave.setDataFrom(WaybillHelper.getDataFrom());
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getPackType())){
|
||||
emisWaybillSave.setPackType("2");
|
||||
}
|
||||
|
||||
// 发件网点
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())){
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"寄件网点必填");
|
||||
emisWaybillSave.setSendSiteCode("88888");
|
||||
}else{
|
||||
if(!StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())){
|
||||
// 寄件网点财务中心
|
||||
EmisSite sendSite = getSiteByCode(emisWaybillSave.getSendSiteCode());
|
||||
if(sendSite!=null) {
|
||||
@ -1005,11 +1022,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
// oms 客户必须存在
|
||||
String customerCode = emisWaybillSave.getCustomerCode();
|
||||
String customerName = emisWaybillSave.getCustomerName();
|
||||
|
||||
// 订单运单初始状态 订单为已接单,运单未初始,待揽收
|
||||
emisWaybillSave.setOrderStatus("0");
|
||||
emisWaybillSave.setWaybillStatus("0");
|
||||
|
||||
// 计算三段码 目的网点2字码+目的地名称
|
||||
String destSite3Code = "";
|
||||
@ -1034,7 +1046,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 下单时间
|
||||
emisWaybillSave.setOrderDate(emisWaybillSave.getSendDate());
|
||||
|
||||
// 订单类型 0-客户下单
|
||||
// 订单类型 0-客户下单 1-系统开单 2-预录单
|
||||
emisWaybillSave.setOrderType("0");
|
||||
|
||||
// 寄件地址
|
||||
@ -1115,26 +1127,25 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
log.error("===OMS下单模式,计费错误:",ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
// 开单当天不算时效
|
||||
Date estDate = getEstimateDate(
|
||||
emisWaybillSave.getSendDate(),emisWaybillSave.getProductType(),
|
||||
emisWaybillSave.getSendCountry(),
|
||||
emisWaybillSave.getReceiveCountry(),0);
|
||||
|
||||
// 预计到达时间
|
||||
log.info("预估到达时间==>"+ DateUtils.dateTime(estDate));
|
||||
emisWaybillSave.setEstimateDate(estDate);
|
||||
|
||||
// 子单号
|
||||
if("1".equals(emisWaybillSave.getBlGenSubbill()) ){
|
||||
// 子单号拼接
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i=1;i<=emisWaybillSave.getParcelQty().intValue();i++){
|
||||
sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+",");
|
||||
}
|
||||
emisWaybillSave.setBillCodeSub(sb.toString());
|
||||
}
|
||||
// // 开单当天不算时效
|
||||
// Date estDate = getEstimateDate(
|
||||
// emisWaybillSave.getSendDate(),emisWaybillSave.getProductType(),
|
||||
// emisWaybillSave.getSendCountry(),
|
||||
// emisWaybillSave.getReceiveCountry(),0);
|
||||
//
|
||||
// // 预计到达时间
|
||||
// log.info("预估到达时间==>"+ DateUtils.dateTime(estDate));
|
||||
// emisWaybillSave.setEstimateDate(estDate);
|
||||
//
|
||||
// // 子单号
|
||||
// if("1".equals(emisWaybillSave.getBlGenSubbill()) ){
|
||||
// // 子单号拼接
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for(int i=1;i<=emisWaybillSave.getParcelQty().intValue();i++){
|
||||
// sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+",");
|
||||
// }
|
||||
// emisWaybillSave.setBillCodeSub(sb.toString());
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -1483,6 +1494,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
//补齐数据
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||
|
||||
// 绑定专属业务员
|
||||
String bindEmpCode=emisWaybillSave.getTakePieceEmployeeCode();
|
||||
if(StringUtils.isEmpty(bindEmpCode)){
|
||||
bindEmpCode=emisWaybillSave.getOperateEmployeeCode();
|
||||
}
|
||||
String customerCode=emisWaybillSave.getCustomerCode();
|
||||
|
||||
if(!StringUtils.isEmpty(bindEmpCode)&&!StringUtils.isEmpty(customerCode)) {
|
||||
bindSalesmen(bindEmpCode,customerCode);
|
||||
}
|
||||
|
||||
|
||||
// 扣减子单
|
||||
emisElectronicSitePagService.realMatchSubBill(emisWaybillSave.getSendSiteCode(),"T7080",emisWaybillSave.getParcelQty());
|
||||
|
||||
@ -1567,6 +1590,28 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
|
||||
public int bindSalesmen(String empCode,String customerCode) throws EmisBizError {
|
||||
|
||||
int eCnt=emisWaybillMapper.checkEmpIsExist(empCode);
|
||||
if(eCnt==0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cnt=emisWaybillMapper.checkIsBindSalesmen(customerCode,empCode);
|
||||
if(cnt==0){
|
||||
emisWaybillMapper.insertBindSalesmen(customerCode,empCode);
|
||||
}
|
||||
|
||||
// 取消全部默认
|
||||
emisWaybillMapper.cancelBindSalesmenDefault(customerCode);
|
||||
|
||||
// 设置默认
|
||||
emisWaybillMapper.setBindSalesmenDefault(customerCode,empCode);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Oms 新开单
|
||||
* @param emisWaybillSave
|
||||
@ -1577,12 +1622,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 公共计算部分
|
||||
calcWayBillCommonInfoByOms(emisWaybillSave,true);
|
||||
|
||||
//补齐数据
|
||||
// 插入运单数据
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||
|
||||
// 扣减子单
|
||||
// emisElectronicSitePagService.realMatchSubBill(emisWaybillSave.getSendSiteCode(),"T7080",emisWaybillSave.getParcelQty());
|
||||
|
||||
// 产生主键插入其他数据
|
||||
// 插入费用
|
||||
List<EmisWaybillFeeitem> feeitemList=emisWaybillSave.getFeeitemList();
|
||||
@ -1643,10 +1685,20 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
emisWaybillSave.preUpdate();
|
||||
|
||||
|
||||
// 基础信息更新
|
||||
emisWaybillMapper.updateEmisWaybill(emisWaybillSave);
|
||||
|
||||
// 绑定专属业务员
|
||||
String bindEmpCode=emisWaybillSave.getTakePieceEmployeeCode();
|
||||
if(StringUtils.isEmpty(bindEmpCode)){
|
||||
bindEmpCode=emisWaybillSave.getOperateEmployeeCode();
|
||||
}
|
||||
String customerCode=emisWaybillSave.getCustomerCode();
|
||||
|
||||
if(!StringUtils.isEmpty(bindEmpCode)&&!StringUtils.isEmpty(customerCode)) {
|
||||
bindSalesmen(bindEmpCode,customerCode);
|
||||
}
|
||||
|
||||
// 删除旧信息
|
||||
emisWaybillFeeitemMapper.deleteEmisWaybillFeeitemByWaybillId(emisWaybillSave.getId());
|
||||
|
||||
|
||||
@ -2381,4 +2381,72 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectUserBindSalesmenList" resultType="map">
|
||||
SELECT
|
||||
b.emp_code AS empCode,
|
||||
b.emp_name AS empName,
|
||||
b.extra_data AS rate,
|
||||
b.avatar,
|
||||
b.phonenumber AS phone,
|
||||
b.owner_site_code AS ownerSiteCode,
|
||||
'' AS ownerSiteName,
|
||||
a.default_flag as defaultFlag
|
||||
FROM
|
||||
sys_oms_user_bind_emp a,
|
||||
sys_user b
|
||||
WHERE
|
||||
a.emp_code = b.emp_code
|
||||
AND a.customer_code = #{customerCode}
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and b.emp_name like concat('%', #{searchValue}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryNewSalesmen" resultType="map">
|
||||
SELECT
|
||||
a.emp_code AS empCode,
|
||||
a.emp_name AS empName,
|
||||
a.extra_data AS rate,
|
||||
a.avatar,
|
||||
a.phonenumber AS phone,
|
||||
a.owner_site_code AS ownerSiteCode,
|
||||
b.site_name AS ownerSiteName
|
||||
FROM
|
||||
sys_user a,emis_site b
|
||||
WHERE a.owner_site_code=b.site_code
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and (a.emp_code=#{searchValue} or a.phonenumber=#{searchValue})
|
||||
</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>
|
||||
|
||||
<delete id="cancelBindSalesmenDefault" parameterType="String">
|
||||
update sys_oms_user_bind_emp set default_flag='0' where customer_code=#{customerCode}
|
||||
</delete>
|
||||
|
||||
<delete id="setBindSalesmenDefault" parameterType="String">
|
||||
update sys_oms_user_bind_emp set default_flag='1' where customer_code=#{customerCode} and emp_code=#{empCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBindSalesmen" parameterType="String">
|
||||
delete from sys_oms_user_bind_emp where customer_code=#{customerCode} and emp_code=#{empCode}
|
||||
</delete>
|
||||
|
||||
<insert id="insertBindSalesmen" parameterType="String" >
|
||||
insert into sys_oms_user_bind_emp(customer_code,emp_code) values(#{customerCode}, #{empCode})
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user