| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumCarSupport { | |||
| // 0-不支持 1-ETCP | |||
| NOCAR(0, "暂未支持"), | |||
| ETCP(1, "ETCP"), | |||
| ; | |||
| public static EnumCarSupport getEnum(Integer code) { | |||
| for (EnumCarSupport value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumCarSupport(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -11,12 +11,20 @@ public interface WxAuthorizerInfoMapper extends CommonMapper<WxAuthorizerInfo, L | |||
| WxAuthorizerInfo findMp(WxAuthorizerInfo wxAuthorizerInfo); | |||
| WxAuthorizerInfo findWeChatMp(WxAuthorizerInfo wxAuthorizerInfo); | |||
| WxAuthorizerInfo findByAppid(String appId); | |||
| int updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateRefreshToken(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateAccessToken(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateAuthBackInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int removeOpenAppId(WxAuthorizerInfo wxAuthorizerInfo); | |||
| List<WxWeappInfo> findWeappList(); | |||
| List<WxWeappInfo> findWxMpList(); | |||
| @@ -66,16 +66,22 @@ public interface WxAuthorizerInfoService { | |||
| void deleteById(Long id); | |||
| void updateReleaseVersion(WxAuthorizerInfo record); | |||
| int updateReleaseVersion(WxAuthorizerInfo record); | |||
| void updateBaseVersion(WxAuthorizerInfo record); | |||
| int updateBaseVersion(WxAuthorizerInfo record); | |||
| void updateDomainUrl(WxAuthorizerInfo record); | |||
| int updateDomainUrl(WxAuthorizerInfo record); | |||
| void updateWebDomainUrl(WxAuthorizerInfo record); | |||
| int updateWebDomainUrl(WxAuthorizerInfo record); | |||
| void updateTemplate(WxAuthorizerInfo record); | |||
| int updateTemplate(WxAuthorizerInfo record); | |||
| void updateOpenAppid(WxAuthorizerInfo record); | |||
| int updateOpenAppid(WxAuthorizerInfo record); | |||
| int removeOpenAppid(WxAuthorizerInfo record); | |||
| int updateAuthAppidInfo(WxAuthorizerInfo record); | |||
| int updateAuthBackInfo(WxAuthorizerInfo record); | |||
| } | |||
| @@ -6,10 +6,13 @@ import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumCarSupport; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxWeappExtSetMapper; | |||
| import com.iformall.service.WxAuthorizerInfoService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -85,6 +88,8 @@ public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService { | |||
| WxAppinfo appinfo = appinfoMapper.findByAppId(record.getAuthorizerAppid()); | |||
| if(appinfo != null) { | |||
| record.setId(appinfo.getId()); | |||
| record.setTenantId(appinfo.getTenantId()); | |||
| record.setType(appinfo.getType()); | |||
| } else { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -94,16 +99,24 @@ public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService { | |||
| record.setUpdateTime(curDate); | |||
| // 授权表 添加 | |||
| authorizerInfoMapper.insertSelective(record); | |||
| // 扩展配置表添加 | |||
| WxWeappExtSet weappExtSet = new WxWeappExtSet(); | |||
| weappExtSet.setId(record.getId()); | |||
| weappExtSet.setAppId(record.getAuthorizerAppid()); | |||
| if(appinfo != null) { | |||
| weappExtSet.setType(appinfo.getType()); | |||
| if(appinfo.getType() != null) { | |||
| if (appinfo.getType().equals(EnumAppType.C.getCode()) || | |||
| appinfo.getType().equals(EnumAppType.B.getCode())) { | |||
| // C/B 扩展配置表添加 | |||
| WxWeappExtSet weappExtSet = new WxWeappExtSet(); | |||
| weappExtSet.setId(record.getId()); | |||
| weappExtSet.setAppId(record.getAuthorizerAppid()); | |||
| if (appinfo.getType().equals(EnumAppType.C.getCode())) { | |||
| weappExtSet.setCarSupport(EnumCarSupport.NOCAR.getCode()); | |||
| } | |||
| if (appinfo != null) { | |||
| weappExtSet.setType(appinfo.getType()); | |||
| } | |||
| weappExtSet.setCreateDate(curDate); | |||
| weappExtSet.setUpdateDate(curDate); | |||
| weappExtSetMapper.insertSelective(weappExtSet); | |||
| } | |||
| } | |||
| weappExtSet.setCreateDate(curDate); | |||
| weappExtSet.setUpdateDate(curDate); | |||
| weappExtSetMapper.insertSelective(weappExtSet); | |||
| } else { | |||
| record.setId(authorizerInfo.getId()); | |||
| record.setUpdateTime(curDate); | |||
| @@ -118,64 +131,102 @@ public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService { | |||
| } | |||
| @Override | |||
| public void updateReleaseVersion(WxAuthorizerInfo record) { | |||
| authorizerInfoMapper.updateReleaseInfo(record); | |||
| public int updateReleaseVersion(WxAuthorizerInfo record) { | |||
| return authorizerInfoMapper.updateReleaseInfo(record); | |||
| } | |||
| @Override | |||
| public void updateBaseVersion(WxAuthorizerInfo record) { | |||
| public int updateBaseVersion(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setBaseStatus(record.getBaseStatus()); | |||
| info.setBaseTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(info); | |||
| } | |||
| @Override | |||
| public void updateDomainUrl(WxAuthorizerInfo record) { | |||
| public int updateDomainUrl(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setDomainStatus(record.getDomainStatus()); | |||
| info.setDomainTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(info); | |||
| } | |||
| @Override | |||
| public void updateWebDomainUrl(WxAuthorizerInfo record) { | |||
| public int updateWebDomainUrl(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setWebdomainStatus(record.getWebdomainStatus()); | |||
| info.setWebdomainTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(info); | |||
| } | |||
| @Override | |||
| public void updateTemplate(WxAuthorizerInfo record) { | |||
| public int updateTemplate(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setTemplateStatus(record.getTemplateStatus()); | |||
| info.setTemplateTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(info); | |||
| } | |||
| @Override | |||
| public void updateOpenAppid(WxAuthorizerInfo record) { | |||
| public int updateOpenAppid(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setOpenAppid(record.getOpenAppid()); | |||
| info.setBindOpenTime(curDate); | |||
| authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(info); | |||
| } | |||
| @Override | |||
| public int removeOpenAppid(WxAuthorizerInfo record) { | |||
| return authorizerInfoMapper.removeOpenAppId(record); | |||
| } | |||
| @Override | |||
| public int updateAuthAppidInfo(WxAuthorizerInfo record) { | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.findByAppid(record.getAuthorizerAppid()); | |||
| if(authorizerInfo != null) { | |||
| record.setId(authorizerInfo.getId()); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| } else { | |||
| /// TODO | |||
| } | |||
| return 0; | |||
| } | |||
| @Override | |||
| public int updateAuthBackInfo(WxAuthorizerInfo record) { | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.findByAppid(record.getAuthorizerAppid()); | |||
| if(authorizerInfo != null) { | |||
| if(DateUtils.isSameMonth(authorizerInfo.getAuditBackTime(), record.getAuditBackTime())) | |||
| { | |||
| // 同一个月,增加 | |||
| record.setId(authorizerInfo.getId()); | |||
| return authorizerInfoMapper.updateAuthBackInfo(record); | |||
| } else { | |||
| // 不是同一个月,重置authBackNum | |||
| record.setAuditBackNum(1); | |||
| return authorizerInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } else { | |||
| /// TODO | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -1,75 +0,0 @@ | |||
| package com.iformall.service.weopen; | |||
| 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(Integer type, Integer auditStatus); | |||
| /** | |||
| * 根据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); | |||
| } | |||
| @@ -1,54 +0,0 @@ | |||
| package com.iformall.service.weopen; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappBasicSet; | |||
| public interface WxWeappBasicSetService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappBasicSet> listAsPage(WxWeappBasicSet record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappBasicSet getById(Long id); | |||
| /** | |||
| * 根据type and deploy获取 | |||
| * @param weappBasicSet | |||
| * @return | |||
| */ | |||
| WxWeappBasicSet getByTypeAndDeploy(WxWeappBasicSet weappBasicSet); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxWeappBasicSet record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -1,75 +0,0 @@ | |||
| package com.iformall.service.weopen; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappCodeStatusService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record); | |||
| /** | |||
| * 查询version列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<Map> getVersionList(Integer type); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappCodeStatus getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxWeappCodeStatus getByAppId(String appId); | |||
| /** | |||
| * 保存实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveStatus(WxWeappCodeStatus record); | |||
| /** | |||
| * 更新codeCommit Status | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateStatus(WxWeappCodeStatus record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -1,55 +0,0 @@ | |||
| package com.iformall.service.weopen; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| public interface WxWeappExtSetService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappExtSet> listAsPage(WxWeappExtSet record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappExtSet getById(Long id); | |||
| /** | |||
| * 根据Obj获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxWeappExtSet getByObj(WxWeappExtSet record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxWeappExtSet record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -1,78 +0,0 @@ | |||
| package com.iformall.service.weopen; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| 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); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappReleaseStatusVo> getList(WxWeappReleaseStatusVo record); | |||
| /** | |||
| * 查询version列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<Map> getVersionList(Integer type); | |||
| /** | |||
| * 根据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); | |||
| } | |||
| @@ -1,76 +0,0 @@ | |||
| package com.iformall.service.weopen.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| import com.iformall.mapper.WxWeappAuditStatusMapper; | |||
| import com.iformall.service.weopen.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(Integer type, Integer auditStatus) { | |||
| return weappAuditStatusMapper.findUserVersions(type, auditStatus); | |||
| } | |||
| @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) { | |||
| logger.info("AUDIT: " + record.toString()); | |||
| weappAuditStatusMapper.insertSelective(record); | |||
| } | |||
| @Override | |||
| public void updateStatus(WxWeappAuditStatus record) { | |||
| logger.info("AUDIT: " + record.toString()); | |||
| weappAuditStatusMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappAuditStatusMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1,58 +0,0 @@ | |||
| package com.iformall.service.weopen.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappBasicSet; | |||
| import com.iformall.mapper.WxWeappBasicSetMapper; | |||
| import com.iformall.service.weopen.WxWeappBasicSetService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| public class WxWeappBasicSetServiceImpl implements WxWeappBasicSetService { | |||
| @Autowired | |||
| WxWeappBasicSetMapper wxWeappBasicSetMapper; | |||
| @Override | |||
| public PageInfo<WxWeappBasicSet> listAsPage(WxWeappBasicSet record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappBasicSetMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxWeappBasicSet getById(Long id) { | |||
| return wxWeappBasicSetMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxWeappBasicSet getByTypeAndDeploy(WxWeappBasicSet weappBasicSet) { | |||
| return wxWeappBasicSetMapper.selectOne(weappBasicSet); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxWeappBasicSet record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxWeappBasicSetMapper.insertSelective(record); | |||
| } else { | |||
| wxWeappBasicSetMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxWeappBasicSetMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1,76 +0,0 @@ | |||
| package com.iformall.service.weopen.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import com.iformall.mapper.WxWeappCodeStatusMapper; | |||
| import com.iformall.service.weopen.WxWeappCodeStatusService; | |||
| 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 WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxWeappCodeStatusMapper weappCodeStatusMapper; | |||
| @Override | |||
| public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappCodeStatusMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) { | |||
| return weappCodeStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public List<Map> getVersionList(Integer type) { | |||
| return weappCodeStatusMapper.findUserVersions(type); | |||
| } | |||
| @Override | |||
| public WxWeappCodeStatus getById(Long id) { | |||
| return weappCodeStatusMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxWeappCodeStatus getByAppId(String appId) { | |||
| WxWeappCodeStatus weappCodeStatusQ = new WxWeappCodeStatus(); | |||
| weappCodeStatusQ.setAppId(appId); | |||
| return weappCodeStatusMapper.selectOne(weappCodeStatusQ); | |||
| } | |||
| @Override | |||
| public void saveStatus(WxWeappCodeStatus record) { | |||
| logger.info("CODE-COMMIT: " + record.toString()); | |||
| weappCodeStatusMapper.insertSelective(record); | |||
| } | |||
| @Override | |||
| public void updateStatus(WxWeappCodeStatus record) { | |||
| logger.info("CODE-COMMIT: " + record.toString()); | |||
| weappCodeStatusMapper.updateStatus(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappCodeStatusMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1,58 +0,0 @@ | |||
| package com.iformall.service.weopen.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| import com.iformall.mapper.WxWeappExtSetMapper; | |||
| import com.iformall.service.weopen.WxWeappExtSetService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| public class WxWeappExtSetServiceImpl implements WxWeappExtSetService { | |||
| @Autowired | |||
| WxWeappExtSetMapper wxWeappExtSetMapper; | |||
| @Override | |||
| public PageInfo<WxWeappExtSet> listAsPage(WxWeappExtSet record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappExtSetMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxWeappExtSet getById(Long id) { | |||
| return wxWeappExtSetMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxWeappExtSet getByObj(WxWeappExtSet record) { | |||
| return wxWeappExtSetMapper.selectOne(record); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxWeappExtSet record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxWeappExtSetMapper.insertSelective(record); | |||
| } else { | |||
| wxWeappExtSetMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxWeappExtSetMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1,109 +0,0 @@ | |||
| package com.iformall.service.weopen.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| 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.weopen.WxWeappReleaseStatusService; | |||
| 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<WxWeappReleaseStatusVo> getList(WxWeappReleaseStatusVo record) { | |||
| return weappReleaseStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public List<Map> getVersionList(Integer type) { | |||
| return weappReleaseStatusMapper.findUserVersions(type); | |||
| } | |||
| @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) { | |||
| logger.info("RELEASE: " + record.toString()); | |||
| 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); | |||
| if(authorizerInfo != null) { | |||
| record.setUserVersion(authorizerInfo.getCurrentVersion()); | |||
| record.setVersionDesc(authorizerInfo.getCurrentDesc()); | |||
| record.setReleaseTime(authorizerInfo.getReleaseTime()); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| weappReleaseStatusMapper.updateStatus(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappReleaseStatusMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1130,5 +1130,27 @@ public class DateUtils { | |||
| return cale.getTime(); | |||
| } | |||
| /** | |||
| * 判断两日期是否同一个月 | |||
| * @param date1 | |||
| * @param date2 | |||
| * @return | |||
| */ | |||
| public static boolean isSameMonth(Date date1, Date date2) { | |||
| Calendar calendar1 = Calendar.getInstance(); | |||
| calendar1.setTime(date1); | |||
| Calendar calendar2 = Calendar.getInstance(); | |||
| calendar2.setTime(date2); | |||
| int year1 = calendar1.get(Calendar.YEAR); | |||
| int year2 = calendar2.get(Calendar.YEAR); | |||
| int month1 = calendar1.get(Calendar.MONTH); | |||
| int month2 = calendar2.get(Calendar.MONTH); | |||
| System.out.println(year1 + " " + month1); | |||
| System.out.println(year2 + " " + month2); | |||
| return calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH); | |||
| } | |||
| } | |||