Merge remote-tracking branch 'origin/test' into ats-restruct

This commit is contained in:
walker-sheng 2021-07-15 16:29:48 +08:00
commit 921358002c
11 changed files with 157 additions and 2 deletions

View File

@ -29,6 +29,10 @@ public class WeChatConfig {
private String spApp2Secret;
private String spApp3Id;
private String spApp3Secret;
/** 微信模块基础url */
private String wxModuleUrl;
@ -104,6 +108,14 @@ public class WeChatConfig {
.append("&grant_type=authorization_code").toString();
}
public String getMiniApp3Code2SessionUrl(String wmCode) {
return new StringBuilder(this.domainUri)
.append("/sns/jscode2session?appid=").append(spApp3Id)
.append("&secret=").append(this.spApp3Secret)
.append("&js_code=").append(wmCode)
.append("&grant_type=authorization_code").toString();
}
public String getWxModuleBatchGetUserInfoUrl() {
return this.wxModuleUrl + "/api/user/batchget";
}

View File

@ -110,6 +110,16 @@ public class LoginController {
return this.iAuthenticateService.getTokenByWmCode2(code);
}
/**
* 郑州共赢小程序code换token
* @param code
* @return
*/
@GetMapping(path = "/wm/zzww/token")
public String getTokenByWmCode3(String code) {
return this.iAuthenticateService.getTokenByWmCode3(code);
}
/**
*token是否过期
*/

View File

@ -58,4 +58,35 @@ public class Model2dController {
public void updateState(@PathVariable Long id, @PathVariable String state, @RequestAttribute AccountVO user) {
this.model2dService.updateState(id, state, user);
}
/**
* 查询某个模型所有历史版本数据
* @param code
* @return
*/
@GetMapping("/{code}/versions")
public List<Model2dVO> queryAllVersion(@PathVariable String code) {
return this.model2dService.queryAllVersionOf(code);
}
/**
* 分页查询某个模型历史版本数据
* @param code
* @return
*/
@GetMapping("/{code}/versions/paging")
public PageVO<Model2dVO> pageQueryVersion(@PathVariable String code, Model2dQueryVO queryVO) {
return model2dService.pageQueryVersion(code, queryVO);
}
/**
* 回滚版本
* @param code
* @param version
*/
@PutMapping("/{code}/version/{version}")
public void rollbackVersion(@PathVariable String code, @PathVariable Integer version) {
this.model2dService.rollbackVersion(code, version);
}
}

View File

@ -36,7 +36,9 @@ public class WxApiService implements IWxApiService {
/** 玖琏科技小程序 */
JoyLink,
/** 到那儿了小程序 */
DNL
DNL,
/** 郑州共赢驾驶小程序 */
ZZWW_DRIVER,
}
/**
@ -58,6 +60,9 @@ public class WxApiService implements IWxApiService {
case DNL:
url = this.weChatConfig.getMiniApp2Code2SessionUrl(wmCode);
break;
case ZZWW_DRIVER:
url = this.weChatConfig.getMiniApp3Code2SessionUrl(wmCode);
break;
}
wmUserSession = restTemplate.getForObject(url, WmUserSession.class);
BusinessExceptionAssertEnum.WECHAT_CODE_EXPIRED.assertHasText(wmUserSession.getOpenid(),

View File

@ -148,6 +148,13 @@ public class AuthenticateService implements IAuthenticateService {
return loginInfoVO.getToken();
}
@Override
public String getTokenByWmCode3(String code) {
AccountVO accountVO = this.getOrCreateUserByWmcode(WxApiService.MiniApp.ZZWW_DRIVER, code);
LoginUserInfoVO loginInfoVO = this.handleMiniAppLogin(accountVO);
return loginInfoVO.getToken();
}
private LoginUserInfoVO handleMiniAppLogin(AccountVO accountVO) {
// 移除之前登录信息
List<LoginUserInfoVO> infoVOList = this.loginSessionManager.queryLoginInfoByUserId(accountVO.getId());

View File

@ -88,6 +88,13 @@ public interface IAuthenticateService {
*/
String getTokenByWmCode2(String code);
/**
* 郑州共赢小程序code换token
* @param code
* @return
*/
String getTokenByWmCode3(String code);
boolean isTokenExpired(String token);
/**

View File

@ -38,4 +38,26 @@ public interface Model2dService {
void updateBasicInfo(Long id, Model2dVO model2dVO, AccountVO user);
void updateState(Long id, String state, AccountVO user);
/**
* 查询某个模型所有历史版本
* @param code
* @return
*/
List<Model2dVO> queryAllVersionOf(String code);
/**
* 分页查询某个模型历史版本数据
* @param code
* @param queryVO
* @return
*/
PageVO<Model2dVO> pageQueryVersion(String code, Model2dQueryVO queryVO);
/**
* 回滚版本
* @param code
* @param version
*/
void rollbackVersion(String code, Integer version);
}

View File

@ -38,7 +38,7 @@ public class Model2dServiceImpl implements Model2dService {
public PageVO<Model2dVO> pageQueryInfo(Model2dQueryVO queryVO) {
Model2dExample example = new Model2dExample();
Model2dExample.Criteria criteria = example.createCriteria();
// criteria.andStateEqualTo(StatusEnum.Valid.getCode());
criteria.andStateEqualTo(StatusEnum.Valid.getCode());
if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeLike(String.format("%%%s%%", queryVO.getCode()));
}
@ -96,6 +96,44 @@ public class Model2dServiceImpl implements Model2dService {
this.model2dDAO.updateByPrimaryKeySelective(update);
}
@Override
public List<Model2dVO> queryAllVersionOf(String code) {
Model2dExample example = new Model2dExample();
example.createCriteria()
.andCodeEqualTo(code);
List<Model2d> model2ds = this.model2dDAO.selectByExampleWithBLOBs(example);
return Model2dVO.convert2VOList(model2ds);
}
@Override
public PageVO<Model2dVO> pageQueryVersion(String code, Model2dQueryVO queryVO) {
Model2dExample example = new Model2dExample();
example.createCriteria()
.andCodeEqualTo(code);
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<Model2d> page = (Page<Model2d>) this.model2dDAO.selectByExampleWithBLOBs(example);
return PageVO.convert(page, Model2dVO.convert2VOList(page.getResult()));
}
@Override
public void rollbackVersion(String code, Integer version) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(code);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(version);
Model2d model2d = new Model2d();
model2d.setState(StatusEnum.Invalid.getCode());
Model2dExample example = new Model2dExample();
example.createCriteria()
.andCodeEqualTo(code)
.andStateEqualTo(StatusEnum.Valid.getCode());
this.model2dDAO.updateByExampleSelective(model2d, example);
model2d.setState(StatusEnum.Valid.getCode());
example.clear();
example.createCriteria()
.andCodeEqualTo(code)
.andVersionEqualTo(version);
this.model2dDAO.updateByExampleSelective(model2d, example);
}
private Model2d getEntityById(Long id) {
Model2d db = this.model2dDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(db,

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.vo.map;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.map.display.DisplayVO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
@ -38,6 +39,10 @@ public class MapGraphDataNewVO {
* 大屏配置
*/
private BigScreenConfig bigScreenConfig;
/** 显示配置 */
private List<DisplayVO> displayList;
/**
* 联锁数据生成配置
*/

View File

@ -0,0 +1,16 @@
package club.joylink.rtss.vo.map.display;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class DisplayVO {
private List<String> stationCodeList;
private List<String> elementList;
}

View File

@ -62,6 +62,8 @@ wechat:
sp-app-secret: 4b5d453e5ec246a3f1b72360c59e4fab
sp-app2-id: wxecb0321367be529c
sp-app2-secret: 3c31cb41588f27a78160092249123766
sp-app3-id: wxe6140d5985333338
sp-app3-secret: 6b7359860c22e3607467df421cd24eef
wm-base-url: https://joylink.club/oss/joylink/%s?state=%s
wx-module-url: http://localhost:9001
mini: