自动化立体仓库 - WMS系统
zhang
2 天以前 e62569856fdfb0c7c31ee88cf96628af08eabf85
src/main/java/com/zy/asrs/controller/AppVersionController.java
@@ -37,17 +37,19 @@
    @RequestMapping(value = "/appVersion/list/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
    public R list(@RequestParam(defaultValue = "1") Integer curr,
                  @RequestParam(defaultValue = "10") Integer limit,
                  @RequestParam(required = false) String orderByField,
                  @RequestParam(required = false) String orderByType,
                  @RequestParam(required = false) String condition,
                  @RequestParam Map<String, Object> param) {
        EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(AppVersion.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        }
        return R.ok(appVersionService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -71,10 +73,10 @@
        return R.ok("有新版本,需要更新").add(latestApp);
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
            if (val.contains(RANGE_TIME_LINK)) {
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
@@ -97,8 +99,8 @@
    @RequestMapping(value = "/appVersion/update/auth")
    @ManagerAuth
    public R update(AppVersion appVersion){
        if (Cools.isEmpty(appVersion) || null==appVersion.getId()){
    public R update(AppVersion appVersion) {
        if (Cools.isEmpty(appVersion) || null == appVersion.getId()) {
            return R.error();
        }
        if (appVersion.getLatest() == 1) {
@@ -111,8 +113,8 @@
    @RequestMapping(value = "/appVersion/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
        for (Long id : ids){
    public R delete(@RequestParam(value = "ids[]") Long[] ids) {
        for (Long id : ids) {
            appVersionService.deleteById(id);
        }
        return R.ok();
@@ -120,7 +122,7 @@
    @RequestMapping(value = "/appVersion/export/auth")
    @ManagerAuth
    public R export(@RequestBody JSONObject param){
    public R export(@RequestBody JSONObject param) {
        EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        Map<String, Object> map = excludeTrash(param.getJSONObject("appVersion"));
@@ -136,7 +138,7 @@
        wrapper.like("id", condition);
        Page<AppVersion> page = appVersionService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (AppVersion appVersion : page.getRecords()){
        for (AppVersion appVersion : page.getRecords()) {
            Map<String, Object> map = new HashMap<>();
            map.put("id", appVersion.getId());
            map.put("value", appVersion.getId());
@@ -149,7 +151,7 @@
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<AppVersion> wrapper = new EntityWrapper<AppVersion>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != appVersionService.selectOne(wrapper)){
        if (null != appVersionService.selectOne(wrapper)) {
            return R.parse(BaseRes.REPEAT).add(getComment(AppVersion.class, String.valueOf(param.get("key"))));
        }
        return R.ok();
@@ -158,12 +160,12 @@
    @RequestMapping(value = "/appVersion/uploadApp/auth")
    @ManagerAuth
    public R uploadApp(@RequestParam("id") Integer id,
                       @RequestParam("file") MultipartFile[] files){
                       @RequestParam("file") MultipartFile[] files) {
        AppVersion appVersion = appVersionService.selectById(id);
        MultipartFile file = files[0];
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
        String path =  ClassUtils.getDefaultClassLoader().getResource("appVersion").getPath();
        String path = ClassUtils.getDefaultClassLoader().getResource("appVersion").getPath();
        //文件后缀名
        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
        //上传文件名
@@ -174,7 +176,7 @@
        //服务器端保存的文件对象
        File serverFile = new File(filepath);
        if(!serverFile.exists()) {
        if (!serverFile.exists()) {
            try {
                //创建文件
                serverFile.createNewFile();