ソースを参照

Merge branch 'feature/asyncOrder' of http://git.aseanbusiness.cn/qzyReal/market-server into feature/asyncOrder

# Conflicts:
#	sp-core/sp-base/src/main/java/com/pj/current/dto/PCLoginUserInfo.java
#	sp-service/sp-admin/src/main/java/com/pj/project4sp/admin/SpAdmin.java
#	sp-service/sp-admin/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java
qzyReal 1 年間 前
コミット
d8c43b2b87

+ 1 - 1
sp-core/sp-base/src/main/java/com/pj/current/dto/PCLoginUserInfo.java

@@ -9,6 +9,6 @@ import java.io.Serializable;
 public class PCLoginUserInfo implements Serializable {
     private String loginId;
     private String loginName;
-    private String adminType;
+    private String type;
     private Long tradeAreaId;
 }

+ 16 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/vo/OrderVo.java

@@ -200,6 +200,11 @@ public class OrderVo {
     private Double buyQty;
 
     /**
+     * 边民额度序号
+     */
+    private String limitNo;
+
+    /**
      * 商品额度
      */
     private Double gLimit;
@@ -207,7 +212,7 @@ public class OrderVo {
     /**
      * 商品序号
      */
-    private Integer gNo;
+    private String gNo;
 
     /**
      * 进口申报单Id
@@ -218,4 +223,14 @@ public class OrderVo {
      *  1-边民,2-商铺业主或其代理人,3-合作社代表,4-互助组代表
      */
     private String declareType;
+
+    /**
+     * 净重
+     */
+    private Double netWt;
+
+    /**
+     * 毛重
+     */
+    private Double grossWt;
 }

+ 20 - 3
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java

@@ -1,6 +1,8 @@
 package com.pj.tb_orders;
 
 import java.util.List;
+
+import com.pj.current.satoken.StpUserUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -89,7 +91,14 @@ public class TbOrdersController {
 	public AjaxJson selectYear() {
 		SoMap so=new SoMap();
 		so.put("year",tbOrdersService.selectYear());
-		so.put("count",tbOrdersService.totalMoney());
+		//运营管理者统计全部
+		if(StpUserUtil.getPCLoginInfo().getType()==null||StpUserUtil.getPCLoginInfo().getType().equals("00")){
+			so.put("count",tbOrdersService.totalMoney(null));
+		}
+		//合作社只统计对应的互市id
+		if(StpUserUtil.getPCLoginInfo().getType()!=null&&StpUserUtil.getPCLoginInfo().getType().equals("01")){
+			so.put("count",tbOrdersService.totalMoney(StpUserUtil.getPCLoginInfo().getTradeAreaId()));
+		}
 		return AjaxJson.getSuccessData(so);
 	}
 
@@ -97,8 +106,16 @@ public class TbOrdersController {
 	@RequestMapping("orderStatistics")
 	public AjaxJson orderStatistics(String year) {
 		SoMap so=new SoMap();
-		so.put("money",tbOrdersService.orderStatistics("交易额",year));
-		so.put("count",tbOrdersService.orderStatistics("交易量",year));
+		//运营管理者统计全部
+		if(StpUserUtil.getPCLoginInfo().getType()==null||StpUserUtil.getPCLoginInfo().getType().equals("00")){
+			so.put("money",tbOrdersService.orderStatistics("交易额",year,  null));
+			so.put("count",tbOrdersService.orderStatistics("交易量",year,null));
+		}
+		//合作社只统计对应的互市id
+		if(StpUserUtil.getPCLoginInfo().getType()!=null&&StpUserUtil.getPCLoginInfo().getType().equals("01")){
+			so.put("money",tbOrdersService.orderStatistics("交易额",year,  StpUserUtil.getPCLoginInfo().getTradeAreaId()));
+			so.put("count",tbOrdersService.orderStatistics("交易量",year,StpUserUtil.getPCLoginInfo().getTradeAreaId()));
+		}
 		return AjaxJson.getSuccessData(so);
 	}
 

+ 2 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.java

@@ -34,9 +34,9 @@ public interface TbOrdersMapper extends BaseMapper <TbOrders> {
 
 	List<TbOrders> getLevelTwoList(SoMap so);
 
-	List<Map<String, Object>> orderStatistics(@Param("type") String type,@Param("year") String year);
+	List<Map<String, Object>> orderStatistics(@Param("type") String type,@Param("year") String year,@Param("tradeAreaId") Long tradeAreaId);
 
 	List<Map<String, Object>> selectYear();
 
-	Map<String, Object> totalMoney();
+	Map<String, Object> totalMoney(@Param("tradeAreaId") Long tradeAreaId);
 }

+ 4 - 3
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.xml

@@ -99,9 +99,9 @@
 	<!--已完成和累计交易额 -->
 	<select id="totalMoney" resultType="java.util.Map">
 		SELECT
-				( SELECT SUM( resale_price ) FROM tb_orders ) AS totalMoney,
-				( SELECT SUM( resale_price )  FROM tb_orders WHERE order_finish=1) AS finishMoney,
-				( SELECT COUNT(id)  FROM tb_orders) AS orders
+				( SELECT SUM( resale_price ) FROM tb_orders  <if test='tradeAreaId != null '> WHERE trade_area_id = #{tradeAreaId} </if> ) AS totalMoney,
+				( SELECT SUM( resale_price )  FROM tb_orders WHERE order_finish=1 <if test='tradeAreaId != null '> AND trade_area_id = #{tradeAreaId} </if>) AS finishMoney,
+				( SELECT COUNT(id)  FROM tb_orders <if test='tradeAreaId != null '> WHERE trade_area_id = #{tradeAreaId} </if>) AS orders
 	</select>
 	<!--查询所有统计年份 -->
 	<select id="selectYear" resultType="java.util.Map">
@@ -135,6 +135,7 @@
 			LEFT JOIN
 			tb_orders ON
 			MONTH(tb_orders.create_time) = months.month AND YEAR(tb_orders.create_time) =#{year}
+		    <if test='tradeAreaId != null '> and tb_orders.trade_area_id = #{tradeAreaId} </if>
 		GROUP BY
 			months.month
 		ORDER BY

+ 4 - 4
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java

@@ -423,8 +423,8 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
      * @param year
      * @return
      */
-    public List<Map<String, Object>> orderStatistics(String type,String year){
-        return tbOrdersMapper.orderStatistics(type,year);
+    public List<Map<String, Object>> orderStatistics(String type,String year,Long tradeAreaId){
+        return tbOrdersMapper.orderStatistics(type,year,tradeAreaId);
     }
 
     /**
@@ -439,7 +439,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
      * 累计交易额
      * @return
      */
-    public Map<String, Object> totalMoney(){
-        return tbOrdersMapper.totalMoney();
+    public Map<String, Object> totalMoney(Long tradeAreaId){
+        return tbOrdersMapper.totalMoney(tradeAreaId);
     }
 }

+ 6 - 4
sp-service/sp-admin/src/main/java/com/pj/project4sp/admin/SpAdmin.java

@@ -20,14 +20,16 @@ public class SpAdmin implements Serializable  {
 
 	/** id,--主键、自增 */
 	public Long id;
+
 	/**
-	 * 类型  (00=运营管理者,01=合作社)
+	 * 类型(00=运营管理者,01=合作社)
 	 */
-	private String type="00";
+	private String type;
+
 	/**
-	 * 互市区
+	 * 所属互市(type=00时,值=-1;其他则为对应互市ID)
 	 */
-	private Long tradeAreaId=-1L;
+	private Long tradeAreaId;
 
 	/** admin名称 */
 	public String name;	

+ 3 - 4
sp-service/sp-admin/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java

@@ -103,10 +103,9 @@ public class SpAccAdminService {
         StpUserUtil.cachePerList(per_list);
         // 记录登录信息至redis
         PCLoginUserInfo info = new PCLoginUserInfo();
-        info.setLoginId(String.valueOf(admin.getId()))
-                .setLoginName(admin.getName())
-                .setAdminType(admin.getType())
-                .setTradeAreaId(admin.getTradeAreaId());
+        info.setLoginId(String.valueOf(admin.getId())).setLoginName(admin.getName());
+        info.setType(admin.getType());
+        info.setTradeAreaId(admin.getTradeAreaId());
         StpUserUtil.cachePcLoginInfo(info);
         return AjaxJson.getSuccessData(map);
     }