Commit 664603e1 authored by lcl's avatar lcl

u

parent b895e4a2
package com.dsk.common.utils; package com.dsk.common.utils;
import java.math.BigDecimal;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -51,7 +52,8 @@ public class CheckUtils { ...@@ -51,7 +52,8 @@ public class CheckUtils {
* @return * @return
*/ */
public static int checkIntegerPlaces(Double number) { public static int checkIntegerPlaces(Double number) {
String strNumber = Double.toString(Math.abs(number)); BigDecimal bigDecimal = new BigDecimal(number);
String strNumber = bigDecimal.toString();
int integerPlaces = strNumber.indexOf('.'); int integerPlaces = strNumber.indexOf('.');
if (integerPlaces == -1) { if (integerPlaces == -1) {
return strNumber.length(); return strNumber.length();
...@@ -66,7 +68,8 @@ public class CheckUtils { ...@@ -66,7 +68,8 @@ public class CheckUtils {
* @return * @return
*/ */
public static int checkDecimalPlaces(Double number) { public static int checkDecimalPlaces(Double number) {
String strNumber = Double.toString(Math.abs(number)); BigDecimal bigDecimal = new BigDecimal(number);
String strNumber = bigDecimal.toString();
int decimalPlaces = 0; int decimalPlaces = 0;
int index = strNumber.indexOf('.'); int index = strNumber.indexOf('.');
if (index != -1) { if (index != -1) {
......
...@@ -3,6 +3,7 @@ package com.dsk.system.service.impl; ...@@ -3,6 +3,7 @@ package com.dsk.system.service.impl;
import cn.hutool.core.bean.BeanException; import cn.hutool.core.bean.BeanException;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.core.domain.R; import com.dsk.common.core.domain.R;
import com.dsk.common.exception.ServiceException; import com.dsk.common.exception.ServiceException;
...@@ -179,36 +180,38 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -179,36 +180,38 @@ public class CustomerServiceImpl implements ICustomerService {
private void dealWithcustomerData(Customer customer) { private void dealWithcustomerData(Customer customer) {
if (ObjectUtils.isEmpty(customer.getCompanyName())) throw new BeanException("企业名称不能为空"); if (ObjectUtils.isEmpty(customer.getCompanyName())) throw new BeanException("企业名称不能为空");
if (ObjectUtils.isEmpty(customer.getCompanyId())) { try {
try { Map<String, Object> map = opportunityRadarService.enterpriseByName(customer.getCompanyName());
Map<String, Object> map = opportunityRadarService.enterpriseByName(customer.getCompanyName()); if (!ObjectUtils.isEmpty(map.get("data"))) {
if (!ObjectUtils.isEmpty(map.get("data"))) { Integer companyId = MapUtil.getInt(BeanUtil.beanToMap(map.get("data")), "jskEid");
customer.setCompanyId(MapUtil.getInt(BeanUtil.beanToMap(map.get("data")), "jskEid")); if(ObjectUtil.isNotEmpty(customer.getCompanyId()) && customer.getCompanyId() != companyId) {
if (ObjectUtils.isEmpty(customer.getLegalPerson())) { return;
customer.setLegalPerson(MapUtil.getStr(map, "legalPerson")); }
} customer.setCompanyId(companyId);
if (ObjectUtils.isEmpty(customer.getRegisterCapital())) { if (ObjectUtils.isEmpty(customer.getLegalPerson())) {
customer.setRegisterCapital(MapUtil.getStr(map, "registeredCapitalStr")); customer.setLegalPerson(MapUtil.getStr(map, "legalPerson"));
} }
if (ObjectUtils.isEmpty(customer.getProvinceId())) { if (ObjectUtils.isEmpty(customer.getRegisterCapital())) {
customer.setProvinceId(MapUtil.getInt(map, "provinceId")); customer.setRegisterCapital(MapUtil.getStr(map, "registeredCapitalStr"));
} }
if (ObjectUtils.isEmpty(customer.getCityId())) { if (ObjectUtils.isEmpty(customer.getProvinceId())) {
customer.setCityId(MapUtil.getInt(map, "cityId")); customer.setProvinceId(MapUtil.getInt(map, "provinceId"));
} }
if (ObjectUtils.isEmpty(customer.getDistrictId())) { if (ObjectUtils.isEmpty(customer.getCityId())) {
customer.setDistrictId(MapUtil.getInt(map, "countyId")); customer.setCityId(MapUtil.getInt(map, "cityId"));
} }
if (ObjectUtils.isEmpty(customer.getRegisterAddress())) { if (ObjectUtils.isEmpty(customer.getDistrictId())) {
customer.setRegisterAddress(MapUtil.getStr(map, "domicile")); customer.setDistrictId(MapUtil.getInt(map, "countyId"));
} }
if (ObjectUtils.isEmpty(customer.getCreditCode())) { if (ObjectUtils.isEmpty(customer.getRegisterAddress())) {
customer.setCreditCode(MapUtil.getStr(map, "creditCode")); customer.setRegisterAddress(MapUtil.getStr(map, "domicile"));
} }
if (ObjectUtils.isEmpty(customer.getCreditCode())) {
customer.setCreditCode(MapUtil.getStr(map, "creditCode"));
} }
} catch (Exception e) {
log.debug("获取企业id错误!error:{}", e.getMessage());
} }
} catch (Exception e) {
log.debug("获取企业id错误!error:{}", e.getMessage());
} }
} }
......
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