Browse Source

update tt

master
xhxu 2 years ago
parent
commit
b75b279f9d
11 changed files with 690 additions and 0 deletions
  1. +9
    -0
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  2. +116
    -0
      mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java
  3. +92
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumMeterialType.java
  4. +18
    -0
      mallinkService/src/main/java/com/iformall/mapper/TtMerchantPoiMapper.java
  5. +24
    -0
      mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java
  6. +37
    -0
      mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java
  7. +67
    -0
      mallinkService/src/main/java/com/iformall/service/toutiao/api/TtMediaUploadRequestExecutor.java
  8. +12
    -0
      mallinkService/src/main/java/com/iformall/service/toutiao/api/TtOpenMaService.java
  9. +34
    -0
      mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenMaServiceImpl.java
  10. +141
    -0
      mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml
  11. +140
    -0
      mlToutiaoOpen/src/main/java/com/iformall/controller/TtMerchantPoiController.java

+ 9
- 0
mallinkService/src/main/java/com/iformall/common/ErrorCode.java View File

@@ -370,6 +370,15 @@ public enum ErrorCode{
*/
MSG_MODEL_NOT_FOUND(27000, "找不到短信模板"),
MSG_CONFIG_NOT_FOUND(27001, "找不到短信配置"),

/**
* 文件上传
*/
PICTURE_SIZE_EXCEED(40001, "图片超过2M限制"),
PICTURE_ANALYZING_ERROR(40002, "您上传的图片无法解析,请检查"),
PICTURE_SIZE_CUSTOMIZE(40003, "图片超过大小限制"),
PICTURE_W_H_CUSTOMIZE(40004, "图片不符合宽高限制"),
PICTURE_ENDWIDTH_ERROR(40005, "格式不正确"),
;

private int code;


+ 116
- 0
mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java View File

@@ -0,0 +1,116 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.google.gson.JsonObject;
import com.iformall.utils.Constant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.Date;

@TableName(value = "tt_merchant_poi")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class TtMerchantPoi extends BaseEntity {

protected Long id;//merchant_id

@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId;

@io.swagger.annotations.ApiModelProperty(value="父租户ID",name="parentTenantId")
protected String parentTenantId;

@io.swagger.annotations.ApiModelProperty(value=" merchant_id",name="supplierExtId")
private String supplierExtId;

@io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName")
private String merchantName;

@io.swagger.annotations.ApiModelProperty(value="商户省",name="merchantProvince")
private String merchantProvince;

@io.swagger.annotations.ApiModelProperty(value="商户市",name="merchantCity")
private String merchantCity;

@io.swagger.annotations.ApiModelProperty(value="商户地址",name="merchantAddr")
private String merchantAddr;

@io.swagger.annotations.ApiModelProperty(value="经度",name="longitude")
private Float longitude;

@io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude")
private Float latitude;

@io.swagger.annotations.ApiModelProperty(value="高德POI ID",name="amapId")
private String amapId;

@io.swagger.annotations.ApiModelProperty(value="其他信息",name="extra")
private String extra;

@io.swagger.annotations.ApiModelProperty(value="高德POI ID/抖音POIID",name="poiId")
private String poiId;

@io.swagger.annotations.ApiModelProperty(value="poi名称 ",name="poiName")
private String poiName;

@io.swagger.annotations.ApiModelProperty(value="省",name="province")
private String province;

@io.swagger.annotations.ApiModelProperty(value="市",name="city")
private String city;

@io.swagger.annotations.ApiModelProperty(value="地址",name="address")
private String address;

@io.swagger.annotations.ApiModelProperty(value="抖音平台任务ID",name="taskId")
private String taskId;

@io.swagger.annotations.ApiModelProperty(value="EnumSupplierMathStatus 匹配状态,0-等待匹配,1-正在匹配,2-匹配成功,3-匹配失败",name="matchStatus")
private Integer matchStatus;

@io.swagger.annotations.ApiModelProperty(value="匹配状态描述",name="mismatchStatusDesc")
private String mismatchStatusDesc;

@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;

@io.swagger.annotations.ApiModelProperty(value="抖音平台商户ID",name="supplierId")
private String supplierId;

@io.swagger.annotations.ApiModelProperty(value="EnumSupplierSyncStatus 同步状态, 0 - 未处理; 1 - 通过; 2 - 未通过",name="syncStatus")
private Integer syncStatus;

@io.swagger.annotations.ApiModelProperty(value="EnumSupplierSyncStatus 最近一次同步状态, 0 - 未处理; 1 - 通过; 2 - 未通过",name="lastSyncStatus")
private Integer lastSyncStatus;

@io.swagger.annotations.ApiModelProperty(value="同步失败原因,抖音风控政策问题,该字段无法提供太多信息,目前审核不通过联系抖音运营做进一步处理",name="failReason")
private String failReason;


@io.swagger.annotations.ApiModelProperty(value="商铺营业执照路径",name="bizLicencePath")
private String bizLicencePath;
@io.swagger.annotations.ApiModelProperty(value="营业执照审核详细",name="bizLicenceStatus")
private String bizLicenceStatus;
@io.swagger.annotations.ApiModelProperty(value="商家授权函(或与小程序的合作协议)路径",name="contractPath")
private String contractPath;
@io.swagger.annotations.ApiModelProperty(value="商家授权函审核详细",name="contractStatus")
private String contractStatus;
@io.swagger.annotations.ApiModelProperty(value="商铺行业资质材料信息",name="qualMaterial")
private String qualMaterial;
@io.swagger.annotations.ApiModelProperty(value="商铺行业资质材料信息审核详细",name="qualMaterialStatus")
private String qualMaterialStatus;
@io.swagger.annotations.ApiModelProperty(value="其他补充资质",name="additionalQual")
private String additionalQual;
@io.swagger.annotations.ApiModelProperty(value="其他补充资质审核详细",name="additionalQualStatus")
private String additionalQualStatus;
@io.swagger.annotations.ApiModelProperty(value="所有资质的最早过期时间",name="expireTime")
private String expireTime;



}

+ 92
- 0
mallinkService/src/main/java/com/iformall/enums/EnumMeterialType.java View File

@@ -0,0 +1,92 @@
package com.iformall.enums;

/**
* app平台
* @author alascor
*/
public enum EnumMeterialType {
/**
* * 1 小程序图标 修改小程序图标接口 小于等于 2MB jpeg、jpg、png 像素为 200 * 200
* * 2 小程序服务类目资质材料 增加服务类目接口
* * 补充服务类目资质信息接口 小于等于 2MB jpeg、jpg、png
* * 3 小程序名称审核材料 修改小程序名称接口 小于等于 2MB jpeg、jpg、png
* * 4 小程序落地页截图 申请「短视频挂载」能力接口 小于等于 2MB jpeg、jpg、png
* * 5 场景示例图 申请「获取用户手机号」能力接口 小于等于 5MB jpeg、jpg、png
* * 6 小程序分享模板图片 新增分享模板接口
* * 修改分享模板接口 小于等于 1MB jpeg、jpg、png 像素为 500 * 400
* * 7 商铺营业执照、行业资质材料 提交商铺资质材料接口 小于等于 4MB jpeg、jpg、png
* * 8 服务商和商家的合作协议 提交商铺资质材料接口 小于等于 4MB pdf
*/

one(1,"小程序图标",2097152,"jpeg,jpg、png",200,200),
two(2,"小程序服务类目资质材料",2097152,"jpeg,jpg、png",null,null),
three(3,"小程序名称审核材料",2097152,"jpeg,jpg、png",null,null),
four(4,"小程序落地页截图",2097152,"jpeg,jpg、png",null,null),
five(5,"场景示例图",5242880,"jpeg,jpg、png",null,null),
six(6,"小程序分享模板图片",1048576,"jpeg,jpg、png",500,400),
seven(7,"商铺营业执照、行业资质材料",4194304,"jpeg,jpg、png",null,null),
enght(8,"服务商和商家的合作协议",4194304,"pdf",null,null),
;

EnumMeterialType(Integer code, String name,Integer size,String prefix,Integer wide,Integer height) {
this.code = code;
this.name = name;
this.size = size;
this.prefix = prefix;
this.wide = wide;
this.height = height;
}
private Integer code;
private String name;
private Integer size;
private String prefix;
private Integer wide;
private Integer height;

public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public Integer getWide() {
return wide;
}
public void setWide(Integer wide) {
this.wide = wide;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public static EnumMeterialType getByCode(Integer code) {
for (EnumMeterialType e : EnumMeterialType.values()) {
if (e.getCode().intValue() == code.intValue()) {
return e;
}
}
return null;
}
}

+ 18
- 0
mallinkService/src/main/java/com/iformall/mapper/TtMerchantPoiMapper.java View File

@@ -0,0 +1,18 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.TtMerchantPoi;

import java.util.List;

public interface TtMerchantPoiMapper extends CommonMapper<TtMerchantPoi, Long> {

List<TtMerchantPoi> findList(TtMerchantPoi record);

List<Long> findIdList(TtMerchantPoi record);

List<TtMerchantPoi> findTaskIdList(TtMerchantPoi record);

int deleteByUpdate(Long id);

}

+ 24
- 0
mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java View File

@@ -0,0 +1,24 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.TtMerchantPoi;

/**
* @author gongbiao
*/
public interface TtMerchantPoiService {

/**
* 根据实体查询分页列表
*
* @param record
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<TtMerchantPoi> listAsPage(TtMerchantPoi record, Integer pageIndex, Integer pageSize);

TtMerchantPoi getById(Long id);


}

+ 37
- 0
mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java View File

@@ -0,0 +1,37 @@
package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.TtMerchantPoi;
import com.iformall.mapper.TtMerchantPoiMapper;
import com.iformall.service.TtMerchantPoiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
* @author gongbiao
*/
@Service
public class TtMerchantPoiServiceImpl implements TtMerchantPoiService {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
TtMerchantPoiMapper ttMerchantPoiMapper;


@Override
public PageInfo<TtMerchantPoi> listAsPage(TtMerchantPoi record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttMerchantPoiMapper.findList(record));
}

@Override
public TtMerchantPoi getById(Long id) {
return ttMerchantPoiMapper.selectById(id);
}


}

+ 67
- 0
mallinkService/src/main/java/com/iformall/service/toutiao/api/TtMediaUploadRequestExecutor.java View File

@@ -0,0 +1,67 @@
package com.iformall.service.toutiao.api;

import me.chanjar.weixin.common.WxType;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.ResponseHandler;
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;

import java.io.File;
import java.io.IOException;

/**
* Created by ecoolper on 2017/5/5.
*/
public class TtMediaUploadRequestExecutor implements RequestExecutor<String, File> {
protected RequestHttp<CloseableHttpClient, HttpHost> requestHttp;

public TtMediaUploadRequestExecutor(RequestHttp requestHttp) {
this.requestHttp = requestHttp;
}

@Override
public void execute(String uri, File data, ResponseHandler<String> handler, WxType wxType) throws WxErrorException, IOException {
handler.handle(this.execute(uri, data, wxType));
}

@Override
public String execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (requestHttp.getRequestHttpProxy() != null) {
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
httpPost.setConfig(config);
}
if (file != null) {
HttpEntity entity = MultipartEntityBuilder
.create()
.addBinaryBody("material_file", file)
.setMode(HttpMultipartMode.RFC6532)
.build();
httpPost.setEntity(entity);
}
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) {
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
WxError error = WxError.fromJson(responseContent, wxType);
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
return responseContent;
} finally {
httpPost.releaseConnection();
}
}


}

+ 12
- 0
mallinkService/src/main/java/com/iformall/service/toutiao/api/TtOpenMaService.java View File

@@ -2,12 +2,14 @@ package com.iformall.service.toutiao.api;

import com.iformall.service.toutiao.api.bean.TtOpenResult;
import com.iformall.service.toutiao.miniapp.TtMaService;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
import me.chanjar.weixin.open.bean.result.*;

import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

@@ -230,6 +232,11 @@ public interface TtOpenMaService extends TtMaService {
*/
String API_SPEED_AUDIT = "https://api.weixin.qq.com/wxa/speedupaudit";

/**
* 代授权小程序上传资源
*/
String API_UPLOAD_MATERIAL = "https://open.microapp.bytedance.com/openapi/v1/microapp/upload_material";


/**
* 获得小程序的域名配置信息
@@ -478,6 +485,11 @@ public interface TtOpenMaService extends TtMaService {
*/
WxOpenResult publishQrcodeJump(String prefix) throws WxErrorException;


String mediaUpload(Integer mediaType, String fileType, InputStream inputStream) throws WxErrorException;

String mediaUpload(Integer mediaType, File file) throws WxErrorException;

// /**
// * 小程序用户隐私保护指引服务
// *


+ 34
- 0
mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenMaServiceImpl.java View File

@@ -5,6 +5,7 @@ import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.iformall.service.toutiao.api.TtMediaUploadRequestExecutor;
import com.iformall.service.toutiao.api.TtOpenComponentService;
import com.iformall.service.toutiao.api.TtOpenMaService;
import com.iformall.service.toutiao.api.bean.TtOpenGsonBuilder;
@@ -14,7 +15,10 @@ import com.iformall.service.toutiao.miniapp.TtMaQrcode;
import com.iformall.service.toutiao.miniapp.TtQrcodeRequestExecutor;
import com.iformall.service.toutiao.miniapp.impl.TtMaServiceImpl;
import lombok.extern.java.Log;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.fs.FileUtils;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo;
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
@@ -24,8 +28,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Material.MEDIA_UPLOAD_URL;

/**
*
@@ -649,6 +658,31 @@ public class TtOpenMaServiceImpl extends TtMaServiceImpl implements TtOpenMaServ
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

@Override
public String mediaUpload(Integer mediaType, String fileType, InputStream inputStream) throws WxErrorException {
File tmpFile = null;
try {
tmpFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType);
return this.mediaUpload(mediaType, tmpFile);
} catch (IOException e) {
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build(), e);
} finally {
if (tmpFile != null) {
tmpFile.delete();
}
}
}

@Override
public String mediaUpload(Integer mediaType, File file) throws WxErrorException {
String uri = API_UPLOAD_MATERIAL +"?component_appid="+ttOpenComponentService.getWxOpenConfigStorage().getComponentAppId()
+"&authorizer_access_token="+getAccessToken(false)
+"&material_type="+mediaType;
TtMediaUploadRequestExecutor executor = new TtMediaUploadRequestExecutor(this.getRequestHttp());
return this.execute(executor, uri, file);
}


/**
* 将字符串对象转化为GsonArray对象
*


+ 141
- 0
mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml View File

@@ -0,0 +1,141 @@
<?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.iformall.mapper.TtMerchantPoiMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.TtMerchantPoi">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="supplier_ext_id" jdbcType="VARCHAR" property="supplierExtId"/>
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/>
<result column="merchant_province" jdbcType="VARCHAR" property="merchantProvince"/>
<result column="merchant_city" jdbcType="VARCHAR" property="merchantCity"/>
<result column="merchant_addr" jdbcType="VARCHAR" property="merchantAddr"/>
<result column="longitude" jdbcType="FLOAT" property="longitude"/>
<result column="latitude" jdbcType="FLOAT" property="latitude"/>

<result column="amap_id" jdbcType="VARCHAR" property="amapId"/>
<result column="extra" jdbcType="VARCHAR" property="extra"/>

<result column="poi_id" jdbcType="VARCHAR" property="poiId"/>
<result column="poi_name" jdbcType="VARCHAR" property="poiName"/>
<result column="province" jdbcType="VARCHAR" property="province"/>
<result column="city" jdbcType="VARCHAR" property="city"/>
<result column="address" jdbcType="VARCHAR" property="address"/>

<result column="task_id" jdbcType="VARCHAR" property="taskId"/>
<result column="match_status" jdbcType="INTEGER" property="matchStatus"/>
<result column="mismatch_status_desc" jdbcType="VARCHAR" property="mismatchStatusDesc"/>

<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>

<result column="supplier_id" jdbcType="VARCHAR" property="supplierId"/>
<result column="sync_status" jdbcType="INTEGER" property="syncStatus"/>
<result column="last_sync_status" jdbcType="INTEGER" property="lastSyncStatus"/>
<result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>


<result column="biz_licence_path" jdbcType="VARCHAR" property="bizLicencePath"/>
<result column="biz_licence_status" jdbcType="VARCHAR" property="bizLicenceStatus"/>
<result column="contract_path" jdbcType="VARCHAR" property="contractPath"/>
<result column="contract_status" jdbcType="VARCHAR" property="contractStatus"/>
<result column="qual_material" jdbcType="VARCHAR" property="qualMaterial"/>
<result column="qual_material_status" jdbcType="VARCHAR" property="qualMaterialStatus"/>
<result column="additional_qual" jdbcType="VARCHAR" property="additionalQual"/>
<result column="additional_qual_status" jdbcType="VARCHAR" property="additionalQualStatus"/>
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/>

</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`supplier_ext_id`,
`merchant_name`,`merchant_province`,`merchant_city`,`merchant_addr`,`longitude`,`latitude`,
`amap_id`,`extra`,
`poi_id`,`poi_name`,`province`,`city`,`address`,
`task_id`,`match_status`,`mismatch_status_desc`,
`create_date`,`update_date`,
`supplier_id`,`sync_status`,`last_sync_status`,`fail_reason`,
`biz_licence_path`,`biz_licence_status`,`contract_path`,`contract_status`,`qual_material`,`qual_material_status`,`additional_qual`,`additional_qual_status`,`expire_time`
</sql>
<sql id="dynamicWhereConditions">
where is_del = 0

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != supplierExtId and '' != supplierExtId">
and `supplier_ext_id` = #{supplierExtId}
</if>

<if test=" null != poiId and ''!= poiId ">
and `poi_id` = #{poiId}
</if>

<if test=" null != merchantName and ''!= merchantName ">
and `merchant_name` like concat('%', #{merchantName},'%')
</if>

<if test=" null != taskId and ''!= taskId ">
and `task_id` = #{taskId}
</if>
<if test=" null != matchStatus">
and `match_status` = #{matchStatus}
</if>

<if test=" null != supplierId and '' != supplierId">
and `supplier_id` = #{supplierId}
</if>

<if test=" null != syncStatus">
and `sync_status` = #{syncStatus}
</if>

<if test=" null != lastSyncStatus">
and `last_sync_status` = #{lastSyncStatus}
</if>

<if test=" null != ids ">
and `id` in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from tt_merchant_poi
<include refid="dynamicWhereConditions"/>
</select>
<select id="findIdList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultType="Long">
select id
from tt_merchant_poi
<include refid="dynamicWhereConditions"/>
</select>

<select id="findTaskIdList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultType="String">
select distinct `tenant_id`,`parent_tenant_id`,`task_id`
from tt_merchant_poi
<include refid="dynamicWhereConditions"/>
</select>

<update id="deleteByUpdate" parameterType="Long">
update tt_merchant_poi set is_del = 1
where id = #{id}
</update>

</mapper>

+ 140
- 0
mlToutiaoOpen/src/main/java/com/iformall/controller/TtMerchantPoiController.java View File

@@ -0,0 +1,140 @@
package com.iformall.controller;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.BaseEntity;
import com.iformall.domain.po.TtMerchantPoi;
import com.iformall.enums.EnumMeterialType;
import com.iformall.service.TtMerchantPoiService;
import com.iformall.service.toutiao.FmTtOpenService;
import com.iformall.service.toutiao.api.TtOpenMaService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
@RestController
@RequestMapping("merchantPoi")
public class TtMerchantPoiController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private TtMerchantPoiService ttMerchantPoiService;

@Autowired
protected FmTtOpenService openService;

@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute TtMerchantPoi record, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::list");
if (null == record || StringUtils.isBlank(record.getTenantId())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode());
}
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
final PageInfo<TtMerchantPoi> page = ttMerchantPoiService.listAsPage(record, pageNum, pageSize);
return new ResultData(page);
}

@ApiOperation("根据id查询接口")
@GetMapping("/findById")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData findById(Long id) {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::findById");
if(id == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
TtMerchantPoi record = ttMerchantPoiService.getById(id);
return new ResultData(record);
}

/**
* 代授权小程序上传资源
* 1 小程序图标 修改小程序图标接口 小于等于 2MB jpeg、jpg、png 像素为 200 * 200
* 2 小程序服务类目资质材料 增加服务类目接口
* 补充服务类目资质信息接口 小于等于 2MB jpeg、jpg、png
* 3 小程序名称审核材料 修改小程序名称接口 小于等于 2MB jpeg、jpg、png
* 4 小程序落地页截图 申请「短视频挂载」能力接口 小于等于 2MB jpeg、jpg、png
* 5 场景示例图 申请「获取用户手机号」能力接口 小于等于 5MB jpeg、jpg、png
* 6 小程序分享模板图片 新增分享模板接口
* 修改分享模板接口 小于等于 1MB jpeg、jpg、png 像素为 500 * 400
* 7 商铺营业执照、行业资质材料 提交商铺资质材料接口 小于等于 4MB jpeg、jpg、png
* 8 服务商和商家的合作协议 提交商铺资质材料接口 小于等于 4MB pdf
*
* @param multiReq
* @return
* @throws Exception
*/
@PostMapping(value = "/upload_material", consumes = "multipart/*", headers = "content-type=multipart/form-data")
@ApiOperation("上传图片")
public ResultData awsImgUpload(@RequestParam("file") MultipartFile multiReq
,@RequestParam Map<String, String> param) {
logger.info("[" + getIpAddr() + "] TtMerchantPoiController::upload_material");
String appId = param.get("appId");
if(StringUtils.isBlank(appId)){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
String materialTypeStr = param.get("materialType");
Integer materialType = null;
if(StringUtils.isNotBlank(materialTypeStr)){
try{
materialType = Integer.parseInt(materialTypeStr);
}catch (Exception e){ }
}
if(materialType == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

EnumMeterialType enumMeterialType = EnumMeterialType.getByCode(materialType);
if(enumMeterialType == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
}

long size = multiReq.getSize();
final long length = enumMeterialType.getSize();
if (size > length) {
return new ResultData(ErrorCode.PICTURE_SIZE_EXCEED);
}

String fileFormat = "";
try {
int dot = multiReq.getOriginalFilename().lastIndexOf('.');
if (dot >= 0) {
fileFormat = multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length());
}

TtOpenMaService openMaService = openService.getTtOpenComponentService().getTtMaServiceByAppid(appId);
String res = openMaService.mediaUpload(materialType, fileFormat, multiReq.getInputStream());
return new ResultData(res);

} catch (Exception e) {
logger.error("解析图片",e);
return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR);
}
}



}

Loading…
Cancel
Save