提交 50050838 authored 作者: wangkr's avatar wangkr

update

上级
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.91isoft</groupId>
<artifactId>gsjz</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring.boot.version>2.0.1.RELEASE</spring.boot.version>
<activiti.version>5.22.0</activiti.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<!--mvn 单继承 可以使用 spring-boot-dependencies 代替 parent-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.91isoft</groupId>
<artifactId>91isoft_spbt</artifactId>
<version>2.1.2.beta</version>
<!--<version>2.0.20_beta</version>-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
</dependencies>
<build>
<finalName>jz_gsjz</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<mainClass>org.rcisoft.ProjectApplication</mainClass>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package org.rcisoft;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Created by lcy on 17/8/9.
*/
@SpringBootApplication
@EnableTransactionManagement
@EnableAspectJAutoProxy
@EnableSwagger2
@EnableScheduling
@EnableGlobalMethodSecurity(prePostEnabled=true)
@MapperScan(basePackages = {"org.rcisoft.**.dao","org.activiti.dao"})//扫描dao 不需要@repository
public class ProjectApplication {
public static void main(String[] args) {
SpringApplication.run(ProjectApplication.class, args);
}
}
package org.rcisoft.business.excelimport.common;
import lombok.NoArgsConstructor;
import org.rcisoft.business.jzmessage.common.DictionaryMap;
@NoArgsConstructor
public enum BaseTitleHead {
// tableHead的枚举类 tableType为其对应的数据字典的type--------------!!!
TABLE_HEAD_JZ_CODE("基站号", null),
TABLE_HEAD_JZ_NAME("基站名",null),
TABLE_HEAD_JZ_EVM("基站二维码", null),
TABLE_HEAD_PROJECT_ID("项目编号", null),
TABLE_HEAD_TASK_LINE("业务线", DictionaryMap.jzYwx),
TABLE_HEAD_QY("区域", DictionaryMap.jzLocation),
TABLE_HEAD_PROJECT_STATUS("项目地址", null),
TABLE_HEAD_CURRENT_MAN("阶段负责人", null),
TABLE_HEAD_PROJECT_MAN("项目负责人", null),
TABLE_HEAD_UP_USER("上游客户", null),
TABLE_HEAD_UP_TTUSER("上游铁塔客户", DictionaryMap.jzTtUpper),
TABLE_HEAD_UP_YDUSER("上游移动客户", DictionaryMap.jzYdUpper),
TABLE_HEAD_OPERATOR("运营商", null),
TABLE_HEAD_OPERATOR_DJ("0", DictionaryMap.jzDjYys), //代缴
TABLE_HEAD_OPERATOR_YD("1", DictionaryMap.jzYdYys), //移动
TABLE_HEAD_OPERATOR_TT("2", DictionaryMap.jzTtYys), //铁塔
TABLE_HEAD_DEMAN_ID("需求号", null),
TABLE_HEAD_BUILD_WAY("建设方式", DictionaryMap.jzBuild),
TABLE_HEAD_MOBILE_RELATION("移动关系", null),
TABLE_HEAD_MOBILE_CONTACT("移动联系方式", null),
TABLE_HEAD_LONGITUDE("经度", null),
TABLE_HEAD_DIMENSION("纬度", null),
TABLE_HEAD_MAP_LINK("地图链接", null),
TABLE_HEAD_CREATE_DATE("基站创建日期(yyyy-MM-dd)", null)
;
private String tableHead;
private String tableType;
BaseTitleHead(String tableHead, String tableType) {
this.tableType = tableType;
this.tableHead = tableHead;
}
public String getStatus() {
return tableHead;
}
public void setStatus(String tableHead) {
this.tableHead = tableHead;
}
public String getTableType() {
return tableType;
}
public void setTableType(String tableType) {
this.tableType = tableType;
}
}
package org.rcisoft.business.excelimport.importMethod;
//自定义的hashCode,用于Map
public class NewPair<V,K> {
V first;
K second;
public NewPair(V key, K value) {
this.first = key;
this.second = value;
}
public boolean equals(Object o) {
if(!(o instanceof NewPair))
{
return false;
}
NewPair<V,K> pn = (NewPair<V,K>)o;
return pn.first.equals(first) && pn.second.equals(second);
}
public int hashCode() {
return first.hashCode() + second.hashCode();
}
}
package org.rcisoft.business.excelimport.tbexcelinfo.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.validation.Valid;
import org.rcisoft.business.excelimport.tbexcelinfo.entity.TbExcelInfo;
import org.rcisoft.business.excelimport.tbexcelinfo.service.TbExcelInfoService;
import java.util.List;
/**
* Created by zyj on 2019-8-3 0:55:38.
*/
@RestController
@RequestMapping("/tbexcelinfo")
public class TbExcelInfoController extends CyPaginationController<TbExcelInfo> {
@Autowired
private TbExcelInfoService tbExcelInfoServiceImpl;
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public CyResult add(@Valid TbExcelInfo tbExcelInfo, BindingResult bindingResult) {
CyPersistModel data = tbExcelInfoServiceImpl.save(tbExcelInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelInfo);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable String businessId,TbExcelInfo tbExcelInfo) {
tbExcelInfo.setBusinessId(businessId);
CyPersistModel data = tbExcelInfoServiceImpl.removeLogical(tbExcelInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="删除", notes="删除")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,TbExcelInfo tbExcelInfo) {
tbExcelInfo.setBusinessId(businessId);
CyPersistModel data = tbExcelInfoServiceImpl.remove(tbExcelInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid TbExcelInfo tbExcelInfo, BindingResult bindingResult) {
tbExcelInfo.setBusinessId(businessId);
CyPersistModel data = tbExcelInfoServiceImpl.merge(tbExcelInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelInfo);
}
@ApiOperation(value="查询单一", notes="查询单一")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelInfoServiceImpl.findById(businessId));
}
@ApiOperation(value="查询集合", notes="查询集合")
@GetMapping(value = "/queryTbExcelInfos")
public CyResult queryTbExcelInfos(TbExcelInfo tbExcelInfo) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelInfoServiceImpl.findAll(tbExcelInfo));
}
@ApiOperation(value="分页查询集合", notes="分页查询集合")
@GetMapping(value = "/queryTbExcelInfoByPagination")
public CyGridModel listByPagination(TbExcelInfo tbExcelInfo) {
tbExcelInfoServiceImpl.findAllByPagination(getPaginationUtility(), tbExcelInfo);
return getGridModelResponse();
}
}
package org.rcisoft.business.excelimport.tbexcelinfo.dao;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.core.base.CyBaseMapper;
import org.rcisoft.business.excelimport.tbexcelinfo.entity.TbExcelInfo;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with zyj on 2019-8-3 0:55:38.
*/
@Repository
public interface TbExcelInfoRepository extends CyBaseMapper<TbExcelInfo> {
/**
* 分页查询 tbExcelInfo
*
*/
@Select("<script>select * from tb_excel_info where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TbExcelInfo> queryTbExcelInfos(TbExcelInfo tbExcelInfo);
@Select("<script>select * from tb_excel_info where 1=1 "
+ "AND del_flag = '0' "
+ "AND flag = '1' " +
"AND user_id = #{userId} " +
"AND excel_status = '0'"
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TbExcelInfo> findByUserId(@Param("userId") String userId);
}
package org.rcisoft.business.excelimport.tbexcelinfo.entity;
import lombok.*;
import org.rcisoft.core.entity.CyIdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with zyj on 2019-8-3 0:55:38.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_excel_info")
public class TbExcelInfo extends CyIdEntity<TbExcelInfo> {
/**
* @desc excel的状态: 0:未完成 1:已正常完成 2: 非正常完成
* @column excel_status
* @default
*/
private String excelStatus;
/**
*
*/
private String userId;
}
package org.rcisoft.business.excelimport.tbexcelinfo.service;
import org.rcisoft.business.excelimport.tbexcelinfo.entity.TbExcelInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtil;
import java.util.List;
/**
* Created by zyj on 2019-8-3 0:55:38.
*/
public interface TbExcelInfoService {
/**
* 保存
* @param tbExcelInfo
* @return
*/
CyPersistModel save(TbExcelInfo tbExcelInfo);
/**
* 删除
* @param tbExcelInfo
* @return
*/
CyPersistModel remove(TbExcelInfo tbExcelInfo);
/**
* 逻辑删除
* @param tbExcelInfo
* @return
*/
CyPersistModel removeLogical(TbExcelInfo tbExcelInfo);
/**
* 修改
* @param tbExcelInfo
* @return
*/
CyPersistModel merge(TbExcelInfo tbExcelInfo);
/**
* 根据id查询
* @param id
* @return
*/
TbExcelInfo findById(String id);
/**
* 分页查询
* @param tbExcelInfo
* @return
*/
List<TbExcelInfo> findAllByPagination(CyPageUtil<TbExcelInfo> paginationUtility,
TbExcelInfo tbExcelInfo);
/**
* 查询list
* @param tbExcelInfo
* @return
*/
List<TbExcelInfo> findAll(TbExcelInfo tbExcelInfo);
/**
* 根据userId查询
* @param id
* @return
*/
List<TbExcelInfo> findByUserId(String id);
}
package org.rcisoft.business.excelimport.tbexcelinfo.service.impl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.business.excelimport.tbexcelinfo.dao.TbExcelInfoRepository;
import org.rcisoft.business.excelimport.tbexcelinfo.entity.TbExcelInfo;
import org.rcisoft.business.excelimport.tbexcelinfo.service.TbExcelInfoService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by zyj on 2019-8-3 0:55:38.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class TbExcelInfoServiceImpl extends CyBaseService implements TbExcelInfoService {
@Autowired
private TbExcelInfoRepository tbExcelInfoRepository;
/**
* 保存
* @param tbExcelInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel save(TbExcelInfo tbExcelInfo){
//增加操作
CyUserUtil.setCurrentPersistOperation(tbExcelInfo);
int line = tbExcelInfoRepository.insertSelective(tbExcelInfo);
this.dbInfo(CyUserUtil.getAuthenUsername()+"新增了ID为"+
tbExcelInfo.getBusinessId()+"的信息","新增");
log.info(CyUserUtil.getAuthenUsername()+"新增了ID为"+
tbExcelInfo.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 删除
* @param tbExcelInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(TbExcelInfo tbExcelInfo){
int line = tbExcelInfoRepository.deleteByPrimaryKey(tbExcelInfo.getBusinessId());
this.dbInfo(CyUserUtil.getAuthenUsername()+"删除了ID为"+
tbExcelInfo.getBusinessId()+"的信息","删除");
log.info(CyUserUtil.getAuthenUsername()+"删除了ID为"+
tbExcelInfo.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除
* @param tbExcelInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(TbExcelInfo tbExcelInfo){
CyUserUtil.setCurrentMergeOperation(tbExcelInfo);
tbExcelInfo.setDeleted();
int line = tbExcelInfoRepository.logicalDelete(tbExcelInfo);
this.dbInfo(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
tbExcelInfo.getBusinessId()+"的信息","逻辑删除");
log.info(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
tbExcelInfo.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 修改
* @param tbExcelInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(TbExcelInfo tbExcelInfo){
CyUserUtil.setCurrentMergeOperation(tbExcelInfo);
int line = tbExcelInfoRepository.updateByPrimaryKeySelective(tbExcelInfo);
this.dbInfo(CyUserUtil.getAuthenUsername()+"修改了ID为"+
tbExcelInfo.getBusinessId()+"的信息","修改");
log.info(CyUserUtil.getAuthenUsername()+"修改了ID为"+
tbExcelInfo.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 根据id查询
* @param id
* @return
*/
@Override
public TbExcelInfo findById(String id){
return tbExcelInfoRepository.selectByPrimaryKey(id);
}
/**
* 分页查询
* @param tbExcelInfo
* @return
*/
@Override
public List<TbExcelInfo> findAllByPagination(CyPageUtil<TbExcelInfo> paginationUtility,
TbExcelInfo tbExcelInfo){
tbExcelInfo.setNormal();
return tbExcelInfoRepository.queryTbExcelInfos(tbExcelInfo);
}
/**
* 查询list
* @param tbExcelInfo
* @return
*/
@Override
public List<TbExcelInfo> findAll(TbExcelInfo tbExcelInfo){
tbExcelInfo.setNormal();
return tbExcelInfoRepository.queryTbExcelInfos(tbExcelInfo);
}
/**
* 根据userId查询表中是否有未完成的任务
* @param userId
* @return
*/
@Override
public List<TbExcelInfo> findByUserId(String userId) {
return tbExcelInfoRepository.findByUserId(userId);
}
}
package org.rcisoft.business.excelimport.tbexceljzmessageimport.controller;
/*固定导入*/
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javafx.util.Pair;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.excelimport.importMethod.PoiMethod;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.validation.Valid;
import javax.websocket.server.PathParam;
import org.rcisoft.business.excelimport.tbexceljzmessageimport.entity.TbExcelJzMessageImport;
import org.rcisoft.business.excelimport.tbexceljzmessageimport.service.TbExcelJzMessageImportService;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by zyj on 2019-8-3 0:55:39.
*/
@RestController
@Slf4j
@RequestMapping("/tbexceljzmessageimport")
public class TbExcelJzMessageImportController extends CyPaginationController<TbExcelJzMessageImport> {
@Autowired
private TbExcelJzMessageImportService tbExcelJzMessageImportServiceImpl;
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public CyResult add(@Valid TbExcelJzMessageImport tbExcelJzMessageImport, BindingResult bindingResult) {
CyPersistModel data = tbExcelJzMessageImportServiceImpl.save(tbExcelJzMessageImport);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelJzMessageImport);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable String businessId,TbExcelJzMessageImport tbExcelJzMessageImport) {
tbExcelJzMessageImport.setBusinessId(businessId);
CyPersistModel data = tbExcelJzMessageImportServiceImpl.removeLogical(tbExcelJzMessageImport);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="删除", notes="删除")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,TbExcelJzMessageImport tbExcelJzMessageImport) {
tbExcelJzMessageImport.setBusinessId(businessId);
CyPersistModel data = tbExcelJzMessageImportServiceImpl.remove(tbExcelJzMessageImport);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid TbExcelJzMessageImport tbExcelJzMessageImport, BindingResult bindingResult) {
tbExcelJzMessageImport.setBusinessId(businessId);
CyPersistModel data = tbExcelJzMessageImportServiceImpl.merge(tbExcelJzMessageImport);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelJzMessageImport);
}
@ApiOperation(value="查询单一", notes="查询单一")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelJzMessageImportServiceImpl.findById(businessId));
}
@ApiOperation(value="查询集合", notes="查询集合")
@GetMapping(value = "/queryTbExcelJzMessageImports")
public CyResult queryTbExcelJzMessageImports(TbExcelJzMessageImport tbExcelJzMessageImport) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
tbExcelJzMessageImportServiceImpl.findAll(tbExcelJzMessageImport));
}
@ApiOperation(value="分页查询集合", notes="分页查询集合")
@GetMapping(value = "/queryTbExcelJzMessageImportByPagination")
public CyGridModel listByPagination(TbExcelJzMessageImport tbExcelJzMessageImport) {
tbExcelJzMessageImportServiceImpl.findAllByPagination(getPaginationUtility(), tbExcelJzMessageImport);
return getGridModelResponse();
}
//excel导入的要求: 字间不能有空格!!!!! 前后空格已用 String.trim() 删除
@ApiOperation(value="导入Excel", notes="导入Excel")
@PostMapping(value = "/importExcel")
//file 为前台不必传的数据, excelId, excel excelType excelList 为必传字段 若没有数据请传 ""
public CyResult importExcel(@RequestParam(value = "file", required = false) MultipartFile file, @RequestParam("type") String excelType, @RequestParam("excelId") String excelId, @RequestParam("excelList") String excelList) {
//将json字符串转换为list------------------------------------------------
//Map的value不能为String, 因为含有BigDecimal的字段,(String)BigDecimal不能强转!!!!!!
List<Map<String, Object>> parseObject = new ArrayList<>();
if (!"".equals(excelList)) {
parseObject = (List<Map<String, Object>>) JSON.parseObject(excelList,List.class);
}
else {
parseObject = null;
}
//----------------------------------------------------------------------
Pair<List<TbExcelJzMessageImport>, List<Pair<Integer, Integer>>> result = tbExcelJzMessageImportServiceImpl.importExcel(file, excelType, excelId, parseObject);
//最终要传的东西,若表头错误则传null, 若完全成功则 result.getKey()为null,若部分成功则result.getKey()有数据
Pair<List<TbExcelJzMessageImport>, String> ans = null;
if (result == null) {
ans = null;
} else if(result.getKey() == null){
return CyResultGenUtil.builder(new CyPersistModel(0),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
ans);
} else {
ans = new Pair<List<TbExcelJzMessageImport>, String> (result.getKey(), excelType);
}
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
ans);
}
}
package org.rcisoft.business.excelimport.tbexceljzmessageimport.dao;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.jzmessage.entity.JzMessage;
import org.rcisoft.core.base.CyBaseMapper;
import org.rcisoft.business.excelimport.tbexceljzmessageimport.entity.TbExcelJzMessageImport;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with zyj on 2019-8-3 0:55:39.
*/
@Repository
public interface TbExcelJzMessageImportRepository extends CyBaseMapper<TbExcelJzMessageImport> {
/**
* 分页查询 tbExcelJzMessageImport
*
*/
@Select("<script>select * from tb_excel_jz_message_import where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TbExcelJzMessageImport> queryTbExcelJzMessageImports(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 批量插入信息
*/
/**
* 批量插入信息
*/
@Insert("<script> insert into tb_excel_jz_message_import (business_id, " +
"create_by, " +
"create_date, " +
"update_by, " +
"update_date, " +
"del_flag, " +
"flag, " +
"remarks, " +
"jz_code, " +
"jz_name, " +
"jz_ewm, " +
"project_code, " +
"business_line, " +
"jz_yys, " +
"jz_qy, " +
"project_address, " +
"jz_pro_state, " +
"jz_state, " +
"jz_type, " +
"jz_create_date, " +
"jz_init_user, " +
"jz_init_dept, " +
"jz_cur_user, " +
"jz_cur_dept, " +
"jz_up_custom, " +
"jz_require, " +
"jz_construct, " +
"jz_mobile_name, " +
"jz_mobile_phone, " +
"jz_longitude, " +
"jz_latitude, " +
"jz_version, " +
"jz_xgid, " +
"jz_jd_date, " +
"jz_jd_waring, " +
"jz_prospectlist_name, " +
"jz_prospectlist_path, " +
"jz_designdrawing_name, " +
"jz_designdrawing_path, " +
"jz_elementlist_name, " +
"jz_elementlist_path, " +
"jz_outboundlist_name, " +
"jz_outboundlist_path, " +
"jz_operatoracceptlist_name, " +
"jz_operatoracceptlist_path, " +
"jz_routedrawing_name, " +
"jz_routedrawing_path, " +
"jz_completedacceptlist_name, " +
"jz_completedacceptlist_path, " +
"jz_uppermachineroomplace, " +
"jz_ne_id, " +
"jz_opendrawing_name, " +
"jz_opendrawing_path, " +
"jz_propertycode, " +
"jz_isconnectwithowner, " +
"jz_propertyname, " +
"jz_ownercontactinfo, " +
"jz_budgetofelectic_name, " +
"jz_budgetofelectic_path, " +
"jz_matterlist_name, " +
"jz_matterlist_path, " +
"jz_openrepory_name, " +
"jz_openrepory_path, " +
"jz_constructprocept_name, " +
"jz_constructprocept_path, " +
"jz_completedreport_name,"+
"jz_completedreport_path,"+
"jz_completedphoto_name,"+
"jz_completedphoto_path,"+
"jz_rentdrawing_name, " +
"jz_rentdrawing_path, " +
"jz_project_id, " +
"jz_project_owner, " +
"jz_ewm_drawing, " +
"jz_mobile_relation, " +
"jz_map_link, " +
"excel_id ) values " +
"<foreach collection =\"jzMessageList\" item=\"item\" separator=\",\" > " +
"(" +
"#{item.businessId}, " +
"#{item.createBy}, " +
"#{item.createDate}, " +
"#{item.updateBy}, " +
"#{item.updateDate}, " +
"#{item.delFlag}, " +
"#{item.flag}, " +
"#{item.remarks}, " +
"#{item.jzCode}, " +
"#{item.jzName}, " +
"#{item.jzEwm}, " +
"#{item.projectCode}, " +
"#{item.businessLine}, " +
"#{item.jzYys}, " +
"#{item.jzQy}, " +
"#{item.projectAddress}, " +
"#{item.jzProState}, " +
"#{item.jzState}, " +
"#{item.jzType}, " +
"#{item.jzCreateDate}, " +
"#{item.jzInitUser}, " +
"#{item.jzInitDept}, " +
"#{item.jzCurUser}, " +
"#{item.jzCurDept}, " +
"#{item.jzUpCustom}, " +
"#{item.jzRequire}, " +
"#{item.jzConstruct}, " +
"#{item.jzMobileName}, " +
"#{item.jzMobilePhone}, " +
"#{item.jzLongitude}, " +
"#{item.jzLatitude}, " +
"#{item.jzVersion}, " +
"#{item.jzXgid}, " +
"#{item.jzJdDate}, " +
"#{item.jzJdWaring}, " +
"#{item.jzProspectlistName}, " +
"#{item.jzProspectlistPath}, " +
"#{item.jzDesigndrawingName}, " +
"#{item.jzDesigndrawingPath}, " +
"#{item.jzElementlistName}, " +
"#{item.jzElementlistPath}, " +
"#{item.jzOutboundlistName}, " +
"#{item.jzOutboundlistPath}, " +
"#{item.jzOperatoracceptlistName}, " +
"#{item.jzOperatoracceptlistPath}, " +
"#{item.jzRoutedrawingName}, " +
"#{item.jzRoutedrawingPath}, " +
"#{item.jzCompletedacceptlistName}, " +
"#{item.jzCompletedacceptlistPath}, " +
"#{item.jzUppermachineroomplace}, " +
"#{item.jzNeId}, " +
"#{item.jzOpendrawingName}, " +
"#{item.jzOpendrawingPath}, " +
"#{item.jzPropertycode}, " +
"#{item.jzIsconnectwithowner}, " +
"#{item.jzPropertyname}, " +
"#{item.jzOwnercontactinfo}, " +
"#{item.jzBudgetofelecticName}, " +
"#{item.jzBudgetofelecticPath}, " +
"#{item.jzMatterlistName}, " +
"#{item.jzMatterlistPath}, " +
"#{item.jzOpenreporyName}, " +
"#{item.jzOpenreporyPath}, " +
"#{item.jzConstructproceptName}, " +
"#{item.jzConstructproceptPath}, " +
"#{item.jzCompletedreportName}, " +
"#{item.jzCompletedreportPath}, " +
"#{item.jzCompletedphotoName}, " +
"#{item.jzCompletedphotoPath}, " +
"#{item.jzRentdrawingName}, " +
"#{item.jzRentdrawingPath}, " +
"#{item.jzProjectId}, " +
"#{item.jzProjectOwner}, " +
"#{item.jzEwmDrawing}, " +
"#{item.jzMobileRelation}, " +
"#{item.jzMapLink},"+
"#{item.excelId}" +
")" +
"</foreach>" +
"</script>")
@ResultMap(value = "BaseResultMap" )
int batchInsert(@Param("jzMessageList") List<TbExcelJzMessageImport> jzMessageList);
/**
* 联表查询完成的任务
*/
@Select("<script>select tejmi.* from tb_excel_jz_message_import AS tejmi " +
"JOIN tb_excel_info AS tei " +
"ON tei.business_id = tejmi.excel_id " +
"where 1=1 " +
"AND tei.excel_status = '0' " +
"AND tei.user_id = #{userId} "
+ "<if test=\"item.delFlag !=null and item.delFlag != '' \">and tejmi.del_flag = #{item.delFlag} and tei.del_flag = #{item.delFlag} </if> "
+ "<if test=\"item.flag !=null and item.flag != '' \">and tejmi.flag = #{item.flag} and tei.flag = #{item.flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMapJzMessage" )
List<JzMessage> queryCompelteTask(@Param("item") TbExcelJzMessageImport tbExcelJzMessageImport, @Param("userId") String userId);
/**
* 通过项目编号去查询
*/
@Select("<script> select * from tb_excel_jz_message_import where " +
"project_code = #{projectCode} and excel_id = #{excelId} "+
"</script>")
@ResultMap(value = "BaseResultMap")
TbExcelJzMessageImport queryProjectCodeExcel(@Param("projectCode") String projectCode, @Param("excelId") String excelId);
}
package org.rcisoft.business.excelimport.tbexceljzmessageimport.service;
import javafx.util.Pair;
import org.rcisoft.business.excelimport.tbexceljzmessageimport.entity.TbExcelJzMessageImport;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtil;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* Created by zyj on 2019-8-3 0:55:39.
*/
public interface TbExcelJzMessageImportService {
/**
* 保存
* @param tbExcelJzMessageImport
* @return
*/
CyPersistModel save(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 删除
* @param tbExcelJzMessageImport
* @return
*/
CyPersistModel remove(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 逻辑删除
* @param tbExcelJzMessageImport
* @return
*/
CyPersistModel removeLogical(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 修改
* @param tbExcelJzMessageImport
* @return
*/
CyPersistModel merge(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 根据id查询
* @param id
* @return
*/
TbExcelJzMessageImport findById(String id);
/**
* 分页查询
* @param tbExcelJzMessageImport
* @return
*/
List<TbExcelJzMessageImport> findAllByPagination(CyPageUtil<TbExcelJzMessageImport> paginationUtility,
TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 查询list
* @param tbExcelJzMessageImport
* @return
*/
List<TbExcelJzMessageImport> findAll(TbExcelJzMessageImport tbExcelJzMessageImport);
/**
* 导入excel
* @param file
* @param excelType
* @return
*/
Pair<List<TbExcelJzMessageImport>, List<Pair<Integer, Integer>>> importExcel(MultipartFile file, String excelType, String excelId, List<Map<String, Object> > excelList);
/**
* 批量查入
* @param tbExcelJzMessageImports
* @return
*/
CyPersistModel batchSave(List<TbExcelJzMessageImport> tbExcelJzMessageImports);
}
package org.rcisoft.business.exportexclemodel.controller;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.exportexclemodel.service.impl.ExcleModelServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j
@RestController
@RequestMapping("/getexclemodel")
public class GetExcleModel {
@Autowired
ExcleModelServiceImpl excleModelService;
@ApiOperation(value="下载模板", notes="下载模板")
@GetMapping(value = "/model/{businessId:\\w+}")
public void ExcleModel(@PathVariable String businessId, HttpServletRequest request, HttpServletResponse response) {
excleModelService.getExcleModel(businessId,request,response);
}
}
package org.rcisoft.business.exportexclemodel.service;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Service
public interface ExcleModelService {
void getExcleModel(String id,HttpServletRequest request, HttpServletResponse response);
}
package org.rcisoft.business.exportexclemodel.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ClassUtils;
import org.apache.ibatis.jdbc.Null;
import org.rcisoft.business.exportexclemodel.service.ExcleModelService;
import org.rcisoft.business.exportexclemodel.util.ExcelDownload;
import org.rcisoft.business.exportexclemodel.util.FindInfo;
import org.rcisoft.business.jzmessage.common.DictionaryMap;
import org.rcisoft.business.sdictionary.dao.SDictionaryRepository;
import org.rcisoft.business.sdictionary.entity.SDictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class ExcleModelServiceImpl implements ExcleModelService {
@Autowired
FindInfo findInfo;
@Override
public void getExcleModel(String id,HttpServletRequest request, HttpServletResponse response){//id 0 代缴 1 移动 2 铁塔
String fileName = "基站信息表.xlsx"; //模板名称
List<String[]> handers = new ArrayList();
String[] h1 ={"基站号","基站名","运营商","基站二维码","项目编号","业务线","区域","项目地址","阶段负责人","项目负责人","基站创建日期(yyyy-MM-dd)"};
handers.add(h1); //代缴站列标题
String[] h2 ={"上游客户","运营商","需求号","建设方式","基站名","区域","移动关系","移动联系方式","经度","纬度","阶段负责人","项目负责人","基站创建日期(yyyy-MM-dd)"};
handers.add(h2); //移动列标题
String[] h3 ={"上游客户","运营商","需求号","建设方式","基站名","区域","经度","纬度","阶段负责人","项目负责人","基站创建日期(yyyy-MM-dd)"};
handers.add(h3); //自建站铁塔列标题
List<String[]> downData ;//下拉框数据
downData = findInfo.getInfo(id);//查询数据字典获得下拉框的值
int Iid = Integer.valueOf(id);//前台返回0,1,2分别为代缴,移动,铁塔
List<String[]> downRows = new ArrayList();
String[] h4 ={"2","5","6"}; //下拉的列序号数组(序号从0开始)
String[] h5 ={"0","1","3","5"}; //下拉的列序号数组(序号从0开始)
downRows.add(h4);
downRows.add(h5);
downRows.add(h5);
//下面是是网上的代码
ExcelDownload.getExcelTemplate(fileName, handers.get(Iid), downData, downRows.get(Iid), request, response);
}
}
package org.rcisoft.business.exportexclemodel.util;
import org.rcisoft.business.sdictionary.entity.SDictionary;
import org.rcisoft.business.sdictionary.service.SDictionaryService;
import org.rcisoft.common.ResultServiceExceptionEnums;
import org.rcisoft.core.exception.CyServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class FindInfo {
@Autowired
SDictionaryService sDictionaryServiceImpl;
private String[] ListToString(List<SDictionary> infoList) {
String[] str = new String[infoList.size()];
int i = 0;
for(i = 0;i<infoList.size();i ++){
str[i] = infoList.get(i).getName();
}
return str;
}
public List<String[]> getInfo (String id){
List<String[]> downData = new ArrayList();
SDictionary sDictionary = new SDictionary();
sDictionary.setNormal();
if(id.equals("0")){//代缴
//代缴运营商 可优化
List<SDictionary> ysName = sDictionaryServiceImpl.selectDjYsByType(sDictionary);//代缴运营商
if(ysName.isEmpty()){//非空判断
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(ysName));
// 业务线 可优化
List<SDictionary> ywxName = sDictionaryServiceImpl.selectYWXByType(sDictionary);//业务线
if(ywxName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(ywxName));
List<SDictionary> qyName = sDictionaryServiceImpl.selectQYByType(sDictionary);//区域
if(qyName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(qyName));
}else{
if (id.equals("1")){//移动
//移动上游客户 可优化
List<SDictionary> upperName = sDictionaryServiceImpl.selectYdUpperByType(sDictionary);//上游客户
if(upperName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(upperName));
//移动运营商 可优化
List<SDictionary> ysName = sDictionaryServiceImpl.selectYdYsByType(sDictionary);//移动运营商
if(ysName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(ysName));
}
if (id.equals("2")){//铁塔
// 铁塔上游客户 可优化
List<SDictionary> upperName = sDictionaryServiceImpl.selectTtUpperByType(sDictionary);//铁塔上游客户
if(upperName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(upperName));
List<SDictionary> ysName = sDictionaryServiceImpl.selectTtYsByType(sDictionary);//铁塔运营商
if(ysName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(ysName));
}
//建设方式
List<SDictionary> buildName = sDictionaryServiceImpl.selectBuildByType(sDictionary);//建设方式(移动和铁塔的)
if(buildName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(buildName));
//区域优化
List<SDictionary> qyName = sDictionaryServiceImpl.selectQYByType(sDictionary);//区域(移动和铁塔的)
if(qyName.isEmpty()){
throw new CyServiceException(ResultServiceExceptionEnums.SDictionary_NULL_ERROR);
}
downData.add(ListToString(qyName));
}
return downData;
}
}
package org.rcisoft.business.hijzmessage.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.validation.Valid;
import org.rcisoft.business.hijzmessage.entity.HiJzMessage;
import org.rcisoft.business.hijzmessage.service.HiJzMessageService;
import java.util.List;
/**
* Created by lpy on 2019-7-26 15:45:51.
*/
@RestController
@RequestMapping("/hijzmessage")
public class HiJzMessageController extends CyPaginationController<HiJzMessage> {
@Autowired
private HiJzMessageService hiJzMessageServiceImpl;
@ApiOperation(value="添加基站历史信息表", notes="添加基站历史信息表")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public CyResult add(@Valid HiJzMessage hiJzMessage, BindingResult bindingResult) {
CyPersistModel data = hiJzMessageServiceImpl.save(hiJzMessage);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
hiJzMessage);
}
@ApiOperation(value="逻辑删除基站历史信息表", notes="逻辑删除基站历史信息表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable String businessId,HiJzMessage hiJzMessage) {
hiJzMessage.setBusinessId(businessId);
CyPersistModel data = hiJzMessageServiceImpl.removeLogical(hiJzMessage);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="删除基站历史信息表", notes="删除基站历史信息表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,HiJzMessage hiJzMessage) {
hiJzMessage.setBusinessId(businessId);
CyPersistModel data = hiJzMessageServiceImpl.remove(hiJzMessage);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="修改基站历史信息表", notes="修改基站历史信息表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid HiJzMessage hiJzMessage, BindingResult bindingResult) {
hiJzMessage.setBusinessId(businessId);
CyPersistModel data = hiJzMessageServiceImpl.merge(hiJzMessage);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
hiJzMessage);
}
@ApiOperation(value="查询单一基站历史信息表", notes="查询单一基站历史信息表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
hiJzMessageServiceImpl.findById(businessId));
}
@ApiOperation(value="查询基站历史信息表集合", notes="查询基站历史信息表集合")
@GetMapping(value = "/queryHiJzMessages")
public CyResult queryHiJzMessages(HiJzMessage hiJzMessage) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
hiJzMessageServiceImpl.findAll(hiJzMessage));
}
@ApiOperation(value="分页查询基站历史信息表集合", notes="分页查询基站历史信息表集合")
@GetMapping(value = "/queryHiJzMessageByPagination")
public CyGridModel listByPagination(HiJzMessage hiJzMessage) {
hiJzMessageServiceImpl.findAllByPagination(getPaginationUtility(), hiJzMessage);
return getGridModelResponse();
}
}
package org.rcisoft.business.hijzmessage.dao;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.hijzmessage.entity.HiJzMessage;
import org.rcisoft.core.base.CyBaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* Created with lpy on 2019-7-26 15:45:51.
*/
@Repository
public interface HiJzMessageRepository extends CyBaseMapper<HiJzMessage> {
/**
* 分页查询 hiJzMessage
*
*/
@Select("<script>select * from hi_jz_message where 1=1 "
+ "<if test= \"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test= \"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<HiJzMessage> queryHiJzMessages(HiJzMessage hiJzMessage);
/**
* 批量插入信息
*/
@Insert("<script> insert into hi_jz_message " +
"(" +
"business_id, " +
"create_by, " +
"create_date, " +
"update_by, " +
"update_date, " +
"del_flag, " +
"flag, " +
"remarks, " +
"jz_code, " +
"jz_name, " +
"jz_ewm, " +
"project_code, " +
"business_line, " +
"jz_yys, " +
"jz_qy, " +
"project_address, " +
"jz_pro_state, " +
"jz_state, " +
"jz_type, " +
"jz_create_date, " +
"jz_init_user, " +
"jz_init_dept, " +
"jz_cur_user, " +
"jz_cur_dept, " +
"jz_up_custom, " +
"jz_require, " +
"jz_construct, " +
"jz_mobile_name, " +
"jz_mobile_phone, " +
"jz_longitude, " +
"jz_latitude, " +
"jz_version, " +
"jz_xgid, " +
"jz_jd_date, " +
"jz_jd_waring, " +
"jz_prospectlist_name, " +
"jz_prospectlist_path, " +
"jz_designdrawing_name, " +
"jz_designdrawing_path, " +
"jz_elementlist_name, " +
"jz_elementlist_path, " +
"jz_outboundlist_name, " +
"jz_outboundlist_path, " +
"jz_operatoracceptlist_name, " +
"jz_operatoracceptlist_path, " +
"jz_routedrawing_name, " +
"jz_routedrawing_path, " +
"jz_completedacceptlist_name, " +
"jz_completedacceptlist_path, " +
"jz_uppermachineroomplace, " +
"jz_ne_id, " +
"jz_opendrawing_name, " +
"jz_opendrawing_path, " +
"jz_propertycode, " +
"jz_isconnectwithowner, " +
"jz_propertyname, " +
"jz_ownercontactinfo, " +
"jz_budgetofelectic_name, " +
"jz_budgetofelectic_path, " +
"jz_matterlist_name, " +
"jz_matterlist_path, " +
"jz_openrepory_name, " +
"jz_openrepory_path, " +
"jz_constructprocept_name, " +
"jz_constructprocept_path, " +
"jz_completedreport_name,"+
"jz_completedreport_path,"+
"jz_completedphoto_name,"+
"jz_completedphoto_path,"+
"jz_rentdrawing_name, " +
"jz_rentdrawing_path, " +
"jz_project_id, " +
"jz_project_owner, " +
"jz_ewm_drawing, " +
"jz_wait_reason, " +
"jz_id, " +
"jz_mobile_relation, " +
"jz_map_link) " +
"values " +
"<foreach collection =\"hiJzMessageList\" item=\"item\" separator=\",\" >" +
"(#{item.businessId}, " +
"#{item.createBy}, " +
"#{item.createDate}, " +
"#{item.updateBy}, " +
"#{item.updateDate}, " +
"#{item.delFlag}, " +
"#{item.flag}, " +
"#{item.remarks}, " +
"#{item.jzCode}, " +
"#{item.jzName}, " +
"#{item.jzEwm}, " +
"#{item.projectCode}, " +
"#{item.businessLine}, " +
"#{item.jzYys}, " +
"#{item.jzQy}, " +
"#{item.projectAddress}, " +
"#{item.jzProState}, " +
"#{item.jzState}, " +
"#{item.jzType}, " +
"#{item.jzCreateDate}, " +
"#{item.jzInitUser}, " +
"#{item.jzInitDept}, " +
"#{item.jzCurUser}, " +
"#{item.jzCurDept}, " +
"#{item.jzUpCustom}, " +
"#{item.jzRequire}, " +
"#{item.jzConstruct}, " +
"#{item.jzMobileName}, " +
"#{item.jzMobilePhone}, " +
"#{item.jzLongitude}, " +
"#{item.jzLatitude}, " +
"#{item.jzVersion}, " +
"#{item.jzXgid}, " +
"#{item.jzJdDate}, " +
"#{item.jzJdWaring}, " +
"#{item.jzProspectlistName}, " +
"#{item.jzProspectlistPath}, " +
"#{item.jzDesigndrawingName}, " +
"#{item.jzDesigndrawingPath}, " +
"#{item.jzElementlistName}, " +
"#{item.jzElementlistPath}, " +
"#{item.jzOutboundlistName}, " +
"#{item.jzOutboundlistPath}, " +
"#{item.jzOperatoracceptlistName}, " +
"#{item.jzOperatoracceptlistPath}, " +
"#{item.jzRoutedrawingName}, " +
"#{item.jzRoutedrawingPath}, " +
"#{item.jzCompletedacceptlistName}, " +
"#{item.jzCompletedacceptlistPath}, " +
"#{item.jzUppermachineroomplace}, " +
"#{item.jzNeId}, " +
"#{item.jzOpendrawingName}, " +
"#{item.jzOpendrawingPath}, " +
"#{item.jzPropertycode}, " +
"#{item.jzIsconnectwithowner}, " +
"#{item.jzPropertyname}, " +
"#{item.jzOwnercontactinfo}, " +
"#{item.jzBudgetofelecticName}, " +
"#{item.jzBudgetofelecticPath}, " +
"#{item.jzMatterlistName}, " +
"#{item.jzMatterlistPath}, " +
"#{item.jzOpenreporyName}, " +
"#{item.jzOpenreporyPath}, " +
"#{item.jzConstructproceptName}, " +
"#{item.jzConstructproceptPath}, " +
"#{item.jzCompletedreportName}, " +
"#{item.jzCompletedreportPath}, " +
"#{item.jzCompletedphotoName}, " +
"#{item.jzCompletedphotoPath}, " +
"#{item.jzRentdrawingName}, " +
"#{item.jzRentdrawingPath}, " +
"#{item.jzProjectId}, " +
"#{item.jzProjectOwner}, " +
"#{item.jzEwmDrawing}, " +
"#{item.jzWaitReason}, " +
"#{item.jzId}, " +
"#{item.jzMobileRelation}," +
"#{item.jzMapLink})</foreach>" +
"</script>")
@ResultMap(value = "BaseResultMap" )
int batchInsert(@Param("hiJzMessageList") List<HiJzMessage> hiJzMessageList);
@Select("<script>select jz.*," +
"sde1. NAME AS curDeptName, " +
"su1. NAME AS curUserName, " +
"su3. NAME AS projectOwner, " +
"sdi2. NAME AS yysName, " +
"sdi. NAME jzLocationName, " +
"sdi3. NAME AS ywxName, " +
"su4.NAME AS updateName, " +
"su5.NAME AS initUserName" +
" from hi_jz_message jz " +
"left join s_user su4 on jz.update_by = su4.BUSINESS_ID" +
" left join s_dept sde1 on jz.jz_cur_dept = sde1.BUSINESS_ID" +
" left join s_user su1 on jz.jz_cur_user = su1.BUSINESS_ID" +
" left join s_user su5 on jz.jz_init_user = su5.BUSINESS_ID" +
" left join s_user su3 on jz.jz_project_owner = su3.BUSINESS_ID" +
" left join s_dictionary sdi on jz.jz_qy = sdi.`value` and sdi.type = 'JZ_QY'" +
" left join s_dictionary sdi3 on jz.business_line = sdi3.`value` and sdi3.type = 'JZ_YWX'" +
" left join s_dictionary sdi2 on jz.jz_yys = sdi2.`value` and sdi2.type = 'JZ_YYS'" +
" where jz.jz_id = #{jzMessageId} " +
" ORDER BY jz.update_date DESC" +
"</script>")
@ResultMap(value = "BaseResultMap")
List<HiJzMessage> getHijzMessageByjzMessageId(@Param("jzMessageId") String jzMessageId);
@Select("<script>select max(jz_version) jzVersion from hi_jz_message where 1=1 " +
"<if test= \"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> " +
"<if test= \"flag !=null and flag != '' \">and flag = #{flag} </if> "+
" and jz_id = #{jzId} </script>")
Map getMaxVersionByJzId(HiJzMessage hiJzMessage);
}
package org.rcisoft.business.hijzmessage.service;
import org.rcisoft.business.hijzmessage.entity.HiJzMessage;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtil;
import java.util.List;
/**
* Created by lpy on 2019-7-26 15:45:51.
*/
public interface HiJzMessageService {
/**
* 保存 基站历史信息表
* @param hiJzMessage
* @return
*/
CyPersistModel save(HiJzMessage hiJzMessage);
/**
* 删除 基站历史信息表
* @param hiJzMessage
* @return
*/
CyPersistModel remove(HiJzMessage hiJzMessage);
/**
* 逻辑删除 基站历史信息表
* @param hiJzMessage
* @return
*/
CyPersistModel removeLogical(HiJzMessage hiJzMessage);
/**
* 修改 基站历史信息表
* @param hiJzMessage
* @return
*/
CyPersistModel merge(HiJzMessage hiJzMessage);
/**
* 根据id查询 基站历史信息表
* @param id
* @return
*/
HiJzMessage findById(String id);
/**
* 分页查询 基站历史信息表
* @param hiJzMessage
* @return
*/
List<HiJzMessage> findAllByPagination(CyPageUtil<HiJzMessage> paginationUtility,
HiJzMessage hiJzMessage);
/**
* 查询list 基站历史信息表
* @param hiJzMessage
* @return
*/
List<HiJzMessage> findAll(HiJzMessage hiJzMessage);
}
package org.rcisoft.business.hijzmessage.service.impl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.business.hijzmessage.dao.HiJzMessageRepository;
import org.rcisoft.business.hijzmessage.entity.HiJzMessage;
import org.rcisoft.business.hijzmessage.service.HiJzMessageService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by lpy on 2019-7-26 15:45:51.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class HiJzMessageServiceImpl extends CyBaseService implements HiJzMessageService {
@Autowired
private HiJzMessageRepository hiJzMessageRepository;
/**
* 保存 基站历史信息表
* @param hiJzMessage
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel save(HiJzMessage hiJzMessage){
//增加操作
CyUserUtil.setCurrentPersistOperation(hiJzMessage);
int line = hiJzMessageRepository.insertSelective(hiJzMessage);
this.dbInfo(CyUserUtil.getAuthenUsername()+"新增了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息","新增基站历史信息表");
log.info(CyUserUtil.getAuthenUsername()+"新增了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息");
return new CyPersistModel(line);
}
/**
* 删除 基站历史信息表
* @param hiJzMessage
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(HiJzMessage hiJzMessage){
int line = hiJzMessageRepository.deleteByPrimaryKey(hiJzMessage.getBusinessId());
this.dbInfo(CyUserUtil.getAuthenUsername()+"删除了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息","删除基站历史信息表");
log.info(CyUserUtil.getAuthenUsername()+"删除了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除 基站历史信息表
* @param hiJzMessage
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(HiJzMessage hiJzMessage){
CyUserUtil.setCurrentMergeOperation(hiJzMessage);
hiJzMessage.setDeleted();
int line = hiJzMessageRepository.logicalDelete(hiJzMessage);
this.dbInfo(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息","逻辑删除基站历史信息表");
log.info(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息");
return new CyPersistModel(line);
}
/**
* 修改 基站历史信息表
* @param hiJzMessage
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(HiJzMessage hiJzMessage){
CyUserUtil.setCurrentMergeOperation(hiJzMessage);
int line = hiJzMessageRepository.updateByPrimaryKeySelective(hiJzMessage);
this.dbInfo(CyUserUtil.getAuthenUsername()+"修改了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息","修改基站历史信息表");
log.info(CyUserUtil.getAuthenUsername()+"修改了ID为"+
hiJzMessage.getBusinessId()+"的基站历史信息表信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 基站历史信息表
* @param id
* @return
*/
@Override
public HiJzMessage findById(String id){
return hiJzMessageRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 基站历史信息表
* @param hiJzMessage
* @return
*/
@Override
public List<HiJzMessage> findAllByPagination(CyPageUtil<HiJzMessage> paginationUtility,
HiJzMessage hiJzMessage){
hiJzMessage.setNormal();
return hiJzMessageRepository.queryHiJzMessages(hiJzMessage);
}
/**
* 查询list 基站历史信息表
* @param hiJzMessage
* @return
*/
@Override
public List<HiJzMessage> findAll(HiJzMessage hiJzMessage){
hiJzMessage.setNormal();
return hiJzMessageRepository.queryHiJzMessages(hiJzMessage);
}
}
package org.rcisoft.business.jzmessage.common;
//数据字典表type字段映射
public class DictionaryMap {
public static final String jzLocation = "JZ_QY";//区域
public static final String jzTtYys = "JZ_TT_YYS";//铁塔运营商
public static final String jzDjYys = "JZ_DJ_YYS";//代缴运营商
public static final String jzYdYys = "JZ_YD_YYS";//移动运营商
public static final String jzBuild = "JZ_BUILD";//建设方式
public static final String jzYwx = "JZ_YWX";//业务线
public static final String jzTtUpper = "JZ_TT_UPPER";//铁塔上游客户
public static final String jzYdUpper = "JZ_YD_UPPER";//移动上游客户
public static final String jzYwy = "JZ_YWY";//业务员
public static final String jzDeadline = "JZ_DEADLINE";//基站状态
public static final String deptForShort = "DEPT_FOR_SHORT";//分公司
public static final String hgb = "HGB";//合规部
public static final String whb = "WHB";//维护部
public static final String jzMapDept = "JZ_MAP_DEPT";//部门映射
public static final String jzMapRole = "JZ_MAP_ROLE";//角色映射
public static final String jzZl = "JZ_ZL";//助理
public static final String admin = "ADMIN";//管理员
public static final String maintManager = "MAINTMANAGER";//维护部二级经理
public static final String importAdmin = "IMPORTADMIN";//导入管理员
public static final String exportAdmin = "EXPORTADMIN";//导出管理员
public static final String manager = "MANAGER";//三级经理
public static final String deptForGswl = "DEPT_FOR_GSWL";//广厦网络下的二级部门
public static final String rallyManager = "RALLYMANAGER";//多部门查看
public static final String companyDept = "COMPANY_DEPT";//此部门可以查看本公司所有部门基站信息
public static final String kingDeeUserMap = "KINGDEE_USER_MAP";
public static final String kingDeeDeptMap = "KINGDEE_DEPT_MAP";
}
package org.rcisoft.business.jzmessage.common;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.jzmessage.entity.JzMessage;
import org.rcisoft.business.sdictionary.service.impl.SDictionaryServiceImpl;
import org.rcisoft.business.userwarning.dao.UserWarningRepository;
import org.rcisoft.business.userwarning.entity.UserWarning;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
@Component
public class OptimizeQuery {
@Autowired
private UserWarningRepository userWarningRepository;
/**
* 解析数据字典 区域 运营商 上游客户 建设方式 基站类型 预警状态
* @param jzMessage
* @param export
*/
public void helpOptimizeQuery(List<JzMessage> jzMessage,String export){
for (JzMessage message : jzMessage) {
//区域
for (String qy : SDictionaryServiceImpl.optimizeJzQy.keySet()) {
if (qy.equals(message.getJzQy())){
message.setJzLocationName(SDictionaryServiceImpl.optimizeJzQy.get(qy));
}
}
//业务线
for (String ywx : SDictionaryServiceImpl.optimizeJzYwx.keySet()) {
if(ywx.equals(message.getBusinessLine())){
message.setYwxName(SDictionaryServiceImpl.optimizeJzYwx.get(ywx));
}
}
//建设方式
for (String build : SDictionaryServiceImpl.optimizeJzBuild.keySet()) {
if (build.equals(message.getJzConstruct())){
message.setJzBuildName(SDictionaryServiceImpl.optimizeJzBuild.get(build));
}
}
//代缴
if (message.getJzType().equals("0")){
message.setTypeName(TypeEnum.DJ.getname()); //设置基站名称
//代缴运营商
for (String djYys : SDictionaryServiceImpl.optimizeJzDjYys.keySet()) {
if (djYys.equals(message.getJzYys())){
message.setYysName(SDictionaryServiceImpl.optimizeJzDjYys.get(djYys));
}
}
}
//移动
else if (message.getJzType().equals("1")){
message.setTypeName(TypeEnum.YD.getname());
for (String ydYys : SDictionaryServiceImpl.optimizeJzYdYys.keySet()) {
if (ydYys.equals(message.getJzYys())){
message.setYysName(SDictionaryServiceImpl.optimizeJzYdYys.get(ydYys));
}
}
for (String ydUpper : SDictionaryServiceImpl.optimizeJzYdUpper.keySet()) {
if (ydUpper.equals(message.getJzUpCustom())){
message.setUpperName(SDictionaryServiceImpl.optimizeJzYdUpper.get(ydUpper));
}
}
}
//铁塔
else if (message.getJzType().equals("2")){
message.setTypeName(TypeEnum.TT.getname());
for (String ttYys : SDictionaryServiceImpl.optimizeJzTtYys.keySet()) {
if (ttYys.equals(message.getJzYys())){
message.setYysName(SDictionaryServiceImpl.optimizeJzTtYys.get(ttYys));
}
}
for (String ttUpper : SDictionaryServiceImpl.optimizeJzTtUpper.keySet()) {
if (ttUpper.equals(message.getJzUpCustom())){
message.setUpperName(SDictionaryServiceImpl.optimizeJzTtUpper.get(ttUpper));
}
}
}
//判断是否是导入还是查询全部
if (export.equals("0")){
isWaring(message);
}
}
}
public void isWaring(JzMessage message){
//判断是否为预警状态
UserWarning userWarning = new UserWarning();
userWarning.setNormal();
userWarning.setJzId(message.getBusinessId());
userWarning.setUserId(message.getJzCurUser());
List<UserWarning> userWarnings = userWarningRepository.queryIsWaring(userWarning);
//如果预警表为空,说明该基站未预警
if (CollectionUtils.isEmpty(userWarnings)){
message.setIsWaring("0");
}else{
message.setIsWaring("1");
}
for (UserWarning warning : userWarnings) {
message.setUwType(warning.getType());
message.setJzStatus(warning.getJzStatus());
}
}
}
package org.rcisoft.business.jzmessage.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@Data
@AllArgsConstructor
public class ProcessMid {
private String processId;//流程实例id
private String jzMessageId;//基站信息id
private String typeTemplate;//模板类型
private String type;//基站状态
}
package org.rcisoft.business.jzmessage.common;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.jzmessage.entity.JzMessage;
import org.rcisoft.business.jzmessage.util.FindSon;
import org.rcisoft.business.sdictionary.service.impl.SDictionaryServiceImpl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.sys.dept.entity.SysDept;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import static org.rcisoft.business.sdictionary.service.impl.SDictionaryServiceImpl.*;
//关联表分页
@Slf4j
@Component
public class Relevance {
public JzMessage helpPagination(JzMessage jzMessage,List<SysDept> deptList){
Boolean isNotSpecialRole = true;//不是特殊角色
Boolean isNotSpecialDept = true;//不是特殊部门
Boolean isSalesman = false;//是不是业务员
List<String> deptIdList = new ArrayList<>();
String roleStr = CyUserUtil.getAuthenRoleStr();//获取当前登录人角色
String userId = CyUserUtil.getAuthenBusinessId();//获取当前登录人id
String userCode = CyUserUtil.getAuthenBusinessId();//获取当前登录人id
HashMap<String,List<String>> crossDeptList = new HashMap<>();
String parentsId = null;
//字符数组转list
List<String> roleIdList =null;
if (roleStr!=null){
roleIdList = Arrays.asList(roleStr.split(","));
}
String deptCode = CyUserUtil.getAuthenDeptCode();//获取部门编号
String deptId = CyUserUtil.getAuthenDept();//获取部门id
for(SysDept item : deptList){ //遍历部门列表
if(item.getCode().equals(deptCode)){//查询当前部门信息
parentsId = item.getParentId();//上级部门id
break;
}
}
if (roleIdList!=null){
for (String roleId : roleIdList){//判断是不是特殊角色
if(specialRole.values().contains(roleId)){
isNotSpecialRole = false;
}
if(salesman.values().contains(roleId)){
isSalesman = true;
}
}
}
//判断是不是特殊部门
if(specialDept.values().contains(deptCode)){
isNotSpecialDept = false;
}
//解析当前业务员姓名
String curUserName = jzMessage.getCurUserName(); //获取当前业务员姓名字符串
String[] names = new String[5];
if (curUserName != null && curUserName != ""){
String[] temp = curUserName.split(" ");
//只取前五个字符串
if (temp.length>5){
for (int i = 0; i <5; i++){
names[i] = temp[i];
}
}else {
names = temp;
}
jzMessage.setCurUserNames(names);
}
//解析当前选择基站id
String tempBusinessIds = jzMessage.getBusinessId();
if (tempBusinessIds!=null){
jzMessage.setBusinessIds(tempBusinessIds.split(","));
}
jzMessage = tranFiledFront(jzMessage);
//设置数据字典jzQy关联
jzMessage.setJzLocation(DictionaryMap.jzLocation);
jzMessage.setNormal();
//部门在数据字典companyDept中,可以查看本公司所有数据,合规部可以查看所属部门下的所有部门数据
if (companyDept.containsValue(deptId)){
//查找出当前登录人所属(部门)分公司
String companyId = FindSon.FindCompany(deptId,deptId,deptList);
if (SDictionaryServiceImpl.deptForGswl.containsValue(companyId)){
for (String s : SDictionaryServiceImpl.deptForGswl.keySet()) {
deptIdList.addAll(FindSon.FindSons(SDictionaryServiceImpl.deptForGswl.get(s), deptList));
deptIdList.add(SDictionaryServiceImpl.deptForGswl.get(s));
}
}else{
deptIdList.addAll(FindSon.FindSons(companyId,deptList));
//放入当前部门
deptIdList.add(companyId);
}
}
//如果是合规部,那么就可以查看其所属部门下的所有基站信息
if (hgb.containsValue(deptId)){
deptIdList.addAll(FindSon.FindSons(parentsId,deptList));
}
//数据字典取值为 (371:13,54)371为用户businessId,13,54为用户跨部门查看的部门id
//解析value
for (String value : rallyManager.values()) {
String[] v = value.split(":");
List<String> temp = Arrays.asList(v[1].split(","));
crossDeptList.put(v[0],temp);
}
for (String s : crossDeptList.keySet()) {
if (s.equals(userId)){
for (String dept : crossDeptList.get(s)) {
deptIdList.addAll(FindSon.FindSons(dept,deptList));
deptIdList.add(dept);
}
}
}
deptIdList.addAll(FindSon.FindSons(deptId,deptList));//递归查询子部门
deptIdList.add(deptId);//添加当前部门id
jzMessage.setDeptIdList(deptIdList);
jzMessage.setNotSpecialRole(isNotSpecialRole);
jzMessage.setNotSpecialDept(isNotSpecialDept);
jzMessage.setIsSalesMan(isSalesman);
return jzMessage;
}
//解析前台特殊格式数据
public JzMessage tranFiledFront(JzMessage jzMessage){
//解析当前选择运营商 运行商格式 JZ_DJ_YYS,1
String[] jzYys = new String[3];
String[] jzUpCustom = new String[3];
String[] jzState = new String[3];
if (StringUtils.isNotEmpty(jzMessage.getJzYys())){
jzYys = jzMessage.getJzYys().split(",");
jzMessage.setSDicYysType(jzYys[1]); //数据字典类型
jzMessage.setJzYys(jzYys[2]);//数据字典属性
}
//解析当前选择上游客户 JZ_YD_UPPER,1
if (StringUtils.isNotEmpty(jzMessage.getJzUpCustom())){
jzUpCustom = jzMessage.getJzUpCustom().split(",");
jzMessage.setSDicUpperType(jzUpCustom[1]); //数据字典类型
jzMessage.setJzUpCustom(jzUpCustom[2]);//数据字典属性
}
//解析基站状态 1,3 (1代表基站类型jz_type 3代表基站状态 jz_state)
if (StringUtils.isNotEmpty(jzMessage.getJzState())&&StringUtils.isEmpty(jzMessage.getJzType())){
jzState = jzMessage.getJzState().split(",");
jzMessage.setJzState(jzState[1]);
}else if(StringUtils.isNotEmpty(jzMessage.getJzType())){
List<String> listJzState = Arrays.asList(jzMessage.getJzState().split(","));
jzMessage.setListJzState(listJzState);
}
if (StringUtils.isNotEmpty(jzMessage.getJzState())&&StringUtils.isEmpty(jzMessage.getJzType())){
jzMessage.setJzType(jzState[0]);
}else if (StringUtils.isNotEmpty(jzMessage.getJzUpCustom())&&StringUtils.isEmpty(jzMessage.getJzType())){
jzMessage.setJzType(jzUpCustom[0]);//基站类型
}else if (StringUtils.isNotEmpty(jzMessage.getJzYys())&&StringUtils.isEmpty(jzMessage.getJzType())){
jzMessage.setJzType(jzYys[0]);//基站类型
}
//设置数据字典关联
return jzMessage;
}
}
package org.rcisoft.business.jzmessage.common;
import lombok.extern.slf4j.Slf4j;
import org.activiti.constants.CyWfConstants;
import org.activiti.model.CyPIAndTaskModel;
import org.activiti.service.CyWfService;
import org.rcisoft.business.jzmessage.dao.JzMessageRepository;
import org.rcisoft.business.jzmessage.entity.JzMessage;
import org.rcisoft.business.userwarning.entity.UserWarning;
import org.rcisoft.common.BaseStationStatus;
import org.rcisoft.business.userwarning.service.UserWarningService;
import org.rcisoft.common.ProcessMapBpmn;
import org.rcisoft.core.component.CyApplicationContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Slf4j
@Component
public class StartProcessHelper {
public static final String PAYMENTSTATION = "0";//0 代缴站
public static final String RAILCOM = "1";//移动
public static final String FILGHTNUMBER = "2";//铁塔
public static final String PARAM = "message";//点击信息
public static final String CHOOSE = "choose";//选择流程
//流程状态
public static final String UNCOMMITTED = "0";//未提交
public static final String APPROVALPENDING = "1";//待审批
public static final String AGREED = "2";//通过
public static final String OPPOSE = "3";//驳回
public static final String COMMITTED = "提交";
public static final String FRORNTPASS = "通过";//通过
public static final String FRONTREJECT = "驳回";//驳回
@Autowired
CyWfService cyWfServiceImpl;
@Autowired
private JzMessageRepository jzMessageRepository;
UserWarningService userWarningServiceImpl;
public CyPIAndTaskModel BaseStationStart(JzMessage jzMessage) {
jzMessage.setNormal();
jzMessage = jzMessageRepository.selectByPrimaryKey(jzMessage);
//当前基站选择流程
String select = jzMessage.getSelect();
log.debug("当前选择流程:" + select);
//当前业务主键
log.info("业务主键:" + jzMessage.getBusinessId());
CyPIAndTaskModel instanceAndTask = null;
//遍历枚举类,启动流程
for (ProcessMapBpmn value : ProcessMapBpmn.values()) {
if (value.getCode().equals(select)) {
//拆站
if (select.equals(ProcessMapBpmn.BS_STAND_DOWN.getCode())) {
jzMessage.setJzState(BaseStationStatus.BS_WAIT_STANDOWN.getCode());
//设置流程启动key
String processKey = value.getKey();
//设置流程变量
JzMessage myJzmessage = setVariables(jzMessage);
instanceAndTask = commonCreateProcess(processKey, myJzmessage);
}
//需求取消
else if (select.equals(ProcessMapBpmn.BS_NEED_CANCLE.getCode())) {
jzMessage.setOriginalProState(jzMessage.getJzProState());
jzMessage.setOriginalState(jzMessage.getJzState());//记录一下原始基站状态
jzMessage.setJzState(BaseStationStatus.BS_CANALE_REQUIREMENT.getCode());
//设置流程启动key
String processKey = value.getKey();
//设置流程变量
JzMessage myJzmessage = setVariables(jzMessage);
instanceAndTask = commonCreateProcess(processKey, myJzmessage);
}
//当前流程状态为已交维,启动交维流程
else if (jzMessage.getJzState().equals(BaseStationStatus.BS_HAVE_MAINTAIN.getCode())||"0".equals(jzMessage.getJzType())) {
//维护部拆站
if (select.equals(ProcessMapBpmn.BS_MAINTANCE_DOWN.getCode())) {
//设置流程启动key
jzMessage.setJzState(BaseStationStatus.BS_WAIT_STANDOWN.getCode());
String processKey = value.getKey();
//设置流程变量
jzMessage = setVariables(jzMessage);
instanceAndTask = commonCreateProcess(processKey, jzMessage);
}
//维护部修改
if (select.equals(ProcessMapBpmn.BS_MAINTANCE_CHANGE.getCode())) {
//设置流程启动key
String processKey = value.getKey();
//设置流程变量
jzMessage = setVariables(jzMessage);
instanceAndTask = commonCreateProcess(processKey, jzMessage);
}
} else {
String processKey = value.getKey();
//设置流程变量
jzMessage = setVariables(jzMessage);
instanceAndTask = commonCreateProcess(processKey, jzMessage);
}
}
}
return instanceAndTask;
}
//设置全局和本地流程变量方法
public JzMessage setVariables(JzMessage jzMessage) {
HashMap<String, Object> variables = new HashMap<>();
log.debug("全局点击信息:" + jzMessage.getTransition());
variables.put(CyWfConstants.PROCESS_TASK_TRANSITION, jzMessage.getTransition());
variables.put(PARAM, jzMessage.getTransition());
if (jzMessage.getSelect() != null) {
variables.put(CHOOSE, jzMessage.getSelect());
}
HashMap<String, Object> variablesLocal = new HashMap<>();
variablesLocal.put(CyWfConstants.PROCESS_TASK_MEMO, jzMessage.getMsgRemarks());//备注信息
log.debug("本地备注信息:" + jzMessage.getMsgRemarks());
variablesLocal.put(CyWfConstants.PROCESS_TASK_TRANSITION, jzMessage.getTransition());//点击按钮信息
log.debug("本地点击信息:" + jzMessage.getTransition());
jzMessage.setVariables(variables);
jzMessage.setVariablesLocal(variablesLocal);
return jzMessage;
}
/**
* 创建流程部署流程实例 共同方法
*/
public CyPIAndTaskModel commonCreateProcess(String processKey, JzMessage jzMessage) {
//设置流程状态为 待审批(1)
jzMessage.setJzProState(APPROVALPENDING);
if (xzSpecialProcess().contains(jzMessage.getSelect())) {
//如果当前为选址 更新预警时间和状态,清除预警
clearWaring(jzMessage);
clearUserWaring(jzMessage);
} else if (getSpecialProcess().contains(jzMessage.getSelect())) {
clearUserWaring(jzMessage);
}
//更新流程状态为待审批 修改基站信息除外
if (!qdSpecialProcess().contains(jzMessage.getSelect())){
jzMessageRepository.updateJzMessage(jzMessage);
}
//通过流程图id创建流程实例
return cyWfServiceImpl.startProcessByKey(processKey, jzMessage.getBusinessId(), jzMessage.getVariables(), true, jzMessage.getVariablesLocal());
}
/**
* 获取特殊流程
*/
public static List getSpecialProcess() {
List<String> list = new ArrayList<>();
list.add(ProcessMapBpmn.MC_JOINT_HEARING.getCode());//移动会审
list.add(ProcessMapBpmn.MC_DISCLOSURE.getCode());//移动交底
list.add(ProcessMapBpmn.IT_JOINT_HEARING.getCode());//铁塔会审
list.add(ProcessMapBpmn.MC_PICKING.getCode());//移动领料
list.add(ProcessMapBpmn.IT_PICKING.getCode());//铁塔领料
list.add(ProcessMapBpmn.MC_DELIVER_MONEY.getCode());//移动交资
list.add(ProcessMapBpmn.MC_DELIVER_MAINTEANCE.getCode());//移动交维
list.add(ProcessMapBpmn.IT_DELIVER_MAINTEANCE.getCode());//铁塔交维
return list;
}
public static List xzSpecialProcess() {
List<String> list = new ArrayList<>();
list.add(ProcessMapBpmn.MC_DISCUSS_SUCCESS.getCode()); //移动选址
list.add(ProcessMapBpmn.MC_DISCUSS_FAILURE.getCode());
list.add(ProcessMapBpmn.IT_DISCUSS_SUCCESS.getCode());//铁塔选址
list.add(ProcessMapBpmn.IT_DISCUSS_FAILURE.getCode());
return list;
}
public static List qdSpecialProcess(){
List<String> list = new ArrayList<>();
list.add(ProcessMapBpmn.BS_CHANGE_SALEMANS.getCode()); //更换业务员
list.add(ProcessMapBpmn.BS_MAINTANCE_CHANGE.getCode());//维护部修改
list.add(ProcessMapBpmn.BS_MODIFY_INFO.getCode());//修改基站信息
return list;
}
public void clearWaring(JzMessage jzMessage) {
jzMessage.setNormal();
//基站警告状态设为0
jzMessage.setJzJdWaring("0");
//更新进度日期为当前日期
jzMessage.setJzJdDate(new Date());
//更新预警状态
jzMessageRepository.updateJzMessage(jzMessage);
}
public void clearUserWaring(JzMessage jzMessage) {
//清除预警(更新预警为已处理 1 )
userWarningServiceImpl = CyApplicationContextHolder.getBean(UserWarningService.class);
UserWarning userWarning = new UserWarning();
userWarning.setJzId(jzMessage.getBusinessId());
userWarning.setJzStatus(jzMessage.getJzState());
userWarningServiceImpl.dealWarning(userWarning);
}
}
package org.rcisoft.business.jzmessage.common;
public enum TypeEnum {
DJ("代缴站","0"),
YD("移动","1"),
TT("铁塔","2");
private String name;
private String key;
TypeEnum(String name, String key) {
this.name = name;
this.key = key;
}
public String getname() {
return name;
}
public void setname(String name) {
this.name = name;
}
public String getkey() {
return key;
}
public void setkey(String key) {
this.key = key;
}
}
package org.rcisoft.business.jzmessage.controller;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.exportexclemodel.util.ExcelDownload;
import org.rcisoft.business.jzmessage.entity.FileUpload;
import org.rcisoft.business.jzmessage.entity.JzMessage;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyFileController;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping("/file")
@Slf4j
public class JzFileController extends CyFileController {
public final static String RIGHTSEPARATOR = "/";
public final static String LEFTONESEPARATOR = "\\";
public final static String LEFTSEPARATOR = "\\\\";
@Value("${global.path.base_upload_location}")
public String BASE_UPLOAD_LOCATION;
@Value("${global.path.temp_location}")
public String TEMP_LOCATION;
@Value("${global.path.jz_location}")
public String JZ_LOCATION;
@PostMapping("/upload")
public CyResult fileUpload(@RequestParam("file") MultipartFile multipartFile, JzMessage jzMessage) {
String businessId = jzMessage.getBusinessId();
String originalName = multipartFile.getOriginalFilename();//获取文件名字
String absolutePath = BASE_UPLOAD_LOCATION + JZ_LOCATION + businessId;//文件绝对路径
String tempPath = super.globalCommonFileUpload(multipartFile, CyFileController.SAVING_PATTERN_UUID, absolutePath);
log.debug("路径:" + tempPath);
List<String> middlePath = new ArrayList<>();
if (tempPath.contains(LEFTONESEPARATOR)){
middlePath = Arrays.asList(tempPath.split(LEFTSEPARATOR));
}else{
middlePath = Arrays.asList(tempPath.split(RIGHTSEPARATOR));
}
String newOriginalName = "";
for (String s : middlePath) {
if (s.contains(".")) {
newOriginalName = s;
}
}
//拼接新的资源路径
String finallyPath = JZ_LOCATION + businessId + "/" + newOriginalName;
FileUpload fileUpload = new FileUpload();
fileUpload.setFileName(originalName);
fileUpload.setFilePath(finallyPath);
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
fileUpload);
}
@GetMapping("/download")
public CyResult fileDownload(@RequestParam("fileName") String fileName,@RequestParam("filePath") String filePath, HttpServletResponse response, HttpServletRequest request) {
// filePath = filePath.substring(1,filePath.length()-1);
// fileName = fileName.substring(1,fileName.length()- 1);
String absolutePath = BASE_UPLOAD_LOCATION + filePath;
ExcelDownload.getExcel(absolutePath,fileName,response,request);
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
null);
}
}
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论