parent
e02d6998ae
commit
51ff871510
@ -1,132 +0,0 @@
|
|||||||
package com.ruoyi.framework.config;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import org.apache.ibatis.io.VFS;
|
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
||||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.core.io.DefaultResourceLoader;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
|
||||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
|
||||||
import org.springframework.core.type.classreading.MetadataReader;
|
|
||||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
|
||||||
import org.springframework.util.ClassUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mybatis支持*匹配扫描包
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class MyBatisConfig
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private Environment env;
|
|
||||||
|
|
||||||
static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
|
|
||||||
|
|
||||||
public static String setTypeAliasesPackage(String typeAliasesPackage)
|
|
||||||
{
|
|
||||||
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
|
|
||||||
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
|
|
||||||
List<String> allResult = new ArrayList<String>();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (String aliasesPackage : typeAliasesPackage.split(","))
|
|
||||||
{
|
|
||||||
List<String> result = new ArrayList<String>();
|
|
||||||
aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
|
||||||
+ ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
|
|
||||||
Resource[] resources = resolver.getResources(aliasesPackage);
|
|
||||||
if (resources != null && resources.length > 0)
|
|
||||||
{
|
|
||||||
MetadataReader metadataReader = null;
|
|
||||||
for (Resource resource : resources)
|
|
||||||
{
|
|
||||||
if (resource.isReadable())
|
|
||||||
{
|
|
||||||
metadataReader = metadataReaderFactory.getMetadataReader(resource);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.size() > 0)
|
|
||||||
{
|
|
||||||
HashSet<String> hashResult = new HashSet<String>(result);
|
|
||||||
allResult.addAll(hashResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allResult.size() > 0)
|
|
||||||
{
|
|
||||||
typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return typeAliasesPackage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Resource[] resolveMapperLocations(String[] mapperLocations)
|
|
||||||
{
|
|
||||||
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
|
|
||||||
List<Resource> resources = new ArrayList<Resource>();
|
|
||||||
if (mapperLocations != null)
|
|
||||||
{
|
|
||||||
for (String mapperLocation : mapperLocations)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Resource[] mappers = resourceResolver.getResources(mapperLocation);
|
|
||||||
resources.addAll(Arrays.asList(mappers));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resources.toArray(new Resource[resources.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
|
|
||||||
{
|
|
||||||
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
|
|
||||||
String mapperLocations = env.getProperty("mybatis.mapperLocations");
|
|
||||||
String configLocation = env.getProperty("mybatis.configLocation");
|
|
||||||
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
|
||||||
VFS.addImplClass(SpringBootVFS.class);
|
|
||||||
|
|
||||||
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
|
||||||
sessionFactory.setDataSource(dataSource);
|
|
||||||
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
|
||||||
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
|
||||||
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
|
||||||
return sessionFactory.getObject();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,241 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.controller;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReporting;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReportingDetails;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.service.impl.TbCompanyInformationReportingDetailsServiceImpl;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.service.impl.TbCompanyInformationReportingServiceImpl;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.token.TokenService;
|
||||||
|
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.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.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报Controller
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Api(tags = "企业信息上报")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/reporting")
|
||||||
|
public class TbCompanyInformationReportingController extends BaseController {
|
||||||
|
|
||||||
|
private final TbCompanyInformationReportingServiceImpl tbCompanyInformationReportingService;
|
||||||
|
private final TbCompanyInformationReportingDetailsServiceImpl tbCompanyInformationReportingDetailsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息上报列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("查询企业信息上报列表")
|
||||||
|
@ApiOperationSupport(author = "张二富", order = 1)
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "reportMonth", value = "上报月份 1-12", dataType = "String", dataTypeClass = String.class),
|
||||||
|
@ApiImplicitParam(name = "reportState", value = "上报状态 0=已提交,1=待提交", dataType = "String", dataTypeClass = String.class)
|
||||||
|
})
|
||||||
|
public TableDataInfo list(TbCompanyInformationReporting tbCompanyInformationReporting)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<TbCompanyInformationReporting> list = tbCompanyInformationReportingService.selectTbCompanyInformationReportingList(tbCompanyInformationReporting);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业信息上报详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiOperation("获取企业信息上报详细信息")
|
||||||
|
@ApiOperationSupport(author = "张二富", order = 5)
|
||||||
|
@ApiImplicitParam(name = "id", value = "企业信息上报id 列表返回的id", required = true)
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
if(id==null||id==0){
|
||||||
|
return error("企业信息上报id为空");
|
||||||
|
}
|
||||||
|
List<TbCompanyInformationReportingDetails> byCompanyInformationReportingId = tbCompanyInformationReportingDetailsService.getByCompanyInformationReportingId(id);
|
||||||
|
TbCompanyInformationReporting tbCompanyInformationReporting = tbCompanyInformationReportingService.selectTbCompanyInformationReportingById(id);
|
||||||
|
tbCompanyInformationReporting.setDetails(byCompanyInformationReportingId);
|
||||||
|
return success(tbCompanyInformationReporting);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增企业信息上报
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增企业信息上报")
|
||||||
|
@ApiOperationSupport(author = "张二富", order = 10)
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "companyId", value = "公司id", dataType = "String", dataTypeClass = String.class ,required = true),
|
||||||
|
@ApiImplicitParam(name = "companyName", value = "公司名称", dataType = "String", dataTypeClass = String.class,required = true),
|
||||||
|
@ApiImplicitParam(name = "reportMonth", value = "上报月份 1-12", dataType = "String", dataTypeClass = String.class,required = true),
|
||||||
|
@ApiImplicitParam(name = "details", value = "上报详情信息 三项必填一项", dataType = "List<TbCompanyInformationReportingDetails>", dataTypeClass = TbCompanyInformationReportingDetails.class,required = true)
|
||||||
|
})
|
||||||
|
public AjaxResult add(@RequestBody TbCompanyInformationReporting tbCompanyInformationReporting) {
|
||||||
|
if(tbCompanyInformationReporting==null){
|
||||||
|
return error("入参为空");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReporting.getCompanyId()==null|| StringUtils.isBlank(tbCompanyInformationReporting.getCompanyName())||StringUtils.isBlank(tbCompanyInformationReporting.getReportMonth())){
|
||||||
|
return error("参数异常 请检查 企业id 企业名称 上报月份 是否为空");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReporting.getDetails()==null||tbCompanyInformationReporting.getDetails().size()<1){
|
||||||
|
return error("上报详情信息三项不能都为空");
|
||||||
|
}
|
||||||
|
List<TbCompanyInformationReportingDetails> details = tbCompanyInformationReporting.getDetails();
|
||||||
|
for (TbCompanyInformationReportingDetails detail : details) {
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group1FieldsEmptyByCompanyThreePreventionData(detail)){
|
||||||
|
tbCompanyInformationReporting.setCompanyThreePreventionData("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setCompanyThreePreventionData("1");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group2FieldsEmptyBySystemPlanExercise(detail)){
|
||||||
|
tbCompanyInformationReporting.setSystemPlanExercise("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setSystemPlanExercise("1");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group3FieldsEmptyByInspectionResult(detail)){
|
||||||
|
tbCompanyInformationReporting.setInspectionResult("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setInspectionResult("1");
|
||||||
|
}
|
||||||
|
detail.setCreateTime(DateUtils.getNowDate());
|
||||||
|
}
|
||||||
|
tbCompanyInformationReporting.setReportState("1");
|
||||||
|
int i = tbCompanyInformationReportingService.insertTbCompanyInformationReporting(tbCompanyInformationReporting);
|
||||||
|
boolean saveBatch = tbCompanyInformationReportingDetailsService.saveBatch(details);
|
||||||
|
if(!saveBatch){
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
return toAjax(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改企业信息上报
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
@ApiOperation("修改企业信息上报")
|
||||||
|
@ApiOperationSupport(author = "张二富", order = 15)
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "企业信息上报id", dataType = "Long", dataTypeClass = Long.class ,required = true),
|
||||||
|
@ApiImplicitParam(name = "companyId", value = "公司id", dataType = "Long", dataTypeClass = Long.class ,required = true),
|
||||||
|
@ApiImplicitParam(name = "companyName", value = "公司名称", dataType = "String", dataTypeClass = String.class,required = true),
|
||||||
|
@ApiImplicitParam(name = "reportMonth", value = "上报月份 1-12", dataType = "String", dataTypeClass = String.class,required = true),
|
||||||
|
@ApiImplicitParam(name = "details", value = "上报详情信息 三项必填一项 id字段也必填", dataType = "List<TbCompanyInformationReportingDetails>", dataTypeClass = TbCompanyInformationReportingDetails.class,required = true)
|
||||||
|
})
|
||||||
|
public AjaxResult edit(@RequestBody TbCompanyInformationReporting tbCompanyInformationReporting) {
|
||||||
|
if(tbCompanyInformationReporting==null){
|
||||||
|
return error("入参为空");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReporting.getId()==null){
|
||||||
|
return error("参数企业信息上报id为空");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReporting.getCompanyId()==null|| StringUtils.isBlank(tbCompanyInformationReporting.getCompanyName())||StringUtils.isBlank(tbCompanyInformationReporting.getReportMonth())){
|
||||||
|
return error("参数异常 请检查 企业id 企业名称 上报月份 是否为空");
|
||||||
|
}
|
||||||
|
if(tbCompanyInformationReporting.getDetails()==null||tbCompanyInformationReporting.getDetails().size()<1){
|
||||||
|
return error("上报详情信息三项不能都为空");
|
||||||
|
}
|
||||||
|
if("0".equals(tbCompanyInformationReporting.getReportState())){
|
||||||
|
return error("上报已提交不能修改");
|
||||||
|
}
|
||||||
|
List<TbCompanyInformationReportingDetails> details = tbCompanyInformationReporting.getDetails();
|
||||||
|
boolean sing=false;
|
||||||
|
boolean batchById = false;
|
||||||
|
for (TbCompanyInformationReportingDetails detail : details) {
|
||||||
|
detail.setCompanyInformationReportingId(tbCompanyInformationReporting.getId());
|
||||||
|
if(StringUtils.isBlank(detail.getDataType())){
|
||||||
|
sing=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if("1".equals(detail.getDataType())){
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group1FieldsEmptyByCompanyThreePreventionData(detail)){
|
||||||
|
tbCompanyInformationReporting.setCompanyThreePreventionData("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setCompanyThreePreventionData("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if("2".equals(detail.getDataType())){
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group2FieldsEmptyBySystemPlanExercise(detail)){
|
||||||
|
tbCompanyInformationReporting.setSystemPlanExercise("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setSystemPlanExercise("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if("3".equals(detail.getDataType())){
|
||||||
|
if(tbCompanyInformationReportingDetailsService.group3FieldsEmptyByInspectionResult(detail)){
|
||||||
|
tbCompanyInformationReporting.setInspectionResult("0");
|
||||||
|
}else {
|
||||||
|
tbCompanyInformationReporting.setInspectionResult("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QueryWrapper<TbCompanyInformationReportingDetails> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReportingDetails.Fields.dataType),detail.getDataType());
|
||||||
|
queryWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReportingDetails.Fields.companyInformationReportingId),tbCompanyInformationReporting.getId());
|
||||||
|
TbCompanyInformationReportingDetails one = tbCompanyInformationReportingDetailsService.getOne(queryWrapper);
|
||||||
|
|
||||||
|
if(one==null){
|
||||||
|
detail.setCreateTime(DateUtils.getNowDate());
|
||||||
|
batchById=tbCompanyInformationReportingDetailsService.save(detail);
|
||||||
|
}else {
|
||||||
|
if(!one.getId().equals(Optional.ofNullable(detail.getId()).orElse(0L))){
|
||||||
|
detail.setId(one.getId());
|
||||||
|
}
|
||||||
|
detail.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
batchById=tbCompanyInformationReportingDetailsService.updateById(detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(sing){
|
||||||
|
return error("上报详情类型为空");
|
||||||
|
}
|
||||||
|
int i = tbCompanyInformationReportingService.updateTbCompanyInformationReporting(tbCompanyInformationReporting);
|
||||||
|
|
||||||
|
if(!batchById){
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
return toAjax(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改企业信息上报
|
||||||
|
*/
|
||||||
|
@PutMapping("/changeState")
|
||||||
|
public AjaxResult changeState(@RequestBody TbCompanyInformationReporting tbCompanyInformationReporting){
|
||||||
|
UpdateWrapper<TbCompanyInformationReporting> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReporting.Fields.id),tbCompanyInformationReporting.getId());
|
||||||
|
updateWrapper.set(StringUtils.camelToUnderline(TbCompanyInformationReporting.Fields.reportState),"0");
|
||||||
|
updateWrapper.set("update_time",DateUtils.getNowDate());
|
||||||
|
return toAjax(tbCompanyInformationReportingService.update(updateWrapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
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.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.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报详情Controller
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/details")
|
||||||
|
public class TbCompanyInformationReportingDetailsController extends BaseController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReportingDetails;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报详情Mapper接口
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TbCompanyInformationReportingDetailsMapper extends BaseMapper<TbCompanyInformationReportingDetails> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReporting;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报Mapper接口
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TbCompanyInformationReportingMapper extends BaseMapper<TbCompanyInformationReporting> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReportingDetails;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报详情Service接口
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
public interface ITbCompanyInformationReportingDetailsService extends IService<TbCompanyInformationReportingDetails> {
|
||||||
|
|
||||||
|
boolean group1FieldsEmptyByCompanyThreePreventionData(TbCompanyInformationReportingDetails data);
|
||||||
|
|
||||||
|
boolean group2FieldsEmptyBySystemPlanExercise(TbCompanyInformationReportingDetails data);
|
||||||
|
|
||||||
|
boolean group3FieldsEmptyByInspectionResult(TbCompanyInformationReportingDetails data);
|
||||||
|
|
||||||
|
List<TbCompanyInformationReportingDetails> getByCompanyInformationReportingId(Long companyInformationReportingId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReporting;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报Service接口
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
public interface ITbCompanyInformationReportingService extends IService<TbCompanyInformationReporting>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询企业信息上报
|
||||||
|
*
|
||||||
|
* @param id 企业信息上报主键
|
||||||
|
* @return 企业信息上报
|
||||||
|
*/
|
||||||
|
public TbCompanyInformationReporting selectTbCompanyInformationReportingById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息上报列表
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 企业信息上报集合
|
||||||
|
*/
|
||||||
|
public List<TbCompanyInformationReporting> selectTbCompanyInformationReportingList(TbCompanyInformationReporting tbCompanyInformationReporting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增企业信息上报
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertTbCompanyInformationReporting(TbCompanyInformationReporting tbCompanyInformationReporting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改企业信息上报
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateTbCompanyInformationReporting(TbCompanyInformationReporting tbCompanyInformationReporting);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.service.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReporting;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReportingDetails;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.mapper.TbCompanyInformationReportingDetailsMapper;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.mapper.TbCompanyInformationReportingMapper;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.service.ITbCompanyInformationReportingDetailsService;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报详情Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TbCompanyInformationReportingDetailsServiceImpl extends ServiceImpl<TbCompanyInformationReportingDetailsMapper, TbCompanyInformationReportingDetails> implements ITbCompanyInformationReportingDetailsService {
|
||||||
|
|
||||||
|
public boolean group1FieldsEmptyByCompanyThreePreventionData(TbCompanyInformationReportingDetails data) {
|
||||||
|
List<String> fields = Arrays.asList(
|
||||||
|
data.getTotalNum(),
|
||||||
|
data.getPatrolNum(),
|
||||||
|
data.getEmergencyProcessingNum(),
|
||||||
|
data.getWallLength(),
|
||||||
|
data.getSecurityDoorNum(),
|
||||||
|
data.getExplosionPreventionNum(),
|
||||||
|
data.getShieldForkNum(),
|
||||||
|
data.getPreventPunctureClothingNum(),
|
||||||
|
data.getRiotBatonsNum(),
|
||||||
|
data.getVideoSurveillanceNum(),
|
||||||
|
data.getPedestrianBrakesNum(),
|
||||||
|
data.getBuildingIntercomNum(),
|
||||||
|
data.getFaceControlNum(),
|
||||||
|
data.getElectronPulseLength(),
|
||||||
|
data.getFaceCamerasNum(),
|
||||||
|
data.getVehicleGatesNum(),
|
||||||
|
data.getFingerprintIdentificationNum(),
|
||||||
|
data.getPerimeterAlarmLength(),
|
||||||
|
data.getEmergencyAlarmFacilitiesNum()
|
||||||
|
);
|
||||||
|
|
||||||
|
for (String field : fields) {
|
||||||
|
if (field != null && !field.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean group2FieldsEmptyBySystemPlanExercise(TbCompanyInformationReportingDetails data) {
|
||||||
|
|
||||||
|
List<String> fields = Arrays.asList(
|
||||||
|
data.getEmergencyManagement(),
|
||||||
|
data.getEmergencyPlan()
|
||||||
|
);
|
||||||
|
|
||||||
|
String emergencyRehearsal = data.getEmergencyRehearsal();
|
||||||
|
for (String field : fields) {
|
||||||
|
if (field != null && !field.isEmpty()&&"0".equals(field)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return emergencyRehearsal != null && !emergencyRehearsal.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean group3FieldsEmptyByInspectionResult(TbCompanyInformationReportingDetails data) {
|
||||||
|
List<String> fields = Arrays.asList(
|
||||||
|
data.getInternalSecurityInspection(),
|
||||||
|
data.getSecurityFacilityInspection()
|
||||||
|
);
|
||||||
|
|
||||||
|
for (String field : fields) {
|
||||||
|
if (field != null && !field.isEmpty()&&"0".equals(field)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TbCompanyInformationReportingDetails> getByCompanyInformationReportingId(Long companyInformationReportingId) {
|
||||||
|
QueryWrapper<TbCompanyInformationReportingDetails> tbCompanyInformationReportingDetailsQueryWrapper = new QueryWrapper<>();
|
||||||
|
Optional.of(companyInformationReportingId)
|
||||||
|
.ifPresent(id->{
|
||||||
|
tbCompanyInformationReportingDetailsQueryWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReportingDetails.Fields.companyInformationReportingId),companyInformationReportingId);
|
||||||
|
});
|
||||||
|
return this.list(tbCompanyInformationReportingDetailsQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.ruoyi.business.companyInformationReporting.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.domain.TbCompanyInformationReporting;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.mapper.TbCompanyInformationReportingMapper;
|
||||||
|
import com.ruoyi.business.companyInformationReporting.service.ITbCompanyInformationReportingService;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业信息上报Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 张二富
|
||||||
|
* @date 2024-06-26
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class TbCompanyInformationReportingServiceImpl extends ServiceImpl<TbCompanyInformationReportingMapper, TbCompanyInformationReporting> implements ITbCompanyInformationReportingService
|
||||||
|
{
|
||||||
|
private final TbCompanyInformationReportingMapper tbCompanyInformationReportingMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息上报
|
||||||
|
*
|
||||||
|
* @param id 企业信息上报主键
|
||||||
|
* @return 企业信息上报
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TbCompanyInformationReporting selectTbCompanyInformationReportingById(Long id)
|
||||||
|
{
|
||||||
|
return tbCompanyInformationReportingMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息上报列表
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 企业信息上报
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TbCompanyInformationReporting> selectTbCompanyInformationReportingList(TbCompanyInformationReporting tbCompanyInformationReporting)
|
||||||
|
{
|
||||||
|
QueryWrapper<TbCompanyInformationReporting> tbCompanyInformationReportingQueryWrapper = new QueryWrapper<>();
|
||||||
|
Optional.ofNullable(tbCompanyInformationReporting.getReportMonth())
|
||||||
|
.ifPresent(reportMonth->{
|
||||||
|
tbCompanyInformationReportingQueryWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReporting.Fields.reportMonth),reportMonth);
|
||||||
|
});
|
||||||
|
Optional.ofNullable(tbCompanyInformationReporting.getReportState())
|
||||||
|
.ifPresent(reportState->{
|
||||||
|
tbCompanyInformationReportingQueryWrapper.eq(StringUtils.camelToUnderline(TbCompanyInformationReporting.Fields.reportState),reportState);
|
||||||
|
});
|
||||||
|
return tbCompanyInformationReportingMapper.selectList(tbCompanyInformationReportingQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增企业信息上报
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertTbCompanyInformationReporting(TbCompanyInformationReporting tbCompanyInformationReporting) {
|
||||||
|
|
||||||
|
tbCompanyInformationReporting.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return tbCompanyInformationReportingMapper.insert(tbCompanyInformationReporting);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改企业信息上报
|
||||||
|
*
|
||||||
|
* @param tbCompanyInformationReporting 企业信息上报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateTbCompanyInformationReporting(TbCompanyInformationReporting tbCompanyInformationReporting)
|
||||||
|
{
|
||||||
|
tbCompanyInformationReporting.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return tbCompanyInformationReportingMapper.updateById(tbCompanyInformationReporting);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.business.companyInformationReporting.mapper.TbCompanyInformationReportingDetailsMapper">
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.business.companyInformationReporting.mapper.TbCompanyInformationReportingMapper">
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in new issue