Преглед изворни кода

[微信开发平台][修改]:草稿、模板修改, 审核状态,小程序列表

release_toaliyun_real
Stormeye Wu пре 7 година
родитељ
комит
8e213849a7
16 измењених фајлова са 280 додато и 334 уклоњено
  1. +13
    -9
      mallinkService/src/main/java/com/iformall/domain/po/WxAuthorizerInfo.java
  2. +15
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxWeappCodeStatus.java
  3. +0
    -109
      mallinkService/src/main/java/com/iformall/domain/po/WxWeappInfo.java
  4. +17
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxWeappInfo.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java
  6. +0
    -16
      mallinkService/src/main/java/com/iformall/mapper/WxWeappInfoMapper.java
  7. +20
    -1
      mallinkService/src/main/java/com/iformall/service/WxAuthorizerInfoService.java
  8. +0
    -47
      mallinkService/src/main/java/com/iformall/service/WxWeappInfoService.java
  9. +12
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxAuthorizerInfoServiceImpl.java
  10. +13
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxWeappCodeStatusServiceImpl.java
  11. +0
    -54
      mallinkService/src/main/java/com/iformall/service/impl/WxWeappInfoServiceImpl.java
  12. +1
    -1
      mallinkService/src/main/resources/mapper/WxAppinfoMapper.xml
  13. +79
    -4
      mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml
  14. +0
    -64
      mallinkService/src/main/resources/mapper/WxWeappInfoMapper.xml
  15. +50
    -15
      mallinkWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java
  16. +57
    -2
      mallinkWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java

+ 13
- 9
mallinkService/src/main/java/com/iformall/domain/po/WxAuthorizerInfo.java Прегледај датотеку

@@ -21,30 +21,30 @@ public class WxAuthorizerInfo implements Serializable {
@Transient
protected String sortColumns;

/**微信公众账号基本信息表id,关联微信公众号基本信息表*/
@io.swagger.annotations.ApiModelProperty(value="微信公众账号基本信息表id,关联微信公众号基本信息表",name="officialAccountId")
private Long officialAccountId;
/**授权方appid*/
@io.swagger.annotations.ApiModelProperty(value="授权方appid",name="authorizerAppid")
private String authorizerAppid;
/**授权方头像*/
@io.swagger.annotations.ApiModelProperty(value="授权方头像",name="headImg")
private String headImg;
/**授权方公众号所设置的微信号,可能为空*/
@io.swagger.annotations.ApiModelProperty(value="授权方公众号所设置的微信号,可能为空",name="alias")
private String alias;
/**二维码图片的URL,开发者最好自行也进行保存*/
@io.swagger.annotations.ApiModelProperty(value="二维码图片的URL,开发者最好自行也进行保存",name="qrcodeUrl")
private String qrcodeUrl;
/**创建时间*/
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
private Date createTime;
/**更新时间*/
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
private Date updateTime;
/**授权状态,0为已授权,1为已取消授权*/
@io.swagger.annotations.ApiModelProperty(value="授权状态,0为已授权,1为已取消授权",name="authorizationStatus")
private Integer authorizationStatus;
@io.swagger.annotations.ApiModelProperty(value="授权时间",name="authTime")
private Date authTime;
@io.swagger.annotations.ApiModelProperty(value="当前版本",name="currentVersion")
private String currentVersion;
@io.swagger.annotations.ApiModelProperty(value="当前版本描述",name="currentDesc")
private String currentDesc;
@io.swagger.annotations.ApiModelProperty(value="当前版本发布时间",name="releaseTime")
private Date releaseTime;



@@ -57,8 +57,12 @@ public class WxAuthorizerInfo implements Serializable {
,Alias_ASC("`alias` ASC"),Alias_DESC("`alias` DESC")
,QrcodeUrl_ASC("`qrcode_url` ASC"),QrcodeUrl_DESC("`qrcode_url` DESC")
,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC")
,Updateime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
,AuthorizationStatus_ASC("`authorization_status` ASC"),AuthorizationStatus_DESC("`authorization_status` DESC")
,AuthTime_ASC("`auth_time` ASC"),AuthTime_DESC("`auth_time` DESC")
,CurrentVersion_ASC("`current_version` ASC"),CurrentVersion_DESC("`current_version` DESC")
,CurrentDesc_ASC("`current_desc` ASC"),CurrentDesc_DESC("`current_desc` DESC")
,ReleaseTime_ASC("`release_time` ASC"),ReleaseTime_DESC("`release_time` DESC")
;
private String value;
Field(String value){


+ 15
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxWeappCodeStatus.java Прегледај датотеку

@@ -35,18 +35,27 @@ public class WxWeappCodeStatus implements Serializable {
/**code提交状态*/
@io.swagger.annotations.ApiModelProperty(value="code提交状态(0:成功, ...error code)",name="codeStatus")
private Integer codeStatus;
/**更新时间*/
@io.swagger.annotations.ApiModelProperty(value="code提交时间",name="codeTime")
private Date codeTime;
/**审核状态*/
@io.swagger.annotations.ApiModelProperty(value="审核状态((0为审核成功,1为审核失败,2为审核中,3已撤回))",name="auditStatus")
private Integer auditStatus;
/**审核时间*/
@io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime")
private Date auditTime;
/**发布状态*/
@io.swagger.annotations.ApiModelProperty(value="发布状态((0为发布成功,...error code))",name="releaseStatus")
private Integer releaseStatus;
/**发布时间*/
@io.swagger.annotations.ApiModelProperty(value="发布时间",name="releaseTime")
private Date releaseTime;
/**创建时间*/
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
private Date createTime;
/**更新时间*/
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
private Date updateTime;



@@ -56,8 +65,8 @@ public class WxWeappCodeStatus implements Serializable {
,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC")
,Type_ASC("`type` ASC"),Type_DESC("`type` DESC")
,UserVersion_ASC("`user_version` ASC"),UserVersion_DESC("`user_version` DESC")
,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC")
,UpdateTime_ASC("`update_time` ASC"),UpdateDate_DESC("`update_time` DESC")
;
private String value;
Field(String value){


+ 0
- 109
mallinkService/src/main/java/com/iformall/domain/po/WxWeappInfo.java Прегледај датотеку

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

import lombok.Data;
import javax.persistence.*;
import java.util.*;
import javax.persistence.Transient;
import java.util.List;
import javax.persistence.Id;
import java.io.Serializable;

@Table(name = "wx_weapp_info")
@Data
public class WxWeappInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
protected Long id;
@Transient
protected List<Long> ids;
@Transient
protected String sortColumns;
/**小程序ID*/
@io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId")
private String appId;
/**小程序类型(1-B端 2-C端)*/
@io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type")
private Integer type;
/**小程序名称*/
@io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name")
private String name;
/**当前版本*/
@io.swagger.annotations.ApiModelProperty(value="当前版本",name="currentVersion")
private String currentVersion;
/**描述*/
@io.swagger.annotations.ApiModelProperty(value="描述",name="currentDesc")
private String currentDesc;
/**创建时间*/
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
/**更新时间*/
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;



public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC")
,Type_ASC("`type` ASC"),Type_DESC("`type` DESC")
,ame_ASC("`name` ASC"),Name_DESC("`name` DESC")
,CurrentVersion_ASC("`current_version` ASC"),CurrentVersion_DESC("`current_version` DESC")
,CurrentDesc_ASC("`current_desc` ASC"),CurrentDesc_DESC("`current_desc` DESC")
,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
;
private String value;
Field(String value){
this.value = value;
}
public String getValue() {
return value;
}
public void setCol(String value) {
this.value = value;
}
@Override
public String toString() {
return this.getValue();
}
}
public void setSortColumns(WxWeappInfo.Field... fields)
{
if (fields == null || fields.length == 0) {
return;
}
for (int k = 0; k < fields.length; k++) {
if (fields[k] == null) {
return;
}
}
StringBuilder sb = new StringBuilder(fields[0].toString());
for (int k = 1; k < fields.length; k++) {
sb.append(",");
sb.append(fields[k].toString());
}
this.sortColumns = sb.toString();
}
public void setSortColumns(String sortColumns)
{
if (sortColumns == null || "".equals(sortColumns.trim())) {
return;
}
if (sortColumns.contains(",")) {
String[] cols = sortColumns.split(",");
java.util.List<Field> fList = new java.util.ArrayList();
for (int k = 0; k < cols.length; k++) {
fList.add(Field.valueOf(cols[k]));
}
this.setSortColumns(fList.toArray(new Field[fList.size()]));
} else {
this.setSortColumns(Field.valueOf(sortColumns));
}
}
}

+ 17
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxWeappInfo.java Прегледај датотеку

@@ -0,0 +1,17 @@
package com.iformall.domain.vo;

import com.iformall.domain.po.WxAuthorizerInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class WxWeappInfo extends WxAuthorizerInfo {
/**小程序类型(1-B端 2-C端)*/
@io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type")
private Integer type;
/**小程序名称*/
@io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name")
private String name;
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java Прегледај датотеку

@@ -3,10 +3,13 @@ package com.iformall.mapper;
import java.util.*;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxAuthorizerInfo;
import com.iformall.domain.vo.WxWeappInfo;

public interface WxAuthorizerInfoMapper extends CommonMapper<WxAuthorizerInfo, Long> {

List<WxAuthorizerInfo> findList(WxAuthorizerInfo wxAuthorizerInfo);

List<WxWeappInfo> findVoList(WxWeappInfo wxWeappInfo);



+ 0
- 16
mallinkService/src/main/java/com/iformall/mapper/WxWeappInfoMapper.java Прегледај датотеку

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

import java.util.*;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxWeappInfo;

public interface WxWeappInfoMapper extends CommonMapper<WxWeappInfo, Long> {

List<WxWeappInfo> findList(WxWeappInfo wxWeappInfo);

}

+ 20
- 1
mallinkService/src/main/java/com/iformall/service/WxAuthorizerInfoService.java Прегледај датотеку

@@ -1,8 +1,10 @@
package com.iformall.service;

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxAuthorizerInfo;
import com.iformall.domain.vo.WxWeappInfo;

import java.util.List;

public interface WxAuthorizerInfoService {

@@ -15,6 +17,23 @@ public interface WxAuthorizerInfoService {
* @return
*/
PageInfo<WxAuthorizerInfo> listAsPage(WxAuthorizerInfo record, Integer pageIndex, Integer pageSize);

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

/**
* 根据实体查询列表
* @param record
* @return
*/
List<WxWeappInfo> getList(WxWeappInfo record);
/**
* 根据Id获得实体


+ 0
- 47
mallinkService/src/main/java/com/iformall/service/WxWeappInfoService.java Прегледај датотеку

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

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

public interface WxWeappInfoService {

/**
* 根据实体查询分页列表
*
* @param record
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<WxWeappInfo> listAsPage(WxWeappInfo record, Integer pageIndex, Integer pageSize);
/**
* 根据Id获得实体
*
* @param id
* @return
*/
WxWeappInfo getById(Long id);
/**
* 保存或更新实体
*
* @param record
*/
void saveOrUpdate(WxWeappInfo record);

/**
* 根据Id删除实体
*
* @param id
*/
void deleteById(Long id);

}

+ 12
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxAuthorizerInfoServiceImpl.java Прегледај датотеку

@@ -3,6 +3,7 @@ package com.iformall.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxAuthorizerInfo;
import com.iformall.domain.vo.WxWeappInfo;
import com.iformall.mapper.WxAuthorizerInfoMapper;
import com.iformall.service.WxAuthorizerInfoService;
import org.slf4j.Logger;
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

import java.util.Date;
import java.util.List;

@Service
public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService {
@@ -26,6 +28,16 @@ public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAuthorizerInfoMapper.findList(record));
}

@Override
public PageInfo<WxWeappInfo> listVoAsPage(WxWeappInfo record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAuthorizerInfoMapper.findVoList(record));
}

@Override
public List<WxWeappInfo> getList(WxWeappInfo record) {
return wxAuthorizerInfoMapper.findVoList(record);
}

@Override
public WxAuthorizerInfo getById(Long id) {
return wxAuthorizerInfoMapper.selectByPrimaryKey(id);


+ 13
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxWeappCodeStatusServiceImpl.java Прегледај датотеку

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxWeappCodeStatus;
import com.iformall.enums.EnumAuditStatus;
import com.iformall.mapper.WxWeappCodeStatusMapper;
import com.iformall.service.WxWeappCodeStatusService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,11 +42,11 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService {
//record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
record.setCreateDate(new Date());
record.setUpdateDate(new Date());
record.setCreateTime(new Date());
record.setUpdateTime(new Date());
wxWeappCodeStatusMapper.insertSelective(record);
} else {
record.setUpdateDate(new Date());
record.setUpdateTime(new Date());
wxWeappCodeStatusMapper.updateByPrimaryKeySelective(record);
}
}
@@ -56,7 +57,9 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService {
updateRecord.setId(record.getId());
updateRecord.setUserVersion(record.getUserVersion());
updateRecord.setCodeStatus(record.getCodeStatus());
updateRecord.setUpdateDate(new Date());
Date curDate = new Date();
updateRecord.setUpdateTime(curDate);
updateRecord.setReleaseTime(curDate);
wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord);
}

@@ -65,7 +68,9 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService {
WxWeappCodeStatus updateRecord = new WxWeappCodeStatus();
updateRecord.setId(record.getId());
updateRecord.setAuditStatus(record.getAuditStatus());
updateRecord.setUpdateDate(new Date());
Date curDate = new Date();
updateRecord.setUpdateTime(curDate);
updateRecord.setAuditTime(curDate);
wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord);
}

@@ -74,7 +79,9 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService {
WxWeappCodeStatus updateRecord = new WxWeappCodeStatus();
updateRecord.setId(record.getId());
updateRecord.setReleaseStatus(record.getReleaseStatus());
updateRecord.setUpdateDate(new Date());
Date curDate = new Date();
updateRecord.setUpdateTime(curDate);
updateRecord.setReleaseTime(curDate);
wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord);
}



+ 0
- 54
mallinkService/src/main/java/com/iformall/service/impl/WxWeappInfoServiceImpl.java Прегледај датотеку

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

import java.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxWeappInfo;
import com.iformall.mapper.WxWeappInfoMapper;
import com.iformall.service.WxWeappInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

@Service
public class WxWeappInfoServiceImpl implements WxWeappInfoService {
@Autowired
WxWeappInfoMapper wxWeappInfoMapper;


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

@Override
public WxWeappInfo getById(Long id) {
return wxWeappInfoMapper.selectByPrimaryKey(id);
}

@Override
public void saveOrUpdate(WxWeappInfo record) {
if (record.getId() == null) {
//record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
wxWeappInfoMapper.insertSelective(record);
} else {
wxWeappInfoMapper.updateByPrimaryKeySelective(record);
}
}

@Override
public void deleteById(Long id) {
wxWeappInfoMapper.deleteByPrimaryKey(id);
}
}

+ 1
- 1
mallinkService/src/main/resources/mapper/WxAppinfoMapper.xml Прегледај датотеку

@@ -36,7 +36,7 @@
</if>

<if test=" null != appId ">
and `app_id` like concat('%', #{appId},'%')
and `app_id` = #{appId}
</if>
<if test=" null != parentAppId ">
and `parent_app_id` like concat('%', #{parentAppId},'%')


+ 79
- 4
mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml Прегледај датотеку

@@ -8,11 +8,16 @@
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="authorization_status" jdbcType="INTEGER" property="authorizationStatus" />
<result column="auth_time" jdbcType="TIMESTAMP" property="authTime" />
<result column="current_version" jdbcType="VARCHAR" property="currentVersion" />
<result column="current_desc" jdbcType="VARCHAR" property="currentDesc" />
<result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
</resultMap>
<sql id="allColumns">
`id`,`authorizer_appid`,`head_img`,`alias`,`qrcode_url`,`create_time`,`authorization_status`
`id`,`authorizer_appid`,`head_img`,`alias`,`qrcode_url`,`create_time`,`authorization_status`,`auth_time`,`current_version`,`current_desc`,`release_time`
</sql>

<sql id="dynamicWhereConditions">
@@ -21,7 +26,7 @@
and `id` = #{id}
</if>
<if test=" null != authorizerAppid ">
and `authorizer_appid` like concat('%', #{authorizerAppid},'%')
and `authorizer_appid` = #{authorizerAppid}
</if>
<if test=" null != headImg ">
and `head_img` like concat('%', #{headImg},'%')
@@ -34,10 +39,25 @@
</if>
<if test=" null != createTime ">
and `create_time` = #{createTime}
</if>
</if>
<if test=" null != updateTime ">
and `update_time` = #{updateTime}
</if>
<if test=" null != authorizationStatus ">
and `authorization_status` = #{authorizationStatus}
</if>
</if>
<if test=" null != authTime ">
and `auth_time` = #{authTime}
</if>
<if test=" null != currentVersion ">
and `current_version` = #{currentVersion}
</if>
<if test=" null != currentDesc ">
and `current_desc` like concat('%', #{currentDesc},'%')
</if>
<if test=" null != releaseTime ">
and `release_time` = #{releaseTime}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -51,6 +71,61 @@
select <include refid="allColumns" /> from wx_authorizer_info
<include refid="dynamicWhereConditions" />
</select>


<resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="authorizer_appid" jdbcType="VARCHAR" property="authorizerAppid" />
<result column="head_img" jdbcType="VARCHAR" property="headImg" />
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="authorization_status" jdbcType="INTEGER" property="authorizationStatus" />
<result column="auth_time" jdbcType="TIMESTAMP" property="authTime" />
<result column="current_version" jdbcType="VARCHAR" property="currentVersion" />
<result column="current_desc" jdbcType="VARCHAR" property="currentDesc" />
<result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="name" jdbcType="TIMESTAMP" property="name" />
</resultMap>

<sql id="allVColumns">
ai.`id`,ai.`authorizer_appid`,ai.`head_img`,ai.`alias`,ai.`qrcode_url`,ai.`create_time`,ai.`update_time`,
ai.`authorization_status`,ai.`auth_time`,
ai.`current_version`,ai.`current_desc`,ai.`release_time`,
a.`type`,a.`name`
</sql>

<sql id="dynamicVWhereConditions">
where 1 = 1
<if test=" null != id ">
and ai.`id` = #{id}
</if>
<if test=" null != authorizerAppid ">
and ai.`authorizer_appid` = #{authorizerAppid}
</if>
<if test=" null != type ">
and a.`type` = #{type}
</if>
<if test=" null != currentVersion ">
and ai.`current_version` = #{currentVersion}
</if>
<if test=" null != ids ">
and ai.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="findVoList" parameterType="com.iformall.domain.vo.WxWeappInfo" resultMap="VBaseResultMap">
select <include refid="allVColumns" />
from wx_authorizer_info ai
left join wx_appinfo a on ai.`authorizer_appid` = a.app_id
<include refid="dynamicVWhereConditions" />
</select>


+ 0
- 64
mallinkService/src/main/resources/mapper/WxWeappInfoMapper.xml Прегледај датотеку

@@ -1,64 +0,0 @@
<?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.WxWeappInfoMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxWeappInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="current_version" jdbcType="VARCHAR" property="currentVersion" />
<result column="current_desc" jdbcType="VARCHAR" property="currentDesc" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
</resultMap>
<sql id="allColumns">
`id`,`app_id`,`type`,`current_version`,`current_desc`,`create_date`,`update_date`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != appId ">
and `app_id` = #{appId}
</if>
<if test=" null != type ">
and `type` = #{type}
</if>
<if test=" null != name ">
and `name` = #{name}
</if>
<if test=" null != currentVersion ">
and `current_version` like concat('%', #{currentVersion},'%')
</if>
<if test=" null != currentDesc ">
and `current_desc` like concat('%', #{currentDesc},'%')
</if>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</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.WxWeappInfo" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_weapp_info
<include refid="dynamicWhereConditions" />
</select>
</mapper>

+ 50
- 15
mallinkWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java Прегледај датотеку

@@ -2,10 +2,13 @@ package com.iformall.controller;

import com.iformall.domain.po.WxAuthorizerInfo;
import com.iformall.domain.po.WxComponentVerifyTicket;
import com.iformall.domain.po.WxWeappCodeStatus;
import com.iformall.enums.EnumAuditStatus;
import com.iformall.enums.EnumWxAuthorizationInfoType;
import com.iformall.enums.EnumWxAuthorizationStatus;
import com.iformall.service.WxAuthorizerInfoService;
import com.iformall.service.WxComponentVerifyTicketService;
import com.iformall.service.WxWeappCodeStatusService;
import com.iformall.service.wechat.WxOpenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -13,8 +16,10 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import me.chanjar.weixin.open.api.WxOpenMaService;
import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerInfoResult;
import me.chanjar.weixin.open.bean.result.WxOpenMaQueryAuditResult;
import me.chanjar.weixin.open.bean.result.WxOpenQueryAuthResult;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -37,7 +42,7 @@ public class WechatCalllbackController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
protected WxOpenService wxOpenService;
protected WxOpenService openService;

@Autowired
private WxComponentVerifyTicketService componentVerifyTicketService;
@@ -45,6 +50,9 @@ public class WechatCalllbackController extends BaseController {
@Autowired
private WxAuthorizerInfoService authorizerInfoService;

@Autowired
private WxWeappCodeStatusService weappCodeStatusService;

@RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation("接收ticket回调")
public Object receiveTicket(HttpServletRequest request) throws IOException {
@@ -86,13 +94,13 @@ public class WechatCalllbackController extends BaseController {
signature, encType, msgSignature, timestamp, nonce, resultxml);

if (!StringUtils.equalsIgnoreCase("aes", encType)
|| !wxOpenService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
|| !openService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
}

// aes加密的消息
WxOpenXmlMessage inMessage = WxOpenXmlMessage.fromEncryptedXml(resultxml,
wxOpenService.getWxOpenConfigStorage(), timestamp, nonce, msgSignature);
openService.getWxOpenConfigStorage(), timestamp, nonce, msgSignature);
this.logger.debug("\n消息解密后内容为:\n{} ", inMessage.toString());
if(inMessage.getInfoType().equals(EnumWxAuthorizationInfoType.COMPONENT_VERIFY_TICKET.getMessage())) {
// 保存component_verify_ticket
@@ -108,10 +116,10 @@ public class WechatCalllbackController extends BaseController {
inMessage.getInfoType().equals(EnumWxAuthorizationInfoType.UPDATEAUTHORIZED.getMessage())
) {
try {
WxOpenQueryAuthResult queryAuthResult = wxOpenService.getWxOpenComponentService().getQueryAuth(inMessage.getAuthorizationCode());
WxOpenQueryAuthResult queryAuthResult = openService.getWxOpenComponentService().getQueryAuth(inMessage.getAuthorizationCode());
logger.info("getQueryAuth", queryAuthResult);

WxOpenAuthorizerInfoResult openAuthorizerInfoResult = wxOpenService.getWxOpenComponentService().getAuthorizerInfo(
WxOpenAuthorizerInfoResult openAuthorizerInfoResult = openService.getWxOpenComponentService().getAuthorizerInfo(
queryAuthResult.getAuthorizationInfo().getAuthorizerAppid());
// save auth info
authorizerInfoService.saveOrUpdate(new WxAuthorizerInfo(){
@@ -135,7 +143,7 @@ public class WechatCalllbackController extends BaseController {
});
}
try {
String out = wxOpenService.getWxOpenComponentService().route(inMessage);
String out = openService.getWxOpenComponentService().route(inMessage);
this.logger.debug("\n组装回复信息:{}", out);
} catch (WxErrorException e) {
this.logger.error("notify", e);
@@ -173,14 +181,14 @@ public class WechatCalllbackController extends BaseController {
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
appId, openid, signature, encType, msgSignature, timestamp, nonce, resultxml);
if (!StringUtils.equalsIgnoreCase("aes", encType)
|| !wxOpenService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
|| !openService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
}

String out = "";
// aes加密的消息
WxMpXmlMessage inMessage = WxOpenXmlMessage.fromEncryptedMpXml(resultxml,
wxOpenService.getWxOpenConfigStorage(), timestamp, nonce, msgSignature);
openService.getWxOpenConfigStorage(), timestamp, nonce, msgSignature);
logger.debug("\n消息解密后内容为:\n{} ", inMessage.toString());
// 全网发布测试用例
if (StringUtils.equalsAnyIgnoreCase(appId, "wx570bc396a51b8ff8", "wxd101a85aa106f53e")) {
@@ -192,16 +200,16 @@ public class WechatCalllbackController extends BaseController {
.fromUser(inMessage.getToUser())
.toUser(inMessage.getFromUser())
.build(),
wxOpenService.getWxOpenConfigStorage()
openService.getWxOpenConfigStorage()
);
} else if (StringUtils.startsWith(inMessage.getContent(), "QUERY_AUTH_CODE:")) {
String msg = inMessage.getContent().replace("QUERY_AUTH_CODE:", "") + "_from_api";
WxMpKefuMessage kefuMessage = WxMpKefuMessage.TEXT().content(msg).toUser(inMessage.getFromUser()).build();
wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage);
openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage);
}
} else if (StringUtils.equals(inMessage.getMsgType(), "event")) {
WxMpKefuMessage kefuMessage = WxMpKefuMessage.TEXT().content(inMessage.getEvent() + "from_callback").toUser(inMessage.getFromUser()).build();
wxOpenService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage);
openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage);
}
} catch (WxErrorException e) {
logger.error("callback", e);
@@ -209,11 +217,26 @@ public class WechatCalllbackController extends BaseController {
} else {
/**判断消息类型,调用对应的方法*/
switch (inMessage.getMsgType()){
case "event":
case "event": {
switch (inMessage.getEvent()) {
case "weapp_audit_success": { // 审核成功
updateAuditStatus(appId, true);
break;
}
case "weapp_audit_fail": { // 审核失败
updateAuditStatus(appId, false);
break;
}
default:
break;
}
return "success";
}
case "text":
WxMpXmlOutMessage outMessage = wxOpenService.getWxOpenMessageRouter().route(inMessage, appId);
WxMpXmlOutMessage outMessage = openService.getWxOpenMessageRouter().route(inMessage, appId);
if (outMessage != null) {
out = WxOpenXmlMessage.wxMpOutXmlMessageToEncryptedXml(outMessage, wxOpenService.getWxOpenConfigStorage());
out = WxOpenXmlMessage.wxMpOutXmlMessageToEncryptedXml(outMessage, openService.getWxOpenConfigStorage());
logger.info(out);
}
/*
else {
@@ -236,7 +259,19 @@ public class WechatCalllbackController extends BaseController {
}
}

logger.info(out);
return out;
}

private void updateAuditStatus(String appId, boolean success) {
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId);
if(codeStatus != null) {
if(success) {
codeStatus.setAuditStatus(EnumAuditStatus.SUCCESS.getCode());
} else {
codeStatus.setAuditStatus(EnumAuditStatus.FAIL.getCode());
}
weappCodeStatusService.updateAuditStatus(codeStatus);
}
}
}

+ 57
- 2
mallinkWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java Прегледај датотеку

@@ -13,6 +13,7 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxWeappInfo;
import com.iformall.enums.EnumAppType;
import com.iformall.enums.EnumAuditStatus;
import com.iformall.enums.EnumTemplateType;
@@ -27,6 +28,7 @@ import me.chanjar.weixin.open.api.WxOpenMaService;
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
import me.chanjar.weixin.open.bean.result.WxOpenMaDomainResult;
import me.chanjar.weixin.open.bean.result.WxOpenMaQueryAuditResult;
import me.chanjar.weixin.open.bean.result.WxOpenMaSubmitAuditResult;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import org.slf4j.Logger;
@@ -49,7 +51,7 @@ public class WxWeappInfoController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(getClass());

@Autowired
private WxWeappInfoService weappInfoService;
private WxAuthorizerInfoService authorizerInfoService;

@Autowired
private WxWeappBasicSetService weappBasicSetService;
@@ -78,10 +80,21 @@ public class WxWeappInfoController extends BaseController {
public ResultData list(@ModelAttribute WxWeappInfo weappInfo, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxWeappController::list");
if (null == weappInfo) weappInfo = new WxWeappInfo();
final PageInfo<WxWeappInfo> page = weappInfoService.listAsPage(weappInfo, pageNum, pageSize);
weappInfo.setSortColumns(WxAuthorizerInfo.Field.CurrentVersion_DESC);
final PageInfo<WxWeappInfo> page = authorizerInfoService.listVoAsPage(weappInfo, pageNum, pageSize);
return new ResultData(page);
}

@ApiOperation("列表接口")
@GetMapping("allist")
public ResultData getList(@ModelAttribute WxWeappInfo weappInfo) {
logger.debug("[" + getIpAddr() + "] WxWeappController::list");
if (null == weappInfo) weappInfo = new WxWeappInfo();
weappInfo.setSortColumns(WxAuthorizerInfo.Field.CurrentVersion_DESC);
final List<WxWeappInfo> list = authorizerInfoService.getList(weappInfo);
return new ResultData(list);
}

@ApiOperation(value = "APPs基础设置(服务器域名、业务域名、基础版本、微信模板)", notes = "{\"apps\":\"appid,appid\",\"type\":\"String\",\"deploy\":\"String\"}")
@PostMapping("batchBasicSet")
public ResultData batchSet(@RequestBody Map<String, String> params) {
@@ -298,6 +311,48 @@ public class WxWeappInfoController extends BaseController {
}
}

@ApiOperation(value = "批量审核查询", notes = "{\"apps\":\"appid,appid\"}")
@PostMapping("batchAuditQuery")
public ResultData batchAuditQuery(@RequestBody Map<String, String> params) {
String appsStr = params.get("apps");
// 逐一设置app配置
String [] apps = appsStr.split(",");
for(String appId: apps) {
try {
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId);
WxOpenMaQueryAuditResult openResult = openMaService.getLatestAuditStatus();
logger.info(openResult.toString());
if(openResult.isSuccess()) {
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId);
if(codeStatus != null) {
// 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回
switch (openResult.getStatus().intValue()) {
case 0:
codeStatus.setAuditStatus(EnumAuditStatus.SUCCESS.getCode());
break;
case 1:
codeStatus.setAuditStatus(EnumAuditStatus.FAIL.getCode());
break;
case 2:
codeStatus.setAuditStatus(EnumAuditStatus.AUDITING.getCode());
break;
case 3:
codeStatus.setAuditStatus(EnumAuditStatus.UNDO.getCode());
break;
default:
codeStatus.setAuditStatus(EnumAuditStatus.AUDITING.getCode());
break;
}
weappCodeStatusService.updateAuditStatus(codeStatus);
}
}
} catch (WxErrorException e) {
logger.error(e.getMessage());
}
}
return new ResultData();
}

@ApiOperation(value = "批量审核撤回", notes = "{\"apps\":\"appid,appid\"}")
@PostMapping("batchAuditCancel")
public ResultData batchAuditCancel(@RequestBody Map<String, String> params) {


Loading…
Откажи
Сачувај