上传apk
This commit is contained in:
parent
0b12332114
commit
2459915ed9
|
|
@ -10,6 +10,7 @@ import com.bonus.canteen.core.alloc.domain.AllocCanteen;
|
|||
import com.bonus.canteen.core.alloc.domain.AllocStall;
|
||||
import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper;
|
||||
import com.bonus.canteen.core.alloc.mapper.AllocStallMapper;
|
||||
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.service.IDoubleScreenMachineService;
|
||||
|
|
@ -118,6 +119,11 @@ public class DoubleScreenMachineController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "上传APK")
|
||||
@PostMapping({"/uploadApk"})
|
||||
public AjaxResult uploadApk(@RequestBody @Valid ApkDTO dto) {
|
||||
this.screenMachineService.uploadApk(dto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.canteen.core.device.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApkDTO {
|
||||
private String version;
|
||||
private String versionName;
|
||||
private String apkName;
|
||||
private String apkPath;
|
||||
private String updateContent;
|
||||
private String deployUser;
|
||||
private String type;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.device.mapper;
|
|||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.device.domain.DeviceBind;
|
||||
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;
|
||||
|
|
@ -81,4 +82,10 @@ public interface DoubleScreenMachineMapper {
|
|||
int checkIsExistDeviceName(@Param("deviceName") @NotBlank(message = "设备名称必填") String deviceName,@Param("deviceId") String deviceId);
|
||||
|
||||
int checkIsExistDeviceSn(@Param("deviceSn") @NotBlank(message = "设备sn码必填") String deviceSn,@Param("deviceId") String deviceId);
|
||||
|
||||
ApkDTO getApkByType(@Param("type") String type,@Param("version") String version);
|
||||
|
||||
int updateApk(ApkDTO dto);
|
||||
|
||||
int insertApk(ApkDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.device.service;
|
|||
import java.util.List;
|
||||
import com.bonus.canteen.core.device.domain.DeviceBind;
|
||||
import com.bonus.canteen.core.device.domain.DeviceInfo;
|
||||
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;
|
||||
|
|
@ -49,4 +50,6 @@ public interface IDoubleScreenMachineService {
|
|||
* @param sn
|
||||
*/
|
||||
void updateTimeBySn(String sn);
|
||||
|
||||
void uploadApk(@Valid ApkDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
package com.bonus.canteen.core.device.service.impl;
|
||||
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.common.utils.MqUtil;
|
||||
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.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import com.bonus.common.houqin.mq.constant.LeMqConstant;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
|
|
@ -166,4 +169,18 @@ public class DoubleScreenMachineServiceImpl implements IDoubleScreenMachineServi
|
|||
throw new RuntimeException("更新时间失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadApk(ApkDTO dto) {
|
||||
try {
|
||||
ApkDTO apkDTO = mapper.getApkByType(dto.getType(), dto.getVersion());
|
||||
if (apkDTO != null) {
|
||||
mapper.updateApk(dto);
|
||||
} else {
|
||||
mapper.insertApk(dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,12 +180,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and device_id != #{deviceId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getApkByType" resultType="com.bonus.canteen.core.device.dto.ApkDTO">
|
||||
select * from app_version where type = #{type} and version = #{version}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceRecipe">
|
||||
insert into device_recipe(id,device_id, canteen_id,stall_id,
|
||||
revision)
|
||||
values (#{id},#{deviceId}, #{canteenId}, #{stallId},'0')
|
||||
</insert>
|
||||
<insert id="insertApk">
|
||||
insert into app_version(version, version_name, apk_name, apk_path, update_content, deploy_user, type)
|
||||
values (#{version}, #{versionName}, #{apkName}, #{apkPath}, #{updateContent}, #{deployUser}, #{type})
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceRecipe" >
|
||||
update device_recipe
|
||||
|
|
@ -202,4 +209,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</set>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateApk">
|
||||
update app_version
|
||||
<set>
|
||||
<if test="version != null and version != ''">
|
||||
version = #{version},
|
||||
</if>
|
||||
<if test="versionName != null and versionName != ''">
|
||||
version_name = #{versionName},
|
||||
</if>
|
||||
<if test="apkName != null and apkName != ''">
|
||||
apk_name = #{apkName},
|
||||
</if>
|
||||
<if test="apkPath != null and apkPath != ''">
|
||||
apk_path = #{apkPath},
|
||||
</if>
|
||||
<if test="updateContent != null and updateContent != ''">
|
||||
update_content = #{updateContent},
|
||||
</if>
|
||||
<if test="updateContent != null and updateContent != ''">
|
||||
update_content = #{updateContent},
|
||||
</if>
|
||||
<if test="deployUser != null and deployUser != ''">
|
||||
deploy_user = #{deployUser},
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
type = #{type},
|
||||
</if>
|
||||
</set>
|
||||
where version = #{version}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue