Bladeren bron

C端列表用户权限

zhangchenm 1 maand geleden
bovenliggende
commit
a4982f3d42

+ 2 - 2
trade-client/src/main/java/com/trade/client/enterprise/companyrelated/controller/ImporterEntityController.java

@@ -5,12 +5,11 @@ import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 
 import com.github.pagehelper.PageInfo;
+import com.trade.client.security.utils.UserUtils;
 import com.trade.common.core.domain.ResponseResult;
-import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
 
 import com.trade.client.enterprise.companyrelated.service.ImporterEntityCService;
 import com.trade.common.validate.OnCreate;
@@ -41,6 +40,7 @@ public class ImporterEntityController {
      */
     @RequestMapping("/queryList")
     public ResponseResult<PageInfo<ImporterEntity>> queryList(ImporterEntitySearch search) {
+        search.setCustomerUserId(UserUtils.getCustomerUserId());
         return ResponseResult.success(importerEntityCService.queryListBySearch(search));
     }
 

+ 2 - 2
trade-client/src/main/java/com/trade/client/enterprise/companyrelated/controller/VendorEntityController.java

@@ -5,11 +5,10 @@ import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 
 import com.trade.client.enterprise.companyrelated.service.VendorEntityCService;
+import com.trade.client.security.utils.UserUtils;
 import com.trade.common.core.domain.ResponseResult;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
 
 import com.trade.service.enterprise.companyrelated.domain.VendorEntity;
 import com.trade.service.enterprise.companyrelated.domain.vo.VendorEntitySearch;
@@ -35,6 +34,7 @@ public class VendorEntityController {
      */
     @RequestMapping("/queryList")
     public Object queryList(VendorEntitySearch search) {
+        search.setCustomerUserId(UserUtils.getCustomerUserId());
         return ResponseResult.success(vendorEntityCService.queryListBySearch(search));
     }
 

+ 2 - 2
trade-client/src/main/java/com/trade/client/trade/salesorder/controller/SalesOrderController.java

@@ -1,6 +1,7 @@
 package com.trade.client.trade.salesorder.controller;
 
 import com.github.pagehelper.PageInfo;
+import com.trade.client.security.utils.UserUtils;
 import com.trade.client.trade.salesorder.service.SalesOrderCService;
 import com.trade.service.trade.salesorder.dto.SalesOrderDTO;
 import com.trade.service.trade.salesorder.dto.SalesOrderDeliverDTO;
@@ -8,10 +9,8 @@ import com.trade.common.core.domain.ResponseResult;
 import com.trade.service.trade.salesorder.vo.SalesOrderDtlVO;
 import com.trade.service.trade.salesorder.vo.SalesOrderSearch;
 import com.trade.service.trade.salesorder.vo.SalesOrderVO;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
@@ -37,6 +36,7 @@ public class SalesOrderController {
      */
     @RequestMapping("/list")
     public ResponseResult<PageInfo<SalesOrderVO>> list(SalesOrderSearch search) {
+        search.setCustomerUserId(UserUtils.getCustomerUserId());
         return ResponseResult.success(salesOrderCService.queryListBySearch(search));
     }
 

+ 1 - 1
trade-service/src/main/java/com/trade/service/enterprise/companyrelated/domain/vo/VendorEntitySearch.java

@@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
 @Data
 public class VendorEntitySearch extends BaseSearch {
 
-    private Long userId;
+    private Long customerUserId;
     private String entityName;
     private String entityNo;
     /**

+ 4 - 6
trade-service/src/main/java/com/trade/service/trade/salesorder/domain/SalesOrder.java

@@ -22,34 +22,32 @@ import lombok.Setter;
 public class SalesOrder extends BizBaseEntity {
 
     private static final long serialVersionUID = 1L;
-
     /**
      * 用户id
      */
     private Long customerUserId;
-
     /**
      * 订单编号
      */
     private String orderNo;
-
     /**
      * 进口商id
      */
     private Long importerId;
-
     /**
      * 销售合同id
      */
     private Long saleContractId;
-
     /**
      * 订单金额
      */
     private BigDecimal amount;
-
     /**
      * 状态 0待生效/1待发货/2运输中/3交易完成
      */
     private Integer status;
+    /**
+     * 报关单拉取状态 0未拉取/1已拉取
+     */
+    private Integer customsDeclarationStatus;
 }

+ 4 - 0
trade-service/src/main/java/com/trade/service/trade/salesorder/mapper/SalesOrderMapper.java

@@ -18,4 +18,8 @@ import java.util.List;
 public interface SalesOrderMapper extends BaseMapper<SalesOrder> {
 
     List<SalesOrderVO> queryListBySearch(SalesOrderSearch search);
+
+    List<String> queryOrderNo4GetCustomsDeclaration();
+
+    int updateCustomsDeclarationStatusFinishedByOrderNo(String orderNo);
 }

+ 10 - 0
trade-service/src/main/java/com/trade/service/trade/salesorder/service/impl/SalesOrderServiceImpl.java

@@ -120,4 +120,14 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
     public boolean existSalesOrderByImporterId(Long importerId) {
         return this.count(new QueryWrapper<SalesOrder>().eq("importer_id", importerId)) > 0;
     }
+
+    @Override
+    public List<String> queryOrderNo4GetCustomsDeclaration() {
+        return this.baseMapper.queryOrderNo4GetCustomsDeclaration();
+    }
+
+    @Override
+    public void updateCustomsDeclarationStatusFinishedByOrderNo(String orderNo) {
+        this.baseMapper.updateCustomsDeclarationStatusFinishedByOrderNo(orderNo);
+    }
 }

+ 1 - 1
trade-service/src/main/resources/mapper/enterprise/companyrelated/ImporterEntityMapper.xml

@@ -47,7 +47,7 @@
             and status = #{status}
         </if>
         <if test="entityName!= null and entityName!= ''">
-            and entity_name like CONCAT('%', #{entityName}, '%')
+            and (entity_name like CONCAT('%', #{entityName}, '%') or entity_no = #{entityName})
         </if>
         <if test="createdTimeStart!= null">
             and gmt_create &gt;= #{createdTimeStart}

+ 2 - 2
trade-service/src/main/resources/mapper/enterprise/companyrelated/VendorEntityMapper.xml

@@ -47,8 +47,8 @@
         vendor_entity
         WHERE
         deleted = 0
-        <if test="userId!= null and userId!= ''">
-            and user_id = #{userId}
+        <if test="customerUserId!= null and customerUserId!= ''">
+            and customer_user_id = #{customerUserId}
         </if>
         <if test="entityName!= null and entityName!= ''">
             and entity_name like CONCAT('%', #{entityName}, '%')

+ 16 - 1
trade-service/src/main/resources/mapper/trade/salesorder/SalesOrderMapper.xml

@@ -12,6 +12,7 @@
         <result column="sale_contract_id" property="saleContractId" />
         <result column="amount" property="amount" />
         <result column="status" property="status" />
+        <result column="customs_declaration_status" property="customsDeclarationStatus" />
         <result column="gmt_create" property="gmtCreate" />
         <result column="gmt_modified" property="gmtModified" />
     </resultMap>
@@ -20,8 +21,9 @@
     <sql id="Base_Column_List">
         id,
         deleted,
-        customer_user_id, order_no, importer_id, sale_contract_id, amount, status, gmt_create, gmt_modified
+        customer_user_id, order_no, importer_id, sale_contract_id, amount, status, customs_declaration_status, gmt_create, gmt_modified
     </sql>
+
     <select id="queryListBySearch" resultType="com.trade.service.trade.salesorder.vo.SalesOrderVO">
         SELECT
         a.id,
@@ -73,4 +75,17 @@
             ORDER BY a.id DESC
     </select>
 
+
+    <select id="queryOrderNo4GetCustomsDeclaration" resultType="java.lang.String">
+        SELECT order_no
+        FROM sales_order
+        WHERE customs_declaration_status = 0 AND deleted = 0 AND status = 2
+    </select>
+
+    <update id="updateCustomsDeclarationStatusFinishedByOrderNo">
+        UPDATE sales_order
+        SET customs_declaration_status = 1
+        WHERE order_no = #{orderNo} AND deleted = 0
+    </update>
+
 </mapper>