| @@ -32,6 +32,8 @@ public class WxWeappCodeStatus implements Serializable { | |||
| /**用户版本*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||
| private String userVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||
| private String versionDesc; | |||
| /**code提交状态*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="code提交状态(0:成功, ...error code)",name="codeStatus") | |||
| private Integer codeStatus; | |||
| @@ -0,0 +1,14 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappCodeStatusVo extends WxWeappCodeStatus { | |||
| /**小程序名称*/ | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||
| private String name; | |||
| } | |||
| @@ -2,12 +2,15 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import java.util.List; | |||
| public interface WxWeappCodeStatusMapper extends CommonMapper<WxWeappCodeStatus, Long> { | |||
| List<WxWeappCodeStatus> findList(WxWeappCodeStatus wxWeappCodeStatus); | |||
| List<WxWeappCodeStatusVo> findVoList(WxWeappCodeStatusVo weappCodeStatusVo); | |||
| @@ -2,6 +2,9 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import java.util.List; | |||
| public interface WxWeappCodeStatusService { | |||
| @@ -13,7 +16,15 @@ public interface WxWeappCodeStatusService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappCodeStatus> listAsPage(WxWeappCodeStatus record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -3,13 +3,17 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxWeappCodeStatusMapper; | |||
| import com.iformall.service.WxWeappCodeStatusService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||
| @@ -17,10 +21,18 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||
| @Autowired | |||
| WxWeappCodeStatusMapper wxWeappCodeStatusMapper; | |||
| @Autowired | |||
| WxAuthorizerInfoMapper wxAuthorizerInfoMapper; | |||
| @Override | |||
| public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappCodeStatusMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxWeappCodeStatus> listAsPage(WxWeappCodeStatus record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappCodeStatusMapper.findList(record)); | |||
| public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) { | |||
| return wxWeappCodeStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| @@ -82,6 +94,14 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||
| updateRecord.setUpdateTime(curDate); | |||
| updateRecord.setReleaseTime(curDate); | |||
| wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord); | |||
| // 更新 小程序 状态 | |||
| if(record.getReleaseStatus().equals(0)) { // 发布成功 | |||
| WxAuthorizerInfo updateInfo = new WxAuthorizerInfo(); | |||
| updateInfo.setCurrentVersion(record.getUserVersion()); | |||
| updateInfo.setCurrentDesc(record.getVersionDesc()); | |||
| updateInfo.setUpdateTime(curDate); | |||
| wxAuthorizerInfoMapper.updateByPrimaryKeySelective(updateInfo); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -103,7 +103,7 @@ | |||
| and ai.`id` = #{id} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and ai.`name` like concat('%', #{name},'%') | |||
| and a.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != authorizerAppid "> | |||
| and ai.`authorizer_appid` = #{authorizerAppid} | |||
| @@ -62,6 +62,76 @@ | |||
| select <include refid="allColumns" /> from wx_weapp_code_status | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappCodeStatusVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="user_version" jdbcType="VARCHAR" property="userVersion" /> | |||
| <result column="code_status" jdbcType="INTEGER" property="codeStatus" /> | |||
| <result column="code_time" jdbcType="TIMESTAMP" property="codeTime" /> | |||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus" /> | |||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> | |||
| <result column="release_status" jdbcType="INTEGER" property="releaseStatus" /> | |||
| <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| <result column="name" jdbcType="TIMESTAMP" property="name" /> | |||
| </resultMap> | |||
| <sql id="allVoColumns"> | |||
| c.`id`,c.`app_id`,c.`type`,c.`user_version`,c.`code_status`,c.`code_time`,c.`audit_status`,c.`audit_time`,c.`release_status`,c.`release_time`,c.`create_time`,c.`update_time`, | |||
| a.`name` | |||
| </sql> | |||
| <sql id="dynamicVoWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and c.`id` = #{id} | |||
| </if> | |||
| <if test=" null != appId "> | |||
| and c.`app_id` = #{appId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and c.`type` = #{type} | |||
| </if> | |||
| <if test=" null != userVersion "> | |||
| and vc.`user_version` = #{userVersion} | |||
| </if> | |||
| <if test=" null != codeStatus "> | |||
| and c.`code_status` = #{codeStatus} | |||
| </if> | |||
| <if test=" null != auditStatus "> | |||
| and c.v`audit_status` = #{auditStatus} | |||
| </if> | |||
| <if test=" null != releaseStatus "> | |||
| and c.`release_status` = #{releaseStatus} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and c.`create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and c.`update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and a.`name` like concat('%', #{name},'%') | |||
| </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="findVoList" parameterType="com.iformall.domain.vo.WxWeappCodeStatusVo" resultMap="VBaseResultMap"> | |||
| select <include refid="allVoColumns" /> | |||
| from wx_weapp_code_status c | |||
| left join wx_appinfo a on c.`app_id` = a.app_id | |||
| <include refid="dynamicVoWhereConditions" /> | |||
| </select> | |||
| @@ -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.WxWeappCodeStatusVo; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumAuditStatus; | |||
| @@ -73,7 +74,7 @@ public class WxWeappInfoController extends BaseController { | |||
| private WxTemplateMsgService templateMsgService; | |||
| @ApiOperation(value = "分页列表接口", notes = "查询支持小程序类型,名称,appid,version") | |||
| @ApiOperation(value = "小程序分页列表接口", notes = "查询支持小程序类型,名称,appid,version") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -87,7 +88,7 @@ public class WxWeappInfoController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("列表接口") | |||
| @ApiOperation("小程序列表接口") | |||
| @GetMapping("allist") | |||
| public ResultData getList(@ModelAttribute WxWeappInfo weappInfo) { | |||
| logger.debug("[" + getIpAddr() + "] WxWeappController::list"); | |||
| @@ -281,10 +282,12 @@ public class WxWeappInfoController extends BaseController { | |||
| codeStatus = new WxWeappCodeStatus(); | |||
| codeStatus.setAppId(appId); | |||
| codeStatus.setUserVersion(userVersion); | |||
| codeStatus.setVersionDesc(userDesc); | |||
| codeStatus.setCodeStatus(Integer.valueOf(openRet.getErrcode())); | |||
| weappCodeStatusService.saveOrUpdate(codeStatus); | |||
| } else { | |||
| codeStatus.setUserVersion(userVersion); | |||
| codeStatus.setVersionDesc(userDesc); | |||
| codeStatus.setCodeStatus(Integer.valueOf(openRet.getErrcode())); | |||
| weappCodeStatusService.updateCodeCommitStatus(codeStatus); | |||
| } | |||
| @@ -403,6 +406,31 @@ public class WxWeappInfoController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation(value = "小程序发布状态分页列表接口", notes = "查询支持小程序类型,名称,appid,version") | |||
| @GetMapping("releaseStatusList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData releaseStatusList(@ModelAttribute WxWeappCodeStatusVo weappCodeStatusVo, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxWeappController::releaseStatusList"); | |||
| if (null == weappCodeStatusVo) weappCodeStatusVo = new WxWeappCodeStatusVo(); | |||
| weappCodeStatusVo.setSortColumns(WxWeappCodeStatus.Field.UserVersion_DESC); | |||
| final PageInfo<WxWeappCodeStatusVo> page = weappCodeStatusService.listAsPage(weappCodeStatusVo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("小程序发布状态列表接口") | |||
| @GetMapping("releaseStatusAllList") | |||
| public ResultData getReleaseStatusList(@ModelAttribute WxWeappCodeStatusVo weappCodeStatusVo) { | |||
| logger.debug("[" + getIpAddr() + "] WxWeappController::releaseStatusAllList"); | |||
| if (null == weappCodeStatusVo) weappCodeStatusVo = new WxWeappCodeStatusVo(); | |||
| weappCodeStatusVo.setSortColumns(WxWeappCodeStatus.Field.UserVersion_DESC); | |||
| final List<WxWeappCodeStatusVo> list = weappCodeStatusService.getList(weappCodeStatusVo); | |||
| return new ResultData(list); | |||
| } | |||
| /* | |||
| * 0. 回调搭建好 | |||
| * 1. wx_appinfo配置好 | |||