Browse Source

fixed 上传发货信息功能迭代

fushengqian 5 months ago
parent
commit
cb0097db85

+ 3 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/GenCodeServiceImpl.java

@@ -132,8 +132,9 @@ public class GenCodeServiceImpl implements GenCodeService {
 
     /**
      * 生成代码(自定义路径)
-     * 
+     *
      * @param tableName 表名称
+     * @return
      */
     @Override
     public void generatorCode(String tableName) throws BusinessRuntimeException {
@@ -181,4 +182,4 @@ public class GenCodeServiceImpl implements GenCodeService {
         }
         return genPath + File.separator + VelocityUtils.getFileName(template, table);
     }
-}
+}

+ 5 - 3
fuint-application/src/main/java/com/fuint/common/util/VelocityUtils.java

@@ -44,14 +44,16 @@ public class VelocityUtils {
         velocityContext.put("tablePrefix", genTable.getTablePrefix().replaceAll("_", ""));
         velocityContext.put("tableName", genTable.getTableName());
         velocityContext.put("moduleName", genTable.getModuleName());
-        String modelName = CommonUtil.firstLetterToUpperCase(genTable.getTablePrefix()).replaceAll("_", "") + CommonUtil.firstLetterToUpperCase(genTable.getTableName());
+        String modelName = CommonUtil.firstLetterToUpperCase(genTable.getTablePrefix()).replaceAll("_", "") + CommonUtil.firstLetterToUpperCase(CommonUtil.toCamelCase(genTable.getTableName()));
         velocityContext.put("modelName", modelName);
         velocityContext.put("basePackage", getPackagePrefix(genTable.getPackageName()));
         velocityContext.put("packageName", genTable.getPackageName());
         velocityContext.put("pkColumn", genTable.getPkName());
         velocityContext.put("author", genTable.getAuthor());
         velocityContext.put("table", genTable);
-        String tableClass = CommonUtil.firstLetterToUpperCase(genTable.getTableName());
+        String tableClass = CommonUtil.toCamelCase(genTable.getTableName());
+        velocityContext.put("serviceName", tableClass);
+        tableClass = CommonUtil.firstLetterToUpperCase(tableClass);
         String tablePrefix = CommonUtil.firstLetterToUpperCase(genTable.getTablePrefix()).replaceAll("_", "");
         velocityContext.put("className", tablePrefix + tableClass);
         velocityContext.put("tableClass", tableClass);
@@ -101,7 +103,7 @@ public class VelocityUtils {
         // 模块名
         String moduleName = genTable.getModuleName();
         // 表名称
-        String tableName = CommonUtil.firstLetterToUpperCase(genTable.getTableName());
+        String tableName = CommonUtil.firstLetterToUpperCase(CommonUtil.toCamelCase(genTable.getTableName()));
         // 表前缀
         String tablePrefix = CommonUtil.firstLetterToUpperCase(genTable.getTablePrefix()).replaceAll("_", "");
         String vuePath = "/src";

+ 64 - 0
fuint-application/src/main/java/com/fuint/module/schedule/UploadShippingInfoJob.java

@@ -0,0 +1,64 @@
+package com.fuint.module.schedule;
+
+import com.fuint.common.enums.PayStatusEnum;
+import com.fuint.common.service.OrderService;
+import com.fuint.common.service.WeixinService;
+import com.fuint.framework.exception.BusinessCheckException;
+import com.fuint.repository.model.MtOrder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.core.env.Environment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 微信小程序上传发货处理定时任务
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@EnableScheduling
+@Component("UploadShippingInfoJob")
+public class UploadShippingInfoJob {
+
+    private Logger logger = LoggerFactory.getLogger(UploadShippingInfoJob.class);
+
+    @Autowired
+    private Environment environment;
+
+    /**
+     * 订单服务接口
+     */
+    @Autowired(required = false)
+    private OrderService orderService;
+
+    /**
+     * 微信服务接口
+     * */
+    @Autowired(required = false)
+    private WeixinService weixinService;
+
+    @Scheduled(cron = "${uploadShippingInfoJob.job.time}")
+    @Transactional(rollbackFor = Exception.class)
+    public void dealOrder() throws BusinessCheckException {
+        String theSwitch = environment.getProperty("uploadShippingInfoJob.job.switch");
+         if (theSwitch != null && theSwitch.equals("1")) {
+            logger.info("uploadShippingInfoJobStart!!!");
+            Map<String, Object> param = new HashMap<>();
+            param.put("pay_status", PayStatusEnum.SUCCESS.getValue());
+            List<MtOrder> dataList = orderService.getOrderListByParams(param);
+            if (dataList.size() > 0) {
+                for (MtOrder mtOrder : dataList) {
+                     weixinService.uploadShippingInfo(mtOrder.getOrderSn());
+                }
+            }
+            logger.info("uploadShippingInfoJobEnd!!!");
+        }
+    }
+}

+ 8 - 9
fuint-application/src/main/resources/vm/java/BackendController.java.vm

@@ -6,6 +6,7 @@ import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
 import com.fuint.common.Constants;
 import com.fuint.common.enums.StatusEnum;
+import com.fuint.common.service.${tableClass}Service;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.framework.exception.BusinessCheckException;
@@ -35,7 +36,7 @@ public class Backend${tableClass}Controller extends BaseController {
     /**
      * ${moduleName}服务接口
      */
-    private ${tableClass}Service ${tableName}Service;
+    private ${tableClass}Service ${serviceName}Service;
 
     /**
      * ${moduleName}列表查询
@@ -84,7 +85,7 @@ public class Backend${tableClass}Controller extends BaseController {
             params.put("storeId", storeId);
         }
         paginationRequest.setSearchParams(params);
-        PaginationResponse<${className}> paginationResponse = ${tableName}Service.query${tableClass}ListByPagination(paginationRequest);
+        PaginationResponse<${className}> paginationResponse = ${serviceName}Service.query${tableClass}ListByPagination(paginationRequest);
 
         Map<String, Object> paramsStore = new HashMap<>();
         paramsStore.put("status", StatusEnum.ENABLED.getKey());
@@ -120,7 +121,7 @@ public class Backend${tableClass}Controller extends BaseController {
             return getFailureResult(1001, "请先登录");
         }
 
-        ${className} ${tablePrefix}${tableClass} = ${tableName}Service.query${tableClass}ById(id);
+        ${className} ${tablePrefix}${tableClass} = ${serviceName}Service.query${tableClass}ById(id);
         if (${tablePrefix}${tableClass} == null) {
             return getFailureResult(201);
         }
@@ -128,7 +129,7 @@ public class Backend${tableClass}Controller extends BaseController {
         String operator = accountInfo.getAccountName();
         ${tablePrefix}${tableClass}.setOperator(operator);
         ${tablePrefix}${tableClass}.setStatus(status);
-        ${tableName}Service.update${tableClass}(${tablePrefix}${tableClass});
+        ${serviceName}Service.update${tableClass}(${tablePrefix}${tableClass});
 
         return getSuccessResult(true);
     }
@@ -148,7 +149,6 @@ public class Backend${tableClass}Controller extends BaseController {
         String id = params.get("id") == null ? "" : params.get("id").toString();
         String status = params.get("status") == null ? "" : params.get("status").toString();
         String storeId = params.get("storeId") == null ? "0" : params.get("storeId").toString();
-        String sort = params.get("sort") == null ? "0" : params.get("sort").toString();
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
@@ -159,13 +159,12 @@ public class Backend${tableClass}Controller extends BaseController {
         info.setOperator(accountInfo.getAccountName());
         info.setStatus(status);
         info.setStoreId(Integer.parseInt(storeId));
-        info.setSort(Integer.parseInt(sort));
         info.setMerchantId(accountInfo.getMerchantId());
         if (StringUtil.isNotEmpty(id)) {
             info.setId(Integer.parseInt(id));
-            ${tableName}Service.update${tableClass}(info);
+            ${serviceName}Service.update${tableClass}(info);
         } else {
-            ${tableName}Service.add${tableClass}(info);
+            ${serviceName}Service.add${tableClass}(info);
         }
 
         return getSuccessResult(true);
@@ -188,7 +187,7 @@ public class Backend${tableClass}Controller extends BaseController {
             return getFailureResult(1001, "请先登录");
         }
 
-        ${className} ${tableName}Info = ${tableName}Service.query${tableClass}ById(id);
+        ${className} ${tableName}Info = ${serviceName}Service.query${tableClass}ById(id);
 
         Map<String, Object> result = new HashMap<>();
         result.put("${tableName}Info", ${tableName}Info);

+ 1 - 1
fuint-application/src/main/resources/vm/java/model.java.vm

@@ -12,7 +12,7 @@ import lombok.Setter;
 
 /**
  * ${moduleName}实体
- * 
+ *
  * @Created by ${author}
  * CopyRight https://www.fuint.cn
  */

+ 3 - 3
fuint-application/src/main/resources/vm/java/serviceImpl.java.vm

@@ -49,7 +49,7 @@ public class ${tableClass}ServiceImpl extends ServiceImpl<${className}Mapper, ${
         LambdaQueryWrapper<${className}> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.ne(${className}::getStatus, StatusEnum.DISABLE.getKey());
 
-        lambdaQueryWrapper.orderByAsc(${className}::getSort);
+        lambdaQueryWrapper.orderByAsc(${className}::getId);
         List<${className}> dataList = ${tablePrefix}${tableClass}Mapper.selectList(lambdaQueryWrapper);
 
         PageRequest pageRequest = PageRequest.of(paginationRequest.getCurrentPage(), paginationRequest.getPageSize());
@@ -136,7 +136,7 @@ public class ${tableClass}ServiceImpl extends ServiceImpl<${className}Mapper, ${
    /**
     * 根据条件搜索${moduleName}
     *
-    * @param params 查询参数
+    * @param  params 查询参数
     * @throws BusinessCheckException
     * @return
     * */
@@ -160,7 +160,7 @@ public class ${tableClass}ServiceImpl extends ServiceImpl<${className}Mapper, ${
                     .eq(${className}::getStoreId, storeId));
         }
 
-        lambdaQueryWrapper.orderByAsc(${className}::getSort);
+        lambdaQueryWrapper.orderByAsc(${className}::getId);
         List<${className}> dataList = ${tablePrefix}${tableClass}Mapper.selectList(lambdaQueryWrapper);
         return dataList;
     }

+ 14 - 0
fuint-repository/src/main/java/com/fuint/repository/mapper/MtUploadShippingLogMapper.java

@@ -0,0 +1,14 @@
+package com.fuint.repository.mapper;
+
+import com.fuint.repository.model.MtUploadShippingLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 微信小程序上传发货信息 Mapper 接口
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+public interface MtUploadShippingLogMapper extends BaseMapper<MtUploadShippingLog> {
+
+}

+ 58 - 0
fuint-repository/src/main/java/com/fuint/repository/model/MtUploadShippingLog.java

@@ -0,0 +1,58 @@
+package com.fuint.repository.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 微信小程序上传发货信息实体
+ *
+ * @Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Getter
+@Setter
+@TableName("mt_upload_shipping_log")
+@ApiModel(value = "upload_shipping_log表对象", description = "upload_shipping_log表对象")
+public class MtUploadShippingLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("自增")
+    @TableId(value = "ID", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty("商户ID")
+    private Integer merchantId;
+
+    @ApiModelProperty("店铺ID")
+    private Integer storeId;
+
+    @ApiModelProperty("订单ID")
+    private Integer orderId;
+
+    @ApiModelProperty("订单号")
+    private String orderSn;
+
+    @ApiModelProperty("订单手机号")
+    private String mobile;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty("最后操作人")
+    private String operator;
+
+    @ApiModelProperty("状态,A成功;B失败")
+    private String status;
+
+}

+ 5 - 0
fuint-repository/src/main/resources/mapper/MtUploadShippingLogMapper.xml

@@ -0,0 +1,5 @@
+<?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.fuint.repository.mapper.MtUploadShippingLogMapper}">
+
+</mapper>