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,11 +180,14 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -179,11 +180,14 @@ 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"))) {
customer.setCompanyId(MapUtil.getInt(BeanUtil.beanToMap(map.get("data")), "jskEid")); Integer companyId = MapUtil.getInt(BeanUtil.beanToMap(map.get("data")), "jskEid");
if(ObjectUtil.isNotEmpty(customer.getCompanyId()) && customer.getCompanyId() != companyId) {
return;
}
customer.setCompanyId(companyId);
if (ObjectUtils.isEmpty(customer.getLegalPerson())) { if (ObjectUtils.isEmpty(customer.getLegalPerson())) {
customer.setLegalPerson(MapUtil.getStr(map, "legalPerson")); customer.setLegalPerson(MapUtil.getStr(map, "legalPerson"));
} }
...@@ -210,6 +214,5 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -210,6 +214,5 @@ public class CustomerServiceImpl implements ICustomerService {
log.debug("获取企业id错误!error:{}", e.getMessage()); 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