|
|
|
@ -3,6 +3,8 @@ package com.dxhy.order.baseservice.module.buyer.service.impl; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.model.DeptEntity; |
|
|
|
|
import com.dxhy.order.baseservice.module.thirdservice.user.service.UserInfoService; |
|
|
|
|
import com.dxhy.order.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoEnum; |
|
|
|
@ -24,6 +26,8 @@ import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -56,6 +60,9 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
@Resource |
|
|
|
|
private OpenApiService openApiService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private UserInfoService userInfoService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PageUtils queryBuyerList(Map<String, Object> paramMap, List<String> shList) { |
|
|
|
|
int pageSize = Integer.parseInt(String.valueOf(paramMap.get(ConfigureConstant.STRING_PAGE_SIZE))); |
|
|
|
@ -757,4 +764,53 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
} |
|
|
|
|
return buyerEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 引用购方信息 |
|
|
|
|
* |
|
|
|
|
* @param buyerName |
|
|
|
|
* @param buyerCode |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R quoteBuyer(String buyerName, String buyerCode, String xhfNsrshb) { |
|
|
|
|
if (StringUtils.isEmpty(buyerName) && StringUtils.isEmpty(buyerCode)) { |
|
|
|
|
return R.error("购方名称和购方编码不能同时为空!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(xhfNsrshb)) { |
|
|
|
|
return R.error(OrderInfoContentEnum.TAXCODE_ISNULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询当前账号是否存在购方信息
|
|
|
|
|
BuyerEntity buyer = buyerMapper.selectBuyerByCodeOrNameAndNsrsbh(buyerName, buyerCode, xhfNsrshb); |
|
|
|
|
if (buyer != null) { |
|
|
|
|
return R.error("此购方已经被引用"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
buyer = buyerMapper.selectBuyerByCodeOrNameAndNsrsbh(buyerName, buyerCode, "-1"); |
|
|
|
|
if (buyer == null) { |
|
|
|
|
return R.error("未找到购方信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据销方税号查一下销方信息
|
|
|
|
|
DeptEntity deptEntity = userInfoService.querySysDeptEntityFromUrl(xhfNsrshb, "", null); |
|
|
|
|
if (deptEntity == null) { |
|
|
|
|
return R.error("未找到销方信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BuyerEntity newBuyerEntity = new BuyerEntity(); |
|
|
|
|
BeanUtils.copyProperties(buyer, newBuyerEntity); |
|
|
|
|
|
|
|
|
|
newBuyerEntity.setId(baseService.getGenerateShotKey()); |
|
|
|
|
newBuyerEntity.setXhfNsrsbh(xhfNsrshb); |
|
|
|
|
newBuyerEntity.setXhfMc(deptEntity.getTaxpayerName()); |
|
|
|
|
newBuyerEntity.setCreateTime(new Date()); |
|
|
|
|
|
|
|
|
|
if (buyerMapper.insertBuyer(newBuyerEntity) > 0) { |
|
|
|
|
return R.ok(); |
|
|
|
|
} else { |
|
|
|
|
return R.error("引用失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|