| package com.doumee.service.business.impl; | 
|   | 
| import com.alibaba.fastjson.JSONObject; | 
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
| import com.doumee.biz.system.SystemDictDataBiz; | 
| import com.doumee.core.annotation.excel.ExcelImporter; | 
| import com.doumee.core.constants.ResponseStatus; | 
| import com.doumee.core.exception.BusinessException; | 
| import com.doumee.core.utils.Constants; | 
| import com.doumee.core.utils.HttpsUtil; | 
| import com.doumee.dao.admin.request.JkCustomerImport; | 
| import com.doumee.dao.admin.request.JkLineImport; | 
| import com.doumee.dao.business.JkLineMapper; | 
| import com.doumee.dao.business.model.*; | 
| import com.doumee.dao.system.model.SystemUser; | 
| import com.doumee.service.business.third.model.LoginUserInfo; | 
| import com.doumee.service.business.third.model.PageData; | 
| import com.doumee.service.business.third.model.PageWrap; | 
| import com.doumee.core.utils.Utils; | 
| import com.doumee.dao.business.JkCustomerMapper; | 
| import com.doumee.service.business.JkCustomerService; | 
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
| import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
| import com.baomidou.mybatisplus.core.metadata.IPage; | 
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
| import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.apache.commons.lang3.StringUtils; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.data.redis.core.RedisTemplate; | 
| import org.springframework.stereotype.Service; | 
| import org.springframework.transaction.annotation.Transactional; | 
| import org.springframework.util.CollectionUtils; | 
| import org.springframework.web.multipart.MultipartFile; | 
|   | 
| import java.math.BigDecimal; | 
| import java.math.RoundingMode; | 
| import java.util.ArrayList; | 
| import java.util.Date; | 
| import java.util.List; | 
| import java.util.concurrent.TimeUnit; | 
|   | 
| /** | 
|  * 交控-客户信息表Service实现 | 
|  * @author 江蹄蹄 | 
|  * @date 2025/09/28 09:01 | 
|  */ | 
| @Service | 
| @Slf4j | 
| public class JkCustomerServiceImpl implements JkCustomerService { | 
|   | 
|     @Autowired | 
|     private JkCustomerMapper jkCustomerMapper; | 
|     @Autowired | 
|     private JkLineMapper jkLineMapper; | 
|     @Autowired | 
|     private SystemDictDataBiz systemDictDataBiz; | 
|   | 
|     @Autowired | 
|     private RedisTemplate<String, Object> redisTemplate; | 
|     @Override | 
|     public Integer create(JkCustomer jkCustomer) { | 
|         jkCustomerMapper.insert(jkCustomer); | 
|         return jkCustomer.getId(); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteById(Integer id,LoginUserInfo user) { | 
|         jkCustomerMapper.update(null,new UpdateWrapper<JkCustomer>().lambda() | 
|                 .set(JkCustomer::getIsdeleted,Constants.ONE) | 
|                 .set(JkCustomer::getEditor,user.getId()) | 
|                 .set(JkCustomer::getEditDate,new Date()) | 
|                 .eq(JkCustomer::getId,id) | 
|         ); | 
|     } | 
|   | 
|     @Override | 
|     public void delete(JkCustomer jkCustomer) { | 
|         UpdateWrapper<JkCustomer> deleteWrapper = new UpdateWrapper<>(jkCustomer); | 
|         jkCustomerMapper.delete(deleteWrapper); | 
|     } | 
|   | 
|     @Override | 
|     public void deleteByIdInBatch(List<Integer> ids,LoginUserInfo user) { | 
|         if (CollectionUtils.isEmpty(ids)) { | 
|             return; | 
|         } | 
|         jkCustomerMapper.update(null,new UpdateWrapper<JkCustomer>().lambda() | 
|                 .set(JkCustomer::getIsdeleted,Constants.ONE) | 
|                 .set(JkCustomer::getEditor,user.getId()) | 
|                 .set(JkCustomer::getEditDate,new Date()) | 
|                 .in(JkCustomer::getId,ids) | 
|         ); | 
|     } | 
|   | 
|     @Override | 
|     public void updateById(JkCustomer jkCustomer) { | 
|         if(jkCustomer.getId() == null | 
|             ||jkCustomer.getLocationInfo() ==null ){ | 
|                 throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|         } | 
|         String[] strs = jkCustomer.getLocationInfo().split(","); | 
|         jkCustomer.setLongitude(getDecimalByVal(strs[0]));//经度 | 
|         jkCustomer.setLatitude(strs.length>1?getDecimalByVal(strs[1]):null);//纬度 | 
|         if(jkCustomer.getLatitude() == null || jkCustomer.getLongitude() ==null){ | 
|             //非成对出现,无效经纬度不维护 | 
|             throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|         } | 
|   | 
|         jkCustomerMapper.update(null,new UpdateWrapper<JkCustomer>().lambda() | 
|                 .set(JkCustomer::getLatitude,jkCustomer.getLatitude()) | 
|                 .set(JkCustomer::getLongitude,jkCustomer.getLongitude()) | 
|                 .set(JkCustomer::getEditor,jkCustomer.getLoginUserInfo().getId()) | 
|                 .set(JkCustomer::getStartDistance,null) | 
|                 .set(JkCustomer::getEndDistance,null) | 
|                 .set(JkCustomer::getStartSteps,null) | 
|                 .set(JkCustomer::getEndSteps,null) | 
|                 .set(JkCustomer::getDistanceStatus,Constants.ZERO) | 
|                 .set(JkCustomer::getDistance,null) | 
|                 .set(JkCustomer::getEditDate,new Date()) | 
|                 .eq(JkCustomer::getId,jkCustomer.getId()) | 
|         ); | 
|     } | 
|   | 
|     @Override | 
|     public void updateByIdInBatch(List<JkCustomer> jkCustomers) { | 
|         if (CollectionUtils.isEmpty(jkCustomers)) { | 
|             return; | 
|         } | 
|         for (JkCustomer jkCustomer: jkCustomers) { | 
|             this.updateById(jkCustomer); | 
|         } | 
|     } | 
|   | 
|     @Override | 
|     public JkCustomer findById(Integer id) { | 
|         return jkCustomerMapper.selectById(id); | 
|     } | 
|   | 
|     @Override | 
|     public JkCustomer findOne(JkCustomer jkCustomer) { | 
|         QueryWrapper<JkCustomer> wrapper = new QueryWrapper<>(jkCustomer); | 
|         return jkCustomerMapper.selectOne(wrapper); | 
|     } | 
|   | 
|     @Override | 
|     public List<JkCustomer> findList(JkCustomer jkCustomer) { | 
|         QueryWrapper<JkCustomer> wrapper = new QueryWrapper<>(jkCustomer); | 
|         return jkCustomerMapper.selectList(wrapper); | 
|     } | 
|    | 
|     @Override | 
|     public PageData<JkCustomer> findPage(PageWrap<JkCustomer> pageWrap) { | 
|         IPage<JkCustomer> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); | 
|         MPJLambdaWrapper<JkCustomer> queryWrapper = new MPJLambdaWrapper<>(); | 
|         Utils.MP.blankToNull(pageWrap.getModel()); | 
|         pageWrap.getModel().setIsdeleted(Constants.ZERO); | 
|         queryWrapper.selectAll(JkCustomer.class ) | 
|                 .selectAs(JkLine::getName,JkCustomer::getLineName) | 
|                 .selectAs(JkLine::getWeeks,JkCustomer::getLineWeeks) | 
|                 .selectAs(Category::getId,JkCustomer::getCategoryId) | 
|                 .selectAs(Category::getName,JkCustomer::getCategoryName) | 
|                 .leftJoin(JkLine.class,JkLine::getId,JkCustomer::getLineId ) | 
|                 .leftJoin(Category.class,Category::getId,JkLine::getCategoryId ); | 
|         queryWrapper.eq( pageWrap.getModel().getDistanceStatus()!=null,JkCustomer::getDistanceStatus, pageWrap.getModel().getDistanceStatus()); | 
|         queryWrapper.eq( pageWrap.getModel().getCategoryId()!=null,JkLine::getCategoryId, pageWrap.getModel().getCategoryId()); | 
|         queryWrapper.eq(StringUtils.isNotBlank(pageWrap.getModel().getLineWeeks()),JkLine::getWeeks, pageWrap.getModel().getLineWeeks()); | 
|         queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getCategoryName()),Category::getName, pageWrap.getModel().getCategoryName()); | 
|         queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getLineName()),JkLine::getName, pageWrap.getModel().getLineName()); | 
|         queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getCategoryName()),Category::getName, pageWrap.getModel().getCategoryName()); | 
|         if (pageWrap.getModel().getId() != null) { | 
|             queryWrapper.eq(JkCustomer::getId, pageWrap.getModel().getId()); | 
|         } | 
|         if (pageWrap.getModel().getCreator() != null) { | 
|             queryWrapper.eq(JkCustomer::getCreator, pageWrap.getModel().getCreator()); | 
|         } | 
|         if (pageWrap.getModel().getCreateDate() != null) { | 
|             queryWrapper.ge(JkCustomer::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); | 
|             queryWrapper.le(JkCustomer::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); | 
|         } | 
|         if (pageWrap.getModel().getEditor() != null) { | 
|             queryWrapper.eq(JkCustomer::getEditor, pageWrap.getModel().getEditor()); | 
|         } | 
|         if (pageWrap.getModel().getEditDate() != null) { | 
|             queryWrapper.ge(JkCustomer::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); | 
|             queryWrapper.le(JkCustomer::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); | 
|         } | 
|         if (pageWrap.getModel().getIsdeleted() != null) { | 
|             queryWrapper.eq(JkCustomer::getIsdeleted, pageWrap.getModel().getIsdeleted()); | 
|         } | 
|         if (pageWrap.getModel().getInfo() != null) { | 
|             queryWrapper.eq(JkCustomer::getInfo, pageWrap.getModel().getInfo()); | 
|         } | 
|         if (pageWrap.getModel().getName() != null) { | 
|             queryWrapper.like(JkCustomer::getName, pageWrap.getModel().getName()); | 
|         } | 
|         if (pageWrap.getModel().getCode() != null) { | 
|             queryWrapper.like(JkCustomer::getCode, pageWrap.getModel().getCode()); | 
|         } | 
|         if (pageWrap.getModel().getLocation() != null) { | 
|             queryWrapper.like(JkCustomer::getLocation, pageWrap.getModel().getLocation()); | 
|         } | 
|         if (pageWrap.getModel().getLongitude() != null) { | 
|             queryWrapper.eq(JkCustomer::getLongitude, pageWrap.getModel().getLongitude()); | 
|         } | 
|         if (pageWrap.getModel().getLatitude() != null) { | 
|             queryWrapper.eq(JkCustomer::getLatitude, pageWrap.getModel().getLatitude()); | 
|         } | 
|         if (pageWrap.getModel().getSortno() != null) { | 
|             queryWrapper.eq(JkCustomer::getSortno, pageWrap.getModel().getSortno()); | 
|         } | 
|         if (pageWrap.getModel().getLineId() != null) { | 
|             queryWrapper.eq(JkCustomer::getLineId, pageWrap.getModel().getLineId()); | 
|         } | 
|         if (pageWrap.getModel().getStatus() != null) { | 
|             queryWrapper.eq(JkCustomer::getStatus, pageWrap.getModel().getStatus()); | 
|         } | 
|         if (pageWrap.getModel().getSortnum() != null) { | 
|             queryWrapper.eq(JkCustomer::getSortnum, pageWrap.getModel().getSortnum()); | 
|         } | 
|   | 
|         queryWrapper.orderByAsc(JkCustomer::getCode); | 
|         IPage<JkCustomer> result = jkCustomerMapper.selectJoinPage(page, JkCustomer.class,queryWrapper); | 
|         if(result.getRecords()!=null && result.getRecords().size()>0){ | 
|             for(JkCustomer model :result.getRecords()){ | 
|                 if(model.getLongitude()!=null && model.getLatitude()!=null){ | 
|                     model.setLocationInfo(model.getLongitude().setScale(6, RoundingMode.HALF_UP).doubleValue() | 
|                             +","+model.getLatitude().setScale(6, RoundingMode.HALF_UP).doubleValue()); | 
|                 } | 
|             } | 
|         } | 
|         return PageData.from(result); | 
|     } | 
|   | 
|     @Override | 
|     public     void checkNullLocation() { | 
|         log.error("更新交控中心客户经纬度信息===============开始"); | 
|         Boolean importing = (Boolean) redisTemplate.opsForValue().get(Constants.RedisKeys.CHECKING_JKCUSTOMER_LOCATION); | 
|         if(importing!=null && importing){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,上次任务正在执行中,请稍后再试!"); | 
|         } | 
|         redisTemplate.opsForValue().set(Constants.RedisKeys.CHECKING_JKCUSTOMER_LOCATION,true); | 
|         try { | 
|             LambdaQueryWrapper<JkCustomer> queryWrapper = new LambdaQueryWrapper<>(); | 
|             queryWrapper.isNotNull(JkCustomer::getLocation); | 
|             queryWrapper.and(wrapper ->{ | 
|                 wrapper.isNull(JkCustomer::getLatitude) | 
|                         .or().isNull(JkCustomer::getLongitude) | 
|                         .or().eq(JkCustomer::getDistanceStatus,Constants.TWO);}); | 
|             //查询全部有地址,但是没有经纬度的客户信息 | 
|             List<JkCustomer>  list = jkCustomerMapper.selectList(queryWrapper); | 
|             if(list ==null || list.size()==0){ | 
|                 return; | 
|             } | 
|             String url = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GAODE_LOCATION_GEOAPI_URL).getCode(); | 
|             for(JkCustomer c : list){ | 
|                 try { | 
|                     String urlStr =url.replace("${param}" | 
|                             ,c.getLocation().replaceAll("[^a-zA-Z0-9\\u4e00-\\u9fa5]", "")); | 
|                     String result = HttpsUtil.get(urlStr,true); | 
|                     JSONObject json = JSONObject.parseObject(result); | 
|                     if(json!=null | 
|                             && json.getInteger("status")!=null | 
|                             && json.getInteger("status") ==1 | 
|                             && json.getJSONArray("geocodes")!=null | 
|                             && json.getJSONArray("geocodes").size()>0 | 
|                             && json.getJSONArray("geocodes").getJSONObject(0)!=null | 
|                             && json.getJSONArray("geocodes").getJSONObject(0).getString("location")!=null){ | 
|                         //请求成功 | 
|                         String[] strs =json.getJSONArray("geocodes").getJSONObject(0).getString("location").split(","); | 
|                         c.setLongitude(getDecimalByVal(strs[0]));//经度 | 
|                         c.setLatitude(strs.length>1?getDecimalByVal(strs[1]):null);//纬度 | 
|                         if(c.getLatitude() != null && c.getLongitude() !=null){ | 
|                             //非成对出现,无效经纬度不维护 | 
|                             jkCustomerMapper.update(null,new UpdateWrapper<JkCustomer>().lambda() | 
|                                     .set(JkCustomer::getLatitude,c.getLatitude()) | 
|                                     .set(JkCustomer::getLongitude,c.getLongitude()) | 
|                                     .set(JkCustomer::getStartDistance,null) | 
|                                     .set(JkCustomer::getEndDistance,null) | 
|                                     .set(JkCustomer::getStartSteps,null) | 
|                                     .set(JkCustomer::getEndSteps,null) | 
|                                     .set(JkCustomer::getDistanceStatus,Constants.ZERO) | 
|                                     .set(JkCustomer::getDistance,null) | 
|                                     .set(JkCustomer::getEditDate,new Date()) | 
|                                     .eq(JkCustomer::getId,c.getId()) | 
|                             ); | 
|                         } | 
|                     }else{ | 
|                         log.error("更新交控中心客户经纬度信息=====获取json=========="+urlStr+"\n"+c.getName()+"\n"+json); | 
|                     } | 
|                 }catch (Exception e){ | 
|                     log.error("更新交控中心客户经纬度信息=====失败=========="+c.getName()+"-"+c.getLocation()); | 
|                 } | 
|             } | 
|         }catch (Exception e){ | 
|                 log.error("更新交控中心客户经纬度信息===============",e.getMessage()); | 
|         }finally { | 
|             redisTemplate.delete(Constants.RedisKeys.CHECKING_JKCUSTOMER_LOCATION); | 
|         } | 
|         log.error("更新交控中心客户经纬度信息===============结束"); | 
|   | 
|     } | 
|     @Override | 
|     public long count(JkCustomer jkCustomer) { | 
|         QueryWrapper<JkCustomer> wrapper = new QueryWrapper<>(jkCustomer); | 
|         return jkCustomerMapper.selectCount(wrapper); | 
|     } | 
|   | 
|   | 
|     @Override | 
|     @Transactional(rollbackFor = {BusinessException.class,Exception.class}) | 
|     public List<JkCustomer> importBatch(MultipartFile file, LoginUserInfo loginUserInfo){ | 
|         Boolean importing = (Boolean) redisTemplate.opsForValue().get(Constants.RedisKeys.IMPORTING_JKCUSTOMER); | 
|         if(importing!=null && importing){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,已存在导入任务正在执行中,请稍后再试!"); | 
|         } | 
|         redisTemplate.opsForValue().set(Constants.RedisKeys.IMPORTING_JKCUSTOMER,true,30, TimeUnit.MINUTES); | 
|         try { | 
|             ExcelImporter ie = null; | 
|             List<JkCustomerImport> dataList =null; | 
|             try { | 
|                 ie = new ExcelImporter(file,1,0); | 
|                 dataList = ie.getDataList(JkCustomerImport.class,null); | 
|             }  catch (Exception e) { | 
|                 e.printStackTrace(); | 
|             } | 
|             if(dataList == null || dataList.size() ==0){ | 
|                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!"); | 
|             } | 
|             //当前所有线路 | 
|             List<JkLine> lineList =  jkLineMapper.selectJoinList(JkLine.class,new MPJLambdaWrapper<JkLine>() | 
|                     .selectAll(JkLine.class) | 
|                     .eq(JkLine::getIsdeleted,Constants.ZERO) | 
|             ); | 
|             List<JkCustomer> allList =  jkCustomerMapper.selectJoinList(JkCustomer.class,new MPJLambdaWrapper<JkCustomer>() | 
|                     .selectAll(JkCustomer.class) | 
|                     .eq(JkCustomer::getIsdeleted,Constants.ZERO) | 
|             ); | 
|   | 
|             List<JkCustomer> newList = new ArrayList<>(); | 
|             List<JkCustomer> updateList = new ArrayList<>(); | 
|             for(int i=0;i<dataList.size();i++){ | 
|                 JkCustomerImport model = dataList.get(i); | 
|                 if(StringUtils.isBlank(model.getName()) | 
|                         &&StringUtils.isBlank(model.getCode()) | 
|                         &&StringUtils.isBlank(model.getLocation()) | 
|                         &&StringUtils.isBlank(model.getSortno()) | 
|                         &&StringUtils.isBlank(model.getLocationInfo()) | 
|                         &&StringUtils.isBlank(model.getLineName()) ){ | 
|                     continue; | 
|                 } | 
|                 checkModelParam(model,newList,updateList,i,loginUserInfo,allList,lineList ); | 
|             } | 
|             if((newList == null || newList.size() ==0) && updateList.size() == 0){ | 
|                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入有效数据为空!"); | 
|             } | 
|             if(newList.size()>0){ | 
|                 jkCustomerMapper.insert(newList); | 
|             } | 
|             if(updateList.size()>0){ | 
|                 for (JkCustomer c : updateList){ | 
|                     jkCustomerMapper.updateById(c); | 
|                 } | 
|             } | 
|             newList.addAll(updateList); | 
|             return newList; | 
|         }catch (BusinessException e){ | 
|             throw e; | 
|         }catch (Exception e){ | 
|             e.printStackTrace(); | 
|             throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"信息导入失败,请稍后重试"); | 
|         }finally { | 
|             redisTemplate.delete(Constants.RedisKeys.IMPORTING_JKCUSTOMER); | 
|         } | 
|   | 
|     } | 
|   | 
|   | 
|     private JkCustomer checkModelParam(JkCustomerImport model, List<JkCustomer> newList | 
|             , List<JkCustomer> updateList | 
|             ,int index | 
|             ,LoginUserInfo loginUserInfo | 
|             ,List<JkCustomer> allList | 
|             ,List<JkLine> lineList ) { | 
|         if(StringUtils.isBlank(model.getName()) | 
|                 ||StringUtils.isBlank(model.getCode()) | 
|                 ||StringUtils.isBlank(model.getLocation()) ){ | 
|             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+(index+3)+"行客户信息不完整,请检查表格内容!"); | 
|         } | 
|         for(JkCustomer param: newList){ | 
|             if(StringUtils.isNotBlank(model.getCode())&&StringUtils.isNotBlank(param.getCode())) { | 
|                 if (StringUtils.equals(model.getCode(), param.getCode())) { | 
|                     throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + (index + 3) + "行客户简码【" + model.getName() + "】重复出现,请检查表格内容!"); | 
|                 } | 
|             } | 
|         } | 
|         JkLine line = findLineFromListByName(model.getLineName(),lineList); | 
|         if(line == null){ | 
|             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,第" + (index + 3) + "行线路【" + model.getLineName() + "】不存在,请检查表格内容!"); | 
|         } | 
|   | 
|         JkCustomer tModel = findModelFromList(model.getCode(),allList); | 
|         if(tModel == null){ | 
|             tModel = new JkCustomer(); | 
|             tModel.setCreator(loginUserInfo.getId()); | 
|             tModel.setCreateDate(new Date()); | 
|             tModel.setIsnew(Constants.ONE); | 
|             tModel.setDistanceStatus(Constants.TWO);//需要重新定位 | 
|             tModel.setStatus(Constants.ZERO); | 
|             tModel.setDistanceStatus(Constants.ZERO); | 
|             newList.add(tModel); | 
|         }else{ | 
|             if(StringUtils.isBlank(model.getLocation()) || | 
|                     StringUtils.equals(tModel.getLocation().replaceAll("[^a-zA-Z0-9\\u4e00-\\u9fa5]","") | 
|                     ,model.getLocation().replaceAll("[^a-zA-Z0-9\\u4e00-\\u9fa5]",""))){ | 
|                 //如果位置信息发生变化 | 
|                 tModel.setDistanceStatus(Constants.TWO);//需要重新定位 | 
|             } | 
|             tModel.setIsnew(Constants.ZERO); | 
|             updateList.add(tModel); | 
|         } | 
|         tModel.setName(model.getName()); | 
|         tModel.setCode(model.getCode()); | 
|         tModel.setLocation(model.getLocation()); | 
|         tModel.setSortno(model.getSortno()); | 
|         tModel.setLineId(line.getId()); | 
|         if(StringUtils.isNotBlank(model.getLocationInfo())){ | 
|             String[] strs = model.getLocationInfo().split(","); | 
|             tModel.setLongitude(getDecimalByVal(strs[0]));//经度 | 
|             tModel.setLatitude(strs.length>1?getDecimalByVal(strs[1]):null);//纬度 | 
|         } | 
|         if(tModel.getLatitude() == null || tModel.getLongitude() ==null){ | 
|             //非成对出现,无效经纬度不维护 | 
|             tModel.setLongitude(null); | 
|             tModel.setLatitude(null); | 
|         } | 
|         tModel.setEditDate(new Date()); | 
|         tModel.setEditor(loginUserInfo.getId()); | 
|         tModel.setIsdeleted(Constants.ZERO); | 
|         return tModel; | 
|     } | 
|   | 
|     private BigDecimal getDecimalByVal(String val) { | 
|         try { | 
|             return new BigDecimal(val); | 
|         }catch (Exception e){ | 
|   | 
|         } | 
|         return null; | 
|     } | 
|   | 
|     private Company findCompanyFromList(String companyName, List<Company> companyList) { | 
|         if(companyList !=null){ | 
|             for(Company company : companyList){ | 
|                 if(StringUtils.equals(companyName,company.getCompanyNamePath())){ | 
|                     return  company; | 
|                 } | 
|             } | 
|         } | 
|         return null; | 
|     } | 
|     private JkCustomer findModelFromList(String code, List<JkCustomer> list) { | 
|         if(list !=null){ | 
|             for(JkCustomer model : list){ | 
|                 if(StringUtils.equals(code,model.getCode())){ | 
|                     return  model; | 
|                 } | 
|             } | 
|         } | 
|         return null; | 
|     } | 
|     private JkLine findLineFromListByName(String name, List<JkLine> list) { | 
|         if(list !=null){ | 
|             for(JkLine model : list){ | 
|                 if(StringUtils.equals(name,model.getName())){ | 
|                     return model; | 
|                 } | 
|             } | 
|         } | 
|         return null; | 
|     } | 
|   | 
| } |