上传apk优化
This commit is contained in:
parent
2459915ed9
commit
45c5a2b45a
|
|
@ -122,8 +122,7 @@ public class DoubleScreenMachineController extends BaseController {
|
|||
@ApiOperation(value = "上传APK")
|
||||
@PostMapping({"/uploadApk"})
|
||||
public AjaxResult uploadApk(@RequestBody @Valid ApkDTO dto) {
|
||||
this.screenMachineService.uploadApk(dto);
|
||||
return AjaxResult.success();
|
||||
return this.screenMachineService.uploadApk(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.canteen.core.device.dto.ApkDTO;
|
|||
import com.bonus.canteen.core.device.dto.DeviceDTO;
|
||||
import com.bonus.canteen.core.device.dto.DeviceSearchDTO;
|
||||
import com.bonus.canteen.core.device.vo.DeviceFullInfoVO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
|
@ -51,5 +52,5 @@ public interface IDoubleScreenMachineService {
|
|||
*/
|
||||
void updateTimeBySn(String sn);
|
||||
|
||||
void uploadApk(@Valid ApkDTO dto);
|
||||
AjaxResult uploadApk(@Valid ApkDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.canteen.core.device.dto.DeviceSearchDTO;
|
|||
import com.bonus.canteen.core.device.vo.DeviceFullInfoVO;
|
||||
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import com.bonus.common.houqin.mq.constant.LeMqConstant;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
|
|
@ -171,16 +172,22 @@ public class DoubleScreenMachineServiceImpl implements IDoubleScreenMachineServi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void uploadApk(ApkDTO dto) {
|
||||
public AjaxResult uploadApk(ApkDTO dto) {
|
||||
try {
|
||||
ApkDTO apkDTO = mapper.getApkByType(dto.getType(), dto.getVersion());
|
||||
if (apkDTO != null) {
|
||||
//检查最新的一条版本是否相同
|
||||
ApkDTO lastBean = mapper.getApkByType(dto.getType(), null);
|
||||
if (lastBean != null && !lastBean.getVersion().equals(dto.getVersion())){
|
||||
return AjaxResult.error("该版本已存在");
|
||||
}
|
||||
mapper.updateApk(dto);
|
||||
} else {
|
||||
mapper.insertApk(dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("操作失败");
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
<select id="getApkByType" resultType="com.bonus.canteen.core.device.dto.ApkDTO">
|
||||
select * from app_version where type = #{type} and version = #{version}
|
||||
select *
|
||||
from app_version
|
||||
where 1 = 1
|
||||
<if test="version != null and version != ''">
|
||||
and version = #{version}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
order by version desc
|
||||
limit 1
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceRecipe">
|
||||
|
|
|
|||
Loading…
Reference in New Issue