1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.hmit.kernes.controller;
import com.hmit.kernes.entity.AppServiceEntity;
import com.hmit.kernes.service.AppServiceService;
import com.hmit.kernes.service.CloudBaseInfoService;
import com.hmit.kernes.utils.PageUtils;
import com.hmit.kernes.utils.Query;
import com.hmit.kernes.utils.R;
import com.hmit.kernes.utils.RRException;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/app/service")
public class AppServiceController {
@Autowired
AppServiceService appServiceService;
@Autowired
CloudBaseInfoService cloudBaseInfoService;
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
Query query = new Query(params);
List<AppServiceEntity> list=appServiceService.queryList(query);
int total=appServiceService.queryTotal(query);
PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
@RequestMapping("/info/{id}")
public R info(@PathVariable("") Long id){
AppServiceEntity appServiceEntity=appServiceService.queryObject(id);
return R.ok().put("appService",appServiceEntity);
}
@RequestMapping("/save")
public R save(@RequestBody AppServiceEntity appServiceEntity){
//数据校验
//verifyForm();
verify(appServiceEntity);
// appServiceEntity.setServiceTime(new Date());
appServiceEntity.setUnionName(cloudBaseInfoService.queryObject(appServiceEntity.getUnionId()).getLocalUnionName());
appServiceEntity.setStatus(1);
appServiceService.save(appServiceEntity);
return R.ok();
}
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
appServiceService.deleteBatch(ids);
return R.ok();
}
@RequestMapping("/update")
public R update(@RequestBody AppServiceEntity appServiceEntity){
//数据校验
// verifyForm(cloudChairmanInfoEntity);
verify(appServiceEntity);
appServiceEntity.setUpdateTime(new Date());
appServiceService.update(appServiceEntity);
return R.ok();
}
public AppServiceEntity verify(AppServiceEntity a){
if(StringUtils.isBlank(a.getTel())){
throw new RRException("用户手机号不能为空");
}
return a;
}
}