From 46124fe454f90d24171ebc5be0d9cfe2ab22cbc5 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 13 十月 2025 09:47:51 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java |  349 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 336 insertions(+), 13 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
index d3c1ca2..cf6ef90 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
@@ -4,16 +4,15 @@
 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.DateUtil;
-import com.doumee.dao.admin.request.JkCustomerImport;
+import com.doumee.core.utils.*;
+import com.doumee.core.utils.tsp.TspSolver;
+import com.doumee.core.utils.tsp.TspSolverSolutions;
 import com.doumee.dao.admin.request.JkOrdersImport;
 import com.doumee.dao.business.*;
 import com.doumee.dao.business.model.*;
 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.service.business.JkSketchService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -21,17 +20,18 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import org.apache.commons.lang3.StringUtils;
+import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.scheduling.annotation.Async;
 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.util.ArrayList;
+import java.util.*;
 import java.util.Date;
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -85,10 +85,301 @@
         }
         jkSketchMapper.deleteBatchIds(ids);
     }
+    //绾胯矾浼樺寲
+    @Override
+    public JkSketch updateById(JkSketch jkSketch ) {
+        JkSketch model = jkSketchMapper.selectById(jkSketch.getId());
+        if(model == null ||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if( model.getDateInfo() ==  null){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺棩鏈熶俊鎭笉姝g‘锛屼笉鏀寔浼樺寲锛�");
+        }
+       if(Constants.equalsInteger(Constants.ZERO,jkSketch.getForceUpdate()) && Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺瓨鍦ㄦ鍦ㄤ紭鍖栦腑锛岃鑰愬績绛夊緟浼樺寲瀹屾垚鎴栬�呴�夋嫨寮哄埗浼樺寲鎿嶄綔锛�");
+        }
+
+         if(  jkSketch.getLineIdList() ==null || jkSketch.getLineIdList().size()==0 ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇烽�夋嫨鏈夋晥鍚堢悊鐨勭嚎璺繘琛屼紭鍖栨搷浣滐紒");
+        }
+        //褰撳墠鎵�鏈夌嚎璺�(绗﹀悎鏉′欢鐨勭嚎璺級
+        List<JkLine> lineList =  jkLineMapper.selectJoinList(JkLine.class,new MPJLambdaWrapper<JkLine>()
+                .selectAll(JkLine.class)
+                .eq(JkLine::getWeeks,DateUtil.getWeekZhouOfDate(model.getDateInfo()))//鍙兘閫夋嫨褰撳墠鐨勭嚎璺�
+                .eq(JkLine::getIsdeleted,Constants.ZERO)
+                .in(JkLine::getId,jkSketch.getLineIdList())
+        );
+        Integer totalCus = 0,totalNum =0;
+        for(JkLine line :lineList){
+            totalCus += Constants.formatIntegerNum(line.getMaxCustomer());//鎬诲鎴烽噺
+            totalNum += Constants.formatIntegerNum(line.getMaxOrder());//鎬婚�佽揣閲�
+        }
+
+        if( totalCus < Constants.formatIntegerNum(model.getOrderNum())  ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇ョ嚎璺鍗曞鎴锋暟閲忚秴杩囦簡绾胯矾鎬诲鎴烽噺闄愬埗锛屾棤娉曡繘琛屼紭鍖栵紒");
+        }
+        if( totalNum < Constants.formatBigdecimal(model.getTotalNum()).doubleValue()){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇ョ嚎璺鍗曢�佽揣閲忚秴杩囦簡绾胯矾鎬婚�佽揣閲忛檺鍒讹紝鏃犳硶杩涜浼樺寲锛�");
+        }
+        model.setLineList(lineList);//绾胯矾闆嗗悎
+        model.setCustomerList(checkJketchCustomerLocation(model));//璁㈠崟闆嗗悎
+        model.setStatus(Constants.ONE);
+        model.setPlanLineNum(lineList.size());
+        model.setEditDate(new Date());
+        model.setEditor(jkSketch.getLoginUserInfo().getId());
+        model.setPlanLineDate(model.getEditDate());
+        model.setPlanLineUserId(jkSketch.getLoginUserInfo().getId());
+        model.setJobId(UUID.randomUUID().toString());
+        redisTemplate.opsForValue().set(Constants.RedisKeys.JKLINE_JOB+model.getJobId(),true );//鍋氬紓姝ュ鐞�
+        jkSketchMapper.updateById(model);
+        return model;
+    }
 
     @Override
-    public void updateById(JkSketch jkSketch) {
-        jkSketchMapper.updateById(jkSketch);
+    @Async
+    public void startUpdateLineAsync(JkSketch model) {
+        try {
+            List<JkSketchCustomer> customerList = model.getCustomerList();
+            List<JkLine> lineList = model.getLineList();
+            TspSolver.DataModel dataModel = new TspSolver.DataModel();
+            int vehicleNumber1 = lineList.size();//绾胯矾鏁伴噺
+            long[] vehicleCapacities1=new long[lineList.size()];//姣忚締杞︾殑鏈�澶ц鍗曢噺闄愬埗
+            long[] demands1 = new long[customerList.size()+1]; //鍚勪釜鐐圭殑璁㈠崟閲�
+            long[][] distanceMatrix1 = new long[customerList.size()+1][customerList.size()+1];
+            demands1[0] =0;//鍘熺偣
+            double cLatitude =0;
+            double cLongitude =0;
+            String location = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.COMPANY_LOCATION).getCode();
+            try {
+                String[] ss = location.split(",");
+                cLongitude = Double.parseDouble(ss[0]);
+                cLatitude = Double.parseDouble(ss[1]);
+            }catch (Exception e){
+
+            }
+
+            for (int i = 0; i < customerList.size(); i++) {
+                distanceMatrix1[0][i] =  DistanceCalculator.calculateDistance(cLatitude,cLongitude,customerList.get(i).getLatitude().doubleValue(),customerList.get(i).getLongitude().doubleValue())/1000;
+                distanceMatrix1[i][0] = distanceMatrix1[0][i];
+                demands1[i+1] = Constants.formatBigdecimal( customerList.get(i).getTotalNum()).longValue();  //鍚勪釜鐐圭殑璁㈠崟閲�
+                List<Map<String,Object>> disList = customerList.get(i).getDistanceList();
+                for (int j = 0; j< disList.size(); j++) {
+                    if(disList.size()>j){
+                        distanceMatrix1[i+1][j+1]  = (Long) disList.get(j).get("b")/1000;//鏋勯�犺窛绂荤煩闃�
+                    }else{
+                        distanceMatrix1[i+1][j+1]  = 1l;
+                    }
+                }
+            }
+            for (int i = 0; i < lineList.size(); i++) {
+                vehicleCapacities1[i] = lineList.get(i).getMaxOrder();//姣忚締杞︾殑鏈�澶ц鍗曢噺闄愬埗
+            }
+            //鏋勯�犱紭鍖栨暟鎹ā鍨�
+            dataModel.initDataInfo(vehicleNumber1,demands1,vehicleCapacities1,distanceMatrix1);
+            TspSolver.startSearch(dataModel);
+            dealSearchSolution(model,dataModel);
+        }catch (Exception e){
+            e.printStackTrace();
+            jkSketchMapper.update(null,new UpdateWrapper<JkSketch>().lambda()
+                    .eq(JkSketch::getId,model.getId() )
+                    .eq(JkSketch::getJobId,model.getJobId() )
+                    .set(JkSketch::getPlanLineInfo,"鏈�杩戜竴娆$嚎璺紭鍖栧け璐ワ紒")
+                    .set(JkSketch::getStatus,Constants.THREE)
+                    .set(JkSketch::getPlanLineEndDate,new Date()));
+        }
+
+    }
+
+    private void dealSearchSolution(JkSketch model, TspSolver.DataModel dataModel) {
+        Date date = new Date();
+        List<TspSolverSolutions> solutions = dataModel.getSolutions();
+        List<JkSketchLine> sketchLineList = new ArrayList<>();
+        List<JkSketchCustomer> sketchCustomerList  = new ArrayList<>();
+        long totalDistance = 0l;
+        if(solutions!=null && solutions.size()>0){
+            for(TspSolverSolutions so : solutions){
+                List<Integer> routes = so.getRouteIndex();
+                if(routes.size() <=2) {
+                    continue;//鏃犲鎴风殑闈炴湁鏁堣矾绾�
+                }
+                totalDistance+= so.getDistance();
+                JkLine  line =model.getLineList().get(so.getLineIndex());
+                JkSketchLine tModel =  new JkSketchLine();
+                tModel.setSketchId(model.getId());
+                tModel.setCreator(model.getEditor());
+                tModel.setCreateDate(date);
+                tModel.setLineId(line.getId());
+                tModel.setTotalNum(new BigDecimal(0));
+                tModel.setOrderNum(routes.size()-2);
+                tModel.setDateInfo(model.getDateInfo());
+                tModel.setSortnum(sketchLineList.size()+1);
+                tModel.setEditDate(tModel.getCreateDate());
+                tModel.setEditor(tModel.getCreator());
+                tModel.setIsdeleted(Constants.ZERO);
+                tModel.setDistance(so.getDistance());//
+                sketchLineList.add(tModel);
+                tModel.setCustomerList( new ArrayList<>());
+                //鏈夋晥璺緞
+                for (Integer cIndex : routes){
+                    if(cIndex ==0 || cIndex == routes.size()-1){
+                        continue; //璧峰鐐逛笉澶勭悊
+                    }
+                    JkSketchCustomer customer = model.getCustomerList().get(cIndex-1);
+                    tModel.setTotalNum(tModel.getTotalNum().add(Constants.formatBigdecimal(customer.getTotalNum())));//閫佽揣閲�
+                    JkSketchCustomer cModel =  new JkSketchCustomer();
+                    cModel.setCreator(tModel.getCreator());
+                    cModel.setOrderId(customer.getOrderId());
+                    cModel.setCreateDate(tModel.getCreateDate());
+                    cModel.setTotalNum(customer.getTotalNum());
+                    cModel.setDateInfo(model.getDateInfo());
+                    cModel.setSortnum(tModel.getCustomerList().size()+1);
+                    cModel.setEditDate(tModel.getCreateDate());
+                    cModel.setEditor(tModel.getCreator());
+                    cModel.setIsdeleted(Constants.ZERO);
+                    cModel.setSketchId(model.getId());
+                    cModel.setCustomerId(customer.getCustomerId());
+                    tModel.getCustomerList().add(cModel);
+                    if(cIndex ==0 || cIndex == routes.size()-1){
+                        continue; //璧峰鐐逛笉澶勭悊
+                    }
+                }
+            }
+        }
+        if(sketchLineList!=null && sketchLineList.size()>0){
+            jkSketchLineMapper.update(null,new UpdateWrapper<JkSketchLine>().lambda()
+                    .set(JkSketchLine::getIsdeleted,Constants.ONE)
+                    .eq(JkSketchLine::getIsdeleted,Constants.ZERO)
+                    .eq(JkSketchLine::getDateInfo,model.getDateInfo()));
+            jkSketchCustomerMapper.update(null,new UpdateWrapper<JkSketchCustomer>().lambda()
+                    .set(JkSketchCustomer::getIsdeleted,Constants.ONE)
+                    .eq(JkSketchCustomer::getIsdeleted,Constants.ZERO)
+                    .eq(JkSketchCustomer::getDateInfo,model.getDateInfo()));
+            if(sketchLineList.size()>0){
+                jkSketchLineMapper.insert(sketchLineList);
+            }
+            for(JkSketchLine l : sketchLineList){
+                if(l.getCustomerList()!=null ){
+                    for(JkSketchCustomer c :l.getCustomerList()){
+                        c.setSketchLineId(l.getId());
+                    }
+                    sketchCustomerList.addAll(l.getCustomerList());
+                }
+            }
+            if(sketchCustomerList.size()>0){
+                jkSketchCustomerMapper.insert(sketchCustomerList);
+            }
+            jkSketchMapper.update(null,new UpdateWrapper<JkSketch>().lambda()
+                    .eq(JkSketch::getId,model.getId() )
+                    .eq(JkSketch::getJobId,model.getJobId() )
+                    .set(JkSketch::getLineNum,sketchLineList.size() )
+                    .set(JkSketch::getDistance,totalDistance)
+                    .set(JkSketch::getPlanLineInfo,"鏈�杩戜竴娆$嚎璺紭鍖栨垚鍔燂紝浼樺寲鍚庢�昏窛绂伙細"+(totalDistance/1000)+"鍏噷锛�")
+                    .set(JkSketch::getStatus,Constants.TWO)
+                    .set(JkSketch::getPlanLineEndDate,date));
+        }else{
+            jkSketchMapper.update(null,new UpdateWrapper<JkSketch>().lambda()
+                    .eq(JkSketch::getId,model.getId() )
+                    .eq(JkSketch::getJobId,model.getJobId() )
+                    .set(JkSketch::getPlanLineInfo,"鏈�杩戜竴娆$嚎璺紭鍖栧け璐�,鏈壘鍒版渶浼樿矾绾匡紒")
+                    .set(JkSketch::getStatus,Constants.THREE)
+                    .set(JkSketch::getPlanLineEndDate,date));
+        }
+    }
+
+    private   List<JkSketchCustomer>  checkJketchCustomerLocation(JkSketch model) {
+
+        MPJLambdaWrapper<JkSketchCustomer> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(JkSketchCustomer.class )
+                .selectAs(JkCustomer::getName,JkSketchCustomer::getName)
+                .selectAs(JkCustomer::getCode,JkSketchCustomer::getCode)
+                .selectAs(JkCustomer::getLongitude,JkSketchCustomer::getLongitude)
+                .selectAs(JkCustomer::getLatitude,JkSketchCustomer::getLatitude)
+                .leftJoin(JkCustomer.class,JkCustomer::getId,JkSketchCustomer::getCustomerId )
+                .eq(JkSketchCustomer::getSketchId, model.getId())
+                .eq(JkSketchCustomer::getIsdeleted,Constants.ZERO)
+                .orderByAsc(JkSketchCustomer::getSortnum);
+        List<JkSketchCustomer> customerList = jkSketchCustomerMapper.selectJoinList(JkSketchCustomer.class,queryWrapper);
+        if(customerList == null ||customerList.size() ==0){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴蜂俊鎭负绌猴紝涓嶆弧瓒充紭鍖栨潯浠讹紒");
+        }
+        String errorMsg ="";
+        for(JkSketchCustomer c : customerList){
+            if(c.getLatitude()==null || c.getLongitude() ==null){
+                errorMsg += c.getName()+"-"+c.getName()+"锛�";
+            }
+        }
+        if(StringUtils.isNotBlank(errorMsg)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇ョ嚎璺鎴�:"+errorMsg+"瀹氫綅淇℃伅涓嶅畬鏁达紝涓嶆弧瓒充紭鍖栨潯浠讹紒");
+        }
+        for(JkSketchCustomer c : customerList){
+            List<Map<String,Object>> tmpList = new ArrayList<>();
+            for(JkSketchCustomer cm : customerList){
+                Map<String,Object> t = new HashMap<>();
+                t.put("a",cm.getId());
+                if(Constants.equalsInteger(c.getCustomerId(),cm.getCustomerId())){
+                    t.put("b",0l);
+                }else{
+                    t.put("b", DistanceCalculator.calculateDistance(
+                            Constants.formatBigdecimal(c.getLatitude()).doubleValue(),
+                            Constants.formatBigdecimal(c.getLatitude()).doubleValue(),
+                            Constants.formatBigdecimal(cm.getLatitude()).doubleValue(),
+                            Constants.formatBigdecimal(cm.getLongitude()).doubleValue()));
+                }
+                tmpList.add(t);
+            }
+            c.setDistanceList(tmpList);
+        }
+
+        if(Constants.equalsInteger(Constants.ZERO,model.getStatus())){
+            //濡傛灉鏄湭浼樺寲鐘舵�侊紝璁$畻鍘熷璺濈
+            long totalDistance = 0;
+            MPJLambdaWrapper<JkSketchLine> queryWrapper1 = new MPJLambdaWrapper<>();
+            queryWrapper1.selectAll(JkSketchLine.class )
+                    .eq(JkSketchLine::getSketchId, model.getId())
+                    .eq(JkSketchLine::getIsdeleted,Constants.ZERO);
+            List<JkSketchLine> lineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper1);//
+            if(lineList!=null ||lineList.size()>0){
+                double cLatitude =0;
+                double cLongitude =0;
+                String location = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.COMPANY_LOCATION).getCode();
+                try {
+                    String[] ss = location.split(",");
+                    cLongitude = Double.parseDouble(ss[0]);
+                    cLatitude = Double.parseDouble(ss[1]);
+                }catch (Exception e){
+
+                }
+                for(JkSketchLine line : lineList){
+                    boolean isFirst =true;
+                    JkSketchCustomer last = null;
+                    for(JkSketchCustomer c : customerList){
+                        if(Constants.equalsInteger(c.getSketchLineId(),line.getId())){
+                            if(isFirst){
+                                totalDistance += DistanceCalculator.calculateDistance(cLatitude,cLongitude
+                                        ,Constants.formatBigdecimal(c.getLatitude()).doubleValue()
+                                        ,Constants.formatBigdecimal(c.getLongitude()).doubleValue());
+                            }else{
+                                totalDistance += DistanceCalculator.calculateDistance(Constants.formatBigdecimal(c.getLatitude()).doubleValue()
+                                        ,Constants.formatBigdecimal(c.getLongitude()).doubleValue()
+                                        ,Constants.formatBigdecimal(last.getLatitude()).doubleValue()
+                                        ,Constants.formatBigdecimal(last.getLongitude()).doubleValue());
+                            }
+                            last = c;
+                            isFirst=false;
+                        }
+                        if(last!=null){
+                            totalDistance += DistanceCalculator.calculateDistance(cLatitude,cLongitude
+                                    ,Constants.formatBigdecimal(last.getLatitude()).doubleValue()
+                                    ,Constants.formatBigdecimal(last.getLongitude()).doubleValue());
+                        }
+                    }
+                }
+
+            }
+            model.setOriginDistance(totalDistance);
+        }
+
+        return customerList;
     }
 
     @Override
@@ -185,6 +476,7 @@
         return jkSketchMapper.selectCount(wrapper);
     }
 
+
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public List<JkSketch> importBatch(MultipartFile file, String dateInfoStr, LoginUserInfo loginUser){
@@ -216,9 +508,11 @@
                     .selectAll(JkCustomer.class)
                     .eq(JkCustomer::getIsdeleted,Constants.ZERO)
             );
+            String week =  DateUtil.getWeekZhouOfDate(dateInfo);
             //褰撳墠鎵�鏈夌嚎璺�
             List<JkLine> lineList =  jkLineMapper.selectJoinList(JkLine.class,new MPJLambdaWrapper<JkLine>()
                     .selectAll(JkLine.class)
+                    .eq(JkLine::getWeeks,week)//鍙兘閫夋嫨褰撳墠鐨勭嚎璺�
                     .eq(JkLine::getIsdeleted,Constants.ZERO)
             );
             List<JkOrders> newOrderList = new ArrayList<>();
@@ -256,7 +550,7 @@
                 jkOrdersMapper.insert(newOrderList);
             }
 
-            List<JkSketchLine> sketchLineList = initNewSketchLineList(newList,newOrderList);
+            List<JkSketchLine> sketchLineList = initNewSketchLineList(newList,newOrderList,lineList);
             jkSketchLineMapper.update(null,new UpdateWrapper<JkSketchLine>().lambda()
                     .set(JkSketchLine::getIsdeleted,Constants.ONE)
                     .eq(JkSketchLine::getIsdeleted,Constants.ZERO)
@@ -285,6 +579,8 @@
 
     }
 
+
+
     private List<JkSketchCustomer> initNewSketchCustomerList(List<JkSketchLine> sketchLineList, List<JkOrders> newOrderList) {
         List<JkSketchCustomer> list =new ArrayList<>();
         for(JkOrders orders : newOrderList){
@@ -308,9 +604,25 @@
         }
         return list;
     }
-    private List<JkSketchLine> initNewSketchLineList(List<JkSketch> newList, List<JkOrders> newOrderList) {
+    private List<JkSketchLine> initNewSketchLineList(List<JkSketch> newList, List<JkOrders> newOrderList,List<JkLine> lineList) {
         List<JkSketchLine> list =new ArrayList<>();
-        for(JkOrders orders : newOrderList){
+        for (JkLine line : lineList){
+            JkSketchLine tModel =  new JkSketchLine();
+            tModel.setSketchId(getSKetchIdByyCategoryId(line.getCategoryId(),newList));
+            tModel.setCreator(newList.get(0).getCreator());
+            tModel.setCreateDate(newList.get(0).getCreateDate());
+            tModel.setLineId(line.getId());
+            initOrderAndTotalNum(tModel,line.getId(),newOrderList);
+            tModel.setDateInfo(newList.get(0).getDateInfo());
+            tModel.setSortnum(list.size()+1);
+            tModel.setEditDate(tModel.getCreateDate());
+            tModel.setEditor(tModel.getCreator());
+            tModel.setIsdeleted(Constants.ZERO);
+            if(tModel.getSketchId()!=null && Constants.formatIntegerNum(tModel.getOrderNum()) >0){
+                list.add(tModel);
+            }
+        }
+        /*for(JkOrders orders : newOrderList){
             JkSketchLine tModel = findModelFromListByLineId(orders.getLineId(),list);
             if(tModel!=null){
                 tModel.setTotalNum(  tModel.getTotalNum().add(orders.getNum()));//璁㈠崟閲忕疮璁�
@@ -332,8 +644,17 @@
                     list.add(tModel);
                 }
             }
-        }
+        }*/
         return list;
+    }
+
+    private void initOrderAndTotalNum(JkSketchLine tModel, Integer id, List<JkOrders> newOrderList) {
+        for(JkOrders orders : newOrderList){
+            if(Constants.equalsInteger(orders.getLineId(),id)){
+                tModel.setOrderNum(Constants.formatIntegerNum(tModel.getOrderNum())+1);
+                tModel.setTotalNum(Constants.formatBigdecimal(tModel.getTotalNum()).add(Constants.formatBigdecimal(orders.getNum())));
+            }
+        }
     }
 
     private Integer getSKetchIdByyCategoryId(Integer categoryId, List<JkSketch> newList) {
@@ -430,7 +751,7 @@
         }
         JkLine line = findLineFromListByName(model.getLineName(),lineList);
         if(line == null){
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝绗�" + (index + 3) + "琛岀嚎璺��" + model.getLineName() + "銆戜笉瀛樺湪锛岃妫�鏌ヨ〃鏍煎唴瀹癸紒");
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝绗�" + (index + 3) + "琛岀嚎璺��" + model.getLineName() + "銆戜笉瀛樺湪鎴栬�呴厤閫佸懆鏈熶笉绗﹀悎锛岃妫�鏌ヨ〃鏍煎唴瀹癸紒");
         }
 
         JkOrders tModel =   new JkOrders();
@@ -441,6 +762,8 @@
         tModel.setNum(getDecimalByVal(model.getNum()));
         tModel.setCustomerId(customer.getId());
         tModel.setDateInfo(dateInfo);
+        tModel.setLatitude(customer.getLatitude());
+        tModel.setLongitude(customer.getLongitude());
         tModel.setSortnum(model.getSortnum());
         tModel.setLineId(line.getId());
         tModel.setCategoryId(line.getCategoryId());

--
Gitblit v1.9.3