Przeglądaj źródła

出库错误打印日志

lyhzzz 2 lat temu
rodzic
commit
1a2a761724

+ 15 - 0
src/main/java/com/fdkankan/manage/service/impl/ExcelServiceImpl.java

@@ -15,6 +15,7 @@ import com.fdkankan.manage.service.ICompanyService;
 import com.fdkankan.manage.service.IExcelService;
 import com.fdkankan.manage.util.ExcelUtil;
 import com.fdkankan.manage.vo.request.CameraInOutParam;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,6 +23,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.Size;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.util.ArrayList;
@@ -37,6 +39,7 @@ import java.util.List;
  * @since 2022/6/6
  **/
 @Service
+@Slf4j
 public class ExcelServiceImpl implements IExcelService {
 
     @Autowired
@@ -123,6 +126,8 @@ public class ExcelServiceImpl implements IExcelService {
                 String agentName = map.get(2);
                 CameraOutTypeEnum outTypeEnum = CameraOutTypeEnum.getByMsg(outTypeString);
                 if(outTypeEnum == null || StringUtils.isBlank(snCode)){
+                    log.error("outError-->出库错误:出库类型为空或snCode为空:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                            ,snCode,outTypeString,companyName,orderSn,agentName);
                     errorIndex.add(index -3);
                 }
                 CameraInOutParam param = new CameraInOutParam();
@@ -131,11 +136,20 @@ public class ExcelServiceImpl implements IExcelService {
                     param.setOutType(outType);
                 }
                 if(param.getOutType() != null && param.getOutType() == 4 && StringUtils.isBlank(agentName)){
+                    log.error("outError-->出库错误:经销商为空错误:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                            ,snCode,outTypeString,companyName,orderSn,agentName);
+                    errorIndex.add(index -3);
+                }
+                if(param.getOutType() != null && param.getOutType() != 4 && StringUtils.isNotBlank(agentName)){
+                    log.error("outError-->出库错误:出库类型错误:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                            ,snCode,outTypeString,companyName,orderSn,agentName);
                     errorIndex.add(index -3);
                 }
                 if(StringUtils.isNotBlank(agentName)){
                     AgentNew agentNew = agentNewService.getByName(agentName);
                     if(agentNew == null){
+                        log.error("outError-->出库错误:代理商不存在:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                                ,snCode,outTypeString,companyName,orderSn,agentName);
                         errorIndex.add(index -3);
                     }else {
                         param.setAgentId(agentNew.getId());
@@ -166,6 +180,7 @@ public class ExcelServiceImpl implements IExcelService {
         if(type == 0 && wifiNameList.size() <=0){
             throw new BusinessException(ResultCode.IN_TEMPLATE_EMPTY);
         }else if(type == 1 && params.size() <=0){
+
             throw new BusinessException(ResultCode.OUT_TEMPLATE_EMPTY);
         }else if(type == 2 && companyParams.size() <=0){
             throw new BusinessException(ResultCode.COMPANY_TEMPLATE_EMPTY);