|
|
|
@ -1,30 +1,25 @@ |
|
|
|
|
package com.cjy.enterprise.controller; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
import com.cjy.enterprise.domain.EnterpriseInfo; |
|
|
|
|
import com.cjy.enterprise.domain.EnterpriseInfoExtend; |
|
|
|
|
import com.ruoyi.common.utils.SnowflakeIdUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
import com.cjy.enterprise.service.IEnterpriseInfoService; |
|
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
|
import com.ruoyi.common.enums.BusinessType; |
|
|
|
|
import com.cjy.enterprise.domain.EnterpriseInfo; |
|
|
|
|
import com.cjy.enterprise.service.IEnterpriseInfoService; |
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo; |
|
|
|
|
import com.ruoyi.common.enums.BusinessType; |
|
|
|
|
import com.ruoyi.common.utils.SnowflakeIdUtils; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 企业信息Controller |
|
|
|
@ -32,10 +27,10 @@ import com.ruoyi.common.core.page.TableDataInfo; |
|
|
|
|
* @author ruoyi |
|
|
|
|
* @date 2023-02-19 |
|
|
|
|
*/ |
|
|
|
|
@Api("企业基础信息控制器") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/enterprise") |
|
|
|
|
public class EnterpriseInfoController extends BaseController |
|
|
|
|
{ |
|
|
|
|
public class EnterpriseInfoController extends BaseController { |
|
|
|
|
@Value("${website.url}") |
|
|
|
|
private String websiteUrl; |
|
|
|
|
@Autowired |
|
|
|
@ -44,35 +39,29 @@ public class EnterpriseInfoController extends BaseController |
|
|
|
|
/** |
|
|
|
|
* 查询企业信息列表 |
|
|
|
|
*/ |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:list')") |
|
|
|
|
@ApiOperation("查询企业信息列表") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "organCode", value = "企业标识码", dataType = "Long", dataTypeClass = Long.class), |
|
|
|
|
@ApiImplicitParam(name = "organName", value = "企业名称", dataType = "String", dataTypeClass = String.class), |
|
|
|
|
}) |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
public TableDataInfo list(EnterpriseInfo enterpriseInfo) |
|
|
|
|
{ |
|
|
|
|
public TableDataInfo list(EnterpriseInfo enterpriseInfo) { |
|
|
|
|
startPage(); |
|
|
|
|
List<EnterpriseInfoExtend> list = enterpriseInfoService.selectEnterpriseInfoList(enterpriseInfo); |
|
|
|
|
return getDataTable(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出企业信息列表 |
|
|
|
|
*/ |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:export')") |
|
|
|
|
@Log(title = "企业信息", businessType = BusinessType.EXPORT) |
|
|
|
|
@PostMapping("/export") |
|
|
|
|
public void export(HttpServletResponse response, EnterpriseInfo enterpriseInfo) |
|
|
|
|
{ |
|
|
|
|
List<EnterpriseInfoExtend> list = enterpriseInfoService.selectEnterpriseInfoList(enterpriseInfo); |
|
|
|
|
ExcelUtil<EnterpriseInfoExtend> util = new ExcelUtil<EnterpriseInfoExtend>(EnterpriseInfoExtend.class); |
|
|
|
|
util.exportExcel(response, list, "企业信息数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取企业信息详细信息 |
|
|
|
|
*/ |
|
|
|
|
@ApiOperation("查询企业信息详情") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", dataTypeClass = Long.class) |
|
|
|
|
}) |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:query')") |
|
|
|
|
@GetMapping(value = "/{id}") |
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
|
|
|
{ |
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) { |
|
|
|
|
return success(enterpriseInfoService.selectEnterpriseInfoById(id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -82,13 +71,12 @@ public class EnterpriseInfoController extends BaseController |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:add')") |
|
|
|
|
@Log(title = "企业信息", businessType = BusinessType.INSERT) |
|
|
|
|
@PostMapping |
|
|
|
|
public AjaxResult add(@RequestBody EnterpriseInfo enterpriseInfo) |
|
|
|
|
{ |
|
|
|
|
public AjaxResult add(@RequestBody EnterpriseInfo enterpriseInfo) { |
|
|
|
|
enterpriseInfo.setCreaterUserId(getUserId()); |
|
|
|
|
enterpriseInfo.setCreaterTime(new Date()); |
|
|
|
|
enterpriseInfo.setUpdateUserId(getUserId()); |
|
|
|
|
enterpriseInfo.setUpdateTime(new Date()); |
|
|
|
|
enterpriseInfo.setOrganCode(SnowflakeIdUtils.generateIdentification()+""); // 机构编号
|
|
|
|
|
enterpriseInfo.setOrganCode(SnowflakeIdUtils.generateIdentification()); // 机构编号
|
|
|
|
|
enterpriseInfo.setWebsiteUrl(websiteUrl + "&organCode=" + enterpriseInfo.getOrganCode()); |
|
|
|
|
enterpriseInfo.setStatus(0); |
|
|
|
|
enterpriseInfo.setDataStatus(0); |
|
|
|
@ -101,8 +89,7 @@ public class EnterpriseInfoController extends BaseController |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:edit')") |
|
|
|
|
@Log(title = "企业信息", businessType = BusinessType.UPDATE) |
|
|
|
|
@PutMapping |
|
|
|
|
public AjaxResult edit(@RequestBody EnterpriseInfo enterpriseInfo) |
|
|
|
|
{ |
|
|
|
|
public AjaxResult edit(@RequestBody EnterpriseInfo enterpriseInfo) { |
|
|
|
|
return toAjax(enterpriseInfoService.updateEnterpriseInfo(enterpriseInfo)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -112,8 +99,19 @@ public class EnterpriseInfoController extends BaseController |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:remove')") |
|
|
|
|
@Log(title = "企业信息", businessType = BusinessType.DELETE) |
|
|
|
|
@DeleteMapping("/{ids}") |
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) |
|
|
|
|
{ |
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) { |
|
|
|
|
return toAjax(enterpriseInfoService.deleteEnterpriseInfoByIds(ids)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation("更改企业信息状态(停用/启用)") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
@ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", dataTypeClass = Long.class), |
|
|
|
|
@ApiImplicitParam(name = "status", value = "状态 0启用 1停用", dataType = "Integer", dataTypeClass = Integer.class) |
|
|
|
|
}) |
|
|
|
|
@PreAuthorize("@ss.hasPermi('enterprise:edit')") |
|
|
|
|
@Log(title = "企业信息更改状态", businessType = BusinessType.UPDATE) |
|
|
|
|
public AjaxResult updateEnterpriseStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status) { |
|
|
|
|
|
|
|
|
|
return toAjax( enterpriseInfoService.updateEnterprieseStatus(id,status)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|