ccjgmwz vor 3 Jahren
Ursprung
Commit
4656d57221

+ 5 - 5
sendGoodNotPlat.xml

@@ -1,20 +1,20 @@
 <?xml version="1.0" encoding="GBK"?>
 <request>
     <functionID>dangdang.order.goods.send</functionID>
-    <time>2022-06-08 08:18:15</time>
+    <time>2022-06-08 10:04:30</time>
     <OrdersList>
         <OrderInfo>
-            <orderID>44835804434</orderID>
+            <orderID>44840259950</orderID>
             <logisticsName>¾©¶«¿ìµÝ</logisticsName>
             <logisticsNameAb>JD</logisticsNameAb>
             <logisticsTel>950616</logisticsTel>
-            <logisticsOrderID>JDVA14191325557</logisticsOrderID>
+            <logisticsOrderID>JDVA14232071177</logisticsOrderID>
             <SendGoodsList>
                 <ItemInfo>
-                    <itemID>11102076778</itemID>
+                    <itemID>11086907182</itemID>
                     <sendGoodsCount>1</sendGoodsCount>
                     <belongProductsPromoID></belongProductsPromoID>
-                    <productItemId>44835804434001</productItemId>
+                    <productItemId>44840259950001</productItemId>
                 </ItemInfo>
             </SendGoodsList>
         </OrderInfo>

+ 191 - 119
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/AdminCheckQuartz.java

@@ -26,6 +26,7 @@ import com.iotechn.unimall.data.domain.GroupShopDO;
 import com.iotechn.unimall.data.domain.OrderDO;
 import com.iotechn.unimall.data.domain.SpuDO;
 import com.iotechn.unimall.data.domain.shop.ShopAccount;
+import com.iotechn.unimall.data.domain.shop.ShopLog;
 import com.iotechn.unimall.data.domain.shop.ShopOrder;
 import com.iotechn.unimall.data.domain.shop.ShopTran;
 import com.iotechn.unimall.data.dto.shop.XmlObject.OrderDetail;
@@ -38,6 +39,7 @@ import com.iotechn.unimall.data.mapper.GroupShopMapper;
 import com.iotechn.unimall.data.mapper.OrderMapper;
 import com.iotechn.unimall.data.mapper.SpuMapper;
 import com.iotechn.unimall.data.mapper.shop.ShopAccountMapper;
+import com.iotechn.unimall.data.mapper.shop.ShopLogMapper;
 import com.iotechn.unimall.data.mapper.shop.ShopOrderMapper;
 import com.iotechn.unimall.data.mapper.shop.ShopTranMapper;
 import com.iotechn.unimall.data.util.XMLUtil;
@@ -97,144 +99,190 @@ public class AdminCheckQuartz {
     private ShopAccountMapper shopAccountMapper;
     @Autowired
     private ShopTranMapper shopTranMapper;
+    @Autowired
+    private ShopLogMapper shopLogMapper;
 
 
     /**
      * 订单数据定时轮训处理 每小时执行一次
      */
-//    @Scheduled(cron = "0 0 7-20 * * ? ")
-    @Transactional(rollbackFor = Exception.class)
+    @Scheduled(cron = "0 0 7-20 * * ? ")
     public void dealOrder() throws Exception {
-        Wrapper wrapper = new EntityWrapper();
-//        wrapper.ne("order_status_name","卖家已发货");
-        wrapper.eq("dang_order_status","未发货");
-        List<ShopOrder> list = shopOrderMapper.selectList(wrapper);
-        for (ShopOrder shopOrder: list
-        ) {
-            ShopAccount shopAccount = shopAccountMapper.selectById(shopOrder.getAccountId());
-            flushCookie(shopAccount);
-            CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-            HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/getOrderInfo/?orderId="+shopOrder.getOrderId());
-            try{
+        try{
+            List<ShopOrder> shopOrders = shopOrderMapper.selectList(new EntityWrapper<ShopOrder>()
+                    .eq("dang_order_status","未发货")
+                    .eq("order_status_name","卖家已发货"));
+            for (ShopOrder qqq:shopOrders
+            ) {
+                ShopAccount shopAccount = shopAccountMapper.selectById(qqq.getAccountId());
+                flushCookie(shopAccount);
+                CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+                HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=9999&orderId="+qqq.getOrderId());
                 //这里可以设置请求参数,token等
                 get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
                 get.addHeader("cookie",shopAccount.getFuziCookie());
-                HttpResponse response = httpClient.execute(get);//执行获取响应
-                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
-                    //返回字符串
-                    String res = unicodeToString(EntityUtils.toString(response.getEntity(),"UTF-8"));
-                    System.out.println(res);
-                    JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
-                    Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
-                    ShopOrder data = JSONObject.parseObject(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
-                    ShopOrder tmp = new ShopOrder();
-                    tmp.setOrderId(data.getOrderId());
-                    tmp = shopOrderMapper.selectOne(tmp);
-                    data.setAccountId(shopAccount.getId());
-                    if(tmp == null){
-                        data.setDangOrder(shopOrder.getDangOrder());
-                        data.setGmtCreate(new Date());
-                        data.setGmtUpdate(new Date());
-                        shopOrderMapper.insert(data);
-                    }
-                    else{
-                        if(!data.getOrderStatusName().equals(tmp.getOrderStatusName())){
-                            data.setOrderStatusName(shopOrder.getOrderStatusName());
-                            data.setGmtUpdate(new Date());
-                            shopOrderMapper.update(data,new EntityWrapper<ShopOrder>().eq("order_id",tmp.getOrderId()));
+                get.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+                CloseableHttpResponse response = httpClient.execute(get);//执行获取响应
+                try{
+
+                    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
+                        String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
+                        //返回字符串
+                        String res = unicodeToString(strTmp);
+                        JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
+                        Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
+                        List<ShopOrder> data = JSONArray.parseArray(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
+                        for (ShopOrder tmp: data
+                        ) {
+                            //正则表达式,用于匹配非数字串,+号用于匹配出多个非数字串
+                            String regEx="[^0-9]+";
+                            Pattern pattern = Pattern.compile(regEx);
+                            //用定义好的正则表达式拆分字符串,把字符串中的数字留出来
+                            String[] cs = pattern.split(tmp.getRemarkText());
+                            String dangOrder = "";
+                            for (String str:cs
+                            ) {
+                                if(dangOrder.length()>= 11 || str.equals("*")){
+                                    break;
+                                }
+                                dangOrder += str;
+                            }
+                            tmp.setDangOrder(dangOrder);
+                            tmp.setAccountId(shopAccount.getId());
+                            Long time  = Long.parseLong(tmp.getShippingTime());
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+                            String time1 = sdf.format(new Date(time * 1000));
+                            tmp.setShippingTime(time1);
+                            tmp.setDeleteFlag(0);
+                            tmp.setGmtUpdate(new Date());
+                            tmp.setGmtCreate(new Date());
+                            if(tmp.getShippingComName().equals("快递包裹")||tmp.getShippingComName().equals("挂号印刷品")){
+                                tmp.setShippingComName("中国邮政");
+                            }
+                            ShopOrder tt = new ShopOrder();
+                            tt.setOrderId(tmp.getOrderId());
+                            tt =  shopOrderMapper.selectOne(tt);
+                            if(tt == null){
+                                shopOrderMapper.insert(tmp);
+                            }
+                            else{
+                                if(!tt.getDangOrder().equals(tmp.getDangOrder())||!tt.getShippingComName().equals(tmp.getShippingComName())){
+                                    shopOrderMapper.update(tmp,new EntityWrapper<ShopOrder>().eq("order_id",tt.getOrderId()));
+                                }
+                                dangOrderDeal(shopAccount,qqq);
+                            }
                         }
+
                     }
-                }
 
-            } catch (IOException e) {
-                e.printStackTrace();
+
+                } catch (IOException e) {
+                    throw e;
+                }
+                finally {
+                    response.close();
+                    httpClient.close();
+                }
             }
         }
-        Wrapper wrapper1 = new EntityWrapper();
-        wrapper1.eq("order_status_name","卖家已发货");
-        wrapper1.eq("dang_order_status","未发货");
-        List<ShopOrder> list1 = shopOrderMapper.selectList(wrapper1);
-        for (ShopOrder shopOrder: list1
-        ) {
-            ShopAccount shopAccount = shopAccountMapper.selectById(shopOrder.getAccountId());
-            dangOrderDeal(shopAccount,shopOrder);
+        catch (Exception e) {
+            ShopLog shopLog = new ShopLog();
+            shopLog.setGmtCreate(new Date());
+            shopLog.setTitle("同步定时任务异常");
+            shopLog.setContent(e.getMessage());
+            shopLogMapper.insert(shopLog);
+            e.printStackTrace();
         }
     }
     /**
      * 订单数据定时轮训处理 每小时执行一次
      */
-//    @Scheduled(cron = "0 30 7-20 * * ? ")
-    @Transactional(rollbackFor = Exception.class)
+    @Scheduled(cron = "0 30 7-20 * * ? ")
     public void pullOrderList() throws Exception {
-        List<ShopAccount> listAccount = shopAccountMapper.selectList(new EntityWrapper<ShopAccount>().eq("delete_flag",0));
-        for (ShopAccount shopAccount:listAccount
-        ) {
-            flushCookie(shopAccount);
-            CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-            HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=9999&orderStatus=ShippedToReceipt");
-            //这里可以设置请求参数,token等
-            get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
-            get.addHeader("cookie",shopAccount.getFuziCookie());
-
-            CloseableHttpResponse response = httpClient.execute(get);//执行获取响应
-            try{
+        try{
+            List<ShopAccount> listAccount = shopAccountMapper.selectList(new EntityWrapper<ShopAccount>().eq("delete_flag",0));
+            for (ShopAccount shopAccount:listAccount
+            ) {
+                flushCookie(shopAccount);
+                CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+                HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=9999&orderStatus=ShippedToReceipt");
+                //这里可以设置请求参数,token等
+                get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
+                get.addHeader("cookie",shopAccount.getFuziCookie());
 
-                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
-                    String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
-                    //返回字符串
-                    String res = unicodeToString(strTmp);
-                    JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
-                    Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
-                    List<ShopOrder> data = JSONArray.parseArray(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
-                    for (ShopOrder tmp: data
-                    ) {
-                        //正则表达式,用于匹配非数字串,+号用于匹配出多个非数字串
-                        String regEx="[^0-9]+";
-                        Pattern pattern = Pattern.compile(regEx);
-                        //用定义好的正则表达式拆分字符串,把字符串中的数字留出来
-                        String[] cs = pattern.split(tmp.getRemarkText());
-                        String dangOrder = "";
-                        for (String str:cs
+                CloseableHttpResponse response = httpClient.execute(get);//执行获取响应
+                try{
+
+                    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
+                        String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
+                        //返回字符串
+                        String res = unicodeToString(strTmp);
+                        JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
+                        Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
+                        List<ShopOrder> data = JSONArray.parseArray(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
+                        for (ShopOrder tmp: data
                         ) {
-                            if(dangOrder.length()>= 11){
-                                break;
+                            //正则表达式,用于匹配非数字串,+号用于匹配出多个非数字串
+                            String regEx="[^0-9]+";
+                            Pattern pattern = Pattern.compile(regEx);
+                            //用定义好的正则表达式拆分字符串,把字符串中的数字留出来
+                            String[] cs = pattern.split(tmp.getRemarkText());
+                            String dangOrder = "";
+                            for (String str:cs
+                            ) {
+                                if(dangOrder.length()>= 11){
+                                    break;
+                                }
+                                dangOrder += str;
                             }
-                            dangOrder += str;
-                        }
-                        tmp.setDangOrder(dangOrder);
-                        tmp.setAccountId(shopAccount.getId());
-                        Long time  = Long.parseLong(tmp.getShippingTime());
-                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
-                        String time1 = sdf.format(new Date(time * 1000));
-                        tmp.setShippingTime(time1);
-                        tmp.setDeleteFlag(0);
-                        tmp.setGmtUpdate(new Date());
-                        tmp.setGmtCreate(new Date());
-                        ShopOrder tt = new ShopOrder();
-                        tt.setOrderId(tmp.getOrderId());
-                        tt =  shopOrderMapper.selectOne(tt);
-                        if(tt == null){
-                            shopOrderMapper.insert(tmp);
-                        }
-                        else{
-                            if(tt.getDangOrderStatus().equals("未发货")){
-                                shopOrderMapper.update(tmp,new EntityWrapper<ShopOrder>().eq("order_id",tt.getOrderId()));
+                            tmp.setDangOrder(dangOrder);
+                            tmp.setAccountId(shopAccount.getId());
+                            Long time  = Long.parseLong(tmp.getShippingTime());
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+                            String time1 = sdf.format(new Date(time * 1000));
+                            tmp.setShippingTime(time1);
+                            tmp.setDeleteFlag(0);
+                            tmp.setGmtUpdate(new Date());
+                            tmp.setGmtCreate(new Date());
+                            if(tmp.getShippingComName().equals("快递包裹")||tmp.getShippingComName().equals("挂号印刷品")){
+                                tmp.setShippingComName("中国邮政");
+                            }
+                            ShopOrder tt = new ShopOrder();
+                            tt.setOrderId(tmp.getOrderId());
+                            tt =  shopOrderMapper.selectOne(tt);
+                            if(tt == null){
+                                shopOrderMapper.insert(tmp);
+                            }
+                            else{
+                                if(tt.getDangOrderStatus().equals("未发货")&&!tt.getDangOrder().equals(tmp.getDangOrder())){
+                                    shopOrderMapper.update(tmp,new EntityWrapper<ShopOrder>().eq("order_id",tt.getOrderId()));
+                                }
                             }
                         }
-                    }
 
-                }
+                    }
 
 
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            finally {
-                response.close();
-                httpClient.close();
+                } catch (IOException e) {
+                    throw e;
+                }
+                finally {
+                    response.close();
+                    httpClient.close();
+                }
             }
         }
+        catch (Exception e){
+            ShopLog shopLog = new ShopLog();
+            shopLog.setGmtCreate(new Date());
+            shopLog.setTitle("爬取定时任务异常");
+            shopLog.setContent(e.getMessage());
+            shopLogMapper.insert(shopLog);
+            e.printStackTrace();
+        }
+
     }
     public void flushCookie(ShopAccount shopAccount){
         try{
@@ -257,8 +305,8 @@ public class AdminCheckQuartz {
                     }
                 }
             }
-            catch (Exception exception){
-
+            catch (Exception e){
+                throw e;
             }
             finally {
                 response.close();
@@ -298,12 +346,29 @@ public class AdminCheckQuartz {
                 System.out.println("nCookie:" + nCookie);
                 shopAccount.setFuziCookie(nCookie);
                 shopAccountMapper.updateById(shopAccount);
+                ShopLog shopLog = new ShopLog();
+                shopLog.setGmtCreate(new Date());
+                shopLog.setTitle("更新cookie成功");
+                shopLog.setContent("账号:"+shopAccount.getFuziAccount()+",cookie:"+nCookie);
+                shopLogMapper.insert(shopLog);
+            }
+            else{
+                ShopLog shopLog = new ShopLog();
+                shopLog.setGmtCreate(new Date());
+                shopLog.setTitle("更新cookie失败");
+                shopLog.setContent(response.toString());
+                shopLogMapper.insert(shopLog);
             }
             // 释放链接
             response.close();
 
         }catch (Exception e) {
             e.printStackTrace();
+            ShopLog shopLog = new ShopLog();
+            shopLog.setGmtCreate(new Date());
+            shopLog.setTitle("更新cookie异常");
+            shopLog.setContent(e.getMessage());
+            shopLogMapper.insert(shopLog);
         }
 
     }
@@ -348,11 +413,15 @@ public class AdminCheckQuartz {
             try {
                 resultt = sdkClient.excute(ss);
                 if(resultt.getOrderID() == null){
+                    ShopLog shopLog = new ShopLog();
+                    shopLog.setGmtCreate(new Date());
+                    shopLog.setTitle("当当订单编号错误");
+                    shopLog.setContent("店铺:"+shopAccount.getDangName()+",孔网订单:"+shopOrder.getOrderId()+",当当订单:"+shopOrder.getDangOrder());
+                    shopLogMapper.insert(shopLog);
                     return;
                 }
             } catch (ApiException e) {
-                e.printStackTrace();
-
+                throw e;
             }
 
             /**
@@ -366,7 +435,7 @@ public class AdminCheckQuartz {
             try {
                 odgrp = sdkClient.excute(odgr);
             } catch (ApiException e) {
-                e.printStackTrace();
+                throw e;
             }
             SdkClient jiemi = new SdkClient(shopAccount.getDangAppKey(),shopAccount.getDangAppSecret(),shopAccount.getDangSession(),shopAccount.getDangVersion());
             OrdersContentDecryptRequest ordersContentDecryptRequest=new OrdersContentDecryptRequest();
@@ -383,7 +452,7 @@ public class AdminCheckQuartz {
             try {
                 ordersContentDecryptResponse=jiemi.excute(ordersContentDecryptRequest);
             } catch (ApiException e) {
-                e.printStackTrace();
+                throw e;
             }
             List<OrdersContentDecryptDTO> data = ordersContentDecryptResponse.getData();
             CryptUserInfo cryptUserInfo = data.get(0).getCryptUserInfo();
@@ -438,10 +507,8 @@ public class AdminCheckQuartz {
             PrintWriter out = null;
             try {
                 out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("sendGoodNotPlat.xml"), "GBK")));
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            } catch (FileNotFoundException e) {
-                e.printStackTrace();
+            }catch (Exception e) {
+                throw e;
             }
             out.write(xmlFileStr);
             out.close();
@@ -457,7 +524,7 @@ public class AdminCheckQuartz {
             try {
                 result = sdkClient.excute(sendGoodsRequest);
             } catch (ApiException e) {
-                e.printStackTrace();
+                throw e;
             }
             System.out.println(result.toString());
             if(result.getResult().getOrdersList().get(0).getOrderOperCode() == 0 || result.getResult().getOrdersList().get(0).getOrderOperCode() == 605){
@@ -467,6 +534,11 @@ public class AdminCheckQuartz {
         }
         catch (Exception e){
             e.printStackTrace();
+            ShopLog shopLog = new ShopLog();
+            shopLog.setGmtCreate(new Date());
+            shopLog.setTitle("当当发货异常");
+            shopLog.setContent(e.getMessage());
+            shopLogMapper.insert(shopLog);
         }
 
     }

+ 61 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/shop/IShopLogService.java

@@ -0,0 +1,61 @@
+package com.iotechn.unimall.admin.api.shop;
+
+
+import com.iotechn.unimall.data.domain.shop.ShopLog;
+import com.iotechn.unimall.core.annotation.HttpMethod;
+import com.iotechn.unimall.core.annotation.HttpOpenApi;
+import com.iotechn.unimall.core.annotation.HttpParam;
+import com.iotechn.unimall.core.annotation.HttpParamType;
+import com.iotechn.unimall.core.annotation.param.NotNull;
+import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.data.model.Page;
+import java.util.Date;
+
+/**
+ * 同步日志Service接口
+ * 
+ * @author jlb
+ * @date 2022-06-08
+ */
+@HttpOpenApi(group = "admin.shop.shopLog", description = "同步日志")
+public interface IShopLogService{
+	@HttpMethod(description = "新增", permission = "admin:shop:shopLog:add", permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public Boolean add(@NotNull @HttpParam(name = "shopLog", type = HttpParamType.COMMON, description = "同步日志") ShopLog shopLog,
+						   @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "adminId") Long adminId)throws ServiceException;
+
+	@HttpMethod(description = "列表", permission = "admin:shop:shopLog:list",permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public Page<ShopLog> list(
+								@HttpParam(name = "title", type = HttpParamType.COMMON, description = "标题") String title,
+							@HttpParam(name = "content", type = HttpParamType.COMMON, description = "内容") String content,
+										@HttpParam(name = "deleteFlag", type = HttpParamType.COMMON, description = "删除标识") Long deleteFlag,
+							@HttpParam(name = "gmtCreate", type = HttpParamType.COMMON, description = "") Date gmtCreate,
+							@HttpParam(name = "gmtUpdate", type = HttpParamType.COMMON, description = "") Date gmtUpdate,
+							@HttpParam(name = "userId", type = HttpParamType.COMMON, description = "") Long userId,
+							@HttpParam(name = "adminId", type = HttpParamType.COMMON, description = "") Long adminId,
+					@HttpParam(name = "pageNum", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
+		@HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit)
+		throws ServiceException;
+
+	@HttpMethod(description = "删除", permission = "admin:shop:shopLog:delete",permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public Boolean delete(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id)throws ServiceException;
+
+	@HttpMethod(description = "修改", permission = "admin:shopLog:shopLog:update",permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public Boolean update(@NotNull @HttpParam(name = "shopLog", type = HttpParamType.COMMON, description = "同步日志") ShopLog shopLog,
+						  @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "adminId") Long adminId)throws ServiceException;
+
+	@HttpMethod(description = "查询", permission = "admin:shop:shopLog:get",permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public ShopLog get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id)throws ServiceException;
+	
+	@HttpMethod(description = "导出excl表", permission = "admin:shop:shopLog:export",permissionParentName = "同步日志", permissionName = "同步日志管理")
+	public String export(
+								@HttpParam(name = "title", type = HttpParamType.COMMON, description = "标题") String title,
+							@HttpParam(name = "content", type = HttpParamType.COMMON, description = "内容") String content,
+										@HttpParam(name = "deleteFlag", type = HttpParamType.COMMON, description = "删除标识") Long deleteFlag,
+							@HttpParam(name = "gmtCreate", type = HttpParamType.COMMON, description = "") Date gmtCreate,
+							@HttpParam(name = "gmtUpdate", type = HttpParamType.COMMON, description = "") Date gmtUpdate,
+							@HttpParam(name = "userId", type = HttpParamType.COMMON, description = "") Long userId,
+							@HttpParam(name = "adminId", type = HttpParamType.COMMON, description = "") Long adminId,
+				@HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
+	@HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit)throws ServiceException;
+	
+}

+ 126 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/shop/impl/ShopLogServiceImpl.java

@@ -0,0 +1,126 @@
+package com.iotechn.unimall.admin.api.shop.impl;
+
+import java.util.List;
+
+import org.apache.ibatis.session.RowBounds;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.iotechn.unimall.core.exception.ServiceException;
+import com.iotechn.unimall.data.util.ExcelUtil;
+import com.iotechn.unimall.data.mapper.shop.ShopLogMapper;
+import com.iotechn.unimall.data.domain.shop.ShopLog;
+import com.iotechn.unimall.admin.api.shop.IShopLogService;
+import com.iotechn.unimall.data.model.Page;
+import java.util.Date;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 同步日志Service业务层处理
+ * 
+ * @author jlb
+ * @date 2022-06-08
+ */
+@Service
+public class ShopLogServiceImpl implements IShopLogService{
+	@Autowired
+	private ShopLogMapper shopLogMapper;
+	
+	@Override
+	public Boolean add(ShopLog shopLog,Long adminId) throws ServiceException {
+		Date now = new Date();
+		shopLog.setGmtCreate(now);
+		shopLog.setGmtUpdate(now);
+		shopLog.setAdminId(adminId);
+		return shopLogMapper.insert(shopLog)>0;
+	}
+
+	@Override
+	public Page<ShopLog> list(String title,String content,Long deleteFlag,Date gmtCreate,Date gmtUpdate,Long userId,Long adminId, Integer page, Integer limit)throws ServiceException {
+		Wrapper<ShopLog> wrapper = new EntityWrapper<ShopLog>();
+														if (!StringUtils.isEmpty(title)) {
+					wrapper.eq("title", title);
+				}
+												if (!StringUtils.isEmpty(content)) {
+					wrapper.eq("content", content);
+				}
+																	if (!StringUtils.isEmpty(deleteFlag)) {
+					wrapper.eq("delete_flag", deleteFlag);
+				}
+												if (!StringUtils.isEmpty(gmtCreate)) {
+					wrapper.eq("gmt_create", gmtCreate);
+				}
+												if (!StringUtils.isEmpty(gmtUpdate)) {
+					wrapper.eq("gmt_update", gmtUpdate);
+				}
+												if (!StringUtils.isEmpty(userId)) {
+					wrapper.eq("user_id", userId);
+				}
+												if (!StringUtils.isEmpty(adminId)) {
+					wrapper.eq("admin_id", adminId);
+				}
+							wrapper.eq("delete_flag", 0);
+		List<ShopLog> list = shopLogMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
+		Integer count = shopLogMapper.selectCount(wrapper);
+		return new Page<ShopLog>(list, page, limit, count);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public Boolean delete(Long id) {
+		String[] ids = String.valueOf(id).split(",");
+		for (String tt:ids) {
+			ShopLog tmp =  shopLogMapper.selectById(Long.parseLong(tt));
+			if(tmp != null){
+				tmp.setDeleteFlag(1);
+				shopLogMapper.updateById(tmp);
+			}
+		}
+		return true;
+	}
+
+	@Override
+	public Boolean update(ShopLog shopLog,Long adminId) throws ServiceException {
+		Date now = new Date();
+		shopLog.setGmtUpdate(now);
+		shopLog.setAdminId(adminId);
+		return shopLogMapper.updateById(shopLog)>0;
+	}
+
+	@Override
+	public ShopLog get(Long id) throws ServiceException {
+		return shopLogMapper.selectById(id);
+	}
+	
+	@Override
+	public String export(String title,String content,Long deleteFlag,Date gmtCreate,Date gmtUpdate,Long userId,Long adminId, Integer page, Integer limit)throws ServiceException {
+		Wrapper<ShopLog> wrapper = new EntityWrapper<ShopLog>();
+														if (!StringUtils.isEmpty(title)) {
+					wrapper.eq("title", title);
+				}
+												if (!StringUtils.isEmpty(content)) {
+					wrapper.eq("content", content);
+				}
+																	if (!StringUtils.isEmpty(deleteFlag)) {
+					wrapper.eq("delete_flag", deleteFlag);
+				}
+												if (!StringUtils.isEmpty(gmtCreate)) {
+					wrapper.eq("gmt_create", gmtCreate);
+				}
+												if (!StringUtils.isEmpty(gmtUpdate)) {
+					wrapper.eq("gmt_update", gmtUpdate);
+				}
+												if (!StringUtils.isEmpty(userId)) {
+					wrapper.eq("user_id", userId);
+				}
+												if (!StringUtils.isEmpty(adminId)) {
+					wrapper.eq("admin_id", adminId);
+				}
+							List<ShopLog> list = shopLogMapper.selectList(wrapper);
+		ExcelUtil<ShopLog> util = new ExcelUtil<ShopLog>(ShopLog.class);
+		return util.exportExcel(list, "操作日志");
+	}
+}

+ 23 - 12
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/shop/impl/ShopOrderServiceImpl.java

@@ -14,6 +14,7 @@ import com.dangdang.openplatform.openapi.sdk.responsemodel.order.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.iotechn.unimall.data.domain.shop.ShopAccount;
+import com.iotechn.unimall.data.domain.shop.ShopLog;
 import com.iotechn.unimall.data.domain.shop.ShopTran;
 import com.iotechn.unimall.data.dto.shop.FuziDTO;
 import com.iotechn.unimall.data.dto.shop.ShopDTO;
@@ -21,6 +22,7 @@ import com.iotechn.unimall.data.dto.shop.XmlObject.OrderDetail;
 import com.iotechn.unimall.data.dto.shop.XmlObject.SendGood;
 import com.iotechn.unimall.data.dto.shop.XmlObject.SendGoodsInfo;
 import com.iotechn.unimall.data.mapper.shop.ShopAccountMapper;
+import com.iotechn.unimall.data.mapper.shop.ShopLogMapper;
 import com.iotechn.unimall.data.mapper.shop.ShopTranMapper;
 import com.iotechn.unimall.data.util.XMLUtil;
 import org.apache.commons.httpclient.Cookie;
@@ -75,6 +77,9 @@ public class ShopOrderServiceImpl implements IShopOrderService {
     @Autowired
     private ShopTranMapper shopTranMapper;
 
+    @Autowired
+    private ShopLogMapper shopLogMapper;
+
     @Override
     public Boolean add(ShopOrder shopOrder, Long adminId) throws ServiceException {
         Date now = new Date();
@@ -268,18 +273,19 @@ public class ShopOrderServiceImpl implements IShopOrderService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public ShopOrder syncOrderInfo(String orderId,String dangId,String dangOrder) throws Exception {
-        ShopAccount shopAccount = new ShopAccount();
-        if(dangId != null){
-            shopAccount.setDangId(dangId);
-        }
-//        if(fuziId != null){
-//            shopAccount.setFuziId(fuziId);
-//        }
-        shopAccount = shopAccountMapper.selectOne(shopAccount);
-        flushCookie(shopAccount);
-        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-        HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/getOrderInfo/?orderId="+orderId);
         try{
+
+            ShopAccount shopAccount = new ShopAccount();
+            if(dangId != null){
+                shopAccount.setDangId(dangId);
+            }
+    //        if(fuziId != null){
+    //            shopAccount.setFuziId(fuziId);
+    //        }
+            shopAccount = shopAccountMapper.selectOne(shopAccount);
+            flushCookie(shopAccount);
+            CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+            HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/getOrderInfo/?orderId="+orderId);
             //这里可以设置请求参数,token等
             get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
             get.addHeader("cookie",shopAccount.getFuziCookie());
@@ -319,7 +325,12 @@ public class ShopOrderServiceImpl implements IShopOrderService {
                 return null;
             }
 
-        } catch (IOException e) {
+        } catch (Exception e) {
+            ShopLog shopLog = new ShopLog();
+            shopLog.setGmtCreate(new Date());
+            shopLog.setTitle("浏览器插件调用异常");
+            shopLog.setContent(e.getMessage());
+            shopLogMapper.insert(shopLog);
             e.printStackTrace();
             return null;
         }

+ 69 - 57
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/user/AdminUserServiceImpl.java

@@ -167,72 +167,84 @@ public class AdminUserServiceImpl implements AdminUserService {
 
     @Override
     public String test(String param,String param1) throws Exception {
-        ShopAccount shopAccount = shopAccountMapper.selectById(param);
-        flushCookie(shopAccount);
-        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-        HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=9999&orderId="+param1+"&orderStatus=ShippedToReceipt");
-        //这里可以设置请求参数,token等
-        get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
-        get.addHeader("cookie",shopAccount.getFuziCookie());
-        get.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
-        CloseableHttpResponse response = httpClient.execute(get);//执行获取响应
-        try{
 
-            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
-                String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
-                //返回字符串
-                String res = unicodeToString(strTmp);
-                JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
-                Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
-                List<ShopOrder> data = JSONArray.parseArray(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
-                for (ShopOrder tmp: data
-                ) {
-                    //正则表达式,用于匹配非数字串,+号用于匹配出多个非数字串
-                    String regEx="[^0-9]+";
-                    Pattern pattern = Pattern.compile(regEx);
-                    //用定义好的正则表达式拆分字符串,把字符串中的数字留出来
-                    String[] cs = pattern.split(tmp.getRemarkText());
-                    String dangOrder = "";
-                    for (String str:cs
+        List<ShopOrder> shopOrders = shopOrderMapper.selectList(new EntityWrapper<ShopOrder>()
+                .eq("dang_order_status","未发货")
+                .eq("order_status_name","卖家已发货"));
+        for (ShopOrder qqq:shopOrders
+             ) {
+            ShopAccount shopAccount = shopAccountMapper.selectById(qqq.getAccountId());
+            flushCookie(shopAccount);
+            CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+            HttpGet get = new HttpGet("https://shop.kongfz.com/buyer/order/index/?pageCurr=1&pageShow=9999&orderId="+qqq.getOrderId());
+            //这里可以设置请求参数,token等
+            get.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
+            get.addHeader("cookie",shopAccount.getFuziCookie());
+            get.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+            CloseableHttpResponse response = httpClient.execute(get);//执行获取响应
+            try{
+
+                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){//根据状态码处理
+                    String strTmp= EntityUtils.toString(response.getEntity(),"UTF-8");
+                    //返回字符串
+                    String res = unicodeToString(strTmp);
+                    JSONObject datas = JSONObject.parseObject(res);//转换成JSON格式
+                    Boolean status = (Boolean) datas.get("status");//获取返回数据状态,get获取的字段需要根据提供的返回值去获取
+                    List<ShopOrder> data = JSONArray.parseArray(datas.get("data").toString(),ShopOrder.class);//"data"是根据返回值设定
+                    for (ShopOrder tmp: data
                     ) {
-                        if(dangOrder.length()>= 11){
-                            break;
+                        //正则表达式,用于匹配非数字串,+号用于匹配出多个非数字串
+                        String regEx="[^0-9]+";
+                        Pattern pattern = Pattern.compile(regEx);
+                        //用定义好的正则表达式拆分字符串,把字符串中的数字留出来
+                        String[] cs = pattern.split(tmp.getRemarkText());
+                        String dangOrder = "";
+                        for (String str:cs
+                        ) {
+                            if(dangOrder.length()>= 11 || str.equals("*")){
+                                break;
+                            }
+                            dangOrder += str;
                         }
-                        dangOrder += str;
-                    }
-                    tmp.setDangOrder(dangOrder);
-                    tmp.setAccountId(shopAccount.getId());
-                    Long time  = Long.parseLong(tmp.getShippingTime());
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
-                    String time1 = sdf.format(new Date(time * 1000));
-                    tmp.setShippingTime(time1);
-                    tmp.setDeleteFlag(0);
-                    tmp.setGmtUpdate(new Date());
-                    tmp.setGmtCreate(new Date());
-                    ShopOrder tt = new ShopOrder();
-                    tt.setOrderId(tmp.getOrderId());
-                    tt =  shopOrderMapper.selectOne(tt);
-                    if(tt == null){
-                        shopOrderMapper.insert(tmp);
-                    }
-                    else{
-                        if(tt.getDangOrderStatus().equals("未发货")){
-                            shopOrderMapper.update(tmp,new EntityWrapper<ShopOrder>().eq("order_id",tt.getOrderId()));
+                        tmp.setDangOrder(dangOrder);
+                        tmp.setAccountId(shopAccount.getId());
+                        Long time  = Long.parseLong(tmp.getShippingTime());
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+                        String time1 = sdf.format(new Date(time * 1000));
+                        tmp.setShippingTime(time1);
+                        tmp.setDeleteFlag(0);
+                        tmp.setGmtUpdate(new Date());
+                        tmp.setGmtCreate(new Date());
+                        if(tmp.getShippingComName().equals("快递包裹")||tmp.getShippingComName().equals("挂号印刷品")){
+                            tmp.setShippingComName("中国邮政");
+                        }
+                        ShopOrder tt = new ShopOrder();
+                        tt.setOrderId(tmp.getOrderId());
+                        tt =  shopOrderMapper.selectOne(tt);
+                        if(tt == null){
+                            shopOrderMapper.insert(tmp);
+                        }
+                        else{
+                            if(!tt.getDangOrder().equals(tmp.getDangOrder())||!tt.getShippingComName().equals(tmp.getShippingComName())){
+                                shopOrderMapper.update(tmp,new EntityWrapper<ShopOrder>().eq("order_id",tt.getOrderId()));
+                            }
+                            dangOrderDeal(shopAccount,qqq);
                         }
                     }
-                }
 
-            }
+                }
 
 
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        finally {
-            response.close();
-            httpClient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            finally {
+                response.close();
+                httpClient.close();
+            }
         }
+
 //        Wrapper wrapper1 = new EntityWrapper();
 //        wrapper1.eq("order_status_name","卖家已发货");
 //        wrapper1.eq("dang_order_status","未发货");

+ 73 - 0
unimall-admin/src/api/shop/log.js

@@ -0,0 +1,73 @@
+import request from '@/utils/request'
+
+// 查询同步日志列表
+export function listLog(query) {
+  return request({
+    method: 'get',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'list',
+      ...query
+    }
+  })
+}
+
+// 查询同步日志详细
+export function getLog(id) {
+  return request({
+    method: 'get',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'get',
+      id: id
+    }
+  })
+}
+
+// 新增同步日志
+export function addLog(data) {
+  return request({
+    method: 'post',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'add',
+      shopLog: data
+    }
+  })
+}
+
+// 修改同步日志
+export function updateLog(data) {
+  return request({
+    method: 'post',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'update',
+      shopLog: data
+    }
+  })
+}
+
+// 删除同步日志
+export function delLog(id) {
+  return request({
+    method: 'post',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'delete',
+      id: id
+    }
+  })
+}
+
+// 导出同步日志
+export function exportLog(query) {
+  return request({
+    method: 'get',
+    params: {
+      _gp: 'admin.shop.shopLog',
+      _mt: 'export',
+      ...query
+    }
+  })
+}

+ 13 - 0
unimall-admin/src/router/route.json

@@ -100,6 +100,19 @@
 						"log:logininfor:update"
 					]
 				}
+			},
+			{
+				"path": "log",
+				"name": "log",
+				"page": "/shop/log",
+				"meta": {
+					"title": "同步日志",
+					"icon": "logininfor",
+					"noCache": true,
+					"perms": [
+						"admin:shop:shopLog:list"
+					]
+				}
 			}
 		]
 	},

+ 259 - 0
unimall-admin/src/views/shop/log/index.vue

@@ -0,0 +1,259 @@
+<template>
+  <div class="app-container">
+    <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
+      <el-form-item label="标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="内容" prop="content">
+        <el-input
+          v-model="queryParams.content"
+          placeholder="请输入内容"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
+      <el-table-column label="标题" align="center" prop="title" />
+      <el-table-column label="内容" align="center" prop="content" />
+      <el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.gmtCreate) }}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改同步日志对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="标题" prop="title">
+          <el-input v-model="form.title" placeholder="请输入标题" />
+        </el-form-item>
+        <el-form-item label="内容" prop="content">
+          <el-input v-model="form.content" placeholder="请输入内容" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+        <el-form-item label="删除标识" prop="deleteFlag">
+          <el-input v-model="form.deleteFlag" placeholder="请输入删除标识" />
+        </el-form-item>
+        <el-form-item label="" prop="gmtCreate">
+          <el-date-picker
+            v-model="form.gmtCreate"
+            clearable
+            size="small"
+            style="width: 200px"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择"/>
+        </el-form-item>
+        <el-form-item label="" prop="gmtUpdate">
+          <el-date-picker
+            v-model="form.gmtUpdate"
+            clearable
+            size="small"
+            style="width: 200px"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择"/>
+        </el-form-item>
+        <el-form-item label="" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="" prop="adminId">
+          <el-input v-model="form.adminId" placeholder="请输入" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLog, getLog, delLog, addLog, updateLog, exportLog } from '@/api/shop/log'
+
+export default {
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 总条数
+      total: 0,
+      // 同步日志表格数据
+      logList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: undefined,
+        content: undefined,
+        deleteFlag: undefined,
+        gmtCreate: undefined,
+        gmtUpdate: undefined,
+        userId: undefined,
+        adminId: undefined
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询同步日志列表 */
+    getList() {
+      this.loading = true
+      listLog(this.queryParams).then(response => {
+        this.logList = response.data.data.items
+        this.total = response.data.data.count
+        this.loading = false
+      })
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: undefined,
+        title: undefined,
+        content: undefined,
+        remark: undefined,
+        deleteFlag: undefined,
+        gmtCreate: undefined,
+        gmtUpdate: undefined,
+        userId: undefined,
+        adminId: undefined
+      }
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!=1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = '添加同步日志'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      const id = row.id || this.ids.join(',')
+      getLog(id).then(response => {
+        this.form = response.data.data
+        this.open = true
+        this.title = '修改同步日志'
+      })
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          if (this.form.id != undefined) {
+            updateLog(this.form).then(response => {
+              if (response.data) {
+                this.msgSuccess('修改成功')
+                this.open = false
+                this.getList()
+              } else {
+                this.msgError(response.msg)
+              }
+            })
+          } else {
+            addLog(this.form).then(response => {
+              if (response.data) {
+                this.msgSuccess('新增成功')
+                this.open = false
+                this.getList()
+              } else {
+                this.msgError(response.msg)
+              }
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids.join(',')
+      this.$confirm('是否确认删除同步日志编号为"' + ids + '"的数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return delLog(ids)
+      }).then(() => {
+        this.getList()
+        this.msgSuccess('删除成功')
+      }).catch(function() {})
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams
+      this.$confirm('是否确认导出所有同步日志数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return exportLog(queryParams)
+      }).then(response => {
+        this.download(response.data.data)
+      }).catch(function() {})
+    }
+  }
+}
+</script>

+ 80 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/shop/ShopLog.java

@@ -0,0 +1,80 @@
+package com.iotechn.unimall.data.domain.shop;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.iotechn.unimall.core.framework.aspectj.lang.annotaion.Excel;
+import com.iotechn.unimall.core.framework.aspectj.lang.annotaion.Excel.ColumnType;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import lombok.Data;
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.enums.FieldFill;
+import com.iotechn.unimall.core.util.StringUtils;
+import java.util.Date;
+
+/**
+ * 同步日志对象 shop_log
+ * 
+ * @author jlb
+ * @date 2022-06-08
+ */
+@Data
+@TableName("shop_log")
+public class ShopLog extends BaseDO{
+    private static final long serialVersionUID = 1L;
+
+    /**  */
+    @TableId("id")
+    private Long id;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    @TableField("title")
+    private String title;
+
+    /** 内容 */
+    @Excel(name = "内容")
+    @TableField("content")
+    private String content;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    @TableField("remark")
+    private String remark;
+
+    /**  */
+    @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
+    @TableField("gmt_create")
+    private Date gmtCreate;
+
+    /**  */
+    @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
+    @TableField("gmt_update")
+    private Date gmtUpdate;
+
+    /**  */
+    @Excel(name = "")
+    @TableField("user_id")
+    private Long userId;
+
+    /**  */
+    @Excel(name = "")
+    @TableField("admin_id")
+    private Long adminId;
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("title", getTitle())
+            .append("content", getContent())
+            .append("remark", getRemark())
+            .append("deleteFlag", getDeleteFlag())
+            .append("gmtCreate", getGmtCreate())
+            .append("gmtUpdate", getGmtUpdate())
+            .append("userId", getUserId())
+            .append("adminId", getAdminId())
+            .toString();
+    }
+}

+ 13 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/mapper/shop/ShopLogMapper.java

@@ -0,0 +1,13 @@
+package com.iotechn.unimall.data.mapper.shop;
+
+import com.iotechn.unimall.data.domain.shop.ShopLog;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+/**
+ * 同步日志Mapper接口
+ * 
+ * @author jlb
+ * @date 2022-06-08
+ */
+public interface ShopLogMapper extends BaseMapper<ShopLog>{
+
+}

+ 20 - 0
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/shop/ShopLogMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iotechn.unimall.data.mapper.shop.ShopLogMapper">
+    
+    <resultMap type="ShopLog" id="ShopLogResult">
+      <result property="id" column="id"/>
+      <result property="title" column="title"/>
+      <result property="content" column="content"/>
+      <result property="remark" column="remark"/>
+      <result property="deleteFlag" column="delete_flag"/>
+      <result property="gmtCreate" column="gmt_create"/>
+      <result property="gmtUpdate" column="gmt_update"/>
+      <result property="userId" column="user_id"/>
+      <result property="adminId" column="admin_id"/>
+    </resultMap>
+
+
+</mapper>