1
0
Эх сурвалжийг харах

fixed 提升源码质量修改

fushengqian 8 сар өмнө
parent
commit
4b046174b4

+ 1 - 2
fuint-application/src/main/java/com/fuint/common/http/HttpRESTDataClient.java

@@ -126,8 +126,7 @@ public class HttpRESTDataClient {
             HttpClient client = httpClientBuilder.build();
             HttpClient client = httpClientBuilder.build();
             HttpResponse response = client.execute(httpPost);
             HttpResponse response = client.execute(httpPost);
             if (response.getStatusLine() != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
             if (response.getStatusLine() != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
-                String result = EntityUtils.toString(response.getEntity(), "utf-8");
-                return result;
+                return EntityUtils.toString(response.getEntity(), "utf-8");
             }
             }
             return "";
             return "";
         }
         }

+ 1 - 3
fuint-application/src/main/java/com/fuint/common/service/impl/AddressServiceImpl.java

@@ -114,8 +114,6 @@ public class AddressServiceImpl extends ServiceImpl<MtAddressMapper, MtAddress>
             param.put("is_default", YesOrNoEnum.YES.getKey());
             param.put("is_default", YesOrNoEnum.YES.getKey());
         }
         }
 
 
-        List<MtAddress> result = mtAddressMapper.selectByMap(param);
-
-        return result;
+        return mtAddressMapper.selectByMap(param);
     }
     }
 }
 }

+ 1 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/CartServiceImpl.java

@@ -292,8 +292,7 @@ public class CartServiceImpl extends ServiceImpl<MtCartMapper, MtCart> implement
             lambdaQueryWrapper.eq(MtCart::getSkuId, skuId);
             lambdaQueryWrapper.eq(MtCart::getSkuId, skuId);
         }
         }
 
 
-        List<MtCart> result = mtCartMapper.selectList(lambdaQueryWrapper);
-        return result;
+        return mtCartMapper.selectList(lambdaQueryWrapper);
     }
     }
 
 
     /**
     /**

+ 2 - 4
fuint-application/src/main/java/com/fuint/common/service/impl/GiveServiceImpl.java

@@ -291,8 +291,7 @@ public class GiveServiceImpl extends ServiceImpl<MtGiveMapper, MtGive> implement
             //empty
             //empty
         }
         }
 
 
-        ResponseObject result = new ResponseObject(200, "", giveInfo);
-        return result;
+        return new ResponseObject(200, "", giveInfo);
     }
     }
 
 
     /**
     /**
@@ -318,7 +317,6 @@ public class GiveServiceImpl extends ServiceImpl<MtGiveMapper, MtGive> implement
         if (params == null) {
         if (params == null) {
             params = new HashMap<>();
             params = new HashMap<>();
         }
         }
-        List<MtGiveItem> result = mtGiveItemMapper.selectByMap(params);
-        return result;
+        return mtGiveItemMapper.selectByMap(params);
     }
     }
 }
 }

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/OpenGiftServiceImpl.java

@@ -134,6 +134,9 @@ public class OpenGiftServiceImpl extends ServiceImpl<MtOpenGiftMapper, MtOpenGif
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     @OperationServiceLog(description = "新增开卡赠礼")
     @OperationServiceLog(description = "新增开卡赠礼")
     public MtOpenGift addOpenGift(MtOpenGift mtOpenGift) throws BusinessCheckException {
     public MtOpenGift addOpenGift(MtOpenGift mtOpenGift) throws BusinessCheckException {
+        if (mtOpenGift.getMerchantId() == null || mtOpenGift.getMerchantId() < 1) {
+            throw new BusinessCheckException("平台方帐号无法执行该操作,请使用商户帐号操作");
+        }
         mtOpenGift.setUpdateTime(new Date());
         mtOpenGift.setUpdateTime(new Date());
         mtOpenGift.setCreateTime(new Date());
         mtOpenGift.setCreateTime(new Date());
         if (mtOpenGift.getCouponNum() != null && mtOpenGift.getCouponNum() > 100) {
         if (mtOpenGift.getCouponNum() != null && mtOpenGift.getCouponNum() > 100) {

+ 1 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/SmsTemplateServiceImpl.java

@@ -164,7 +164,6 @@ public class SmsTemplateServiceImpl extends ServiceImpl<MtSmsTemplateMapper, MtS
         if (params == null) {
         if (params == null) {
             params = new HashMap<>();
             params = new HashMap<>();
         }
         }
-        List<MtSmsTemplate> result = mtSmsTemplateMapper.selectByMap(params);
-        return result;
+        return mtSmsTemplateMapper.selectByMap(params);
     }
     }
 }
 }

+ 2 - 4
fuint-application/src/main/java/com/fuint/common/service/impl/StockServiceImpl.java

@@ -163,8 +163,7 @@ public class StockServiceImpl extends ServiceImpl<MtStockMapper, MtStock> implem
                 }
                 }
             }
             }
         }
         }
-        ResponseObject result = new ResponseObject(200, "", mtStock);
-        return result;
+        return new ResponseObject(200, "", mtStock);
     }
     }
 
 
     /**
     /**
@@ -211,7 +210,6 @@ public class StockServiceImpl extends ServiceImpl<MtStockMapper, MtStock> implem
         if (params == null) {
         if (params == null) {
             params = new HashMap<>();
             params = new HashMap<>();
         }
         }
-        List<MtStockItem> result = mtStockItemMapper.selectByMap(params);
-        return result;
+        return mtStockItemMapper.selectByMap(params);
     }
     }
 }
 }

+ 10 - 20
fuint-application/src/main/java/com/fuint/common/util/PrinterUtil.java

@@ -65,8 +65,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/setVoiceType";
         String url = BASE_URL + "/xprinter/setVoiceType";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<Boolean> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
     }
     }
 
 
     /**
     /**
@@ -97,8 +96,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/printLabel";
         String url = BASE_URL + "/xprinter/printLabel";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<String> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
     }
     }
 
 
     /**
     /**
@@ -150,8 +148,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/delPrinterQueue";
         String url = BASE_URL + "/xprinter/delPrinterQueue";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<Boolean> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
     }
     }
 
 
     /**
     /**
@@ -164,8 +161,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/queryOrderState";
         String url = BASE_URL + "/xprinter/queryOrderState";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<Boolean> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Boolean>>(){});
     }
     }
 
 
     /**
     /**
@@ -178,8 +174,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/queryOrderStatis";
         String url = BASE_URL + "/xprinter/queryOrderStatis";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<OrderStatisResult> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<OrderStatisResult>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<OrderStatisResult>>(){});
     }
     }
 
 
     /**
     /**
@@ -194,8 +189,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/queryPrinterStatus";
         String url = BASE_URL + "/xprinter/queryPrinterStatus";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<Integer> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Integer>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<Integer>>(){});
     }
     }
 
 
     /**
     /**
@@ -210,8 +204,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/queryPrintersStatus";
         String url = BASE_URL + "/xprinter/queryPrintersStatus";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<List<Integer>> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<List<Integer>>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<List<Integer>>>(){});
     }
     }
 
 
     /**
     /**
@@ -224,8 +217,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/playVoice";
         String url = BASE_URL + "/xprinter/playVoice";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<String> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
     }
     }
 
 
     /**
     /**
@@ -238,8 +230,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/pos";
         String url = BASE_URL + "/xprinter/pos";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<String> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
     }
     }
 
 
     /**
     /**
@@ -252,8 +243,7 @@ public class PrinterUtil {
         String url = BASE_URL + "/xprinter/controlBox";
         String url = BASE_URL + "/xprinter/controlBox";
         String jsonRequest = JSON.toJSONString(restRequest);
         String jsonRequest = JSON.toJSONString(restRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
         String resp = HttpClientUtil.doPostJSON(url, jsonRequest);
-        ObjectRestResponse<String> result = JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
-        return result;
+        return JSON.parseObject(resp, new TypeReference<ObjectRestResponse<String>>(){});
     }
     }
 
 
 }
 }

+ 3 - 1
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendOpenGiftController.java

@@ -186,7 +186,9 @@ public class BackendOpenGiftController extends BaseController {
         } else {
         } else {
             reqDto.setPoint(0);
             reqDto.setPoint(0);
         }
         }
-        reqDto.setMerchantId(accountInfo.getMerchantId());
+        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
+            reqDto.setMerchantId(accountInfo.getMerchantId());
+        }
         reqDto.setStoreId(0);
         reqDto.setStoreId(0);
         reqDto.setStatus(status);
         reqDto.setStatus(status);
         String operator = accountInfo.getAccountName();
         String operator = accountInfo.getAccountName();