|
|
@@ -1,23 +1,21 @@
|
|
|
package org.jeecg.modules.smscheck.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
-import org.jeecg.modules.smscheck.entity.BusinessReminderCard;
|
|
|
-import org.jeecg.modules.smscheck.entity.SysBusinessHallAndSysCompany;
|
|
|
-import org.jeecg.modules.smscheck.entity.SysCompany;
|
|
|
+import org.jeecg.modules.smscheck.entity.*;
|
|
|
+import org.jeecg.modules.smscheck.mapper.SysCompanyMapper;
|
|
|
import org.jeecg.modules.smscheck.service.SysBusinessHallService;
|
|
|
import org.jeecg.modules.smscheck.service.SysCompanyService;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -41,7 +39,8 @@ public class SysCompanyController {
|
|
|
@Resource
|
|
|
private SysBusinessHallService sysBusinessHallService;
|
|
|
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private SysCompanyMapper sysCompanyMapper;
|
|
|
|
|
|
@ApiOperation(value = "营业厅与公司联动", notes = "营业厅与公司联动")
|
|
|
@GetMapping(value = "/list")
|
|
|
@@ -52,7 +51,105 @@ public class SysCompanyController {
|
|
|
return Result.OK(dataSysBusinessHall);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "营业厅与公司-分页列表查询", notes = "营业厅与公司-分页列表查询")
|
|
|
+ @GetMapping(value = "/listPage")
|
|
|
+ public Result< Map<String, Object> > queryPageList(SysBusinessHall sysBusinessHall,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ Page<SmsStatisticsCheckVo> page = new Page<>(pageNo, pageSize);
|
|
|
+ Map<String, Object> sysCompanyListPage = sysCompanyService.getSysCompanyListPage(page);
|
|
|
+ return Result.OK(sysCompanyListPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "营业厅与公司-分页列表查询", notes = "营业厅与公司-分页列表查询")
|
|
|
+ @GetMapping(value = "/dataById")
|
|
|
+ public Result< Map<String, Object> > dataById(SysBusinessHall sysBusinessHall,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ Page<SmsStatisticsCheckVo> page = new Page<>(pageNo, pageSize);
|
|
|
+ Map<String, Object> sysCompanyListPage = sysCompanyService.getSysCompanyListPage(page);
|
|
|
+ return Result.OK(sysCompanyListPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "营业厅与公司-删除list", notes = "营业厅与公司-删除list")
|
|
|
+ @PostMapping(value = "/delAddressList")
|
|
|
+ public Result<?> delAddressList(@RequestBody Map<String, List<String>> data) {
|
|
|
+ if (data==null|| data.size()==0){
|
|
|
+ return Result.error("参数为空");
|
|
|
+ }
|
|
|
+ List<String> list = data.get("ids");
|
|
|
+ if (list==null|| list.size()==0){
|
|
|
+ return Result.error("Id为空");
|
|
|
+ }
|
|
|
+ UpdateWrapper<SysBusinessHall> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("id", list).set("del_flag", 1);
|
|
|
+ boolean update = sysBusinessHallService.update(updateWrapper);
|
|
|
+ if (update){
|
|
|
+ return Result.OK("删除成功...");
|
|
|
+ }
|
|
|
+ return Result.error("删除失败...");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ @ApiOperation(value = "营业厅与公司-add", notes = "营业厅与公司-add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<?> addAddress(@RequestBody Map<String,Map<String,String>> data) {
|
|
|
|
|
|
+ if (data==null|| data.size()==0){
|
|
|
+ return Result.error("参数为空");
|
|
|
+ }
|
|
|
+ Map<String, String> map = data.get("data");
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(map.get("aid"))){
|
|
|
+ String mes ="";
|
|
|
+ if (StringUtils.isBlank(map.get("aname"))){
|
|
|
+ mes+=" 二级部门名称不可为空! ";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(map.get("three_company_id"))){
|
|
|
+ mes+=" 三级部门名称不可为空! ";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(map.get("bname"))){
|
|
|
+ mes+=" 营业厅名称不可为空! ";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(map.get("address"))){
|
|
|
+ mes+=" 营业厅地址不可为空! ";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(map.get("coordinate"))){
|
|
|
+ mes+=" 坐标不可为空! ";
|
|
|
+ }
|
|
|
+ if (!mes.equals("")){
|
|
|
+ return Result.error(mes);
|
|
|
+ }
|
|
|
+ SysCompany sysCompany = new SysCompany();
|
|
|
+ sysCompany.setName(map.get("aname"));
|
|
|
+ sysCompanyService.save(sysCompany);
|
|
|
+ SysBusinessHall sysBusinessHall = new SysBusinessHall();
|
|
|
+ sysBusinessHall.setName(map.get("bname"));
|
|
|
+ sysBusinessHall.setCompanyId(sysCompany.getId());
|
|
|
+ sysBusinessHall.setAddress(map.get("address"));
|
|
|
+ sysBusinessHall.setCoordinate(map.get("coordinate"));
|
|
|
+ sysBusinessHall.setThreeCompanyId(map.get("three_company_id"));
|
|
|
+ boolean save = sysBusinessHallService.save(sysBusinessHall);
|
|
|
+ return Result.OK("增加成功...");
|
|
|
+ }else {
|
|
|
+ SysCompany sysCompany = new SysCompany();
|
|
|
+ sysCompany.setName(map.get("aname"));
|
|
|
+
|
|
|
+ UpdateWrapper<SysCompany> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id",map.get("aid")).set("name",map.get("aname"));
|
|
|
+ boolean update = sysCompanyService.update(updateWrapper);
|
|
|
+
|
|
|
+ UpdateWrapper<SysBusinessHall> hallUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ hallUpdateWrapper.eq("id",map.get("bid")).set("bname",map.get("bname")).set("address",map.get("address"))
|
|
|
+ .set("coordinate",map.get("coordinate")).set("three_company_id",map.get("three_company_id"));
|
|
|
+
|
|
|
+ boolean save = sysBusinessHallService.update(hallUpdateWrapper);
|
|
|
+ return Result.OK("修改成功...");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|