企业信息上报第一版

master
zef 8 months ago
parent e02d6998ae
commit 51ff871510

@ -4,17 +4,13 @@
<file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-admin/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-framework/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-framework/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-generator/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-generator/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-quartz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-quartz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/ruoyi-system/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

@ -6,6 +6,11 @@
<option name="name" value="aliyun nexus" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />

@ -8,5 +8,5 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

@ -99,14 +99,27 @@ token:
# 令牌有效期默认30分钟
expireTime: 30
# MyBatis Plus配置
mybatis-plus:
global-config:
db-config:
where-strategy: not_empty
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain,com.ruoyi.**.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml,classpath*:mapper/**/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
#mybatis:
# # 搜索指定包别名
# typeAliasesPackage: com.ruoyi.**.domain
# # 配置mapper的扫描找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# # 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:

@ -133,6 +133,19 @@
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- mybatis-plus 增强CRUD -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

@ -3,8 +3,10 @@ package com.ruoyi.common.core.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.core.domain.BaseTenantEntity;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -93,6 +95,15 @@ public class BaseController
return rspData;
}
@SuppressWarnings({"rawtypes", "unchecked"})
protected R<Map<String,Object>> getResultand(Map map) {
R rspData = new R<>();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setData(map);
return rspData;
}
/**
*
*/

@ -4,9 +4,12 @@ import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
/**
* Entity
@ -15,31 +18,46 @@ import com.fasterxml.jackson.annotation.JsonInclude;
*/
public class BaseEntity implements Serializable
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 搜索值 */
@JsonIgnore
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private String searchValue;
/** 创建者 */
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @TableField(exist = false)
@ApiModelProperty(hidden = true)
private Date createTime;
/** 更新者 */
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private Date updateTime;
/** 备注 */
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private String remark;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private Map<String, Object> params;
public String getSearchValue()

@ -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,52 @@
package com.ruoyi.framework.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(paginationInnerInterceptor());
// 乐观锁插件
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());
// 阻断插件
interceptor.addInnerInterceptor(blockAttackInnerInterceptor());
return interceptor;
}
/**
* https://baomidou.com/guide/interceptor-pagination.html
*/
public PaginationInnerInterceptor paginationInnerInterceptor() {
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
// 设置数据库类型为mysql
paginationInnerInterceptor.setDbType(DbType.MYSQL);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInnerInterceptor.setMaxLimit(-1L);
return paginationInnerInterceptor;
}
/**
* https://baomidou.com/guide/interceptor-optimistic-locker.html
*/
public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {
return new OptimisticLockerInnerInterceptor();
}
/**
* https://baomidou.com/guide/interceptor-block-attack.html
*/
public BlockAttackInnerInterceptor blockAttackInnerInterceptor() {
return new BlockAttackInnerInterceptor();
}
}

@ -22,6 +22,24 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-annotations</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>

@ -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,108 @@
package com.ruoyi.business.companyInformationReporting.domain;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
/**
* tb_company_information_reporting
*
* @author
* @date 2024-06-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "tb_company_information_reporting")
@Accessors
@FieldNameConstants
public class TbCompanyInformationReporting extends BaseEntity {
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "主键id", position = 1)
private Long id;
/** 企业id */
@Excel(name = "企业id")
@ApiModelProperty(value = "公司id", position = 5)
private Long companyId;
/** 公司名称 */
@Excel(name = "公司名称")
@TableField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "公司名称", position = 10)
private String companyName;
/** 上报月份 */
@Excel(name = "上报月份")
@TableField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "上报月份", position = 15)
private String reportMonth;
/** 上报状态0 已提交 1待提交 */
@Excel(name = "上报状态", readConverterExp = "0=,已=提交,1=待提交")
@TableField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "上报状态0 已提交 1待提交", position = 20)
private String reportState;
/** 企业三防基础数据0 是 1否 */
@Excel(name = "企业三防基础数据", readConverterExp = "0=,是=,1=否")
@ApiModelProperty(value = "企业三防基础数据0 是 1否", position = 25)
private String companyThreePreventionData;
/** 规章制度应急预案应急演练0 是 1否 */
@Excel(name = "规章制度,应急预案,应急演练", readConverterExp = "0=,是=,1=否")
@ApiModelProperty(value = "规章制度应急预案应急演练0 是 1否", position = 30)
private String systemPlanExercise;
/** 部门检查结果0 是 1否 */
@Excel(name = "部门检查结果", readConverterExp = "0=,是=,1=否")
@ApiModelProperty(value = "部门检查结果0 是 1否", position = 35)
private String inspectionResult;
/** 企业信息上报详情 */
@TableField(exist = false)
@ApiModelProperty(value = "企业信息上报详情", position = 40)
private List<TbCompanyInformationReportingDetails> details;
/** 0:不活跃,1:活跃 */
@Excel(name = "0:不活跃,1:活跃")
@ApiModelProperty(value = "0:不活跃,1:活跃", position = 45)
private String isActive;
/** 扩展字段c1 */
@Excel(name = "扩展字段c1")
@ApiModelProperty(hidden = true)
private String c1;
/** 扩展字段c2 */
@Excel(name = "扩展字段c2")
@ApiModelProperty(hidden = true)
private String c2;
/** 扩展字段c3 */
@Excel(name = "扩展字段c3")
@ApiModelProperty(hidden = true)
private String c3;
/** 扩展字段c4 */
@Excel(name = "扩展字段c4")
@ApiModelProperty(hidden = true)
private String c4;
/** 扩展字段c5 */
@Excel(name = "扩展字段c5")
@ApiModelProperty(hidden = true)
private String c5;
}

@ -0,0 +1,202 @@
package com.ruoyi.business.companyInformationReporting.domain;
import com.ruoyi.common.annotation.DataSource;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
* tb_company_information_reporting_details
*
* @author
* @date 2024-06-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "tb_company_information_reporting_details")
@Accessors(chain = true)
@FieldNameConstants
public class TbCompanyInformationReportingDetails extends BaseEntity
{
/** 主键 */
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "主键id", position = 1)
private Long id;
/** 数据上报表id */
@Excel(name = "数据上报表id")
@ApiModelProperty(value = "数据上报表id", position = 5)
private Long companyInformationReportingId;
/** 数据类型 1企业三防基础数据 2规章制度应急预案应急演练 3部门检查 */
@Excel(name = "数据类型 ", readConverterExp = "1=企业三防基础数据,2=规章制度,应急预案,应急演练,3=部门检查")
@ApiModelProperty(value = "数据类型 1企业三防基础数据 2规章制度应急预案应急演练 3部门检查", position = 10)
private String dataType;
/** 值班人员总数 */
@Excel(name = "值班人员总数")
@ApiModelProperty(value = "值班人员总数", position = 15)
private String totalNum;
/** 巡逻人员数 */
@Excel(name = "巡逻人员数")
@ApiModelProperty(value = "巡逻人员数", position = 20)
private String patrolNum;
/** 应急处理人员数 */
@Excel(name = "应急处理人员数")
@ApiModelProperty(value = "应急处理人员数", position = 25)
private String emergencyProcessingNum;
/** 企业围墙长度 */
@Excel(name = "企业围墙长度")
@ApiModelProperty(value = "企业围墙长度", position = 30)
private String wallLength;
/** 防盗门数 */
@Excel(name = "防盗门数")
@ApiModelProperty(value = "防盗门数", position = 35)
private String securityDoorNum;
/** 防爆桶数 */
@Excel(name = "防爆桶数")
@ApiModelProperty(value = "防爆桶数", position = 40)
private String explosionPreventionNum;
/** 盾牌钢叉数 */
@Excel(name = "盾牌钢叉数")
@ApiModelProperty(value = "盾牌钢叉数", position = 45)
private String shieldForkNum;
/** 防刺服数 */
@Excel(name = "防刺服数")
@ApiModelProperty(value = "防刺服数", position = 45)
private String preventPunctureClothingNum;
/** 防暴警棍数 */
@Excel(name = "防暴警棍数")
@ApiModelProperty(value = "防暴警棍数", position = 50)
private String riotBatonsNum;
/** 视频监控数 */
@Excel(name = "视频监控数")
@ApiModelProperty(value = "视频监控数", position = 55)
private String videoSurveillanceNum;
/** 人行闸机数 */
@Excel(name = "人行闸机数")
@ApiModelProperty(value = "人行闸机数", position = 60)
private String pedestrianBrakesNum;
/** 楼宇对讲数 */
@Excel(name = "楼宇对讲数")
@ApiModelProperty(value = "楼宇对讲数", position = 65)
private String buildingIntercomNum;
/** 人脸门禁数 */
@Excel(name = "人脸门禁数")
@ApiModelProperty(value = "人脸门禁数", position = 70)
private String faceControlNum;
/** 电子脉冲长度 */
@Excel(name = "电子脉冲长度")
@ApiModelProperty(value = "电子脉冲长度", position = 75)
private String electronPulseLength;
/** 人脸摄像头数 */
@Excel(name = "人脸摄像头数")
@ApiModelProperty(value = "人脸摄像头数", position = 80)
private String faceCamerasNum;
/** 车辆道闸数 */
@Excel(name = "车辆道闸数")
@ApiModelProperty(value = "车辆道闸数", position = 85)
private String vehicleGatesNum;
/** 指纹识别数 */
@Excel(name = "指纹识别数")
@ApiModelProperty(value = "指纹识别数", position = 90)
private String fingerprintIdentificationNum;
/** 周界报警长度 */
@Excel(name = "周界报警长度")
@ApiModelProperty(value = "周界报警长度", position = 95)
private String perimeterAlarmLength;
/** 紧急报警设施数 */
@Excel(name = "紧急报警设施数")
@ApiModelProperty(value = "紧急报警设施数", position = 100)
private String emergencyAlarmFacilitiesNum;
/** 企业应急管理制度 */
@Excel(name = "企业应急管理制度")
@ApiModelProperty(value = "企业应急管理制度(0是 1否)", position = 105)
private String emergencyManagement;
/** 应急预案 */
@Excel(name = "应急预案")
@ApiModelProperty(value = "应急预案 (0是 1否)", position = 110)
private String emergencyPlan;
/** 应急演练 */
@Excel(name = "应急演练")
@ApiModelProperty(value = "应急演练", position = 115)
private String emergencyRehearsal;
/** 内部治安检查 */
@Excel(name = "内部治安检查")
@ApiModelProperty(value = "内部治安检查(0是 1否)", position = 120)
private String internalSecurityInspection;
/** 治安设施检查 */
@Excel(name = "治安设施检查")
@ApiModelProperty(value = "治安设施检查(0是 1否)", position = 125)
private String securityFacilityInspection;
/** 0:不活跃,1:活跃 */
@Excel(name = "0:不活跃,1:活跃")
@ApiModelProperty(value = "0:不活跃,1:活跃", position = 45)
private String isActive;
/** 扩展字段c1 */
@Excel(name = "扩展字段c1")
@ApiModelProperty(hidden = true)
private String c1;
/** 扩展字段c2 */
@Excel(name = "扩展字段c2")
@ApiModelProperty(hidden = true)
private String c2;
/** 扩展字段c3 */
@Excel(name = "扩展字段c3")
@ApiModelProperty(hidden = true)
private String c3;
/** 扩展字段c4 */
@Excel(name = "扩展字段c4")
@ApiModelProperty(hidden = true)
private String c4;
/** 扩展字段c5 */
@Excel(name = "扩展字段c5")
@ApiModelProperty(hidden = true)
private String c5;
}

@ -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…
Cancel
Save