feat:引用客商

gongquanlin 2 years ago committed by WangQi
parent 5d995778f0
commit 770768d83e
  1. 21
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/controller/BuyerController.java
  2. 2
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/dao/BuyerMapper.java
  3. 9
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/BuyerService.java
  4. 56
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java
  5. 39
      order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml

@ -287,4 +287,25 @@ public class BuyerController {
return R.ok().put(OrderManagementConstant.DATA, buyerEntity); return R.ok().put(OrderManagementConstant.DATA, buyerEntity);
} }
/**
* 引用总部购方信息
*/
@PostMapping("/quote")
@ApiOperation(value = "引用购方信息", notes = "购房信息列表-引用购方信息")
public R quote(@RequestParam Map<String, Object> map) {
String buyerName = (String) map.get("buyerName"); // 购方名称
String buyerCode = (String) map.get("buyerCode"); // 购方编码
if (StringUtils.isEmpty(buyerName) && StringUtils.isEmpty(buyerCode)) {
return R.error("购方名称和购方编码不能同时为空!");
}
String xhfNsrsbh = (String) map.get("xhfNsrsbh"); // 销方信息
if (StringUtils.isBlank(xhfNsrsbh)) {
return R.error(OrderInfoContentEnum.TAXCODE_ISNULL);
}
return buyerService.quoteBuyer(buyerName, buyerCode, xhfNsrsbh);
}
} }

@ -50,6 +50,8 @@ public interface BuyerMapper {
*/ */
int selectBuyerByName(@Param("map") Map<String, String> map, @Param("shList") List<String> shList); int selectBuyerByName(@Param("map") Map<String, String> map, @Param("shList") List<String> shList);
BuyerEntity selectBuyerByCodeOrNameAndNsrsbh(@Param("buyerName") String buyerName, @Param("buyerCode") String buyerCode, @Param("nsrsbh") String nsrsbh);
/** /**
* 根据销方税号,购方名称和购方税号获取购方信息 * 根据销方税号,购方名称和购方税号获取购方信息
* *

@ -112,4 +112,13 @@ public interface BuyerService {
* @return * @return
*/ */
BuyerEntity autoQueryBuyerInfo(String ghfMc, String buyerCode, List<String> shList, List<String> entList); BuyerEntity autoQueryBuyerInfo(String ghfMc, String buyerCode, List<String> shList, List<String> entList);
/**
* 引用购方信息
*
* @param buyerName
* @param buyerCode
* @return
*/
R quoteBuyer(String buyerName, String buyerCode, String xhfNsrshb);
} }

@ -3,6 +3,8 @@ package com.dxhy.order.baseservice.module.buyer.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.ConfigureConstant;
import com.dxhy.order.constant.OrderInfoContentEnum; import com.dxhy.order.constant.OrderInfoContentEnum;
import com.dxhy.order.constant.OrderInfoEnum; import com.dxhy.order.constant.OrderInfoEnum;
@ -24,6 +26,8 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -56,6 +60,9 @@ public class BuyerServiceImpl implements BuyerService {
@Resource @Resource
private OpenApiService openApiService; private OpenApiService openApiService;
@Autowired
private UserInfoService userInfoService;
@Override @Override
public PageUtils queryBuyerList(Map<String, Object> paramMap, List<String> shList) { public PageUtils queryBuyerList(Map<String, Object> paramMap, List<String> shList) {
int pageSize = Integer.parseInt(String.valueOf(paramMap.get(ConfigureConstant.STRING_PAGE_SIZE))); int pageSize = Integer.parseInt(String.valueOf(paramMap.get(ConfigureConstant.STRING_PAGE_SIZE)));
@ -757,4 +764,53 @@ public class BuyerServiceImpl implements BuyerService {
} }
return buyerEntity; 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("引用失败");
}
}
} }

@ -728,6 +728,45 @@
</where> </where>
</select> </select>
<select id="selectBuyerByCodeOrNameAndNsrsbh" resultMap="BaseResultMap">
<bind name="dataType" value="${dataType}"/>
SELECT
id,
taxpayer_code,
purchase_name,
address,
phone,
bank_of_deposit,
bank_number,
email,
sjh,
remarks,
create_user_id,
<if test="dataType == 0">
DATE_FORMAT(create_time,'%Y-%m-%d') as createTime,
DATE_FORMAT(modify_time,'%Y-%m-%d') as modifyTime,
</if>
<if test="dataType == 1">
to_char(create_time,'yyyy-MM-dd') as createTime,
to_char(modify_time,'yyyy-MM-dd') as modifyTime,
</if>
modify_user_id,
ghf_qylx
FROM
buyer_manage_info
<where>
<if test="buyerCode != null and buyerCode != ''">
and buyer_code = #{buyerCode,jdbcType=VARCHAR}
</if>
<if test="buyerName != null and buyerName != ''">
and buyer_name = #{buyerName,jdbcType=VARCHAR}
</if>
<if test="nsrsbh != null and nsrsbh != ''">
and xhf_nsrsbh = #{nsrsbh,jdbcType=VARCHAR}
</if>
</where>
</select>
<delete id="deleteBuyerById" parameterType="String"> <delete id="deleteBuyerById" parameterType="String">
DELETE DELETE
FROM buyer_manage_info FROM buyer_manage_info

Loading…
Cancel
Save