Commit 7c7ad9e3 authored by hanfeng's avatar hanfeng

修改app自动更新(19/7/04)

parent 4b9e054b
...@@ -23,11 +23,13 @@ import org.springframework.stereotype.Service; ...@@ -23,11 +23,13 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.app.entity.AppVersion; import com.xxfc.platform.app.entity.AppVersion;
import com.xxfc.platform.app.mapper.AppVersionMapper; import com.xxfc.platform.app.mapper.AppVersionMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -112,5 +114,44 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> { ...@@ -112,5 +114,44 @@ public class AppVersionBiz extends BaseBiz<AppVersionMapper,AppVersion> {
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
} }
/**
* 添加版本信息
* @param appVersion
*/
@Transactional
public void insertAppVersion(AppVersion appVersion) {
appVersion.setDownloadSwitch(0);
insertSelective(appVersion);
}
public AppVersion get(Integer id) {
if (id==null) {
throw new IllegalArgumentException("Parameter is null");
}
return selectById(id);
}
/**
* 修改一条信息
* @param appVersion
*/
@Transactional
public void updateAppVersionById(AppVersion appVersion) {
updateSelectiveById(appVersion);
}
/**
* 删除
* @param id
*/
public void remove(Integer id) {
AppVersion appVersion = new AppVersion();
appVersion.setIsDel(1);
Example example = Example.builder(AppVersion.class)
.where(WeekendSqls.<AppVersion>custom().andEqualTo(AppVersion::getId,id))
.build();
mapper.updateByExampleSelective(appVersion,example);
}
} }
\ No newline at end of file
...@@ -34,6 +34,8 @@ import java.util.List; ...@@ -34,6 +34,8 @@ import java.util.List;
public class AppVersionController extends BaseController<AppVersionBiz,AppVersion> { public class AppVersionController extends BaseController<AppVersionBiz,AppVersion> {
//最大上传500MB //最大上传500MB
private Long MAX_DRIVING_LICENSE_SIZE =1024*1024*500L; private Long MAX_DRIVING_LICENSE_SIZE =1024*1024*500L;
private int id;
@ApiModelProperty("app自动更新") @ApiModelProperty("app自动更新")
@RequestMapping(value ="/app/unauth/info",method = RequestMethod.GET) @RequestMapping(value ="/app/unauth/info",method = RequestMethod.GET)
@IgnoreUserToken @IgnoreUserToken
...@@ -45,6 +47,42 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio ...@@ -45,6 +47,42 @@ public class AppVersionController extends BaseController<AppVersionBiz,AppVersio
} }
@Override
@ApiOperation("添加")
@RequestMapping(value = "",method = RequestMethod.POST)
@ResponseBody
public ObjectRestResponse<AppVersion> add(@RequestBody AppVersion appVersion){
baseBiz.insertAppVersion(appVersion);
return new ObjectRestResponse<AppVersion>();
}
@ApiOperation("查询")
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<AppVersion> get(@PathVariable Integer id){
return ObjectRestResponse.succ(baseBiz.get(id));
}
@Override
@ApiOperation("修改")
@RequestMapping(value = "/{id}",method = RequestMethod.PUT)
@ResponseBody
public ObjectRestResponse<AppVersion> update(@RequestBody AppVersion appVersion){
baseBiz.updateAppVersionById(appVersion);
return new ObjectRestResponse<AppVersion>();
}
@ApiOperation("删除")
@RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
@ResponseBody
public ObjectRestResponse<AppVersion> remove(@PathVariable Integer id){
baseBiz.remove(id);
return new ObjectRestResponse<AppVersion>();
}
@PostMapping(value = "/upload/installationPackage") @PostMapping(value = "/upload/installationPackage")
@ApiOperation(value = "上传app安装包") @ApiOperation(value = "上传app安装包")
public RestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file) public RestResponse uploadInstallationPackage(@RequestParam("file") MultipartFile file)
......
package com.xxfc.platform.universal.api;
import com.xxfc.platform.universal.api.pojo.Authentication;
import com.xxfc.platform.universal.entity.IdInformation;
/**
* 调用外部接口实现类。调用不同的外部接口,需要编写不同了类实现该类
*/
public interface BaseAuthentication {
Authentication getAuthentication(IdInformation idInformation);
}
package com.xxfc.platform.universal.api.impl;
import com.xxfc.platform.universal.api.BaseAuthentication;
import com.xxfc.platform.universal.api.pojo.Authentication;
import com.xxfc.platform.universal.entity.IdInformation;
public class FQAuthentication implements BaseAuthentication {
@Override
public Authentication getAuthentication(IdInformation idInformation) {
return null;
}
}
package com.xxfc.platform.universal.api.pojo;
public class Authentication {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment