| @@ -346,7 +346,13 @@ public enum ErrorCode{ | |||||
| WEAPP_BASIC_SET_ERR(24001, "基础配置错误"), | WEAPP_BASIC_SET_ERR(24001, "基础配置错误"), | ||||
| WEAPP_BASIC_SET_DOMAIN_ERR(24002, "基础服务器域名配置错误"), | WEAPP_BASIC_SET_DOMAIN_ERR(24002, "基础服务器域名配置错误"), | ||||
| WEAPP_EXT_SET_ERR(24003, "扩展配置错误"), | WEAPP_EXT_SET_ERR(24003, "扩展配置错误"), | ||||
| WECHAT_LOGIN_KEY_OVERTIME(24004, "已过期"), | |||||
| WEAPP_CODE_COMMIT_ERR(24004, "code提交失败"), | |||||
| WEAPP_AUDIT_ERR(24005, "提交审核失败"), | |||||
| WEAPP_HAD_AUDITING(24006, "已有审核中"), | |||||
| WEAPP_NOT_AUDITED(24007, "审核未通过"), | |||||
| WEAPP_APP_RELEASEED(24008, "已发布"), | |||||
| WECHAT_LOGIN_KEY_OVERTIME(24030, "已过期"), | |||||
| /** | /** | ||||
| * 屏广告 | * 屏广告 | ||||
| @@ -0,0 +1,101 @@ | |||||
| package com.iformall.domain.po; | |||||
| import lombok.Data; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_weapp_audit_status") | |||||
| @Data | |||||
| public class WxWeappAuditStatus implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||||
| private String appId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||||
| private String userVersion; | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||||
| private String versionDesc; | |||||
| @io.swagger.annotations.ApiModelProperty(value="auditid",name="auditid") | |||||
| private Long auditid; | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核状态(0为审核成功,1:审核失败,2:审核中,3:已撤回)",name="auditStatus") | |||||
| private Integer auditStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核错误码",name="auditErrCode") | |||||
| private String auditErrCode; | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime") | |||||
| private Date auditTime; | |||||
| 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") | |||||
| ,UserVersion_ASC("`user_version` ASC"),UserVersion_DESC("`user_version` DESC") | |||||
| ,AuditTime_ASC("`audit_time` ASC"),AuditTime_DESC("`audit_time` 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(WxWeappAuditStatus.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(","); | |||||
| List<Field> fList = new 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -42,30 +42,6 @@ public class WxWeappCodeStatus implements Serializable { | |||||
| /**更新时间*/ | /**更新时间*/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="code提交时间",name="codeTime") | @io.swagger.annotations.ApiModelProperty(value="code提交时间",name="codeTime") | ||||
| private Date codeTime; | private Date codeTime; | ||||
| /**审核状态*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核状态(0为审核成功,1为审核失败,2为审核中,3已撤回)",name="auditStatus") | |||||
| private Integer auditStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核错误码",name="auditErrCode") | |||||
| private String auditErrCode; | |||||
| /**审核时间*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime") | |||||
| private Date auditTime; | |||||
| /**发布状态*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布状态(0:发布成功, 1:发布失败, 2:发布中)",name="releaseStatus") | |||||
| private Integer releaseStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布错误码",name="releaseErrCode") | |||||
| private String releaseErrCode; | |||||
| /**发布时间*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布时间",name="releaseTime") | |||||
| private Date releaseTime; | |||||
| /**创建时间*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||||
| private Date createTime; | |||||
| /**更新时间*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||||
| private Date updateTime; | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -73,8 +49,7 @@ public class WxWeappCodeStatus implements Serializable { | |||||
| ,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC") | ,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC") | ||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,UserVersion_ASC("`user_version` ASC"),UserVersion_DESC("`user_version` DESC") | ,UserVersion_ASC("`user_version` ASC"),UserVersion_DESC("`user_version` DESC") | ||||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||||
| ,UpdateTime_ASC("`update_time` ASC"),UpdateDate_DESC("`update_time` DESC") | |||||
| ,CodeTime_ASC("`code_time` ASC"),CodeTime_DESC("`code_time` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -0,0 +1,99 @@ | |||||
| package com.iformall.domain.po; | |||||
| import lombok.Data; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_weapp_release_status") | |||||
| @Data | |||||
| public class WxWeappReleaseStatus implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||||
| private String appId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||||
| private String userVersion; | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||||
| private String versionDesc; | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布状态(0:发布成功, 1:发布失败, 2:发布中, 3:发布撤回)",name="releaseStatus") | |||||
| private Integer releaseStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布错误码",name="releaseErrCode") | |||||
| private String releaseErrCode; | |||||
| @io.swagger.annotations.ApiModelProperty(value="发布时间",name="releaseTime") | |||||
| private Date releaseTime; | |||||
| 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") | |||||
| ,UserVersion_ASC("`user_version` ASC"),UserVersion_DESC("`user_version` DESC") | |||||
| ,ReleaseTime_ASC("`release_time` ASC"),ReleaseTime_DESC("`release_time` 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(WxWeappReleaseStatus.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(","); | |||||
| List<Field> fList = new 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxWeappAuditStatusVo extends WxWeappAuditStatus { | |||||
| /**小程序名称*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||||
| private String name; | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxWeappReleaseStatusVo extends WxWeappReleaseStatus { | |||||
| /**小程序名称*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||||
| private String name; | |||||
| } | |||||
| @@ -0,0 +1,23 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxWeappAuditStatusMapper extends CommonMapper<WxWeappAuditStatus, Long> { | |||||
| List<WxWeappAuditStatus> findList(WxWeappAuditStatus weappAuditStatus); | |||||
| List<WxWeappAuditStatusVo> findVoList(WxWeappAuditStatusVo weappAuditStatusVo); | |||||
| List<Map> findUserVersions(); | |||||
| void updateStatus(WxWeappAuditStatus record); | |||||
| } | |||||
| @@ -9,13 +9,13 @@ import java.util.Map; | |||||
| public interface WxWeappCodeStatusMapper extends CommonMapper<WxWeappCodeStatus, Long> { | public interface WxWeappCodeStatusMapper extends CommonMapper<WxWeappCodeStatus, Long> { | ||||
| List<WxWeappCodeStatus> findList(WxWeappCodeStatus wxWeappCodeStatus); | |||||
| List<WxWeappCodeStatus> findList(WxWeappCodeStatus weappCodeStatus); | |||||
| List<WxWeappCodeStatusVo> findVoList(WxWeappCodeStatusVo weappCodeStatusVo); | List<WxWeappCodeStatusVo> findVoList(WxWeappCodeStatusVo weappCodeStatusVo); | ||||
| List<Map> findUserVersions(); | List<Map> findUserVersions(); | ||||
| void updateCodeCommitStatus(WxWeappCodeStatus weappCodeStatus); | |||||
| void updateStatus(WxWeappCodeStatus weappCodeStatus); | |||||
| @@ -0,0 +1,24 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxWeappReleaseStatusMapper extends CommonMapper<WxWeappReleaseStatus, Long> { | |||||
| List<WxWeappReleaseStatus> findList(WxWeappReleaseStatus wxWeappCodeStatus); | |||||
| List<WxWeappCodeStatusVo> findVoList(WxWeappReleaseStatusVo weappCodeStatusVo); | |||||
| List<Map> findUserVersions(); | |||||
| void updateStatus(WxWeappReleaseStatus weappCodeStatus); | |||||
| } | |||||
| @@ -0,0 +1,75 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxWeappAuditStatusService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxWeappAuditStatusVo> listAsPage(WxWeappAuditStatusVo record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxWeappAuditStatusVo> getList(WxWeappAuditStatusVo record); | |||||
| /** | |||||
| * 查询version列表 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| List<Map> getVersionList(); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxWeappAuditStatus getById(Long id); | |||||
| /** | |||||
| * 根据appId获得实体 | |||||
| * | |||||
| * @param appId | |||||
| * @return | |||||
| */ | |||||
| WxWeappAuditStatus getByAppId(String appId); | |||||
| /** | |||||
| * 保存实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveStatus(WxWeappAuditStatus record); | |||||
| /** | |||||
| * 更新audit Status | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void updateStatus(WxWeappAuditStatus record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -51,32 +51,18 @@ public interface WxWeappCodeStatusService { | |||||
| WxWeappCodeStatus getByAppId(String appId); | WxWeappCodeStatus getByAppId(String appId); | ||||
| /** | /** | ||||
| * 保存或更新实体 | |||||
| * 保存实体 | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxWeappCodeStatus record); | |||||
| void saveStatus(WxWeappCodeStatus record); | |||||
| /** | /** | ||||
| * 更新codeCommit Status | * 更新codeCommit Status | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void updateCodeCommitStatus(WxWeappCodeStatus record); | |||||
| /** | |||||
| * 更新audit Status | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void updateAuditStatus(WxWeappCodeStatus record); | |||||
| /** | |||||
| * 更新release Status | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void updateReleaseStatus(WxWeappCodeStatus record); | |||||
| void updateStatus(WxWeappCodeStatus record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -0,0 +1,69 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxWeappReleaseStatusService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxWeappReleaseStatusVo> listAsPage(WxWeappReleaseStatusVo record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 查询version列表 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| List<Map> getVersionList(); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxWeappReleaseStatus getById(Long id); | |||||
| /** | |||||
| * 根据appId获得实体 | |||||
| * | |||||
| * @param appId | |||||
| * @return | |||||
| */ | |||||
| WxWeappReleaseStatus getByAppId(String appId); | |||||
| /** | |||||
| * 保存实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveStatus(WxWeappReleaseStatus record); | |||||
| /** | |||||
| * 更新release Status | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void updateStatus(WxWeappReleaseStatus record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,80 @@ | |||||
| 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.WxWeappAuditStatus; | |||||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||||
| import com.iformall.mapper.WxWeappAuditStatusMapper; | |||||
| import com.iformall.service.WxWeappAuditStatusService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Service | |||||
| public class WxWeappAuditStatusServiceImpl implements WxWeappAuditStatusService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxWeappAuditStatusMapper weappAuditStatusMapper; | |||||
| @Override | |||||
| public PageInfo<WxWeappAuditStatusVo> listAsPage(WxWeappAuditStatusVo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappAuditStatusMapper.findVoList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<WxWeappAuditStatusVo> getList(WxWeappAuditStatusVo record) { | |||||
| return weappAuditStatusMapper.findVoList(record); | |||||
| } | |||||
| @Override | |||||
| public List<Map> getVersionList() { | |||||
| return weappAuditStatusMapper.findUserVersions(); | |||||
| } | |||||
| @Override | |||||
| public WxWeappAuditStatus getById(Long id) { | |||||
| return weappAuditStatusMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public WxWeappAuditStatus getByAppId(String appId) { | |||||
| WxWeappAuditStatus statusQ = new WxWeappAuditStatus(); | |||||
| statusQ.setAppId(appId); | |||||
| return weappAuditStatusMapper.selectOne(statusQ); | |||||
| } | |||||
| @Override | |||||
| public void saveStatus(WxWeappAuditStatus record) { | |||||
| weappAuditStatusMapper.insertSelective(record); | |||||
| } | |||||
| @Override | |||||
| public void updateStatus(WxWeappAuditStatus record) { | |||||
| WxWeappAuditStatus updateRecord = new WxWeappAuditStatus(); | |||||
| updateRecord.setId(record.getId()); | |||||
| updateRecord.setAuditStatus(record.getAuditStatus()); | |||||
| updateRecord.setAuditErrCode(record.getAuditErrCode()); | |||||
| updateRecord.setAuditTime(record.getAuditTime()); | |||||
| weappAuditStatusMapper.updateByPrimaryKeySelective(updateRecord); | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| weappAuditStatusMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -3,14 +3,11 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||||
| import com.iformall.domain.po.WxWeappCodeStatus; | import com.iformall.domain.po.WxWeappCodeStatus; | ||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | import com.iformall.domain.vo.WxWeappCodeStatusVo; | ||||
| import com.iformall.enums.EnumWeappReleaseStatus; | |||||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | import com.iformall.mapper.WxAuthorizerInfoMapper; | ||||
| import com.iformall.mapper.WxWeappCodeStatusMapper; | import com.iformall.mapper.WxWeappCodeStatusMapper; | ||||
| import com.iformall.service.WxWeappCodeStatusService; | import com.iformall.service.WxWeappCodeStatusService; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -25,105 +22,60 @@ public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| WxWeappCodeStatusMapper wxWeappCodeStatusMapper; | |||||
| @Autowired | |||||
| WxAuthorizerInfoMapper wxAuthorizerInfoMapper; | |||||
| WxWeappCodeStatusMapper weappCodeStatusMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappCodeStatusMapper.findVoList(record)); | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappCodeStatusMapper.findVoList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) { | public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) { | ||||
| return wxWeappCodeStatusMapper.findVoList(record); | |||||
| return weappCodeStatusMapper.findVoList(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<Map> getVersionList() { | public List<Map> getVersionList() { | ||||
| return wxWeappCodeStatusMapper.findUserVersions(); | |||||
| return weappCodeStatusMapper.findUserVersions(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxWeappCodeStatus getById(Long id) { | public WxWeappCodeStatus getById(Long id) { | ||||
| return wxWeappCodeStatusMapper.selectByPrimaryKey(id); | |||||
| return weappCodeStatusMapper.selectByPrimaryKey(id); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxWeappCodeStatus getByAppId(String appId) { | public WxWeappCodeStatus getByAppId(String appId) { | ||||
| WxWeappCodeStatus weappCodeStatusQ = new WxWeappCodeStatus(); | WxWeappCodeStatus weappCodeStatusQ = new WxWeappCodeStatus(); | ||||
| weappCodeStatusQ.setAppId(appId); | weappCodeStatusQ.setAppId(appId); | ||||
| return wxWeappCodeStatusMapper.selectOne(weappCodeStatusQ); | |||||
| return weappCodeStatusMapper.selectOne(weappCodeStatusQ); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxWeappCodeStatus record) { | |||||
| public void saveStatus(WxWeappCodeStatus record) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| record.setCreateTime(curDate); | |||||
| record.setUpdateTime(curDate); | |||||
| wxWeappCodeStatusMapper.insertSelective(record); | |||||
| weappCodeStatusMapper.insertSelective(record); | |||||
| } else { | } else { | ||||
| record.setUpdateTime(curDate); | |||||
| logger.info("CODE-COMMIT: " + record.toString()); | logger.info("CODE-COMMIT: " + record.toString()); | ||||
| wxWeappCodeStatusMapper.updateCodeCommitStatus(record); | |||||
| weappCodeStatusMapper.updateStatus(record); | |||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void updateCodeCommitStatus(WxWeappCodeStatus record) { | |||||
| public void updateStatus(WxWeappCodeStatus record) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| record.setUpdateTime(curDate); | |||||
| logger.info("CODE-COMMIT: " + record.toString()); | logger.info("CODE-COMMIT: " + record.toString()); | ||||
| wxWeappCodeStatusMapper.updateCodeCommitStatus(record); | |||||
| } | |||||
| @Override | |||||
| public void updateAuditStatus(WxWeappCodeStatus record) { | |||||
| Date curDate = new Date(); | |||||
| WxWeappCodeStatus updateRecord = new WxWeappCodeStatus(); | |||||
| updateRecord.setId(record.getId()); | |||||
| updateRecord.setAuditStatus(record.getAuditStatus()); | |||||
| if (StringUtils.isNotBlank(record.getAuditErrCode())) { | |||||
| updateRecord.setAuditErrCode(record.getAuditErrCode()); | |||||
| } | |||||
| updateRecord.setAuditTime(curDate); | |||||
| updateRecord.setUpdateTime(curDate); | |||||
| wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord); | |||||
| } | |||||
| @Override | |||||
| public void updateReleaseStatus(WxWeappCodeStatus record) { | |||||
| Date curDate = new Date(); | |||||
| WxWeappCodeStatus updateRecord = new WxWeappCodeStatus(); | |||||
| updateRecord.setId(record.getId()); | |||||
| updateRecord.setReleaseStatus(record.getReleaseStatus()); | |||||
| if (StringUtils.isNotBlank(record.getReleaseErrCode())) { | |||||
| updateRecord.setReleaseErrCode(record.getReleaseErrCode()); | |||||
| } | |||||
| updateRecord.setReleaseTime(curDate); | |||||
| updateRecord.setUpdateTime(curDate); | |||||
| wxWeappCodeStatusMapper.updateByPrimaryKeySelective(updateRecord); | |||||
| // 更新 小程序 状态 | |||||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { // 发布成功 | |||||
| WxAuthorizerInfo updateInfo = new WxAuthorizerInfo(); | |||||
| updateInfo.setAuthorizerAppid(record.getAppId()); | |||||
| updateInfo.setCurrentVersion(record.getUserVersion()); | |||||
| updateInfo.setCurrentDesc(record.getVersionDesc()); | |||||
| updateInfo.setReleaseTime(curDate); | |||||
| updateInfo.setUpdateTime(curDate); | |||||
| wxAuthorizerInfoMapper.updateReleaseInfo(updateInfo); | |||||
| } | |||||
| weappCodeStatusMapper.updateStatus(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxWeappCodeStatusMapper.deleteByPrimaryKey(id); | |||||
| weappCodeStatusMapper.deleteByPrimaryKey(id); | |||||
| } | } | ||||
| @@ -0,0 +1,106 @@ | |||||
| 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.po.WxWeappReleaseStatus; | |||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||||
| import com.iformall.enums.EnumWeappReleaseStatus; | |||||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||||
| import com.iformall.mapper.WxWeappReleaseStatusMapper; | |||||
| import com.iformall.service.WxWeappReleaseStatusService; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Service | |||||
| public class WxWeappReleaseStatusServiceImpl implements WxWeappReleaseStatusService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxWeappReleaseStatusMapper weappReleaseStatusMapper; | |||||
| @Autowired | |||||
| WxAuthorizerInfoMapper authorizerInfoMapper; | |||||
| @Override | |||||
| public PageInfo<WxWeappReleaseStatusVo> listAsPage(WxWeappReleaseStatusVo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappReleaseStatusMapper.findVoList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<Map> getVersionList() { | |||||
| return weappReleaseStatusMapper.findUserVersions(); | |||||
| } | |||||
| @Override | |||||
| public WxWeappReleaseStatus getById(Long id) { | |||||
| return weappReleaseStatusMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public WxWeappReleaseStatus getByAppId(String appId) { | |||||
| WxWeappReleaseStatus weappCodeStatusQ = new WxWeappReleaseStatus(); | |||||
| weappCodeStatusQ.setAppId(appId); | |||||
| return weappReleaseStatusMapper.selectOne(weappCodeStatusQ); | |||||
| } | |||||
| @Override | |||||
| public void saveStatus(WxWeappReleaseStatus record) { | |||||
| weappReleaseStatusMapper.insertSelective(record); | |||||
| } | |||||
| @Override | |||||
| public void updateStatus(WxWeappReleaseStatus record) { | |||||
| Date curDate = new Date(); | |||||
| logger.info("RELEASE: " + record.toString()); | |||||
| // 更新 小程序 状态 | |||||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { // 发布成功 | |||||
| WxAuthorizerInfo updateInfo = new WxAuthorizerInfo(); | |||||
| updateInfo.setAuthorizerAppid(record.getAppId()); | |||||
| updateInfo.setCurrentVersion(record.getUserVersion()); | |||||
| updateInfo.setCurrentDesc(record.getVersionDesc()); | |||||
| updateInfo.setReleaseTime(curDate); | |||||
| updateInfo.setUpdateTime(curDate); | |||||
| authorizerInfoMapper.updateReleaseInfo(updateInfo); | |||||
| } | |||||
| // 发布回退,退回上次发布状态 | |||||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.BACK.getCode())) { | |||||
| try { | |||||
| WxAuthorizerInfo appQ = new WxAuthorizerInfo(); | |||||
| appQ.setAuthorizerAppid(record.getAppId()); | |||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.selectOne(appQ); | |||||
| record.setUserVersion(authorizerInfo.getCurrentVersion()); | |||||
| record.setVersionDesc(authorizerInfo.getCurrentDesc()); | |||||
| record.setReleaseTime(authorizerInfo.getReleaseTime()); | |||||
| return; | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| } | |||||
| weappReleaseStatusMapper.updateStatus(record); | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| weappReleaseStatusMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,123 @@ | |||||
| <?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.WxWeappCodeStatusMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxWeappAuditStatus"> | |||||
| <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="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="auditid" jdbcType="INTEGER" property="auditid" /> | |||||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus" /> | |||||
| <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode" /> | |||||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`app_id`,`type`,`user_version`,`version_desc`, | |||||
| `audit_status`,`audit_err_code`,`audit_time` | |||||
| </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 != userVersion "> | |||||
| and `user_version` = #{userVersion} | |||||
| </if> | |||||
| <if test=" null != auditid "> | |||||
| and `auditid` = #{auditid} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| <if test=" null != auditTime "> | |||||
| and `audit_time` = #{auditTime} | |||||
| </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.WxWeappAuditStatus" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> | |||||
| from wx_weapp_audit_status | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappAuditStatusVo"> | |||||
| <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="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus" /> | |||||
| <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode" /> | |||||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| c.`id`,c.`app_id`,c.`type`,c.`user_version`,`version_desc`, | |||||
| c.`audit_status`,c.`audit_err_code`,c.`audit_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 c.`user_version` = #{userVersion} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and c.`audit_status` = #{auditStatus} | |||||
| </if> | |||||
| <if test=" null != auditTime "> | |||||
| and c.`audit_time` = #{auditTime} | |||||
| </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.WxWeappAuditStatusVo" resultMap="VBaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | |||||
| from wx_weapp_audit_status c | |||||
| left join wx_appinfo a on c.`app_id` = a.`app_id` | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| </select> | |||||
| <select id="findUserVersions" parameterType="string" resultType="hashmap" > | |||||
| select user_version as version | |||||
| from wx_weapp_audit_status | |||||
| group by user_version | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -6,25 +6,15 @@ | |||||
| <result column="app_id" jdbcType="VARCHAR" property="appId" /> | <result column="app_id" jdbcType="VARCHAR" property="appId" /> | ||||
| <result column="type" jdbcType="INTEGER" property="type" /> | <result column="type" jdbcType="INTEGER" property="type" /> | ||||
| <result column="user_version" jdbcType="VARCHAR" property="userVersion" /> | <result column="user_version" jdbcType="VARCHAR" property="userVersion" /> | ||||
| <result column="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="code_status" jdbcType="INTEGER" property="codeStatus" /> | <result column="code_status" jdbcType="INTEGER" property="codeStatus" /> | ||||
| <result column="code_err_code" jdbcType="VARCHAR" property="codeErrCode" /> | <result column="code_err_code" jdbcType="VARCHAR" property="codeErrCode" /> | ||||
| <result column="code_time" jdbcType="TIMESTAMP" property="codeTime" /> | <result column="code_time" jdbcType="TIMESTAMP" property="codeTime" /> | ||||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus" /> | |||||
| <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode" /> | |||||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> | |||||
| <result column="release_status" jdbcType="VARCHAR" property="releaseStatus" /> | |||||
| <result column="release_err_code" jdbcType="INTEGER" property="releaseErrCode" /> | |||||
| <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`app_id`,`type`,`user_version`, | |||||
| `code_status`,`code_err_code`,`code_time`, | |||||
| `audit_status`,`audit_err_code`,`audit_time`, | |||||
| `release_status`,`release_err_code`,`release_time`, | |||||
| `create_time`,`update_time` | |||||
| `id`,`app_id`,`name`,`type`,`user_version`,`version_desc`, | |||||
| `code_status`,`code_err_code`,`code_time` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -34,7 +24,10 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != appId "> | <if test=" null != appId "> | ||||
| and `app_id` = #{appId} | and `app_id` = #{appId} | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` = #{appId} | |||||
| </if> | |||||
| <if test=" null != type "> | <if test=" null != type "> | ||||
| and `type` = #{type} | and `type` = #{type} | ||||
| </if> | </if> | ||||
| @@ -43,19 +36,9 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != codeStatus "> | <if test=" null != codeStatus "> | ||||
| and `code_status` = #{codeStatus} | and `code_status` = #{codeStatus} | ||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| <if test=" null != releaseStatus "> | |||||
| and `release_status` = #{releaseStatus} | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | |||||
| <if test=" null != codeTime "> | |||||
| and `code_time` = #{codeTime} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -70,10 +53,10 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <update id="updateCodeCommitStatus" parameterType="com.iformall.domain.po.WxWeappCodeStatus" > | |||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxWeappCodeStatus" > | |||||
| update wx_weapp_code_status | update wx_weapp_code_status | ||||
| set `user_version` = #{userVersion}, `code_status` = #{codeStatus}, `code_err_code` = #{codeErrCode}, `code_time` = #{codeTime}, `update_time` = #{updateTime}, | |||||
| `audit_status` = null, `audit_err_code` = null, `audit_time` = null, `release_status` = null, `release_err_code` = null, `release_time` = null | |||||
| set `user_version` = #{userVersion}, `version_desc`= #{versionDesc} | |||||
| `code_status` = #{codeStatus}, `code_err_code` = #{codeErrCode}, `code_time` = #{codeTime} | |||||
| where `app_id` = #{appId} and `type` = #{type} | where `app_id` = #{appId} and `type` = #{type} | ||||
| </update> | </update> | ||||
| @@ -83,26 +66,16 @@ | |||||
| <result column="app_id" jdbcType="VARCHAR" property="appId" /> | <result column="app_id" jdbcType="VARCHAR" property="appId" /> | ||||
| <result column="type" jdbcType="INTEGER" property="type" /> | <result column="type" jdbcType="INTEGER" property="type" /> | ||||
| <result column="user_version" jdbcType="VARCHAR" property="userVersion" /> | <result column="user_version" jdbcType="VARCHAR" property="userVersion" /> | ||||
| <result column="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="code_status" jdbcType="INTEGER" property="codeStatus" /> | <result column="code_status" jdbcType="INTEGER" property="codeStatus" /> | ||||
| <result column="code_err_code" jdbcType="VARCHAR" property="codeErrCode" /> | <result column="code_err_code" jdbcType="VARCHAR" property="codeErrCode" /> | ||||
| <result column="code_time" jdbcType="TIMESTAMP" property="codeTime" /> | <result column="code_time" jdbcType="TIMESTAMP" property="codeTime" /> | ||||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus" /> | |||||
| <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode" /> | |||||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> | |||||
| <result column="release_status" jdbcType="INTEGER" property="releaseStatus" /> | |||||
| <result column="release_err_code" jdbcType="VARCHAR" property="releaseErrCode" /> | |||||
| <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" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allVoColumns"> | <sql id="allVoColumns"> | ||||
| c.`id`,c.`app_id`,c.`type`,c.`user_version`, | |||||
| c.`code_status`,c.`code_err_code`,c.`code_time`, | |||||
| c.`audit_status`,c.`audit_err_code`,c.`audit_time`, | |||||
| c.`release_status`,c.`release_err_code`,c.`release_time`, | |||||
| c.`create_time`,c.`update_time`, | |||||
| c.`id`,c.`app_id`,c.`type`,c.`user_version`,c.`version_desc` | |||||
| c.`code_status`,c.`code_err_code`,c.`code_time` | |||||
| a.`name` | a.`name` | ||||
| </sql> | </sql> | ||||
| @@ -123,18 +96,6 @@ | |||||
| <if test=" null != codeStatus "> | <if test=" null != codeStatus "> | ||||
| and c.`code_status` = #{codeStatus} | and c.`code_status` = #{codeStatus} | ||||
| </if> | </if> | ||||
| <if test=" null != auditStatus "> | |||||
| and c.`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 "> | <if test=" null != name "> | ||||
| and a.`name` like concat('%', #{name},'%') | and a.`name` like concat('%', #{name},'%') | ||||
| </if> | </if> | ||||
| @@ -0,0 +1,126 @@ | |||||
| <?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.WxWeappCodeStatusMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxWeappReleaseStatus"> | |||||
| <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="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="release_status" jdbcType="VARCHAR" property="releaseStatus" /> | |||||
| <result column="release_err_code" jdbcType="INTEGER" property="releaseErrCode" /> | |||||
| <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`app_id`,`type`,`user_version`,`version_desc`, | |||||
| `release_status`,`release_err_code`,`release_time` | |||||
| </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 != userVersion "> | |||||
| and `user_version` = #{userVersion} | |||||
| </if> | |||||
| <if test=" null != releaseStatus "> | |||||
| and `release_status` = #{releaseStatus} | |||||
| </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=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxWeappReleaseStatus" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_weapp_release_status | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxWeappReleaseStatus" > | |||||
| update wx_weapp_release_status | |||||
| set `user_version` = #{userVersion}, | |||||
| `release_status` = null, `release_err_code` = null, `release_time` = null | |||||
| where `app_id` = #{appId} and `type` = #{type} | |||||
| </update> | |||||
| <resultMap id="VBaseResultMap" type="com.iformall.domain.vo.WxWeappReleaseStatusVo"> | |||||
| <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="version_desc" jdbcType="VARCHAR" property="versionDesc" /> | |||||
| <result column="release_status" jdbcType="INTEGER" property="releaseStatus" /> | |||||
| <result column="release_err_code" jdbcType="VARCHAR" property="releaseErrCode" /> | |||||
| <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" /> | |||||
| <result column="name" jdbcType="TIMESTAMP" property="name" /> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| c.`id`,c.`app_id`,c.`type`,c.`user_version`,c.`version_desc`, | |||||
| c.`release_status`,c.`release_err_code`,c.`release_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 c.`user_version` = #{userVersion} | |||||
| </if> | |||||
| <if test=" null != releaseStatus "> | |||||
| and c.`release_status` = #{releaseStatus} | |||||
| </if> | |||||
| <if test=" null != releaseTime "> | |||||
| and c.`release_time` = #{releaseTime} | |||||
| </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.WxWeappReleaseStatusVo" resultMap="VBaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | |||||
| from wx_weapp_release_status c | |||||
| left join wx_appinfo a on c.`app_id` = a.`app_id` | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| </select> | |||||
| <select id="findUserVersions" parameterType="string" resultType="hashmap" > | |||||
| select user_version as version | |||||
| from wx_weapp_release_status | |||||
| group by user_version | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -2,12 +2,14 @@ package com.iformall.controller; | |||||
| import com.iformall.domain.po.WxAuthorizerInfo; | import com.iformall.domain.po.WxAuthorizerInfo; | ||||
| import com.iformall.domain.po.WxComponentVerifyTicket; | import com.iformall.domain.po.WxComponentVerifyTicket; | ||||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||||
| import com.iformall.domain.po.WxWeappCodeStatus; | import com.iformall.domain.po.WxWeappCodeStatus; | ||||
| import com.iformall.enums.EnumWeappAuditStatus; | import com.iformall.enums.EnumWeappAuditStatus; | ||||
| import com.iformall.enums.EnumWxAuthorizationInfoType; | import com.iformall.enums.EnumWxAuthorizationInfoType; | ||||
| import com.iformall.enums.EnumWxAuthorizationStatus; | import com.iformall.enums.EnumWxAuthorizationStatus; | ||||
| import com.iformall.service.WxAuthorizerInfoService; | import com.iformall.service.WxAuthorizerInfoService; | ||||
| import com.iformall.service.WxComponentVerifyTicketService; | import com.iformall.service.WxComponentVerifyTicketService; | ||||
| import com.iformall.service.WxWeappAuditStatusService; | |||||
| import com.iformall.service.WxWeappCodeStatusService; | import com.iformall.service.WxWeappCodeStatusService; | ||||
| import com.iformall.service.wechat.WxOpenService; | import com.iformall.service.wechat.WxOpenService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -49,7 +51,7 @@ public class WechatCalllbackController extends BaseController { | |||||
| private WxAuthorizerInfoService authorizerInfoService; | private WxAuthorizerInfoService authorizerInfoService; | ||||
| @Autowired | @Autowired | ||||
| private WxWeappCodeStatusService weappCodeStatusService; | |||||
| private WxWeappAuditStatusService weappAuditStatusService; | |||||
| @RequestMapping(value = "/notify", method = RequestMethod.POST) | @RequestMapping(value = "/notify", method = RequestMethod.POST) | ||||
| @ApiOperation("接收ticket回调") | @ApiOperation("接收ticket回调") | ||||
| @@ -265,14 +267,15 @@ public class WechatCalllbackController extends BaseController { | |||||
| } | } | ||||
| private void updateAuditStatus(String appId, boolean success) { | private void updateAuditStatus(String appId, boolean success) { | ||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| if(codeStatus != null) { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null) { | |||||
| if(success) { | if(success) { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| } else { | } else { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| } | } | ||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -7,13 +7,9 @@ import com.google.gson.reflect.TypeToken; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.service.WxAppinfoService; | |||||
| import com.iformall.service.WxAuthorizerInfoService; | |||||
| import com.iformall.service.WxWeappCodeStatusService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.service.wechat.WxOpenService; | import com.iformall.service.wechat.WxOpenService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -52,6 +48,12 @@ public class WechatWeappCodeController { | |||||
| @Autowired | @Autowired | ||||
| private WxWeappCodeStatusService weappCodeStatusService; | private WxWeappCodeStatusService weappCodeStatusService; | ||||
| @Autowired | |||||
| private WxWeappAuditStatusService weappAuditStatusService; | |||||
| @Autowired | |||||
| private WxWeappReleaseStatusService weappReleaseStatusService; | |||||
| @Autowired | @Autowired | ||||
| private WxAppinfoService appinfoService; | private WxAppinfoService appinfoService; | ||||
| @@ -110,7 +112,7 @@ public class WechatWeappCodeController { | |||||
| codeStatus.setCodeErrCode(gson.toJson(openRet)); | codeStatus.setCodeErrCode(gson.toJson(openRet)); | ||||
| } | } | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.saveOrUpdate(codeStatus); | |||||
| weappCodeStatusService.saveStatus(codeStatus); | |||||
| } else { | } else { | ||||
| codeStatus.setUserVersion(userVersion); | codeStatus.setUserVersion(userVersion); | ||||
| codeStatus.setVersionDesc(userDesc); | codeStatus.setVersionDesc(userDesc); | ||||
| @@ -121,7 +123,7 @@ public class WechatWeappCodeController { | |||||
| codeStatus.setCodeErrCode(gson.toJson(openRet)); | codeStatus.setCodeErrCode(gson.toJson(openRet)); | ||||
| } | } | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.updateCodeCommitStatus(codeStatus); | |||||
| weappCodeStatusService.updateStatus(codeStatus); | |||||
| } | } | ||||
| return new ResultData(openRet); | return new ResultData(openRet); | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| @@ -137,14 +139,14 @@ public class WechatWeappCodeController { | |||||
| codeStatus.setCodeStatus(EnumWeappCodeCommitStatus.FAIL.getCode()); | codeStatus.setCodeStatus(EnumWeappCodeCommitStatus.FAIL.getCode()); | ||||
| codeStatus.setCodeErrCode(e.getMessage()); | codeStatus.setCodeErrCode(e.getMessage()); | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.saveOrUpdate(codeStatus); | |||||
| weappCodeStatusService.saveStatus(codeStatus); | |||||
| } else { | } else { | ||||
| codeStatus.setUserVersion(userVersion); | codeStatus.setUserVersion(userVersion); | ||||
| codeStatus.setVersionDesc(userDesc); | codeStatus.setVersionDesc(userDesc); | ||||
| codeStatus.setCodeStatus(EnumWeappCodeCommitStatus.FAIL.getCode()); | codeStatus.setCodeStatus(EnumWeappCodeCommitStatus.FAIL.getCode()); | ||||
| codeStatus.setCodeErrCode(e.getMessage()); | codeStatus.setCodeErrCode(e.getMessage()); | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.updateCodeCommitStatus(codeStatus); | |||||
| weappCodeStatusService.updateStatus(codeStatus); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| } | } | ||||
| @@ -218,29 +220,68 @@ public class WechatWeappCodeController { | |||||
| public ResultData submitAudit(String appId, String subMesgStr) { | public ResultData submitAudit(String appId, String subMesgStr) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | ||||
| try { | |||||
| WxOpenMaSubmitAuditMessage subMessage = JSON.parseObject(subMesgStr, WxOpenMaSubmitAuditMessage.class); | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | |||||
| logger.info(openRet.toString()); | |||||
| if(codeStatus != null) { | |||||
| if(codeStatus != null && codeStatus.getCodeStatus().equals(EnumWeappCodeCommitStatus.SUCCESS.getCode())) { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| boolean submitStatus = false; | |||||
| String codeErrCode = ""; | |||||
| try { | |||||
| WxOpenMaSubmitAuditMessage subMessage = JSON.parseObject(subMesgStr, WxOpenMaSubmitAuditMessage.class); | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | |||||
| logger.info(openRet.toString()); | |||||
| if(openRet.isSuccess()) { | if(openRet.isSuccess()) { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| submitStatus = true; | |||||
| codeErrCode = gson.toJson(openRet); | |||||
| } else { | } else { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| submitStatus = false; | |||||
| codeErrCode = gson.toJson(openRet); | |||||
| } | } | ||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| submitStatus = false; | |||||
| codeErrCode = e.getMessage(); | |||||
| } | } | ||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| if(codeStatus != null) { | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(e.getMessage()); | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| if (auditStatus == null) { | |||||
| auditStatus = new WxWeappAuditStatus(); | |||||
| auditStatus.setId(codeStatus.getId()); | |||||
| auditStatus.setAppId(codeStatus.getAppId()); | |||||
| auditStatus.setType(codeStatus.getType()); | |||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||||
| if(submitStatus) { | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| } else { | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| } | |||||
| auditStatus.setAuditErrCode(codeErrCode); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.saveStatus(auditStatus); | |||||
| } else { | |||||
| if(!submitStatus) { | |||||
| if(!auditStatus.getUserVersion().equals(codeStatus.getUserVersion()) | |||||
| && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| // 提交审核失败不替换当前审核中的数据 | |||||
| return new ResultData(ErrorCode.WEAPP_HAD_AUDITING); | |||||
| } | |||||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setCodeErrCode(codeErrCode); | |||||
| } else { | |||||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| } | |||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| if(submitStatus) { | |||||
| return new ResultData(codeErrCode); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.WEAPP_AUDIT_ERR); | |||||
| } | |||||
| } else { | |||||
| logger.error(ErrorCode.WEAPP_CODE_COMMIT_ERR.getMessage()); | |||||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | |||||
| } | } | ||||
| } | } | ||||
| @@ -248,49 +289,88 @@ public class WechatWeappCodeController { | |||||
| @PostMapping("/getAuditstatus") | @PostMapping("/getAuditstatus") | ||||
| public ResultData getAuditstatus(String appId, String auditidStr) { | public ResultData getAuditstatus(String appId, String auditidStr) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getAuditStatus(Long.valueOf(auditidStr)); | |||||
| logger.info(openRet.toString()); | |||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| if(codeStatus != null) { | |||||
| if(openRet.getStatus().equals(0)) { | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| } else { | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| Long auditId = Long.valueOf(auditidStr); | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null && auditStatus.getAuditid().equals(auditId)) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getAuditStatus(auditId); | |||||
| logger.info(openRet.toString()); | |||||
| if (openRet.isSuccess()) { | |||||
| auditStatus.setAuditid(openRet.getAuditId()); | |||||
| // 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回 | |||||
| switch (openRet.getStatus().intValue()) { | |||||
| case 0: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| break; | |||||
| case 1: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| auditStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| break; | |||||
| case 2: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| case 3: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| break; | |||||
| default: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| } | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR, "auditid不对应"); | |||||
| } | } | ||||
| @ApiOperation("查询最新一次提交的审核状态") | @ApiOperation("查询最新一次提交的审核状态") | ||||
| @GetMapping("/getLatestAuditstatus") | @GetMapping("/getLatestAuditstatus") | ||||
| public ResultData get_latest_auditstatus(String appId) { | public ResultData get_latest_auditstatus(String appId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getLatestAuditStatus(); | |||||
| logger.info(openRet.toString()); | |||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| if(codeStatus != null) { | |||||
| if(openRet.getStatus().equals(0)) { | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| } else { | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null | |||||
| && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getLatestAuditStatus(); | |||||
| logger.info(openRet.toString()); | |||||
| if (openRet.isSuccess()) { | |||||
| auditStatus.setAuditid(openRet.getAuditId()); | |||||
| // 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回 | |||||
| switch (openRet.getStatus().intValue()) { | |||||
| case 0: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| break; | |||||
| case 1: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| auditStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| break; | |||||
| case 2: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| case 3: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| break; | |||||
| default: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| } | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } else { | |||||
| return new ResultData(Result.ERROR, "审核状态不是审核中"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -298,54 +378,71 @@ public class WechatWeappCodeController { | |||||
| @PostMapping("/releaseAudited") | @PostMapping("/releaseAudited") | ||||
| public ResultData releaesAudited(String appId) { | public ResultData releaesAudited(String appId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||||
| logger.info(openRet.toString()); | |||||
| if(codeStatus != null) { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.SUCCESS.getCode())) { | |||||
| WxWeappReleaseStatus releaseStatus = weappReleaseStatusService.getByAppId(appId); | |||||
| if(releaseStatus != null) { | |||||
| // 版本已发布成功,跳过 | |||||
| if(releaseStatus.getUserVersion().equals(auditStatus.getUserVersion()) | |||||
| && releaseStatus.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { | |||||
| return new ResultData(ErrorCode.WEAPP_APP_RELEASEED); | |||||
| } | |||||
| } else { | |||||
| releaseStatus = new WxWeappReleaseStatus(); | |||||
| releaseStatus.setAppId(auditStatus.getAppId()); | |||||
| releaseStatus.setType(auditStatus.getType()); | |||||
| releaseStatus.setUserVersion(auditStatus.getUserVersion()); | |||||
| releaseStatus.setVersionDesc(auditStatus.getVersionDesc()); | |||||
| } | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||||
| logger.info(openRet.toString()); | |||||
| if(openRet.getErrcode().equals('0')) { | if(openRet.getErrcode().equals('0')) { | ||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| } else { | } else { | ||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| codeStatus.setReleaseErrCode(gson.toJson(openRet)); | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| releaseStatus.setReleaseErrCode(gson.toJson(openRet)); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| } | } | ||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| weappReleaseStatusService.saveStatus(releaseStatus); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| releaseStatus.setReleaseErrCode(e.getMessage()); | |||||
| weappReleaseStatusService.updateStatus(releaseStatus); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| if(codeStatus != null) { | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| codeStatus.setReleaseErrCode(e.getMessage()); | |||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| } | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.WEAPP_NOT_AUDITED); | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("小程序版本回退") | @ApiOperation("小程序版本回退") | ||||
| @GetMapping("/revertCodeRelease") | @GetMapping("/revertCodeRelease") | ||||
| public ResultData revertCodeRelease(String appId) { | public ResultData revertCodeRelease(String appId) { | ||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| WxWeappReleaseStatus releaseStatus = weappReleaseStatusService.getByAppId(appId); | |||||
| try { | try { | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | ||||
| WxOpenResult openRet = openMaService.revertCodeReleaes(); | WxOpenResult openRet = openMaService.revertCodeReleaes(); | ||||
| logger.info(openRet.toString()); | logger.info(openRet.toString()); | ||||
| if(openRet.isSuccess()) { | if(openRet.isSuccess()) { | ||||
| if(codeStatus != null) { | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.BACK.getCode()); | |||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| if(releaseStatus != null) { | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.BACK.getCode()); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| weappReleaseStatusService.updateStatus(releaseStatus); | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| return new ResultData(openRet); | return new ResultData(openRet); | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| if(codeStatus != null) { | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| codeStatus.setReleaseErrCode(e.getMessage()); | |||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| if(releaseStatus != null) { | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| releaseStatus.setReleaseErrCode(e.getMessage()); | |||||
| weappReleaseStatusService.updateStatus(releaseStatus); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| } | } | ||||
| @@ -385,12 +482,13 @@ public class WechatWeappCodeController { | |||||
| try { | try { | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | ||||
| WxOpenResult openResult = openMaService.undoCodeAudit(); | WxOpenResult openResult = openMaService.undoCodeAudit(); | ||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); | |||||
| if(codeStatus != null) { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null) { | |||||
| if(openResult.getErrcode().equals('0')) { | if(openResult.getErrcode().equals('0')) { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| @@ -13,6 +13,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | import com.iformall.domain.vo.WxWeappCodeStatusVo; | ||||
| import com.iformall.domain.vo.WxWeappInfo; | import com.iformall.domain.vo.WxWeappInfo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -63,6 +64,12 @@ public class WxWeappInfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxWeappCodeStatusService weappCodeStatusService; | private WxWeappCodeStatusService weappCodeStatusService; | ||||
| @Autowired | |||||
| private WxWeappAuditStatusService weappAuditStatusService; | |||||
| @Autowired | |||||
| private WxWeappReleaseStatusService weappReleaseStatusService; | |||||
| @Autowired | @Autowired | ||||
| private WxOpenService openService; | private WxOpenService openService; | ||||
| @@ -380,7 +387,12 @@ public class WxWeappInfoController extends BaseController { | |||||
| } | } | ||||
| // 提交审核 | // 提交审核 | ||||
| if(codeCommitStatus) { | if(codeCommitStatus) { | ||||
| doCodeAudit(appId, extSet, codeStatus); | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| logger.error("审核中不能再提交审核"); | |||||
| return; | |||||
| } | |||||
| doCodeAudit(codeStatus, auditStatus, extSet); | |||||
| } | } | ||||
| } | } | ||||
| @@ -514,7 +526,12 @@ public class WxWeappInfoController extends BaseController { | |||||
| codeCommitStatus = true; | codeCommitStatus = true; | ||||
| } | } | ||||
| if(codeCommitStatus) { | if(codeCommitStatus) { | ||||
| doCodeAudit(appId, extSet, codeStatus); | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||||
| if(auditStatus != null && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| logger.error("审核中不能再提交审核"); | |||||
| return; | |||||
| } | |||||
| doCodeAudit(codeStatus, auditStatus, extSet); | |||||
| } else { | } else { | ||||
| logger.error("CODE提交失败"); | logger.error("CODE提交失败"); | ||||
| } | } | ||||
| @@ -562,7 +579,7 @@ public class WxWeappInfoController extends BaseController { | |||||
| } | } | ||||
| codeStatus.setCodeErrCode(codeErrCode); | codeStatus.setCodeErrCode(codeErrCode); | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.saveOrUpdate(codeStatus); | |||||
| weappCodeStatusService.saveStatus(codeStatus); | |||||
| } else { | } else { | ||||
| codeStatus.setUserVersion(userVersion); | codeStatus.setUserVersion(userVersion); | ||||
| codeStatus.setVersionDesc(userDesc); | codeStatus.setVersionDesc(userDesc); | ||||
| @@ -573,32 +590,64 @@ public class WxWeappInfoController extends BaseController { | |||||
| codeStatus.setCodeErrCode(codeErrCode); | codeStatus.setCodeErrCode(codeErrCode); | ||||
| } | } | ||||
| codeStatus.setCodeTime(new Date()); | codeStatus.setCodeTime(new Date()); | ||||
| weappCodeStatusService.updateCodeCommitStatus(codeStatus); | |||||
| weappCodeStatusService.updateStatus(codeStatus); | |||||
| } | } | ||||
| return codeCommitStatus; | return codeCommitStatus; | ||||
| } | } | ||||
| private void doCodeAudit(String appId, WxWeappExtSet extSet, WxWeappCodeStatus codeStatus) { | |||||
| private void doCodeAudit(WxWeappCodeStatus codeStatus, WxWeappAuditStatus auditStatus, WxWeappExtSet extSet) { | |||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| boolean submitStatus = false; | |||||
| String codeErrCode = ""; | |||||
| try { | try { | ||||
| WxOpenMaSubmitAuditMessage subMessage = gson.fromJson(extSet.getReleaseJson(), new TypeToken<WxOpenMaSubmitAuditMessage>() {}.getType()); | WxOpenMaSubmitAuditMessage subMessage = gson.fromJson(extSet.getReleaseJson(), new TypeToken<WxOpenMaSubmitAuditMessage>() {}.getType()); | ||||
| logger.info(subMessage.toString()); | logger.info(subMessage.toString()); | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeStatus.getAppId()); | |||||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | ||||
| logger.info(openRet.toString()); | logger.info(openRet.toString()); | ||||
| if(openRet.isSuccess()) { | if(openRet.isSuccess()) { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| submitStatus = true; | |||||
| } else { | } else { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(gson.toJson(openRet)); | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| submitStatus = false; | |||||
| codeErrCode = gson.toJson(openRet); | |||||
| } | } | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setAuditErrCode(gson.toJson(e.getMessage())); | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| submitStatus = false; | |||||
| codeErrCode = e.getMessage(); | |||||
| } | |||||
| if (auditStatus == null) { | |||||
| auditStatus = new WxWeappAuditStatus(); | |||||
| auditStatus.setId(codeStatus.getId()); | |||||
| auditStatus.setAppId(codeStatus.getAppId()); | |||||
| auditStatus.setType(codeStatus.getType()); | |||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||||
| if(submitStatus) { | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| } else { | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| } | |||||
| auditStatus.setAuditErrCode(codeErrCode); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.saveStatus(auditStatus); | |||||
| } else { | |||||
| if(!submitStatus) { | |||||
| if(!auditStatus.getUserVersion().equals(codeStatus.getUserVersion()) | |||||
| && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| // 提交审核失败不替换当前审核中的数据 | |||||
| return; | |||||
| } | |||||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| codeStatus.setCodeErrCode(codeErrCode); | |||||
| } else { | |||||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| } | |||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| } | } | ||||
| @@ -607,56 +656,45 @@ public class WxWeappInfoController extends BaseController { | |||||
| @PostMapping("batchAuditQuery") | @PostMapping("batchAuditQuery") | ||||
| public ResultData batchAuditQuery(@RequestBody Map<String, String> params) { | public ResultData batchAuditQuery(@RequestBody Map<String, String> params) { | ||||
| logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchAuditQuery"); | logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchAuditQuery"); | ||||
| Gson gson = new GsonBuilder().create(); | |||||
| String version = params.get("version"); | String version = params.get("version"); | ||||
| WxWeappCodeStatusVo queryVo = new WxWeappCodeStatusVo(); | |||||
| WxWeappAuditStatusVo queryVo = new WxWeappAuditStatusVo(); | |||||
| if(StringUtils.isNotBlank(version)) { | if(StringUtils.isNotBlank(version)) { | ||||
| queryVo.setUserVersion(version); | queryVo.setUserVersion(version); | ||||
| } | } | ||||
| List<WxWeappCodeStatusVo> apps = weappCodeStatusService.getList(queryVo); | |||||
| apps.stream().forEach( app -> { | |||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||||
| if(codeStatus == null) { | |||||
| return; | |||||
| } | |||||
| if(codeStatus.getCodeStatus() == null) { | |||||
| return; | |||||
| } | |||||
| if(!codeStatus.getCodeStatus().equals(EnumWeappCodeCommitStatus.SUCCESS.getCode())) { | |||||
| return; | |||||
| } | |||||
| if(codeStatus.getAuditStatus() == null) { | |||||
| return; | |||||
| } | |||||
| queryVo.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| List<WxWeappAuditStatusVo> apps = weappAuditStatusService.getList(queryVo); | |||||
| apps.stream().forEach( auditStatus -> { | |||||
| // 审核中,可以发起审核查询 | // 审核中,可以发起审核查询 | ||||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||||
| WxOpenMaQueryAuditResult openResult = openMaService.getLatestAuditStatus(); | |||||
| logger.info(openResult.toString()); | |||||
| if (openResult.isSuccess()) { | |||||
| // 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回 | |||||
| switch (openResult.getStatus().intValue()) { | |||||
| case 0: | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| break; | |||||
| case 1: | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| break; | |||||
| case 2: | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| case 3: | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| break; | |||||
| default: | |||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| } | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(auditStatus.getAppId()); | |||||
| WxOpenMaQueryAuditResult openResult = openMaService.getLatestAuditStatus(); | |||||
| logger.info(openResult.toString()); | |||||
| if (openResult.isSuccess()) { | |||||
| // 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回 | |||||
| switch (openResult.getStatus().intValue()) { | |||||
| case 0: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| break; | |||||
| case 1: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||||
| auditStatus.setAuditErrCode(gson.toJson(openResult)); | |||||
| break; | |||||
| case 2: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| case 3: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| break; | |||||
| default: | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| break; | |||||
| } | } | ||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | } | ||||
| }); | }); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -666,28 +704,25 @@ public class WxWeappInfoController extends BaseController { | |||||
| @PostMapping("batchAuditCancel") | @PostMapping("batchAuditCancel") | ||||
| public ResultData batchAuditCancel(@RequestBody Map<String, String> params) { | public ResultData batchAuditCancel(@RequestBody Map<String, String> params) { | ||||
| logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchAuditCancel"); | logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchAuditCancel"); | ||||
| Gson gson = new GsonBuilder().create(); | |||||
| String version = params.get("version"); | String version = params.get("version"); | ||||
| WxWeappCodeStatusVo queryVo = new WxWeappCodeStatusVo(); | |||||
| WxWeappAuditStatusVo queryVo = new WxWeappAuditStatusVo(); | |||||
| if(StringUtils.isNotBlank(version)) { | if(StringUtils.isNotBlank(version)) { | ||||
| queryVo.setUserVersion(version); | queryVo.setUserVersion(version); | ||||
| } | } | ||||
| List<WxWeappCodeStatusVo> apps = weappCodeStatusService.getList(queryVo); | |||||
| apps.stream().forEach( codeStatus -> { | |||||
| if(codeStatus.getAuditStatus() == null) { | |||||
| return; | |||||
| } | |||||
| queryVo.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||||
| List<WxWeappAuditStatusVo> apps = weappAuditStatusService.getList(queryVo); | |||||
| apps.stream().forEach( auditStatus -> { | |||||
| // 审核通过,已发布不可撤回 | // 审核通过,已发布不可撤回 | ||||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.SUCCESS.getCode()) | |||||
| && codeStatus.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { | |||||
| return; | |||||
| } | |||||
| try { | try { | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeStatus.getAppId()); | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(auditStatus.getAppId()); | |||||
| WxOpenResult openResult = openMaService.undoCodeAudit(); | WxOpenResult openResult = openMaService.undoCodeAudit(); | ||||
| logger.info(openResult.toString()); | logger.info(openResult.toString()); | ||||
| if(openResult.isSuccess()) { | if(openResult.isSuccess()) { | ||||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||||
| auditStatus.setAuditErrCode(gson.toJson(openResult)); | |||||
| auditStatus.setAuditTime(new Date()); | |||||
| weappAuditStatusService.updateStatus(auditStatus); | |||||
| } | } | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -700,48 +735,53 @@ public class WxWeappInfoController extends BaseController { | |||||
| @PostMapping("batchRelease") | @PostMapping("batchRelease") | ||||
| public ResultData batchRelease(@RequestBody Map<String, String> params) { | public ResultData batchRelease(@RequestBody Map<String, String> params) { | ||||
| logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchRelease"); | logger.debug("[" + getIpAddr() + "] WxWeappInfoController::batchRelease"); | ||||
| Gson gson = new GsonBuilder().create(); | |||||
| String version = params.get("version"); | String version = params.get("version"); | ||||
| WxWeappCodeStatusVo queryVo = new WxWeappCodeStatusVo(); | |||||
| WxWeappAuditStatusVo queryVo = new WxWeappAuditStatusVo(); | |||||
| if(StringUtils.isNotBlank(version)) { | if(StringUtils.isNotBlank(version)) { | ||||
| queryVo.setUserVersion(version); | queryVo.setUserVersion(version); | ||||
| } | } | ||||
| List<WxWeappCodeStatusVo> apps = weappCodeStatusService.getList(queryVo); | |||||
| apps.stream().forEach( app -> { | |||||
| Gson gson = new GsonBuilder().create(); | |||||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||||
| if(codeStatus == null) { | |||||
| return; | |||||
| } | |||||
| if(codeStatus.getAuditStatus() == null) { | |||||
| return; | |||||
| } | |||||
| // 已发布不能再发布 | |||||
| if(codeStatus.getReleaseStatus() != null) { | |||||
| return; | |||||
| } | |||||
| // 已审核通过的才可以发布 | |||||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.SUCCESS.getCode())) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||||
| logger.info(openRet.toString()); | |||||
| boolean releaseSuccess = false; | |||||
| if(openRet.isSuccess()) { | |||||
| releaseSuccess = true; | |||||
| } | |||||
| if(releaseSuccess) { | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); | |||||
| } else { | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| codeStatus.setReleaseErrCode(gson.toJson(openRet)); | |||||
| } | |||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| codeStatus.setReleaseErrCode(e.getMessage()); | |||||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||||
| queryVo.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); | |||||
| List<WxWeappAuditStatusVo> apps = weappAuditStatusService.getList(queryVo); | |||||
| apps.stream().forEach( auditStatus -> { | |||||
| WxWeappReleaseStatus releaseStatus = weappReleaseStatusService.getByAppId(auditStatus.getAppId()); | |||||
| if(releaseStatus != null) { | |||||
| // 版本已发布成功,跳过 | |||||
| if(releaseStatus.getUserVersion().equals(version) | |||||
| && releaseStatus.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { | |||||
| return; | |||||
| } | } | ||||
| } else { | |||||
| releaseStatus = new WxWeappReleaseStatus(); | |||||
| releaseStatus.setAppId(auditStatus.getAppId()); | |||||
| releaseStatus.setType(auditStatus.getType()); | |||||
| releaseStatus.setUserVersion(auditStatus.getUserVersion()); | |||||
| releaseStatus.setVersionDesc(auditStatus.getVersionDesc()); | |||||
| } | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(auditStatus.getAppId()); | |||||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||||
| logger.info(openRet.toString()); | |||||
| boolean releaseSuccess = false; | |||||
| if(openRet.isSuccess()) { | |||||
| releaseSuccess = true; | |||||
| } | |||||
| if(releaseSuccess) { | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| } else { | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| releaseStatus.setReleaseErrCode(gson.toJson(openRet)); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| } | |||||
| weappReleaseStatusService.saveStatus(releaseStatus); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| releaseStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||||
| releaseStatus.setReleaseErrCode(e.getMessage()); | |||||
| releaseStatus.setReleaseTime(new Date()); | |||||
| weappReleaseStatusService.updateStatus(releaseStatus); | |||||
| } | } | ||||
| }); | }); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -790,8 +830,6 @@ public class WxWeappInfoController extends BaseController { | |||||
| return new ResultData(list); | return new ResultData(list); | ||||
| } | } | ||||
| /* | /* | ||||
| * 0. 回调搭建好 | * 0. 回调搭建好 | ||||
| * 1. wx_appinfo配置好 | * 1. wx_appinfo配置好 | ||||