Sfoglia il codice sorgente

区分申泽和七云平台

soobin 2 anni fa
parent
commit
11985bca5e

+ 91 - 100
src/main/java/com/szwl/controller/TOrderController.java

@@ -82,7 +82,11 @@ public class TOrderController {
     @Autowired
     SzwlFeign szwlFeign;
     @GetMapping("/pageOrder")
-    public ResponseModel<IPage<?>> pageOrder(String equipmentId, String adminId,String adminType,String type,String sn,String status,String userName,String payType,String productNo,String clientId,String trxNo,String dateType, String startDate, String endDate, long current, long size ) {
+    public ResponseModel<IPage<?>> pageOrder(String equipmentId, String adminId,String adminType,
+                                             String type,String sn,String status,String userName,
+                                             String payType,String productNo,String clientId,
+                                             String trxNo,String dateType, String startDate, String companyType,
+                                             String endDate, long current, long size ) {
         //判断当前账号状态
         TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId));
         if(StringUtils.isEmpty(type)){
@@ -195,6 +199,23 @@ public class TOrderController {
             if(StringUtils.isNotEmpty(status)){
                 query.eq(TOrder::getStatus,status);
             }
+            // 公司平台
+            // 申泽平台管理员
+            if (admin.getId() == 2738) {
+                companyType = "0";
+            }
+            // 七云平台管理员
+            if (admin.getId() == 2739) {
+                companyType = "1";
+            }
+            if(StringUtils.isNotEmpty(companyType)) {
+                if(companyType.equals("0")) {
+                    query.isNull(TOrder::getCompanyType).or()
+                            .eq(TOrder::getCompanyType,companyType);
+                }else {
+                    query.eq(TOrder::getCompanyType, companyType);
+                }
+            }
             if(StringUtils.isNotEmpty(clientId)){
                 TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
                 //判断机器是否属于这个登陆账号
@@ -498,7 +519,15 @@ public class TOrderController {
                 //补全clientId
                 TEquipment tEquipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(param.getClientId()));
                 param.setClientId(tEquipment.getClientId());
-//                param.setClientId(tEquipment.getClientId());
+            }
+            // 公司平台
+            // 申泽平台管理员
+            if (admin.getId() == 2738) {
+                param.setCompanyType("0");
+            }
+            // 七云平台管理员
+            if (admin.getId() == 2739) {
+                param.setCompanyType("1");
             }
         }else {
             if(admin.getType()==2){
@@ -530,8 +559,6 @@ public class TOrderController {
                 }else{
                     TAdminEquipment adminEquipment = R.getDataIfSuccess(szwlFeign.getClientIdList(String.valueOf(admin.getId())));
                     if(adminEquipment.getType().equals("0")){
-//                        TAdmin admin1 = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
-//                        param.setAdminId(admin1.getId().toString());
                         param.setAdminId(admin.getParentId().toString());
                     }else {
                         List<String> list = R.getDataIfSuccess(szwlFeign.getClientIds(adminId));
@@ -676,6 +703,14 @@ public class TOrderController {
         ChartColumn chartColumn = new ChartColumn();
         if(StringUtils.isNotEmpty(param.getAdminId())){
             TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(param.getAdminId())));
+            // 申泽平台管理员
+            if (admin.getId() == 2738) {
+                param.setCompanyType("0");
+            }
+            // 七云平台管理员
+            if (admin.getId() == 2739) {
+                param.setCompanyType("1");
+            }
             if(admin.getType()<2){
                 param.setAdminId(null);
             }else {
@@ -763,6 +798,8 @@ public class TOrderController {
             }
         }
 
+
+
         if(StringUtils.isNotEmpty(param.getIfForeign())&&param.getIfForeign().equals("1")){
             //国外
 //            chartColumn = orderService.getEquipmentStatistics(param);
@@ -885,7 +922,6 @@ public class TOrderController {
         IPage<TOrder> iPage = orderService.page(page, query);
         long total = page.getTotal();
         List<TOrder> content = iPage.getRecords();
-//        List<Order> content = page.getContent();
         ArrayList<OrderVo> orderVos = new ArrayList<>();
         for (TOrder order : content) {
             OrderVo orderVo = new OrderVo();
@@ -921,19 +957,26 @@ public class TOrderController {
      */
     @ApiOperation(value = "订单数据导出-查询")
     @RequestMapping(value = "/orderSelect", method = RequestMethod.GET)
-    public ResponseModel<?> orderSelect(String type, String clientId, String username,String ifForeign,  String startDate, String endDate, long current, long size) {
+    public ResponseModel<?> orderSelect(String type, String clientId, String username, String ifForeign,
+                                        String companyType, String startDate, String endDate,
+                                        Long adminId, long current, long size) {
         if(size>100){
             return R.fail(ResponseCodesEnum.A0001,"请求数量过大");
         }
-//        JSONObject jsonObject = new JSONObject();
         Page<OrderDaoChuDTO> page0 = new Page<>(current, size, true);
         page0.setSize(size);
         page0.setCurrent(current);
+        if(adminId == 2738) {
+            companyType = "0";
+        }
+        if(adminId == 2739) {
+            companyType = "1";
+        }
         if (startDate!=null&&endDate!=null) {
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
             Date begin = null;
             Date end = null;
-            Long adminId = null;
+            Long n_adminId = null;
             try {
                 begin = simpleDateFormat.parse(startDate);
                 end = simpleDateFormat.parse(endDate);
@@ -942,7 +985,7 @@ public class TOrderController {
             }
 
             long time = end.getTime() - begin.getTime();
-            if(time>31*24*60*60*1000l){
+            if(time>31*24*60*60*1000L){
                 return R.fail(ResponseCodesEnum.A0001,"时间跨度过长");
             }
             if(!StringUtils.isEmpty(username)){
@@ -952,21 +995,20 @@ public class TOrderController {
                 if(data==null||data.getId()==null){
                     return R.fail(ResponseCodesEnum.A0001,"找不到商家");
                 }
-                adminId = data.getId();
+                n_adminId = data.getId();
             }
             List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
             if(ifForeign.equals("0")) {
                 //大陆
-                OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), adminId, clientId, type, current, size);
+                OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
             }else {
                 //查海外
-                OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
+                OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),n_adminId,clientId,type,current,size);
             }
             for(OrderDaoChuDTO orderDaoChuDTO: OrderDaoChuDTOList){
                 String adminId1 = orderDaoChuDTO.getAdminId().toString();
                 ResponseModel<TAdmin> admin1 = szwlFeign.getAdmin(adminId1);
                 TAdmin admin = admin1.getData();
-//                TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId1));
                 if(admin==null){
                     continue;
                 }
@@ -974,28 +1016,25 @@ public class TOrderController {
                 orderDaoChuDTO.setUsername(admin.getUsername());
                 orderDaoChuDTO.setName(admin.getName());
                 if(!StringUtils.isEmpty(type)&&type.equals("2")){
+                    TArea area = areaService.getById(admin.getAreaId());
+                    if(area!=null){
+                        orderDaoChuDTO.setAddress(area.getFullName());
+                    }
+                    ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
+                    List<String> stringList = clientIds.getData();
+                    if(stringList!=null&&stringList.size()>0){
+                        orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
+                    }
                     //商户为单位
                     ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
                     TAdmin parent = feignAdmin.getData();
                     if(parent!=null&&parent.getId()!=null){
                         orderDaoChuDTO.setLastUsername(parent.getUsername());
-                        TArea area = areaService.getById(admin.getAreaId());
-                        if(area!=null){
-                            orderDaoChuDTO.setAddress(area.getFullName());
-                        }
-                        ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
-                        List<String> stringList = clientIds.getData();
-//                        List<String> stringList = R.getDataIfSuccess(szwlFeign.getClientIds(String.valueOf(admin.getId())));
-                        if(stringList!=null&&stringList.size()>0){
-                            orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
-                        }
                     }
-//                    TAdmin parent = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
                 }else {
                     //设备为单位
                     ResponseModel<TEquipment> equipmentByClientId = szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId()));
                     TEquipment equipment = equipmentByClientId.getData();
-//                    TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId())));
                     if(equipment!=null&&equipment.getId()!=null){
                         if(StringUtils.isNotEmpty(equipment.getFullName())){
                             orderDaoChuDTO.setAddress(equipment.getFullName());
@@ -1005,62 +1044,9 @@ public class TOrderController {
                     }
                 }
             }
-//            jsonObject.put("OrderDaoChuDTOList", OrderDaoChuDTOList);
             page0.setRecords(OrderDaoChuDTOList);
             page0.setTotal(1000);
-//            if(ifForeign.equals("0")){
-//                //大陆
-//                if(type.equals("1")){
-//                    //机器做单位
-//                    LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
-//                    if(StringUtils.isNotEmpty(clientId)){
-//                        query.eq(TEquipment::getClientId,clientId);
-//                    }
-//                    Page<TEquipment> page = new Page<>(current, size, true);
-//                    IPage<TEquipment> iPage = equipmentService.page(page, query);
-//                    page0.setTotal(iPage.getTotal());
-//                }else {
-//                    //商户做单位
-//                    LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
-//                    if(adminId!=null){
-//                        query.eq(TAdmin::getId,adminId);
-//                    }
-//                    Page<TAdmin> page = new Page<>(current, size, true);
-//                    IPage<TAdmin> iPage = .page(page, query);
-//                    page0.setTotal(iPage.getTotal());
-//                }
-//            }else {
-//                //海外
-//                if(type.equals("1")){
-//                    //机器做单位
-//                    LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
-//                    if(adminId!=null){
-//                        query.eq(TCoinOrder::getAdminId,adminId);
-//                    }
-//                    if(StringUtils.isNotEmpty(clientId)){
-//                        query.eq(TCoinOrder::getClientId,clientId);
-//                    }
-//                    query.groupBy(TCoinOrder::getClientId);
-//                    Page<TCoinOrder> page = new Page<>(current, size, true);
-//                    IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
-//                    page0.setTotal(iPage.getTotal());
-//                }else {
-//                    //商户做单位
-//                    LambdaQueryWrapper<TCoinOrder> query = Wrappers.lambdaQuery();
-//                    if(adminId!=null){
-//                        query.eq(TCoinOrder::getAdminId,adminId);
-//                    }
-//                    if(StringUtils.isNotEmpty(clientId)){
-//                        query.eq(TCoinOrder::getClientId,clientId);
-//                    }
-//                    query.groupBy(TCoinOrder::getAdminId);
-//                    Page<TCoinOrder> page = new Page<>(current, size, true);
-//                    IPage<TCoinOrder> iPage = coinOrderService.page(page, query);
-//                    page0.setTotal(iPage.getTotal());
-//                }
-//            }
         }
-
         return R.ok(page0);
     }
 
@@ -1070,17 +1056,23 @@ public class TOrderController {
     @ApiOperation(value = "订单数据导出-导出")
     @RequestMapping(value = "/onlineExport", method = RequestMethod.GET)
     @LogAnnotation(module = "模块名称:订单", operator="操作参数:导出订单数据")
-    public Object onlineExport(HttpServletResponse response, String type, String clientId, String ifForeign, String userName, String startDate, String endDate, long current, long size) {
-//        if(size>100){
-//            return JsonMessage.success("页数过大");
-//        }
-        current = 1l;
-        size = 1000l;
+    public Object onlineExport(HttpServletResponse response, String type, String clientId,
+                               String ifForeign, String userName, String startDate,
+                               String companyType, Long adminId,
+                               String endDate, long current, long size) {
+        current = 1L;
+        size = 1000L;
+        if(adminId == 2738) {
+            companyType = "0";
+        }
+        if(adminId == 2739) {
+            companyType = "1";
+        }
         if (startDate!=null&&endDate!=null) {
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date begin = null;
             Date end = null;
-            Long adminId = null;
+            Long n_adminId = null;
             try {
                 begin = simpleDateFormat.parse(startDate);
                 end = simpleDateFormat.parse(endDate);
@@ -1088,7 +1080,7 @@ public class TOrderController {
                 e.printStackTrace();
             }
                 long time = end.getTime() - begin.getTime();
-                if(time>31*24*60*60*1000l){
+                if(time>31*24*60*60*1000L){
                     return JsonMessage.success("时间跨度过长");
                 }
             if(!StringUtils.isEmpty(userName)){
@@ -1106,15 +1098,15 @@ public class TOrderController {
             List<OrderDaoChuDTO> OrderDaoChuDTOList = new ArrayList<>();
             if(ifForeign.equals("0")) {
                 //大陆
-                OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), adminId, clientId, type, current, size);
+                OrderDaoChuDTOList = orderService.orderDaoChu(simpleDateFormat.format(begin), simpleDateFormat.format(end), n_adminId, clientId, type, companyType, current, size);
             }else {
                 //查海外
-                OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
+                OrderDaoChuDTOList =coinOrderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),n_adminId,clientId,type,current,size);
             }
-//            List<OrderDaoChuDTO> OrderDaoChuDTOList =orderService.orderDaoChu(simpleDateFormat.format(begin),simpleDateFormat.format(end),adminId,clientId,type,current,size);
             for(OrderDaoChuDTO orderDaoChuDTO: OrderDaoChuDTOList){
-                Long adminId1 = Long.valueOf(orderDaoChuDTO.getAdminId().toString());
-                TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(adminId1.toString()));
+                String adminId1 = orderDaoChuDTO.getAdminId().toString();
+                ResponseModel<TAdmin> admin1 = szwlFeign.getAdmin(adminId1);
+                TAdmin admin = admin1.getData();
                 if(admin==null){
                     continue;
                 }
@@ -1122,27 +1114,26 @@ public class TOrderController {
                 orderDaoChuDTO.setUsername(admin.getUsername());
                 orderDaoChuDTO.setName(admin.getName());
                 if(!StringUtils.isEmpty(type)&&type.equals("2")){
-                    //商户为单位
-//                    TAdmin parent = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(admin.getParentId())));
-                    ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
-                    TAdmin parent = feignAdmin.getData();
-                    orderDaoChuDTO.setLastUsername(parent.getUsername());
                     TArea area = areaService.getById(admin.getAreaId());
                     if(area!=null){
                         orderDaoChuDTO.setAddress(area.getFullName());
                     }
                     ResponseModel<List<String>> clientIds = szwlFeign.getClientIds(String.valueOf(admin.getId()));
                     List<String> stringList = clientIds.getData();
-//                        List<String> stringList = R.getDataIfSuccess(szwlFeign.getClientIds(String.valueOf(admin.getId())));
                     if(stringList!=null&&stringList.size()>0){
                         orderDaoChuDTO.setEquipmentTotal(String.valueOf(stringList.size()));
                     }
+                    //商户为单位
+                    ResponseModel<TAdmin> feignAdmin = szwlFeign.getAdmin(String.valueOf(admin.getParentId()));
+                    TAdmin parent = feignAdmin.getData();
+                    if(parent!=null&&parent.getId()!=null){
+                        orderDaoChuDTO.setLastUsername(parent.getUsername());
+                    }
                 }else {
                     //设备为单位
                     ResponseModel<TEquipment> equipmentByClientId = szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId()));
                     TEquipment equipment = equipmentByClientId.getData();
-//                    TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(String.valueOf(orderDaoChuDTO.getClientId())));
-                    if(equipment!=null){
+                    if(equipment!=null&&equipment.getId()!=null){
                         if(StringUtils.isNotEmpty(equipment.getFullName())){
                             orderDaoChuDTO.setAddress(equipment.getFullName());
                         }

+ 25 - 10
src/main/java/com/szwl/mapper/xml/TOrderMapper.xml

@@ -22,7 +22,9 @@
         <result column="personage_proportion" property="personageProportion" />
         <result column="price" property="price" />
         <result column="product_id" property="productId" />
+        <result column="product_desc" property="productDesc" />
         <result column="product_name" property="productName" />
+        <result column="product_no" property="productNo" />
         <result column="refund_date" property="refundDate" />
         <result column="sn" property="sn" />
         <result column="status" property="status" />
@@ -34,7 +36,14 @@
         <result column="note" property="note" />
         <result column="pay_platform" property="payPlatform" />
         <result column="is_settlement" property="isSettlement" />
+        <result column="wx_id" property="wxId" />
         <result column="proportion_desc" property="proportionDesc" />
+        <result column="marketing_amount" property="marketingAmount" />
+        <result column="refund_marketing_amount" property="refundMarketingAmount" />
+        <result column="order_status" property="orderStatus" />
+        <result column="product_number" property="productNumber" />
+        <result column="refund_order_no" property="refundOrderNo" />
+        <result column="company_type" property="companyType" />
     </resultMap>
     <resultMap id="chartBean" type="com.szwl.model.bean.ChartBean">
         <result column="categorie" jdbcType="VARCHAR" property="categorie" />
@@ -59,7 +68,7 @@
     </resultMap>
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, create_date, modify_date, admin_id, admin_proportion, agency_id, agency_proportion, alt_info, client_id, equipment_id, frp_code, merchant_id, merchant_proportion, pay_date, personage_id, personage_proportion, price, product_id, product_name, refund_date, sn, status, type, trx_no, refund_trx_no, es, refund_amount, note, pay_platform, is_settlement, proportion_desc
+        id, create_date, modify_date, admin_id, admin_proportion, agency_id, agency_proportion, alt_info, client_id, equipment_id, frp_code, merchant_id, merchant_proportion, pay_date, personage_id, personage_proportion, price, product_id, product_name, refund_date, sn, status, type, trx_no, refund_trx_no, es, refund_amount, note, pay_platform, is_settlement, proportion_desc, company_type
     </sql>
 
     <!-- 日统计select concat(DATE_FORMAT( a.create_date,'%H'),'点') as categorie,count(1) as saleNum,sum(a.price) as salePrice -->
@@ -332,25 +341,31 @@
         limit 30
     </select>
     <select id="getOrderDaoCu" resultMap="orderDaoChuDTO" parameterType="com.szwl.model.query.OrderDaoChuParam">
-        select sum(price) AS priceTotal,admin_id AS adminId,client_id AS clientId
-         from  t_order  where 1=1
-        <if test="adminId != null and adminId !=''">
-            and admin_id= #{adminId} -- 订单所属商家id
-        </if>
+        select
+               sum(price) AS priceTotal, admin_id AS adminId, client_id AS clientId
+        from  t_order  where 1=1
         <if test="clientId != null and clientId !=''">
             and client_id = #{clientId}
         </if>
+        <choose>
+            <when test="companyType != null and companyType !='' and companyType.equals(&quot;0&quot;)">
+                AND (company_type IS NULL OR company_type = '0')
+            </when>
+            <when test="companyType != null and companyType !='' and companyType.equals(&quot;1&quot;)">
+                AND company_type = '1'
+            </when>
+        </choose>
         and status = 1
-        and create_date >= STR_TO_DATE(CONCAT(#{begin},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
-         <![CDATA[ and create_date <= STR_TO_DATE(CONCAT(#{end},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
+        and create_date >= STR_TO_DATE(CONCAT(#{begin},' 00:00:00'),'%Y-%m-%d %H:%i:%s')
+         <![CDATA[ and create_date <= STR_TO_DATE(CONCAT(#{end},' 23:59:59'),'%Y-%m-%d %H:%i:%s') ]]>
         <if test="type != null and type !='' and type==2">
             group by adminId
         </if>
         <if test="type != null and type !='' and type==1">
             group by clientId
         </if>
-        order by priceTotal desc
-        limit #{current} , #{size}
+            order by priceTotal desc
+            limit #{current} , #{size}
     </select>
     <select id="findByTime" resultType="com.szwl.model.query.OrderStatisticsDTO">
         select count(id) as totalNumber, sum(price) as totalPrice,

+ 13 - 9
src/main/java/com/szwl/model/bean/OrderDaoChuDTO.java

@@ -21,49 +21,53 @@ import java.util.Date;
 public class OrderDaoChuDTO {
 
     /**
-     *
+     * 用户名
      */
 
     private String username;
 
     /**
-     *
+     * 商户名称
      */
     private String name;
 
     /**
-     *
+     * 手机号码
      */
     private String phone;
 
     /**
-     *
+     * 地址
      */
     private String address;
 
     /**
-     *
+     * 设备编号
      */
     private String clientId;
 
+    /**
+     * 用户ID
+     */
     private Long adminId;
+
     /**
-     *
+     * 设备类型
      */
     private String equipmentType;
 
     /**
-     *
+     * 创建时间
      */
     private Date createDate;
 
     /**
-     *
+     * 设备数量
      */
     private String equipmentTotal;
 
     /**
-     *
+     * 上级商家
      */
     private String lastUsername;
 

+ 4 - 0
src/main/java/com/szwl/model/entity/TAdmin.java

@@ -107,6 +107,10 @@ public class TAdmin implements Serializable {
 
     @ApiModelProperty(value = "关联商家,相当于以前的parent_id")
     private String relationAdminId;
+
+    @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
+    private String companyType;
+
     @Transient
     public String getManagerId() {
 

+ 53 - 39
src/main/java/com/szwl/model/entity/TOrder.java

@@ -29,113 +29,127 @@ import lombok.EqualsAndHashCode;
 public class TOrder implements Serializable {
 
     private static final long serialVersionUID = 1L;
+
     @JsonSerialize(using= ToStringSerializer.class)
+    @ApiModelProperty(value = "订单唯一ID")
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
+    @ApiModelProperty(value = "创建时间")
     private Date createDate;
 
+    @ApiModelProperty(value = "修改时间")
     private Date modifyDate;
 
-    @ApiModelProperty(value = "用户id;")
+    @ApiModelProperty(value = "用户ID")
     private Long adminId;
 
-    @ApiModelProperty(value = "平台分账;")
+    @ApiModelProperty(value = "平台分账")
     private BigDecimal adminProportion;
 
-    @ApiModelProperty(value = "一级分销商户id;")
+    @ApiModelProperty(value = "一级分销商户ID")
     private Long agencyId;
 
-    @ApiModelProperty(value = "分账比例;")
+    @ApiModelProperty(value = "一级分账比例")
     private BigDecimal agencyProportion;
 
-    @ApiModelProperty(value = "分销逻辑;")
+    @ApiModelProperty(value = "分销逻辑")
     private String altInfo;
 
-    @ApiModelProperty(value = "设备编号;")
+    @ApiModelProperty(value = "设备编号")
     private String clientId;
 
-    @ApiModelProperty(value = "设备id;")
+    @ApiModelProperty(value = "设备ID")
     private Long equipmentId;
 
-    @ApiModelProperty(value = "支付方式;")
+    @ApiModelProperty(value = "支付方式")
     private String frpCode;
 
-    @ApiModelProperty(value = "二级分销商户id;")
+    @ApiModelProperty(value = "二级分销商户ID")
     private Long merchantId;
 
-    @ApiModelProperty(value = "分账比例;")
+    @ApiModelProperty(value = "二级分账比例")
     private BigDecimal merchantProportion;
 
-    @ApiModelProperty(value = "支付时间;")
+    @ApiModelProperty(value = "支付时间")
     private Date payDate;
 
-    @ApiModelProperty(value = "三级分销商户id;")
+    @ApiModelProperty(value = "三级分销商户ID")
     private Long personageId;
 
-    @ApiModelProperty(value = "分账比例;")
+    @ApiModelProperty(value = "三级分账比例")
     private BigDecimal personageProportion;
 
-    @ApiModelProperty(value = "金额;")
+    @ApiModelProperty(value = "订单金额")
     private BigDecimal price;
 
-    @ApiModelProperty(value = "商品id;")
+    @ApiModelProperty(value = "商品ID")
     private Long productId;
 
-    @ApiModelProperty(value = "商品名称;")
-    private String productName;
-
-    @ApiModelProperty(value = "商品数量;")
-    private Integer productNumber;
-
-    @ApiModelProperty(value = "商品名称;")
+    @ApiModelProperty(value = "商品名称")
     private String productDesc;
 
-    @ApiModelProperty(value = "商品编号;")
+    @ApiModelProperty(value = "商品名称")
+    private String productName;
+
+    @ApiModelProperty(value = "商品编号")
     private String productNo;
-    @ApiModelProperty(value = "退款时间;")
+
+    @ApiModelProperty(value = "退款时间")
     private Date refundDate;
 
-    @ApiModelProperty(value = "订单编号;")
+    @ApiModelProperty(value = "订单编号")
     private String sn;
 
-    @ApiModelProperty(value = "支付状态;")
+    @ApiModelProperty(value = "支付状态")
     private Integer status;
 
-    @ApiModelProperty(value = "0:分账方2个,1:分账方3个,3:分账方4个,3:分账方超4个;")
+    @ApiModelProperty(value = "0:分账方2个,1:分账方3个,3:分账方4个,3:分账方超4个")
     private Integer type;
 
-    @ApiModelProperty(value = "支付流水号;")
+    @ApiModelProperty(value = "支付流水号")
     private String trxNo;
 
-    @ApiModelProperty(value = "退款流水号;")
+    @ApiModelProperty(value = "退款流水号")
     private String refundTrxNo;
 
-    @ApiModelProperty(value = "是否发送到es;")
+    @ApiModelProperty(value = "是否发送到es")
     private String es;
 
-    @ApiModelProperty(value = "退款金额;")
+    @ApiModelProperty(value = "退款金额")
     private BigDecimal refundAmount;
 
-    @ApiModelProperty(value = "标记;")
+    @ApiModelProperty(value = "标记")
     private String note;
 
-    @ApiModelProperty(value = "支付平台; 0或null为汇聚,1为杉德支付")
+    @ApiModelProperty(value = "支付平台  0或null为汇聚,1为杉德支付")
     private String payPlatform;
 
-    @ApiModelProperty(value = "是否结算;0或null为未结算,1已结算。仅杉德支付有这个")
+    @ApiModelProperty(value = "是否结算 0或null为未结算,1已结算。仅杉德支付有这个")
     private String isSettlement;
 
+    @ApiModelProperty(value = "支付流水号")
+    private Long wxId;
+
     @ApiModelProperty(value = "分账详情,当分账超过4方时,这个字段才启用")
     private String proportionDesc;
 
-    @ApiModelProperty(value = "支付流水号;")
-    private String wxId;
+    private BigDecimal marketingAmount;
+
+    @ApiModelProperty(value = "退款营销金额")
+    private BigDecimal refundMarketingAmount;
 
-    //'订单状态;0:排队中(机器上传的,代表机器已收到订单),-1:排队中(默认),1:正在制作,2:已制作',
+    @ApiModelProperty(value = "订单状态;0:排队中,1:正在制作,2:已制作")
     private String orderStatus;
 
-    private BigDecimal marketingAmount;
+    @ApiModelProperty(value = "商品数量")
+    private Integer productNumber;
+
+    @ApiModelProperty(value = "退款订单版本号")
+    private String refundOrderNo;
+
+    @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
+    private String companyType;
+
 
-    private BigDecimal refundMarketingAmount;
 }

+ 2 - 0
src/main/java/com/szwl/model/query/OrderDaoChuParam.java

@@ -31,5 +31,7 @@ public class OrderDaoChuParam {
     private Long current;
     @ApiModelProperty(value="")
     private Long size;
+    @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
+    private String companyType;
 
 }

+ 3 - 0
src/main/java/com/szwl/model/query/StatisticsParam.java

@@ -67,4 +67,7 @@ public class StatisticsParam {
 
     @ApiModelProperty(value="第几次查询")
     private String test = "1";
+
+    @ApiModelProperty(value = "公司平台,0或空为申泽,1为七云")
+    private String companyType;
 }

+ 1 - 1
src/main/java/com/szwl/service/TOrderService.java

@@ -28,7 +28,7 @@ public interface TOrderService extends IService<TOrder> {
 
     ChartColumn getEquipmentStatistics(StatisticsParam param);
 
-    List<OrderDaoChuDTO> orderDaoChu(String begin, String end, Long adminId, String clientId, String type, long current, long size);
+    List<OrderDaoChuDTO> orderDaoChu(String begin, String end, Long adminId, String clientId, String type, String companyType, long current, long size);
 
     List<OrderTarget> findById(TAdmin admin, List<TOrder> list) throws ParseException;
 

+ 26 - 4
src/main/java/com/szwl/service/es/EsTEquipmentService.java

@@ -25,6 +25,7 @@ import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.aggregations.AggregationBuilders;
 import org.elasticsearch.search.aggregations.Aggregations;
 import org.elasticsearch.search.aggregations.BucketOrder;
@@ -201,6 +202,23 @@ public class EsTEquipmentService extends EsBaseService<TEquipment, TEquipmentPar
         }
 
         boolQueryBuilder = esTOrderService.getParam2QueryBuilder(tOrderParam);
+        // 公司平台
+        String companyType = param.getCompanyType();
+        if(StringUtils.isNotEmpty(companyType)) {
+            if(companyType.equals("0")) {
+                boolQueryBuilder.must(
+                        QueryBuilders.boolQuery().should(
+                                QueryBuilders.termQuery("companyType", "0")
+                        ).should(
+                                QueryBuilders.boolQuery().mustNot(
+                                        QueryBuilders.existsQuery("companyType")
+                                )
+                        )
+                );
+            } else {
+                boolQueryBuilder.must(QueryBuilders.termQuery("companyType","1"));
+            }
+        }
         if("1".equals(param.getChangeType())){
             // 花型统计
             return getEquipmentStatistics(boolQueryBuilder,esTOrderService.getTableName(),"productName.keyword");
@@ -323,14 +341,18 @@ public class EsTEquipmentService extends EsBaseService<TEquipment, TEquipmentPar
 
     public ChartColumn getEquipmentStatistics(BoolQueryBuilder queryBuilder,String tableName ,String termField) {
         try {
-            String aggregationResultName = "aggregationResult";//  仅为名称,用以获取返回结果
-            String aggSumName = "sales"; //  仅为名称,用以获取返回结果
+            // 仅为名称,用以获取返回结果
+            String aggregationResultName = "aggregationResult";
+            // 仅为名称,用以获取返回结果
+            String aggSumName = "sales";
 
             // 根据字段 termField 聚合
             TermsAggregationBuilder termsAggregationBuilder = AggregationBuilders.terms(aggregationResultName).field(termField);
-            termsAggregationBuilder.size(30); // 聚合后 返回前30条 记录
+            // 聚合后 返回前30条 记录
+            termsAggregationBuilder.size(30);
             termsAggregationBuilder.order(BucketOrder.compound(
-                BucketOrder.aggregation(aggSumName,false)//先按sales,降序排
+                    //先按sales,降序排
+                BucketOrder.aggregation(aggSumName,false)
             ));
             // 根据字段price 求和 sum, sales 仅为名称,用以获取返回结果
             SumAggregationBuilder sumAggregationBuilder = AggregationBuilders.sum(aggSumName).field("price");

+ 22 - 1
src/main/java/com/szwl/service/es/EsTOrderService.java

@@ -25,6 +25,8 @@ import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.indices.GetIndexRequest;
 import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.ExistsQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.aggregations.Aggregation;
 import org.elasticsearch.search.aggregations.AggregationBuilder;
 import org.elasticsearch.search.aggregations.AggregationBuilders;
@@ -208,6 +210,7 @@ public class EsTOrderService extends EsBaseService<TOrder, TOrderParam> {
             if(StringUtils.isNotEmpty(param.getPayType())){ // 支付方式
                 tOrderParam.setFrpCode(param.getPayType());
             }
+
             if (null != param.getAgencyId()){
                 tOrderParam.setAgencyId(param.getAgencyId());
                 tOrderParam.setType_gt(1);
@@ -297,6 +300,24 @@ public class EsTOrderService extends EsBaseService<TOrder, TOrderParam> {
 
             //Bool查询
             BoolQueryBuilder queryBuilder = getStatisticsParam2QueryBuilder(param);
+            // 公司平台
+            String companyType = param.getCompanyType();
+            if(StringUtils.isNotEmpty(companyType)) {
+                if(companyType.equals("0")) {
+                    queryBuilder.must(
+                            QueryBuilders.boolQuery().should(
+                                    QueryBuilders.termQuery("companyType", "0")
+                            ).should(
+                                    QueryBuilders.boolQuery().mustNot(
+                                            QueryBuilders.existsQuery("companyType")
+                                    )
+                            )
+                    );
+                } else {
+                    queryBuilder.must(QueryBuilders.termQuery("companyType","1"));
+                }
+            }
+
             // 时间聚合
             AggregationBuilder dateHistogram = AggregationBuilders.dateHistogram(aggregationResultName)
                     .field("createDate")
@@ -366,7 +387,7 @@ public class EsTOrderService extends EsBaseService<TOrder, TOrderParam> {
 
         endDate = sdf.format(calendar.getTime());
 
-        calendar.add(calendar.HOUR_OF_DAY, -1);
+        calendar.add(Calendar.HOUR_OF_DAY, -1);
 //        calendar.add(calendar.DATE, -4);
 
         startDate = sdf.format(calendar.getTime());

+ 2 - 1
src/main/java/com/szwl/service/impl/TOrderServiceImpl.java

@@ -127,7 +127,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
     }
 
     @Override
-    public List<OrderDaoChuDTO> orderDaoChu(String begin, String end, Long adminId, String clientId, String type, long current, long size) {
+    public List<OrderDaoChuDTO> orderDaoChu(String begin, String end, Long adminId, String clientId, String type, String companyType, long current, long size) {
         OrderDaoChuParam daoChuParam = new OrderDaoChuParam();
         daoChuParam.setAdminId(adminId);
         daoChuParam.setBegin(begin);
@@ -136,6 +136,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
         daoChuParam.setType(type);
         daoChuParam.setCurrent(current-1);
         daoChuParam.setSize(size);
+        daoChuParam.setCompanyType(companyType);
         return tOrderMapper.getOrderDaoCu(daoChuParam);
     }