|
@@ -0,0 +1,244 @@
|
|
|
|
|
+package org.jeecg.modules.business.controller;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+
|
|
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
+import org.jeecg.common.util.TokenUtils;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+
|
|
|
|
|
+import org.jeecg.modules.business.entity.*;
|
|
|
|
|
+import org.jeecg.modules.business.enums.AgreenmentAccountStatus;
|
|
|
|
|
+import org.jeecg.modules.business.enums.AgreenmentCheckStatus;
|
|
|
|
|
+import org.jeecg.modules.business.service.IBusMarketAgreementUnitService;
|
|
|
|
|
+import org.jeecg.modules.business.service.IBusHotelService;
|
|
|
|
|
+import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @Description: 协议单位
|
|
|
|
|
+ * @Author: jeecg-boot
|
|
|
|
|
+ * @Date: 2023-03-25
|
|
|
|
|
+ * @Version: V1.0
|
|
|
|
|
+ */
|
|
|
|
|
+@Api(tags="协议单位")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/business/busMarketAgreementUnit")
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+public class BusMarketAgreementUnitController extends JeecgController<BusMarketAgreementUnit, IBusMarketAgreementUnitService> {
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IBusMarketAgreementUnitService busAgreementUnitService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IBusHotelService busHotelService;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分页列表查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param busMarketAgreementUnit
|
|
|
|
|
+ * @param pageNo
|
|
|
|
|
+ * @param pageSize
|
|
|
|
|
+ * @param req
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ //@AutoLog(value = "协议单位-分页列表查询")
|
|
|
|
|
+ @ApiOperation(value="协议单位-分页列表查询", notes="协议单位-分页列表查询")
|
|
|
|
|
+ @GetMapping(value = "/list")
|
|
|
|
|
+ public Result<IPage<BusMarketAgreementUnit>> queryPageList(BusMarketAgreementUnit busMarketAgreementUnit,
|
|
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
|
|
+ HttpServletRequest req) {
|
|
|
|
|
+ QueryWrapper<BusMarketAgreementUnit> queryWrapper = QueryGenerator.initQueryWrapper(busMarketAgreementUnit, req.getParameterMap());
|
|
|
|
|
+ Page<BusMarketAgreementUnit> page = new Page<BusMarketAgreementUnit>(pageNo, pageSize);
|
|
|
|
|
+ IPage<BusMarketAgreementUnit> pageList = busAgreementUnitService.page(page, queryWrapper);
|
|
|
|
|
+ pageList.getRecords().forEach(item->{
|
|
|
|
|
+ BusHotel hotle = busHotelService.getById(item.getHotelId());
|
|
|
|
|
+ if (hotle != null) {
|
|
|
|
|
+ item.setHotelName(hotle.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return Result.OK(pageList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param busMarketAgreementUnit
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @AutoLog(value = "协议单位-添加")
|
|
|
|
|
+ @ApiOperation(value="协议单位-添加", notes="协议单位-添加")
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:add")
|
|
|
|
|
+ @PostMapping(value = "/add")
|
|
|
|
|
+ public Result<String> add(@RequestBody BusMarketAgreementUnit busMarketAgreementUnit) {
|
|
|
|
|
+ busMarketAgreementUnit.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
|
|
+ busMarketAgreementUnit.setAccountStatus(AgreenmentAccountStatus.normal.getKey());
|
|
|
|
|
+ busMarketAgreementUnit.setCheckStatus(AgreenmentCheckStatus.unaudited.getKey());
|
|
|
|
|
+ if (busMarketAgreementUnit.getTenantId() == null || busMarketAgreementUnit.getTenantId().equals("")) {
|
|
|
|
|
+ LoginUser user = TokenUtils.getAuthUser();
|
|
|
|
|
+ if (user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")) {
|
|
|
|
|
+ busMarketAgreementUnit.setTenantId(user.getRelTenantIds());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new JeecgBootException("当前登录人租户信息错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取当前最大账号
|
|
|
|
|
+ String _maxAccount = busAgreementUnitService.getMaxAccount();
|
|
|
|
|
+ Integer _num = Integer.parseInt(_maxAccount.split("A")[1]) + 1;
|
|
|
|
|
+ String _account = "A" + String.format( "%05d", _num);
|
|
|
|
|
+ busMarketAgreementUnit.setAccountNo(_account);
|
|
|
|
|
+ busAgreementUnitService.save(busMarketAgreementUnit);
|
|
|
|
|
+ return Result.OK("添加成功!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 编辑
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param busMarketAgreementUnit
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @AutoLog(value = "协议单位-编辑")
|
|
|
|
|
+ @ApiOperation(value="协议单位-编辑", notes="协议单位-编辑")
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:edit")
|
|
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
|
+ public Result<String> edit(@RequestBody BusMarketAgreementUnit busMarketAgreementUnit) {
|
|
|
|
|
+// busAgreementUnitService.updateById(busAgreementUnit);
|
|
|
|
|
+ if(busMarketAgreementUnit.getTenantId() == null || busMarketAgreementUnit.getTenantId().equals("")){
|
|
|
|
|
+ LoginUser user = TokenUtils.getAuthUser();
|
|
|
|
|
+ if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
|
|
|
|
|
+ busMarketAgreementUnit.setTenantId(user.getRelTenantIds());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new JeecgBootException("当前登录人租户信息错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ BusMarketAgreementUnit editModel = busAgreementUnitService.getById(busMarketAgreementUnit.getId());
|
|
|
|
|
+ editModel.setCustomerName(busMarketAgreementUnit.getCustomerName());
|
|
|
|
|
+ editModel.setCustomerShortName(busMarketAgreementUnit.getCustomerShortName());
|
|
|
|
|
+ editModel.setSystemType(busMarketAgreementUnit.getSystemType());
|
|
|
|
|
+ editModel.setCustomerNo(busMarketAgreementUnit.getCustomerNo());
|
|
|
|
|
+ editModel.setContactsName(busMarketAgreementUnit.getContactsName());
|
|
|
|
|
+ editModel.setCustomerType(busMarketAgreementUnit.getCustomerType());
|
|
|
|
|
+ editModel.setSellerId(busMarketAgreementUnit.getSellerId());
|
|
|
|
|
+ editModel.setPhone(busMarketAgreementUnit.getPhone());
|
|
|
|
|
+ editModel.setStatus(busMarketAgreementUnit.getStatus());
|
|
|
|
|
+ editModel.setRegion(busMarketAgreementUnit.getRegion());
|
|
|
|
|
+ editModel.setPostalCode(busMarketAgreementUnit.getPostalCode());
|
|
|
|
|
+ editModel.setAddress(busMarketAgreementUnit.getAddress());
|
|
|
|
|
+ editModel.setCompanyPhone(busMarketAgreementUnit.getCompanyPhone());
|
|
|
|
|
+ editModel.setFax(busMarketAgreementUnit.getFax());
|
|
|
|
|
+ editModel.setCustomerSource(busMarketAgreementUnit.getCustomerSource());
|
|
|
|
|
+ editModel.setHomepage(busMarketAgreementUnit.getHomepage());
|
|
|
|
|
+ editModel.setEmail(busMarketAgreementUnit.getEmail());
|
|
|
|
|
+ editModel.setCustomerIndustry(busMarketAgreementUnit.getCustomerIndustry());
|
|
|
|
|
+ busAgreementUnitService.updateById(editModel);
|
|
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过id删除
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @AutoLog(value = "协议单位-通过id删除")
|
|
|
|
|
+ @ApiOperation(value="协议单位-通过id删除", notes="协议单位-通过id删除")
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:delete")
|
|
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
|
|
+ public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
|
+ busAgreementUnitService.removeById(id);
|
|
|
|
|
+ return Result.OK("删除成功!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量删除
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param ids
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @AutoLog(value = "协议单位-批量删除")
|
|
|
|
|
+ @ApiOperation(value="协议单位-批量删除", notes="协议单位-批量删除")
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:deleteBatch")
|
|
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
|
|
+ this.busAgreementUnitService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过id查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ //@AutoLog(value = "协议单位-通过id查询")
|
|
|
|
|
+ @ApiOperation(value="协议单位-通过id查询", notes="协议单位-通过id查询")
|
|
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
|
|
+ public Result<BusMarketAgreementUnit> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
|
|
+ BusMarketAgreementUnit busMarketAgreementUnit = busAgreementUnitService.getById(id);
|
|
|
|
|
+ if(busMarketAgreementUnit ==null) {
|
|
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.OK(busMarketAgreementUnit);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 列表查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param busMarketAgreementUnit
|
|
|
|
|
+ * @param req
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ //@AutoLog(value = "协议单位-列表查询")
|
|
|
|
|
+ @ApiOperation(value="协议单位-列表查询", notes="协议单位-列表查询")
|
|
|
|
|
+ @GetMapping(value = "/queryList")
|
|
|
|
|
+ public Result<List<BusMarketAgreementUnit>> queryList(BusMarketAgreementUnit busMarketAgreementUnit, HttpServletRequest req) {
|
|
|
|
|
+ QueryWrapper<BusMarketAgreementUnit> queryWrapper = QueryGenerator.initQueryWrapper(busMarketAgreementUnit, req.getParameterMap());
|
|
|
|
|
+ LoginUser user = TokenUtils.getAuthUser();
|
|
|
|
|
+ if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
|
|
|
|
|
+ queryWrapper.eq("tenant_id",user.getRelTenantIds());
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.eq("del_flag",0);
|
|
|
|
|
+ List<BusMarketAgreementUnit> list = busAgreementUnitService.list(queryWrapper);
|
|
|
|
|
+ return Result.OK(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出excel
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param busMarketAgreementUnit
|
|
|
|
|
+ */
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:exportXls")
|
|
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, BusMarketAgreementUnit busMarketAgreementUnit) {
|
|
|
|
|
+ return super.exportXls(request, busMarketAgreementUnit, BusMarketAgreementUnit.class, "协议单位");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过excel导入数据
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param response
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ //@RequiresPermissions("business:bus_agreement_unit_info:importExcel")
|
|
|
|
|
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
|
|
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
+ return super.importExcel(request, response, BusMarketAgreementUnit.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|