| @ -0,0 +1,33 @@ | |||
| HELP.md | |||
| target/ | |||
| !.mvn/wrapper/maven-wrapper.jar | |||
| !**/src/main/**/target/ | |||
| !**/src/test/**/target/ | |||
| ### STS ### | |||
| .apt_generated | |||
| .classpath | |||
| .factorypath | |||
| .project | |||
| .settings | |||
| .springBeans | |||
| .sts4-cache | |||
| ### IntelliJ IDEA ### | |||
| .idea | |||
| *.iws | |||
| *.iml | |||
| *.ipr | |||
| ### NetBeans ### | |||
| /nbproject/private/ | |||
| /nbbuild/ | |||
| /dist/ | |||
| /nbdist/ | |||
| /.nb-gradle/ | |||
| build/ | |||
| !**/src/main/**/build/ | |||
| !**/src/test/**/build/ | |||
| ### VS Code ### | |||
| .vscode/ | |||
| @ -0,0 +1,45 @@ | |||
| 一、CNG系统信息 | |||
| 1、系统地址:http://www.chengducng.com/cdcng/login-pwd | |||
| 2、系统管理员账号、密码:admin、cng321! | |||
| 温江经信局,账号:cdwjnygl 密码:cdwjnygl | |||
| 改装厂,账户名:gaohao密码:gaohao123@ | |||
| 二、VPN信息: | |||
| ip:182.150.40.131 | |||
| 端口:44533 | |||
| 账号:cngcs | |||
| 密码:cngcs2022! | |||
| 三、堡垒机信息: | |||
| 访问地址:https://172.23.252.220/web/main.ssi | |||
| 账号:CNGZH-user01 | |||
| 密码:CNGzh321!CNGzh321! | |||
| 四、CNG数据库服务器信息: | |||
| ip:172.23.22.251 | |||
| 数据库:249 | |||
| 账号:administrator | |||
| 密码:GePh+$jA | |||
| 日志地址:172.23.22.246 | |||
| 密码 &4iNL706 | |||
| 五、git信息 | |||
| http://120.79.162.253:9010/gitea/cdcng_front.git | |||
| 我的密码 l2049808824@ | |||
| 1.解决用温江经信局账号登录时查询改装企业申请注册审核信息不完整的问题 | |||
| 因为area字段为空 | |||
| 1.新建用户 | |||
| 系统管理》 | |||
| 用户管理》新建用户 | |||
| 机构管理》成都市》市经信委添加部门,把新建用户挂上 | |||
| 登录新建用户的账号,密码是账号》改装企业用户申请》改装企业注册,下方点确定,填入完整信息,才会挂到对应区县上 | |||
| 2.材料审核出错 | |||
| 政府管理》改装企业申请注册审核》材料审核提交时空指针 | |||
| PublicityRepo.java 213行是空对象,因为查询时CODE与数据库CODE不一致,手动修改 | |||
| @ -0,0 +1,249 @@ | |||
| <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/maven-v4_0_0.xsd"> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <groupId>com.ciotea.cdcng</groupId> | |||
| <artifactId>cdcng-front</artifactId> | |||
| <packaging>war</packaging> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| <properties> | |||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
| <cxf.version>2.7.4</cxf.version> | |||
| </properties> | |||
| <parent> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-parent</artifactId> | |||
| <version>2.1.8.RELEASE</version> | |||
| <relativePath/> <!-- lookup parent from repository --> | |||
| </parent> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>org.apache.cxf</groupId> | |||
| <artifactId>cxf-rt-frontend-jaxws</artifactId> | |||
| <version>${cxf.version}</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.cxf</groupId> | |||
| <artifactId>cxf-rt-transports-http</artifactId> | |||
| <version>${cxf.version}</version> | |||
| </dependency> | |||
| <!-- Jetty is needed if you're are not using the CXFServlet --> | |||
| <dependency> | |||
| <groupId>org.apache.cxf</groupId> | |||
| <artifactId>cxf-rt-transports-http-jetty</artifactId> | |||
| <version>${cxf.version}</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.ciotea</groupId> | |||
| <artifactId>module-ctask</artifactId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>javax.mail</groupId> | |||
| <artifactId>mail</artifactId> | |||
| <version>1.4.1</version> | |||
| </dependency> | |||
| <!-- 2021.04.07 --> | |||
| <dependency> | |||
| <groupId>com.baomidou</groupId> | |||
| <artifactId>mybatis-plus-boot-starter</artifactId> | |||
| <version>3.3.2</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.poi</groupId> | |||
| <artifactId>poi</artifactId> | |||
| <version>3.17</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.poi</groupId> | |||
| <artifactId>poi-ooxml</artifactId> | |||
| <version>3.17</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-security</artifactId> | |||
| <version>RELEASE</version> | |||
| </dependency> | |||
| <!-- <dependency>--> | |||
| <!-- <groupId>org.springframework</groupId>--> | |||
| <!-- <artifactId>spring-context</artifactId>--> | |||
| <!-- <version>6.0.11</version>--> | |||
| <!-- </dependency>--> | |||
| <dependency> | |||
| <groupId>javax.validation</groupId> | |||
| <artifactId>validation-api</artifactId> | |||
| <version>1.1.0.Final</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.hibernate</groupId> | |||
| <artifactId>hibernate-validator</artifactId> | |||
| <version>5.4.1.Final</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>commons-io</groupId> | |||
| <artifactId>commons-io</artifactId> | |||
| <version>2.5</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.fasterxml.jackson.core</groupId> | |||
| <artifactId>jackson-core</artifactId> | |||
| <version>2.11.3</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>commons-net</groupId> | |||
| <artifactId>commons-net</artifactId> | |||
| <version>3.6</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.liferay</groupId> | |||
| <artifactId>org.apache.commons.fileupload</artifactId> | |||
| <version>1.2.2.LIFERAY-PATCHED-1</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.commons</groupId> | |||
| <artifactId>commons-pool</artifactId> | |||
| <version>1.6</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.commons</groupId> | |||
| <artifactId>commons-collections4</artifactId> | |||
| <version>4.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>commons-validator</groupId> | |||
| <artifactId>commons-validator</artifactId> | |||
| <version>1.6</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.commons</groupId> | |||
| <artifactId>commons-pool2</artifactId> | |||
| <version>2.9.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>cn.com.scca</groupId> | |||
| <artifactId>signgw</artifactId> | |||
| <version>1.0</version> | |||
| </dependency> | |||
| <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 --> | |||
| <dependency> | |||
| <groupId>org.apache.commons</groupId> | |||
| <artifactId>commons-pool2</artifactId> | |||
| <version>2.11.1</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.apache.commons</groupId> | |||
| <artifactId>commons-lang3</artifactId> | |||
| <version>3.6</version> | |||
| </dependency> | |||
| <!-- 2021.04.07 end --> | |||
| <!-- ca --> | |||
| <!-- | |||
| <dependency> | |||
| <groupId>bouncycastle</groupId> | |||
| <artifactId>bcmail-jdk14</artifactId> | |||
| <version>138</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>bouncycastle</groupId> | |||
| <artifactId>bcprov-jdk14</artifactId> | |||
| <version>138</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.ciotea.ca</groupId> | |||
| <artifactId>iTrusCertAPI</artifactId> | |||
| <version>2.5</version> | |||
| <classifier>beta3</classifier> | |||
| </dependency> | |||
| --> | |||
| <dependency> | |||
| <groupId>org.bouncycastle</groupId> | |||
| <artifactId>bcmail-jdk15</artifactId> | |||
| <version>1.45</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.bouncycastle</groupId> | |||
| <artifactId>bcprov-jdk15</artifactId> | |||
| <version>1.45</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.ciotea.ca</groupId> | |||
| <artifactId>iTrusCertAPI</artifactId> | |||
| <version>2.7.9</version> | |||
| </dependency> | |||
| <!-- hibernate --> | |||
| <dependency> | |||
| <groupId>org.hibernate</groupId> | |||
| <artifactId>hibernate-core</artifactId> | |||
| <version>4.3.7.Final</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.ciotea.jdbc</groupId> | |||
| <artifactId>sqljdbc4</artifactId> | |||
| <version>4.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.ciotea</groupId> | |||
| <artifactId>app-infrastructure</artifactId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>io.jsonwebtoken</groupId> | |||
| <artifactId>jjwt</artifactId> | |||
| <version>0.9.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.alibaba</groupId> | |||
| <artifactId>fastjson</artifactId> | |||
| <version>1.2.47</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-web</artifactId> | |||
| <version>RELEASE</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <finalName>cdcng-front</finalName> | |||
| <plugins> | |||
| <plugin> | |||
| <groupId>org.apache.maven.plugins</groupId> | |||
| <artifactId>maven-compiler-plugin</artifactId> | |||
| <version>3.1</version> | |||
| <configuration> | |||
| <source>8</source> | |||
| <target>8</target> | |||
| </configuration> | |||
| </plugin> | |||
| <plugin> | |||
| <groupId>org.apache.maven.plugins</groupId> | |||
| <artifactId>maven-resources-plugin</artifactId> | |||
| <version>2.7</version> | |||
| <configuration> | |||
| <encoding>${project.build.sourceEncoding}</encoding> | |||
| </configuration> | |||
| </plugin> | |||
| </plugins> | |||
| </build> | |||
| </project> | |||
| @ -0,0 +1,78 @@ | |||
| package com.ciotea.cdcng.front.application; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReport; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReportRepo; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReportService; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "stationReport") | |||
| public class StationReportController { | |||
| @Resource | |||
| StationReportRepo stationReportRepo; | |||
| @Resource | |||
| StationReportService stationReportService; | |||
| // ---------------------- app --------------------- | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "mobile/save", method = RequestMethod.POST) | |||
| // void saveReport(StationReport stationReport, Context context) { | |||
| // stationReport.setStationId(context.getDepartment().getId()); | |||
| // stationReportService.savestationReport(stationReport); | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "mobile/list", method = RequestMethod.GET) | |||
| // infrastructure.support.records.Pagination reports(Context context, infrastructure.support.records.Pagination pagination) { | |||
| // String stationId = context.getDepartment().getId(); | |||
| // return pagination.setRows(stationReportRepo.getListByPage(stationId, pagination)); | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "mobile/detail", method = RequestMethod.GET) | |||
| // StationReport reportDetail(String id) { | |||
| // return stationReportRepo.getById(id); | |||
| // } | |||
| // ---------------------- web统计 --------------------- | |||
| @ResponseBody | |||
| @RequestMapping(value = "list", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination reports(String startTime, String endTime, Context context, infrastructure.support.records.Pagination pagination) { | |||
| String stationId = context.getDepartment().getId(); | |||
| return pagination.setRows(pagination.doPaging(stationReportRepo.getTimedivision(startTime, endTime, stationId))); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "statistics", method = RequestMethod.GET) | |||
| Map<String, Object> reportStatistics(String time) { | |||
| List<StationReport> reports = stationReportRepo.getStatisticsByTime(time); | |||
| Map<String, Object> map = stationReportService.convert(reports); | |||
| return map; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "detail/page", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination detailPage(String time, infrastructure.support.records.Pagination pagination) { | |||
| return pagination.setRows(stationReportRepo.getDetailByPage(time, pagination)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "detail", method = RequestMethod.GET) | |||
| List<StationReport> detail(String time, infrastructure.support.records.Pagination pagination) { | |||
| return stationReportRepo.getDetailByPage(time); | |||
| } | |||
| } | |||
| @ -0,0 +1,729 @@ | |||
| package com.ciotea.cdcng.front.application.WindingTank; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.UserRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.AirTightness; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Audit; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.CheckConclusion; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Hydraulic; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.InternalDry; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Macroscopic; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.MacroscopicDetail; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Magnetic; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.MagneticDefect; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.MediumHandle; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Record; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Thickness; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Valve; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Volume; | |||
| import com.ciotea.cdcng.front.domain.windingTank.entity.Weighing; | |||
| import com.ciotea.cdcng.front.domain.windingTank.repository.WindingTankRepository; | |||
| import com.ciotea.cdcng.front.domain.windingTank.service.WindingTankService; | |||
| import com.ciotea.cdcng.front.domain.windingTank.vo.RecordHistoryVo; | |||
| import com.ciotea.cdcng.front.domain.windingTank.vo.RecordVo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value = "windingTank") | |||
| public class WindingTankController { | |||
| @Resource | |||
| WindingTankRepository windingTankRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| WindingTankService windingTankService; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| ChecklogRepository checklogRepository; | |||
| @Resource | |||
| CngCdCarStrategy cngCdCarStrategy; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| @Resource | |||
| UserRepository userRepository; | |||
| @Resource | |||
| private LogOperation logOperation; | |||
| @ResponseBody | |||
| @RequestMapping(value = "records", method = RequestMethod.GET) | |||
| Pagination getRecords(RecordVo recordVo, String searchStatus, String isComplete, Integer isPrint, String searchNow, Pagination pagination, Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| List<RecordVo> list = new ArrayList<RecordVo>(); | |||
| list = windingTankRepository.getRecords(dept.getId(), recordVo, searchStatus, isComplete, isPrint, pagination); | |||
| // String roleName = context.getPosition().getCode(); | |||
| // if(roleName.equals(WindingTankService.STEP_RECORD.getChecker())) { | |||
| // list = windingTankRepository.getRecordsByYsbj(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } else if(roleName.equals(WindingTankService.STEP_MACROSCOPIC.getChecker())) { | |||
| // list = windingTankRepository.getRecordsByHgjc(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } else if(roleName.equals(WindingTankService.STEP_HYDRAULIC.getChecker())) { | |||
| // list = windingTankRepository.getRecordsBySysy(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } else if(roleName.equals(WindingTankService.STEP_VALVE.getChecker())) { | |||
| // list = windingTankRepository.getRecordsByPfjy(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } else if(roleName.equals(WindingTankService.STEP_AIRTIGHTNESS.getChecker())) { | |||
| // list = windingTankRepository.getRecordsByQmxsy(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } else if(roleName.equals(WindingTankService.STEP_CHECKCONCLUSION.getChecker())) { | |||
| // list = windingTankRepository.getRecordsByJltx(dept.getId(), code, searchStatus, searchNow, pagination); | |||
| // } | |||
| return pagination.setRows(list); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "records/history", method = RequestMethod.GET) | |||
| Pagination getRecordsHistory(RecordHistoryVo recordHistoryVo, Pagination pagination, Context context) { | |||
| List<RecordHistoryVo> list = new ArrayList<RecordHistoryVo>(); | |||
| list = windingTankRepository.getRecordsHistory(recordHistoryVo, pagination); | |||
| return pagination.setRows(list); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "record", method = RequestMethod.GET) | |||
| Record getRecord(String recordId) { | |||
| return repository.get(Record.class, recordId); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "mediumHandle", method = RequestMethod.GET) | |||
| MediumHandle getMediumHandle(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getMediumHandle(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "macroscopic", method = RequestMethod.GET) | |||
| Map<String, Object> getMacroscopic(String recordId) { | |||
| Map<String, Object> map = new HashMap<String, Object>(); | |||
| Record record = repository.get(Record.class, recordId); | |||
| if(record != null) { | |||
| if(record.getMacroscopic() != null) { | |||
| MacroscopicDetail detail = windingTankRepository.getByMacroscopicId(record.getMacroscopic().getId()); | |||
| map.put("macroscopic", record.getMacroscopic()); | |||
| map.put("macroscopicDetail", detail); | |||
| } | |||
| } | |||
| return map; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "magnetic", method = RequestMethod.GET) | |||
| Map<String, Object> getMagnetic(String recordId) { | |||
| Map<String, Object> map = new HashMap<String, Object>(); | |||
| Record record = repository.get(Record.class, recordId); | |||
| if(record != null) { | |||
| map.put("magnetic", record.getMagnetic()); | |||
| if(record.getMagnetic() != null) { | |||
| map.put("defect", record.getMagnetic().getMagneticDefects()); | |||
| } | |||
| } | |||
| return map; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "weighing", method = RequestMethod.GET) | |||
| Weighing getWeighing(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| Weighing weighing = record == null ? null : record.getWeighing(); | |||
| if(weighing != null) { | |||
| Thickness thickness = repository.get(Thickness.class, weighing.getId()); | |||
| if(thickness != null) { | |||
| weighing.setMinimumWallThickness(thickness.getMinimumWallThickness()); | |||
| weighing.setThicknessJl(thickness.getConclusion()); | |||
| } | |||
| } | |||
| return weighing; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "weightVolume", method = RequestMethod.GET) | |||
| Volume getWeightVolume(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getVolume(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "hydraulic", method = RequestMethod.GET) | |||
| Hydraulic getHydraulic(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| Hydraulic hydraulic = record == null ? null : record.getHydraulic(); | |||
| if(hydraulic != null) { | |||
| Thickness thickness = repository.get(Thickness.class, hydraulic.getId()); | |||
| if(thickness != null) { | |||
| hydraulic.setMinimumWallThickness(thickness.getMinimumWallThickness()); | |||
| hydraulic.setThicknessJl(thickness.getConclusion()); | |||
| } | |||
| } | |||
| return hydraulic; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "internalDry", method = RequestMethod.GET) | |||
| InternalDry getInternalDry(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getInternalDry(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "assembly", method = RequestMethod.GET) | |||
| Valve getValve(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getValve(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "airTightness", method = RequestMethod.GET) | |||
| AirTightness getAirTightness(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getAirTightness(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "checkConclusion", method = RequestMethod.GET) | |||
| CheckConclusion getCheckConclusion(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getCheckConclusion(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "audit", method = RequestMethod.GET) | |||
| Audit getAudit(String recordId) { | |||
| Record record = repository.get(Record.class, recordId); | |||
| return record == null ? null : record.getAudit(); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "magneticDefects", method = RequestMethod.GET) | |||
| List<MagneticDefect> getMagneticDefects(String magneticId) { | |||
| Magnetic magnetic = repository.get(Magnetic.class, magneticId); | |||
| List<MagneticDefect> list = new ArrayList<MagneticDefect>(); | |||
| list.addAll(magnetic.getMagneticDefects()); | |||
| return list; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "unqualifiedToQualified", method = RequestMethod.POST) | |||
| void unqualifiedToQualified(String index, String recordId, Context context) { | |||
| windingTankService.removeByIndex(index, recordId, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "fillUnqualified", method = RequestMethod.POST) | |||
| void fillUnqualified(String index, String recordId, Context context) { | |||
| windingTankService.fillUnqualified(index, recordId, context); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "record", method = RequestMethod.POST) | |||
| Record addRecord(Record record, Context context) { | |||
| if(!StringUtil.isNullOrEmpty(record.getReportNum())){ | |||
| String reportNum = record.getReportNum(); | |||
| if(record.getReportNum().length() < 6){ | |||
| for(int i = reportNum.length(); i < 6; i++ ){ | |||
| reportNum = "0" + reportNum; | |||
| } | |||
| record.setReportNum(reportNum); | |||
| } | |||
| } | |||
| if(StringUtil.isNullOrEmpty(record.getId())) { | |||
| // 如果录入的气瓶在目前系统中存在并且未打印,则不允许重复增加。 | |||
| List<RecordVo> list = windingTankRepository.isExist(record.getCode()); | |||
| if(list != null && list.size() > 0) { | |||
| throw new AppException("该气瓶上次的检验报告未打印,请先打印后重试"); | |||
| } | |||
| return windingTankService.addRecord(record, context); | |||
| } else { | |||
| return windingTankService.updateRecord(record, context); | |||
| } | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "mediumHandle", method = RequestMethod.POST) | |||
| MediumHandle addMediumHandle(MediumHandle mediumHandle, Context context) { | |||
| if(StringUtil.isNullOrEmpty(mediumHandle.getId())) { | |||
| mediumHandle.setCreatingDate(new Date()); | |||
| mediumHandle.setCreator(context.getUser().getName()); | |||
| Record record = repository.get(Record.class, mediumHandle.getRecord().getId()); | |||
| record.setPresentStatus(1); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| mediumHandle = repository.save(mediumHandle); | |||
| logOperation.saveWindingMediumHandleLog(mediumHandle, context.getUser().getUsername(), Operations.INSERT, ""); | |||
| return mediumHandle; | |||
| } else { | |||
| MediumHandle org = repository.get(MediumHandle.class, mediumHandle.getId()); | |||
| mediumHandle.setCreatingDate(org.getCreatingDate()); | |||
| mediumHandle.setCreator(org.getCreator()); | |||
| mediumHandle.setModificationDate(new Date()); | |||
| mediumHandle.setModifier(context.getUser().getName()); | |||
| mediumHandle = repository.save(mediumHandle); | |||
| logOperation.saveWindingMediumHandleLog(mediumHandle, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| return mediumHandle; | |||
| } | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "macroscopic", method = RequestMethod.POST) | |||
| Macroscopic addMacroscopic(Macroscopic macroscopic, MacroscopicDetail macroscopicDetail, Context context) { | |||
| Macroscopic vo = new Macroscopic(); | |||
| if (StringUtil.isNullOrEmpty(macroscopic.getId())) { | |||
| vo = windingTankService.saveMacroscopic(macroscopic, macroscopicDetail, context); | |||
| Record record = repository.get(Record.class, macroscopic.getRecord().getId()); | |||
| record.setPresentStatus(2); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateMacroscopic(macroscopic, macroscopicDetail, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "magnetic", method = RequestMethod.POST) | |||
| Magnetic magnetic(Magnetic magnetic, String sn[], String code[], String number[], String defectType[], String size[], String finalAssessment[], String remark[], Context context) { | |||
| Magnetic vo = new Magnetic(); | |||
| if (StringUtil.isNullOrEmpty(magnetic.getId())) { | |||
| vo = windingTankService.saveMagnetic(magnetic, sn, code, number, defectType, size, finalAssessment, remark, context); | |||
| Record record = repository.get(Record.class, magnetic.getRecord().getId()); | |||
| record.setPresentStatus(3); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateMagnetic(magnetic, sn, code, number, defectType, size, finalAssessment, remark, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "weighing", method = RequestMethod.POST) | |||
| Weighing weighing(Weighing weighing, Context context) { | |||
| Weighing vo = new Weighing(); | |||
| boolean isTestThickness = false; | |||
| // 测壁厚 | |||
| if(!(StringUtil.isNullOrEmpty(weighing.getWeightLossRate())) && Float.parseFloat(weighing.getWeightLossRate()) > 3 && Float.parseFloat(weighing.getWeightLossRate()) <= 5) { | |||
| isTestThickness = true; | |||
| } | |||
| if(StringUtil.isNullOrEmpty(weighing.getId())) { | |||
| vo = windingTankService.addWeighing(weighing, isTestThickness, context); | |||
| Record record = repository.get(Record.class, weighing.getRecord().getId()); | |||
| record.setPresentStatus(4); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateWeighing(weighing, isTestThickness, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "weightVolume", method = RequestMethod.POST) | |||
| Volume weightVolume(Volume weightVolume, Context context) { | |||
| Volume vo = new Volume(); | |||
| if (StringUtil.isNullOrEmpty(weightVolume.getId())) { | |||
| vo = windingTankService.addWeightVolume(weightVolume, context); | |||
| Record record = repository.get(Record.class, weightVolume.getRecord().getId()); | |||
| record.setPresentStatus(4); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateWeightVolume(weightVolume, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "hydraulicTest", method = RequestMethod.POST) | |||
| Hydraulic addHydraulicTest(Hydraulic hydraulic, Context context) { | |||
| Hydraulic vo = new Hydraulic(); | |||
| boolean isTestThickness = false; | |||
| // 测壁厚 | |||
| // if (!(StringUtil.isNullOrEmpty(hydraulic.getRemnantDeformationRate())) && Float.parseFloat(hydraulic.getRemnantDeformationRate()) > 6 && Float.parseFloat(hydraulic.getRemnantDeformationRate()) <= 10) { | |||
| // isTestThickness = true; | |||
| // } | |||
| if(StringUtil.isNullOrEmpty(hydraulic.getId())) { | |||
| vo = windingTankService.addHydraulic(hydraulic, isTestThickness, context); | |||
| Record record = repository.get(Record.class, hydraulic.getRecord().getId()); | |||
| record.setPresentStatus(5); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateHydraulic(hydraulic, isTestThickness, context); | |||
| } | |||
| return vo; | |||
| // Hydraulic vo = new Hydraulic(); | |||
| // if (StringUtil.isNullOrEmpty(hydraulic.getId())) { | |||
| // vo = windingTankService.addHydraulic(hydraulic, context); | |||
| // | |||
| // Record record = repository.get(Record.class, hydraulic.getRecord().getId()); | |||
| // record.setPresentStatus(6); | |||
| // repository.save(record); | |||
| // | |||
| // } else { | |||
| // vo = windingTankService.updateHydraulic(hydraulic, context); | |||
| // } | |||
| // return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "internalDry", method = RequestMethod.POST) | |||
| InternalDry internalDry(InternalDry internalDry, Context context) { | |||
| InternalDry vo = new InternalDry(); | |||
| if (StringUtil.isNullOrEmpty(internalDry.getId())) { | |||
| internalDry.setCreator(context.getUser().getName()); | |||
| internalDry.setCreatingDate(new Date()); | |||
| vo = repository.save(internalDry); | |||
| logOperation.saveWindingInternalDryLog(vo, context.getUser().getUsername(), Operations.INSERT, ""); | |||
| Record record = repository.get(Record.class, internalDry.getRecord().getId()); | |||
| record.setPresentStatus(6); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| InternalDry org = repository.get(InternalDry.class, internalDry.getId()); | |||
| internalDry.setCreatingDate(org.getCreatingDate()); | |||
| internalDry.setCreator(org.getCreator()); | |||
| internalDry.setModificationDate(new Date()); | |||
| internalDry.setModifier(context.getUser().getName()); | |||
| vo = repository.save(internalDry); | |||
| logOperation.saveWindingInternalDryLog(vo, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "assembly", method = RequestMethod.POST) | |||
| Valve valve(Valve valve, Context context) { | |||
| Valve vo = new Valve(); | |||
| if (StringUtil.isNullOrEmpty(valve.getId())) { | |||
| vo = windingTankService.addAssembly(valve, context); | |||
| Record record = repository.get(Record.class, valve.getRecord().getId()); | |||
| record.setPresentStatus(7); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateAssembly(valve, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "airTightness", method = RequestMethod.POST) | |||
| AirTightness airTightness(AirTightness airTightness, Context context) { | |||
| AirTightness vo = new AirTightness(); | |||
| if (StringUtil.isNullOrEmpty(airTightness.getId())) { | |||
| vo = windingTankService.addAirTightness(airTightness, context); | |||
| Record record = repository.get(Record.class, airTightness.getRecord().getId()); | |||
| record.setPresentStatus(8); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateAirTightness(airTightness, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "vacuumPumping", method = RequestMethod.POST) | |||
| // VacuumPumping vacuumPumping(VacuumPumping vacuumPumping, Context context) { | |||
| // VacuumPumping vo = new VacuumPumping(); | |||
| // if (StringUtil.isNullOrEmpty(vacuumPumping.getId())) { | |||
| // vacuumPumping.setCreator(context.getUser().getName()); | |||
| // vacuumPumping.setCreatingDate(new Date()); | |||
| // vo = repository.save(vacuumPumping); | |||
| // } else { | |||
| // VacuumPumping org = repository.get(VacuumPumping.class, vacuumPumping.getId()); | |||
| // vacuumPumping.setCreatingDate(org.getCreatingDate()); | |||
| // vacuumPumping.setCreator(org.getCreator()); | |||
| // vacuumPumping.setModificationDate(new Date()); | |||
| // vacuumPumping.setModifier(context.getUser().getName()); | |||
| // vo = repository.save(vacuumPumping); | |||
| // } | |||
| // return vo; | |||
| // }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "checkConclusion", method = RequestMethod.POST) | |||
| CheckConclusion checkConclusion(CheckConclusion checkConclusion, String tempConclusion, Context context) { | |||
| CheckConclusion vo = new CheckConclusion(); | |||
| if (StringUtil.isNullOrEmpty(checkConclusion.getId())) { | |||
| vo = windingTankService.addCheckConclusion(checkConclusion, tempConclusion, context); | |||
| Record record = repository.get(Record.class, checkConclusion.getRecord().getId()); | |||
| record.setPresentStatus(9); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| vo = windingTankService.updateCheckConclusion(checkConclusion, tempConclusion, context); | |||
| } | |||
| return vo; | |||
| }; | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "audit", method = RequestMethod.POST) | |||
| // Audit audit(Audit audit, String tempConclusion, Context context) { | |||
| // Audit vo = new Audit(); | |||
| // if (StringUtil.isNullOrEmpty(audit.getId())) { | |||
| // vo = windingTankService.addAudit(audit, tempConclusion, context); | |||
| // Record record = repository.get(Record.class, audit.getRecord().getId()); | |||
| // record.setPresentStatus(11); | |||
| // repository.save(record); | |||
| // } else { | |||
| // vo = windingTankService.updateAudit(audit, tempConclusion, context); | |||
| // } | |||
| // return vo; | |||
| // }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "audit", method = RequestMethod.POST) | |||
| void audit(String recordId, Context context) { | |||
| Audit audit = new Audit(); | |||
| Record record = repository.get(Record.class, recordId); | |||
| if(record.getAudit() == null) { | |||
| audit.setCreator(context.getUser().getName()); | |||
| audit.setCreatingDate(new Date()); | |||
| audit.setAuditor(context.getUser().getName()); | |||
| audit.setAuditTime(Tool.dateByString(new Date())); | |||
| audit.setRecord(record); | |||
| repository.save(audit); | |||
| logOperation.saveWindingAuditLog(audit, context.getUser().getUsername(), Operations.INSERT, ""); | |||
| // 同步保存到历史表 | |||
| // RecordHistory history = new RecordHistory(); | |||
| // history.setCode(record.getCode()); | |||
| // history.setPlatenum(record.getPlatenum()); | |||
| // history.setManufacturingCountry(record.getManufacturingCountry()); | |||
| // history.setFactoryName(record.getFactoryName()); | |||
| // history.setPressureWork(record.getPressureWork()); | |||
| // history.setHydrostaticTestPressure(record.getHydrostaticTestPressure()); | |||
| // history.setWaterVolume(record.getWaterVolume()); | |||
| // history.setWallThickness(record.getWallThickness()); | |||
| // history.setWeight(record.getWeight()); | |||
| // history.setManufacturingDate(record.getManufacturingDate()); | |||
| // history.setLastTestDate(record.getLastTestDate()); | |||
| // history.setInstallationCompany(record.getInstallationCompany()); | |||
| // history.setEntruckingDate(record.getEntruckingDate()); | |||
| // history.setConclusion(record.getConclusion()); | |||
| // history.setCreator(record.getCreator()); | |||
| // history.setCreatingDate(record.getCreatingDate()); | |||
| // history.setModifier(record.getModifier()); | |||
| // history.setModificationDate(record.getModificationDate()); | |||
| // history.setDeptId(record.getDeptId()); | |||
| // history.setRecordId(recordId); | |||
| // repository.save(history); | |||
| record.setPresentStatus(10); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } else { | |||
| record.setPresentStatus(10); | |||
| repository.save(record); | |||
| logOperation.saveWindingRecordLog(record, context.getUser().getUsername(), Operations.UPDATE, ""); | |||
| } | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "record", method = RequestMethod.DELETE) | |||
| void delRecord(String recordId, Context context) { | |||
| windingTankService.removeCheckConclusionByRecordId(recordId, context); | |||
| windingTankService.removeAirTightnessByRecordId(recordId, context); | |||
| windingTankService.removeValveByRecordId(recordId, context); | |||
| windingTankService.removeInternalDry(recordId, context); | |||
| windingTankService.removeHydraulicByRecordId(recordId, context); | |||
| windingTankService.removeMagneticDefectByRecordId(recordId, context); | |||
| windingTankService.removeMagneticByRecordId(recordId, context); | |||
| windingTankService.removeMacroscopicByRecordId(recordId, context); | |||
| windingTankService.removeMediumHandle(recordId, context); | |||
| windingTankService.removeRecord(recordId, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "status", method = RequestMethod.PUT) | |||
| void updateStatus(String recordId, String status, Context context) { | |||
| windingTankService.updateWindingTankStatus(recordId, status, context); | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "reinspection", method = RequestMethod.POST) | |||
| int reinspection(String name, String recordId, Context context) { | |||
| if (name.equals("testCompleted")) { | |||
| windingTankService.removeCheckConclusionByRecordId(recordId, context); | |||
| } else if (name.equals("airTightnessTest")) { | |||
| windingTankService.removeAirTightnessByRecordId(recordId, context); | |||
| } else if (name.equals("checkingAssembly")) { | |||
| windingTankService.removeValveByRecordId(recordId, context); | |||
| } else if (name.equals("internalDry")) { | |||
| windingTankService.removeInternalDry(recordId, context); | |||
| } else if (name.equals("hydraulicTest")) { | |||
| windingTankService.removeHydraulicByRecordId(recordId, context); | |||
| } else if (name.equals("macroscopicCheck")) { | |||
| windingTankService.removeMagneticDefectByRecordId(recordId, context); | |||
| windingTankService.removeMagneticByRecordId(recordId, context); | |||
| windingTankService.removeMacroscopicByRecordId(recordId, context); | |||
| } | |||
| else if (name.equals("mediumHandle")) { | |||
| windingTankService.removeMediumHandle(recordId, context); | |||
| } | |||
| else if (name.equals("originalRecord")) { | |||
| windingTankService.reinspectionRecord(recordId, context); | |||
| } else { | |||
| return 0; | |||
| } | |||
| return 1; | |||
| }; | |||
| @ResponseBody | |||
| @RequestMapping(value = "check", method = RequestMethod.GET) | |||
| String checkPosition(Context context) { | |||
| return context.getPosition().getCode(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "downloadMsg", method = RequestMethod.GET) | |||
| RecordVo downloadMsg(String bottleCode) { | |||
| RecordVo vo = new RecordVo(); | |||
| if(!StringUtil.isNullOrEmpty(bottleCode)) { | |||
| vo = windingTankRepository.downloadMsg(bottleCode.trim()); | |||
| if(vo != null){ | |||
| // List<CheckLog> log = checklogRepository.getRegularInfoBy(vo.getPlatenum()); | |||
| List<RecordVo> record = windingTankRepository.getList(bottleCode); | |||
| if(record != null && record.size() > 0){ | |||
| vo.setLastTestDate(record.get(0).getCreatingDate().substring(0, 10)); | |||
| if(!(StringUtil.isNullOrEmpty(record.get(0).getEffectiveTime()))) { | |||
| vo.setEffectiveTime(record.get(0).getEffectiveTime().substring(0, 10)); | |||
| } | |||
| } | |||
| if(vo.getCngIsorig().equals("0") && vo.getCngDeptType().equals("22")) { | |||
| vo.setInstallationCompany(vo.getCngDeptName()); | |||
| }else { | |||
| vo.setInstallationCompany(vo.getInstallationCompany()); | |||
| } | |||
| if(!StringUtil.isNullOrEmpty(vo.getEntruckingDate())) { | |||
| vo.setEntruckingDate(vo.getEntruckingDate().split(" ")[0]); | |||
| } | |||
| } | |||
| } | |||
| return vo; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "findByMagneticDefect", method = RequestMethod.GET) | |||
| List<MagneticDefect> findByMagneticDefect (String magneticId){ | |||
| return windingTankRepository.findByMagneticDefect(magneticId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "signature", method = RequestMethod.GET) | |||
| User getUser(Context context, String name) { | |||
| return userRepository.getByName(name); | |||
| // User result = new User(); | |||
| // List<Position> postlist = context.getDepartment().getPositions(); | |||
| // for (Position position : postlist) { | |||
| // Set<User> setuser = position.getUsers(); | |||
| // Iterator<User> it = setuser.iterator(); | |||
| // while(it.hasNext()) { | |||
| // User user = it.next(); | |||
| // if(user.getName().equals(name)) { | |||
| // result = user; | |||
| // } | |||
| // } | |||
| // } | |||
| // return result; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottlePlatenum", method = RequestMethod.GET) | |||
| List<Bottle> getBottleByPlatenum(String platenum) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if(!StringUtil.isNullOrEmpty(platenum)) { | |||
| list = bottleRepository.getBottleByPlatenum(platenum); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "recordStatus", method = RequestMethod.PUT) | |||
| Record recordStatus(String id, Integer status, Context context){ | |||
| return windingTankService.updateRecordStatus(id, status, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "reportStatus", method = RequestMethod.PUT) | |||
| Record reportStatus(String id, Integer status, Context context){ | |||
| return windingTankService.updateReportStatus(id, status, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "recordAndReportStatus", method = RequestMethod.PUT) | |||
| Record recordAndReportStatus(String id, Integer recordStatus, Integer reportStatus, Context context){ | |||
| return windingTankService.updateRecordAndReportStatus(id, recordStatus, reportStatus, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRecordByReportNum", method = RequestMethod.GET) | |||
| List<RecordVo> getRecordByReportNum(String reportNum, String searchStatus){ | |||
| return windingTankRepository.getRecordByReportNum(reportNum, searchStatus); | |||
| } | |||
| // private boolean hasRole(Context context, String roleName) { | |||
| // boolean ret = false; | |||
| // for (Role role : context.getUser().getRoles()) { | |||
| // if (role.getName().equals(roleName)) { | |||
| // ret = true; | |||
| // break; | |||
| // } | |||
| // } | |||
| // return ret; | |||
| // } | |||
| } | |||
| @ -0,0 +1,214 @@ | |||
| package com.ciotea.cdcng.front.application.analysis; | |||
| import com.ciotea.cdcng.front.domain.analysis.repository.AnalysisRepository; | |||
| import com.ciotea.cdcng.front.domain.analysis.vo.AnalysisBottleVo; | |||
| import com.ciotea.cdcng.front.domain.analysis.vo.AnalysisValveVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.*; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Controller | |||
| @RequestMapping(value = "analysis") | |||
| public class AnalysisController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AnalysisRepository analysisRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "analysisBottle", method = RequestMethod.GET) | |||
| List<List<AnalysisBottleVo>> analysis(Context context, String bottleType, String depts[], String testStartDate, String testEndDate, | |||
| String nextTestStartDate, String nextTestEndDate, String reason, String cngType, String owner, String area) { | |||
| if(depts == null || depts.length <= 0){ | |||
| Integer types[] = new Integer[] { 17 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| depts = new String[list.size()]; | |||
| for(int i = 0; i < list.size(); i ++) { | |||
| depts[i] = list.get(i).getId() + ""; | |||
| } | |||
| // throw new AppException("请勾选选择部门"); | |||
| } | |||
| List<List<AnalysisBottleVo>> resList = new ArrayList<List<AnalysisBottleVo>>(); | |||
| Integer status[] = new Integer[]{1,2}; | |||
| for(int i = 0; i<depts.length; i++){ | |||
| AuthorityDepartment dept = repository.get(AuthorityDepartment.class, Integer.parseInt(depts[i])); | |||
| Integer sum = 0; | |||
| List<AnalysisBottleVo> list = analysisRepository.analysisBottle(bottleType, depts[i], testStartDate, testEndDate, nextTestStartDate, nextTestEndDate, reason, cngType, owner, area); | |||
| List<AnalysisBottleVo> tempList = new ArrayList<AnalysisBottleVo>(); | |||
| if(list.size()==0){ | |||
| for(int x = 0; x < 2; x++){ | |||
| AnalysisBottleVo emptyVo = new AnalysisBottleVo(); | |||
| emptyVo.setStatus(x + 1); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setSum(0); | |||
| emptyVo.setCount(0); | |||
| tempList.add(emptyVo); | |||
| } | |||
| resList.add(tempList); | |||
| } else{ | |||
| for(int j = 0; j<2; j++){ | |||
| AnalysisBottleVo emptyVo = new AnalysisBottleVo(); | |||
| emptyVo.setStatus(j + 1); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setCount(0); | |||
| sum = sum + emptyVo.getCount(); | |||
| emptyVo.setSum(sum); | |||
| tempList.add(emptyVo); | |||
| for(int x = 0; x < list.size(); x ++){ | |||
| if(status[j].equals(list.get(x).getStatus())){ | |||
| sum = sum + list.get(x).getCount(); | |||
| tempList.get(j).setStatus(list.get(x).getStatus()); | |||
| tempList.get(j).setCount(list.get(x).getCount()); | |||
| tempList.get(j).setSum(sum); | |||
| tempList.get(j).setDeptName(dept.getDeptName()); | |||
| } | |||
| } | |||
| } | |||
| resList.add(tempList); | |||
| } | |||
| } | |||
| return resList; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportBottleExcel", method = RequestMethod.GET) | |||
| void exportExcel(Context context, String bottleType, String depts[], String testStartDate, String testEndDate, | |||
| String nextTestStartDate, String nextTestEndDate, String reason, String cngType, String owner, String area, HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| List<List<AnalysisBottleVo>> listAll = this.analysis(context, bottleType, depts, testStartDate, testEndDate, nextTestStartDate, nextTestEndDate, reason, cngType, owner, area); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/analysis/bottle/analysis.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| tempRow.createCell(1).setCellValue("合格"); | |||
| tempRow.createCell(2).setCellValue("不合格"); | |||
| tempRow.createCell(3).setCellValue("合计"); | |||
| for(int i = 0;i < listAll.size(); i ++){ | |||
| Row row = sheet.createRow(2 + i); | |||
| row.createCell(0).setCellValue(listAll.get(i).get(0).getDeptName()); | |||
| for(int k = 0;k < listAll.get(i).size(); k++){ | |||
| row.createCell(1 + k).setCellValue(listAll.get(i).get(k).getCount()); | |||
| } | |||
| row.createCell(listAll.get(i).size()+1).setCellValue(listAll.get(i).get(listAll.get(i).size() - 1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(2 + listAll.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| int count0=0; | |||
| int count1=0; | |||
| int count2=0; | |||
| for(int k=0;k<listAll.size();k++){ | |||
| count0 = count0+listAll.get(k).get(0).getCount(); | |||
| count1 = count1+listAll.get(k).get(1).getCount(); | |||
| count2 = count2+listAll.get(k).get(1).getSum(); | |||
| } | |||
| row1.createCell(1).setCellValue(count0); | |||
| row1.createCell(2).setCellValue(count1); | |||
| row1.createCell(3).setCellValue(count2); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("检验气瓶统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "analysisValve", method = RequestMethod.GET) | |||
| List<AnalysisValveVo> analysisValve(Context context, String bottleType, String depts[], String startDate, String endDate, | |||
| String factoryId, String modelId, String area) { | |||
| if(depts == null || depts.length <= 0){ | |||
| Integer types[] = new Integer[] { 17 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| depts = new String[list.size()]; | |||
| for(int i = 0; i < list.size(); i ++) { | |||
| depts[i] = list.get(i).getId() + ""; | |||
| } | |||
| // throw new AppException("请勾选选择部门"); | |||
| } | |||
| List<AnalysisValveVo> resList = new ArrayList<AnalysisValveVo>(); | |||
| for(int i = 0; i < depts.length; i ++){ | |||
| AuthorityDepartment dept = repository.get(AuthorityDepartment.class, Integer.parseInt(depts[i])); | |||
| List<AnalysisValveVo> list = analysisRepository.analysisValve(bottleType, depts[i], startDate, endDate, factoryId, modelId, area); | |||
| if(list.size()==0){ | |||
| AnalysisValveVo emptyVo = new AnalysisValveVo(); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setCount(0); | |||
| resList.add(emptyVo); | |||
| } else{ | |||
| AnalysisValveVo emptyVo = new AnalysisValveVo(); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setCount(list.get(0).getCount()); | |||
| resList.add(emptyVo); | |||
| } | |||
| } | |||
| return resList; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportValveExcel", method = RequestMethod.GET) | |||
| void exportExcel(Context context, String bottleType, String depts[], String startDate, String endDate, | |||
| String factoryId, String modelId, String area, HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| if(modelId != null && modelId.equals("null")) { | |||
| modelId = null; | |||
| } | |||
| List<AnalysisValveVo> listAll = this.analysisValve(context, bottleType, depts, startDate, endDate, factoryId, modelId, area); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/analysis/valve/analysis.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Integer sum = 0; | |||
| for(int i = 0;i < listAll.size(); i++){ | |||
| Row row = sheet.createRow(1 + i); | |||
| row.createCell(0).setCellValue(listAll.get(i).getDeptName()); | |||
| row.createCell(1).setCellValue(listAll.get(i).getCount()); | |||
| sum = sum + listAll.get(i).getCount(); | |||
| } | |||
| // 合计 | |||
| Row sumRow = sheet.createRow(listAll.size() + 1); | |||
| sumRow.createCell(0).setCellValue("合计"); | |||
| sumRow.createCell(1).setCellValue(sum); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("更换瓶阀统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,90 @@ | |||
| package com.ciotea.cdcng.front.application.carInspecting; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.carDataSync.CheckLogRegularVO; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.carDataSync.CngCdCarVO; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.checkLog.CheckLogRepo; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.newTransfer.CarNewTransferRepo; | |||
| import com.fasterxml.jackson.core.JsonProcessingException; | |||
| import com.fasterxml.jackson.databind.ObjectMapper; | |||
| /** | |||
| * 5、定检合格 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping | |||
| public class CarCheckQualifiedController { | |||
| private static final Logger logger = LoggerFactory.getLogger(CarCheckQualifiedController.class); | |||
| @Resource | |||
| private CheckLogRepo checkLogRepo; | |||
| @Resource | |||
| private CarNewTransferRepo carNewTransferRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "/public/car/log/qualified", method = RequestMethod.POST) | |||
| public Map<String, Object> addCngCdCheck(@RequestBody CheckLogRegularVO bean, String token) throws JsonProcessingException { | |||
| Map<String, Object> map = tokenVerify(token); | |||
| if (map.get("message") != null) { | |||
| return map; | |||
| } | |||
| if (bean == null) { | |||
| map.put("message", "请传入气瓶信息"); | |||
| return map; | |||
| } | |||
| String vin = bean.getVin(); | |||
| if (StringUtils.isEmpty(vin)) { | |||
| map.put("message", "请传入车架号"); | |||
| return map; | |||
| } | |||
| List<CngCdCarVO> cars = carNewTransferRepo.getCngCdCarOwnerVin(null, vin); | |||
| if (cars.isEmpty()) { | |||
| map.put("message", "根据车架号未获取到车辆信息"); | |||
| return map; | |||
| } | |||
| bean.setCar_id(cars.get(0).getId()); | |||
| try { | |||
| checkLogRepo.addCheck(bean.getNextCheckDate(), bean); | |||
| map.put("state", "成功"); | |||
| } catch (Exception e) { | |||
| String beanStr = new ObjectMapper().writeValueAsString(bean); | |||
| logger.error("添加异常1:" + beanStr + e.getMessage(), e.getMessage()); | |||
| logger.error("添加异常2:" + beanStr + e, e.getMessage()); | |||
| map.put("message", e.getMessage()); | |||
| return map; | |||
| } | |||
| return map; | |||
| } | |||
| private Map<String, Object> tokenVerify(String token) { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| map.put("state", "失败"); | |||
| if (StringUtils.isEmpty(token)) { | |||
| map.put("message", "请传入token令牌"); | |||
| return map; | |||
| } | |||
| if (!CngCdCarVO.TOKEN.equals(token)){ | |||
| map.put("message", "令牌出错"); | |||
| return map; | |||
| } | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,126 @@ | |||
| package com.ciotea.cdcng.front.application.carInspecting; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.carDataSync.BottleVO; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.carDataSync.CngCdCarVO; | |||
| import com.ciotea.cdcng.front.domain.carInspecting.newTransfer.CarNewTransferRepo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.fasterxml.jackson.core.JsonProcessingException; | |||
| import com.fasterxml.jackson.databind.ObjectMapper; | |||
| /** | |||
| * 2、新车登记 | |||
| * 特检院系统-往cng传输新车 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping | |||
| public class CarNewTransferController { | |||
| private static final Logger logger = LoggerFactory.getLogger(CarNewTransferController.class); | |||
| @Resource | |||
| private CarNewTransferRepo carNewTransferRepo; | |||
| @Resource | |||
| private CngCdCarStrategy cngCdCarStrategy; | |||
| /** | |||
| * 存入车辆和车主信息 | |||
| * @param bean | |||
| * @param token | |||
| * @return | |||
| * @throws JsonProcessingException | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "/public/car-transfer/car/", method = RequestMethod.POST) | |||
| public Map<String, Object> addCngCdCar(@RequestBody CngCdCarVO bean, String token) throws JsonProcessingException { | |||
| Map<String, Object> map = tokenVerify(token); | |||
| if (map.get("message") != null) { | |||
| return map; | |||
| } | |||
| try { | |||
| carNewTransferRepo.addCngCdCar(bean, map); | |||
| } catch (Exception e) { | |||
| String beanStr = new ObjectMapper().writeValueAsString(bean); | |||
| map.put("state", "失败"); | |||
| logger.error("添加异常:" + beanStr, e.getMessage()); | |||
| map.put("message", e.getMessage()); | |||
| return map; | |||
| } | |||
| return map; | |||
| } | |||
| /** | |||
| * 存入气瓶信息 | |||
| * @param bean | |||
| * @param token | |||
| * @return | |||
| * @throws JsonProcessingException | |||
| */ | |||
| /*@ResponseBody | |||
| @RequestMapping(value = "/public/car-transfer/bottle", method = RequestMethod.POST) | |||
| public Map<String, Object> addCngCdBottle(@RequestBody BottleVO bean, String token) throws JsonProcessingException { | |||
| Map<String, Object> map = tokenVerify(token); | |||
| if (map.get("message") != null) { | |||
| return map; | |||
| } | |||
| try { | |||
| carNewTransferRepo.addCngCdBottle(bean, map); | |||
| } catch (Exception e) { | |||
| String beanStr = new ObjectMapper().writeValueAsString(bean); | |||
| logger.error("添加气瓶信息异常:" + beanStr, e.getMessage()); | |||
| map.put("state", "失败"); | |||
| map.put("message", "编辑车辆信息异常:" + e.getMessage()); | |||
| return map; | |||
| } | |||
| return map; | |||
| }*/ | |||
| /** | |||
| * 根据车牌号或车架号,获取车辆、车主、气瓶信息 | |||
| * @param vin 车辆车架号 | |||
| * @param platenum 车辆车牌号 | |||
| * @param token | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "/public/car-transfer/car-owner", method = RequestMethod.GET) | |||
| public Map<String, Object> getCngCdCarOrOwner(String platenum, String vin, String token) { | |||
| Map<String, Object> map = tokenVerify(token); | |||
| if (map.get("message") != null) { | |||
| return map; | |||
| } | |||
| map.put("state", "成功"); | |||
| map.put("message", carNewTransferRepo.getCngCdCarOwnerVin(platenum, vin)); | |||
| return map; | |||
| } | |||
| private Map<String, Object> tokenVerify(String token) { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| map.put("state", "失败"); | |||
| if (StringUtils.isEmpty(token)) { | |||
| map.put("message", "请传入token令牌"); | |||
| return map; | |||
| } | |||
| if (!CngCdCarVO.TOKEN.equals(token)){ | |||
| map.put("message", "令牌出错"); | |||
| return map; | |||
| } | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,138 @@ | |||
| package com.ciotea.cdcng.front.application.carManage; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.util.Date; | |||
| import java.util.LinkedHashMap; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import com.ciotea.cdcng.front.application.mobile.Pagination; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelReportColumn; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelReportVo; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelUtil; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.Setupcheck; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.SetupCheckRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.vo.SetupcheckExportView; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| /** | |||
| * 车管所 - 监检通过的车辆信息 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "carManage") | |||
| public class CarManageController { | |||
| @Resource | |||
| SetupCheckRepository setupcheckRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "setupchecks", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getSetupcheck(String platenum, String vin, String dept, String startTime, String endTime, infrastructure.support.records.Pagination pagination) { | |||
| return pagination.setRows(setupcheckRepository.getSetupcheckPaginationByCarManage(platenum, vin, dept, 5, startTime, endTime, pagination)); | |||
| } | |||
| /** | |||
| * 获取改装单位 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "dept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getDept() { | |||
| Integer[] st = {22}; | |||
| return deptRepository.findByDeptTypes(st); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "setupid", method = RequestMethod.GET) | |||
| Setupcheck findSetupcheckById(Integer id) { | |||
| return setupcheckRepository.findSetupcheckById(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottle(Integer carid) { | |||
| return bottleRepository.findBottleById(carid); | |||
| } | |||
| /** | |||
| * 导出 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| // vGasRecords/getSetupcheckExcel | |||
| @RequestMapping(value = "getExcel", method = RequestMethod.GET) | |||
| public void exportExcel(String platenum, String vin, Integer dept, String startTime, String endTime, infrastructure.support.records.Pagination pagination, HttpServletResponse response) { | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = getExportExcel(platenum, vin, dept, startTime, endTime, pagination) ; | |||
| String title = "车辆信息列表.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| private ExcelReportVo getExportExcel(String platenum, String vin, Integer dept, String startTime, String endTime, infrastructure.support.records.Pagination pagination) { | |||
| List<SetupcheckExportView> list = setupcheckRepository.getSetupcheckExport(platenum, vin, dept, 5, startTime, endTime); | |||
| LinkedHashMap<String, ExcelReportColumn> headerMap = new LinkedHashMap<String, ExcelReportColumn>(); | |||
| String title = "车辆信息列表"; | |||
| headerMap.put("platenum", new ExcelReportColumn("车辆牌号", ExcelReportColumn.ALIGN_LEFT, 3000)); | |||
| headerMap.put("vin", new ExcelReportColumn("车架号", ExcelReportColumn.ALIGN_LEFT, 4000)); | |||
| headerMap.put("engineid", new ExcelReportColumn("发动机号", ExcelReportColumn.ALIGN_LEFT, 3000)); | |||
| headerMap.put("pcolor", new ExcelReportColumn("号牌颜色", ExcelReportColumn.ALIGN_LEFT, 2000)); | |||
| headerMap.put("modelDict", new ExcelReportColumn("厂牌型号", ExcelReportColumn.ALIGN_LEFT, 4000)); | |||
| headerMap.put("ownerName", new ExcelReportColumn("车主 / 公司", ExcelReportColumn.ALIGN_LEFT, 7000)); | |||
| headerMap.put("ownerIdCard", new ExcelReportColumn("身份证号 / 组织机构代码", ExcelReportColumn.ALIGN_LEFT, 6000)); | |||
| headerMap.put("address", new ExcelReportColumn("地址", ExcelReportColumn.ALIGN_LEFT, 10000)); | |||
| headerMap.put("phone", new ExcelReportColumn("电话", ExcelReportColumn.ALIGN_CENTER, 3000)); | |||
| headerMap.put("code", new ExcelReportColumn("登记证号", ExcelReportColumn.ALIGN_CENTER, 3000)); | |||
| headerMap.put("deptName", new ExcelReportColumn("安装单位", ExcelReportColumn.ALIGN_LEFT, 7000)); | |||
| headerMap.put("bottleNum", new ExcelReportColumn("安装数量", ExcelReportColumn.ALIGN_CENTER, 3000)); | |||
| headerMap.put("issueOrg", new ExcelReportColumn("发证机构", ExcelReportColumn.ALIGN_LEFT, 5000)); | |||
| headerMap.put("issueDate", new ExcelReportColumn("发证日期", ExcelReportColumn.ALIGN_CENTER, 3000)); | |||
| headerMap.put("setupCode", new ExcelReportColumn("监检编号", ExcelReportColumn.ALIGN_LEFT, 4000)); | |||
| headerMap.put("approveDate", new ExcelReportColumn("批准日期", ExcelReportColumn.ALIGN_CENTER, 3000)); | |||
| headerMap.put("area", new ExcelReportColumn("区域", ExcelReportColumn.ALIGN_CENTER, 2000)); | |||
| ExcelReportVo exlRpt = new ExcelReportVo(); | |||
| exlRpt.setTitle(title); | |||
| exlRpt.setHeaders(headerMap); | |||
| exlRpt.setDatalist(list); | |||
| exlRpt.setSummaryName(null); | |||
| exlRpt.setSummaryColumn(null); | |||
| return exlRpt; | |||
| } | |||
| } | |||
| @ -0,0 +1,153 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Order; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.entity.CarImport; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.repository.CarImportRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| /** | |||
| * 加气属性认定 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "carPremises") | |||
| public class AeratedAttributeController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| CarImportRepository carImportRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "aeratedAttribute", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCars(CngCdCar vo, infrastructure.support.records.Pagination pagination, Context context) { | |||
| // List<Department> list = new ArrayList<Department>(); | |||
| // Department sysDept = context.getPosition().getDepartment();// 系统部门表对象 | |||
| // recurrence(list, sysDept); | |||
| // List<Integer> listType = new ArrayList<Integer>(); | |||
| // for(Department department : list){ | |||
| // AuthorityDepartment authorityDepartment = | |||
| // authorityDepartmentRepository.findByMemo(department.getId()); | |||
| // if(null!=authorityDepartment){ | |||
| // listType.add(authorityDepartment.getId()); | |||
| // } | |||
| // } | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(carStrategy.getAeratedAttributes(vo, permissionFilter, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "cngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getAll() { | |||
| List<CngTypeDict> list = repository.getAll(CngTypeDict.class, Order.asc("id")); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "cngTypeDict", method = RequestMethod.PUT) | |||
| void updateCngTypeDict(String id, String value,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| if (!StringUtil.isNullOrEmpty(value)) { | |||
| CngCdCar cngCdCar = repository.get(CngCdCar.class, Integer.parseInt(id)); | |||
| CngTypeDict cngTypeDict = repository.get(CngTypeDict.class, Integer.parseInt(value)); | |||
| if(cngTypeDict.getCngType().equals("1") || cngTypeDict.getCngType().equals("7") || cngTypeDict.getCngType().equals("3") ){ | |||
| List<CarImport> list = carImportRepository.findByPlateNumVin(cngCdCar.getPlatenum(), cngCdCar.getVin()); | |||
| //carimport不为空 | |||
| if(list.size()>0){ | |||
| //如果该审核状态为通过,则修改加气属性 | |||
| if( list.get(0).getAuditType().equals("2") ){ | |||
| cngCdCar.setCngTypeDict(cngTypeDict); | |||
| // cngCdCar.setIsorig("0"); | |||
| if(dept!=null) | |||
| cngCdCar.setAuthDeptid(dept); | |||
| if(cngUser!=null) | |||
| cngCdCar.setCngUser(cngUser); | |||
| repository.save(cngCdCar); | |||
| } | |||
| //如果该审核状态为未通过,则提示 | |||
| else{ | |||
| throw new AppException("相关处室还未审核"); | |||
| } | |||
| } | |||
| else{ | |||
| throw new AppException("车辆信息未导入"); | |||
| } | |||
| }else{ | |||
| cngCdCar.setCngTypeDict(cngTypeDict); | |||
| cngCdCar.setIsorig("0"); | |||
| if(dept!=null) | |||
| cngCdCar.setAuthDeptid(dept); | |||
| if(cngUser!=null) | |||
| cngCdCar.setCngUser(cngUser); | |||
| repository.save(cngCdCar); | |||
| } | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarById", method = RequestMethod.GET) | |||
| CngCdCar getCar(Integer id) { | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| return car; | |||
| } | |||
| // public void recurrence(List<Department> depts, Department dep) { | |||
| // depts.add(dep); | |||
| // if(dep.getChildren().size() > 0) { | |||
| // for(Department d : dep.getChildren()) { | |||
| // recurrence(depts, d); | |||
| // } | |||
| // } | |||
| // } | |||
| } | |||
| @ -0,0 +1,147 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.AreaRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.BottleCert; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.BottleCertRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Order; | |||
| /** | |||
| * 车辆信息查询 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "carInfo") | |||
| public class CarInfoController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AreaRepository areaRepository; | |||
| @Resource | |||
| BottleCertRepository bottleCertRepository; | |||
| @Resource | |||
| private LogOperation logOperation; | |||
| @ResponseBody | |||
| @RequestMapping(value = "carList", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCars(CngCdCar vo, Context context, Integer dict, Integer dept, Integer area_dict, infrastructure.support.records.Pagination pagination) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| if(context.getUser().getUsername().equals("cngpublic")){ | |||
| pagination.setRows(carStrategy.publicUserCarInfo(vo.getPlatenum(), vo.getVin())); | |||
| }else{ | |||
| pagination.setRows(carStrategy.getCngCdCar(vo, permissionFilter, pagination, dict, dept, area_dict)); | |||
| } | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "cngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts(Context context) { | |||
| List<CngTypeDict> list = new ArrayList<CngTypeDict>(); | |||
| boolean cancel = false; | |||
| if( context.getDepartment().getDeptType() != null ){ | |||
| if( context.getDepartment().getDeptType().getId()==24 ){//交委 | |||
| cancel = true; | |||
| } | |||
| } | |||
| if(cancel){ | |||
| list = carStrategy.getCancelList(); | |||
| }else{ | |||
| list = repository.getAll(CngTypeDict.class, Order.asc("id")); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "regDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] { 17, 22 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "areaDict", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts() { | |||
| // List<AreaDict> list = repository.getAll(AreaDict.class, Order.asc("id")); | |||
| List<AreaDict> list = areaRepository.getAll(); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottles(Integer carId) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if(null != carId){ | |||
| list = bottleRepository.getBottleByCarId(carId); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarById", method = RequestMethod.GET) | |||
| CngCdCar getCar(Integer id) { | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| return car; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "carState", method = RequestMethod.PUT) | |||
| void updateCarState(Integer id, Context context) { | |||
| BottleCert bottleCert = bottleCertRepository.getUseing(id); | |||
| if(bottleCert == null) { | |||
| throw new AppException("该车辆没有正在使用的气瓶使用登记证,请先绑定!"); | |||
| } else { | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| car.setCarState(4); | |||
| repository.save(car); | |||
| logOperation.saveCngcdCarLog(car, context.getUser().getUsername(), Operations.UPDATE, "气瓶使用登记证绑定模块中,修改车辆状态为已绑定气瓶使用登记证"); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,87 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import java.util.Date; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carPremises.cleanCarRefitting.CleanCarRefittingRepo; | |||
| import com.ciotea.cdcng.front.domain.carPremises.makeQRCode.service.MakeQRCodeService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.exception.AppException; | |||
| @Controller | |||
| @RequestMapping(value = "cleanCarRefitting") | |||
| public class CleanCarRefittingController { | |||
| @Resource | |||
| private CleanCarRefittingRepo carRefittingRepo; | |||
| @Resource | |||
| private CngUserRepository cngUserRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| MakeQRCodeService makeQRCodeService; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "list", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCleanCarRefitting(infrastructure.support.records.Pagination pagination, Context context, String platenum, Integer search_ref, Integer search_refstatus) { | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(), context.getDistrict()); | |||
| // 如果是成都市改装管理部门不做区县过滤 | |||
| String areaId = ""; | |||
| if(!context.getDistrict().getCode().equals("510100")) { | |||
| // districtCode = context.getDistrict().getCode(); | |||
| // districtId = districtRepository.getDistrictWithCode(districtCode, "").getId(); | |||
| // AreaDict area = districtRepository.getAreaDictByDisId(districtId); | |||
| // areaId = area.getId() + ""; | |||
| areaId = context.getDistrict().getAreaDict().getId() + ""; | |||
| } | |||
| pagination.setRows(carRefittingRepo.getCleanCarRefitting(areaId, pagination, platenum.trim(), search_ref)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "pass", method = RequestMethod.PUT) | |||
| void pass(Integer id, Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| if(car == null){ | |||
| throw new AppException("该改装证信息处于不可核发状态,请先申请改装"); | |||
| } | |||
| if(car.getRefitState() == -1) { | |||
| throw new AppException("该车辆信息处于驳回状态,请先通知改装厂进行气瓶更换操作"); | |||
| } | |||
| if(dept != null){ | |||
| car.setAuthDeptid(dept); | |||
| } | |||
| if(cngUser != null){ | |||
| car.setCngUser(cngUser); | |||
| car.setDateUpdate(new Date()); | |||
| } | |||
| makeQRCodeService.addMakeQRCodeByCngcdCar(car); | |||
| } | |||
| } | |||
| @ -0,0 +1,43 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carPremises.maintainRecord.entity.MaintainRecord; | |||
| import com.ciotea.cdcng.front.domain.carPremises.maintainRecord.repository.MaintainRecordRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "maintainRecord") | |||
| public class MaintainRecordController { | |||
| @Resource | |||
| MaintainRecordRepository maintainRecordRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "maintainRecords", method = RequestMethod.GET) | |||
| Pagination getRefitinquirys(MaintainRecord vo, Pagination pagination, Context context, String platenum, String vin, Integer search_ref) { | |||
| if(context.getUser().getUsername().equals("cngpublic")){ | |||
| pagination.setRows(maintainRecordRepository.publicMaintainRecords(platenum, vin)); | |||
| }else{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(maintainRecordRepository.getMaintainRecords(vo, permissionFilter, pagination, platenum.trim(), search_ref)); | |||
| } | |||
| return pagination; | |||
| } | |||
| } | |||
| @ -0,0 +1,272 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carPremises.makeQRCode.entity.MakeQRCode; | |||
| import com.ciotea.cdcng.front.domain.carPremises.makeQRCode.repository.MakeQRCodeRepository; | |||
| import com.ciotea.cdcng.front.domain.carPremises.makeQRCode.service.MakeQRCodeService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelReportVo; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelUtil; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.vo.BottleView; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CarTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.PlateTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.entity.Vender; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Order; | |||
| import infrastructure.support.records.Pagination; | |||
| /** | |||
| * 二维码 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "makeQRCode") | |||
| public class MakeQRCodeController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| MakeQRCodeRepository makeQRCodeRepository; | |||
| @Resource | |||
| MakeQRCodeService makeQRCodeService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| private LogOperation logOperation; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @ResponseBody | |||
| @RequestMapping(value = "QRCodes", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCars(MakeQRCode vo, infrastructure.support.records.Pagination pagination, Context context, Integer search_ref, String search_refStatus, String start_refitDate, String end_refitDate) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // 如果是成都市改装管理部门不做区县过滤 | |||
| // String districtCode = ""; | |||
| String districtId = ""; | |||
| if(!context.getDistrict().getCode().equals("510100")) { | |||
| // districtCode = context.getDistrict().getCode(); | |||
| // districtId = districtRepository.getDistrictWithCode(districtCode, "").getId(); | |||
| districtId = context.getDistrict().getAreaDict().getId() + ""; | |||
| } | |||
| pagination.setRows(makeQRCodeRepository.getQRCodes(vo, districtId, pagination, search_ref, search_refStatus, start_refitDate, end_refitDate)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "makeQRCode", method = RequestMethod.POST) | |||
| MakeQRCode addMakeQRCode(MakeQRCode makeQRCode, Context context) { | |||
| // CngUser cngUser = | |||
| // cngUserRepository.findByUserNameOrSysUserID(context.getUser().getUsername(),context.getUser().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| if (null != cngUser) { | |||
| makeQRCode.setRegUserId(cngUser.getId()); | |||
| } | |||
| if (null != context.getPosition().getDepartment()) { | |||
| makeQRCode.setRegDept(authorityDepartmentRepository.findByMemo(context.getPosition().getDepartment().getId())); | |||
| } else { | |||
| makeQRCode.setRegDept(repository.get(AuthorityDepartment.class, 36)); | |||
| } | |||
| makeQRCode.setDateJoined(new Date()); | |||
| makeQRCode.setRowState(1); | |||
| makeQRCode.setPstate("0"); | |||
| // makeQRCode.setSecCode(makeQRCodeMeth(makeQRCode)); | |||
| return makeQRCodeService.addMakeQRCode(makeQRCode); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "makeQRCode", method = RequestMethod.PUT) | |||
| MakeQRCode editMakeQRCode(MakeQRCode makeQRCode, Context context) { | |||
| MakeQRCode org = repository.get(MakeQRCode.class, makeQRCode.getId()); | |||
| if(!org.getPstate().equals("0") ){ | |||
| throw new AppException("请先选中要修改的数据"); | |||
| } | |||
| // 新增修改后的数据 | |||
| makeQRCode.setDateJoined(org.getDateJoined()); | |||
| makeQRCode.setDateUpdate(new Date()); | |||
| makeQRCode.setId(null); | |||
| makeQRCode.setRowState(1); | |||
| makeQRCode.setRegUserId(org.getRegUserId()); | |||
| makeQRCode.setRegDept(org.getRegDept()); | |||
| makeQRCode.setPstate("0"); | |||
| // makeQRCode.setSecCode(makeQRCodeMeth(makeQRCode)); | |||
| return makeQRCodeService.editMakeQRCode(makeQRCode, org, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "makeQRCode", method = RequestMethod.DELETE) | |||
| void delMakeQRCode(Integer id, Context context) { | |||
| MakeQRCode makeQRCode = repository.get(MakeQRCode.class, id); | |||
| // -- old | |||
| // List<MakeQRCode> list = makeQRCodeRepository.findByVin(makeQRCode.getVin(), 2, makeQRCode.getPlatenum()); | |||
| // if (list.size() == 0) { | |||
| // MakeQRCode newBean = makeQRCode; | |||
| // newBean.setRowState(2); | |||
| // newBean.setId(null); | |||
| // MakeQRCode bean = repository.get(MakeQRCode.class, id); | |||
| // repository.remove(bean); | |||
| // repository.save(newBean); | |||
| // return; | |||
| // } | |||
| // repository.remove(makeQRCode); | |||
| String platenum = makeQRCode.getPlatenum(); | |||
| makeQRCode.setRowState(2); | |||
| repository.save(makeQRCode); | |||
| CngCdCar car = carStrategy.findByPlatenum(platenum); | |||
| car.setIsMakeQRCode(0); | |||
| repository.save(car); | |||
| logOperation.saveMangecarLog(makeQRCode, context.getUser().getUsername(), Operations.DELETE, ""); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "completeQRCode", method = RequestMethod.PUT) | |||
| void completeQRCode(Integer id, Context context) { | |||
| MakeQRCode makeQRCode = repository.get(MakeQRCode.class, id); | |||
| makeQRCode.setPstate("2"); | |||
| makeQRCode.setDateUpdate(new Date()); | |||
| repository.save(makeQRCode); | |||
| logOperation.saveMangecarLog(makeQRCode, context.getUser().getUsername(), Operations.UPDATE, "修改打印状态为已完成"); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "printQRCode", method = RequestMethod.PUT) | |||
| void printQRCode(Integer id, Context context) { | |||
| MakeQRCode makeQRCode = repository.get(MakeQRCode.class, id); | |||
| makeQRCode.setPstate("1"); | |||
| makeQRCode.setDateUpdate(new Date()); | |||
| repository.save(makeQRCode); | |||
| logOperation.saveMangecarLog(makeQRCode, context.getUser().getUsername(), Operations.UPDATE, "修改打印状态为已打印"); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "plateTypeDict", method = RequestMethod.GET) | |||
| List<PlateTypeDict> getPlateTypeDicts() { | |||
| List<PlateTypeDict> list = repository.getAll(PlateTypeDict.class, Order.asc("id")); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "carTypeDict", method = RequestMethod.GET) | |||
| List<CarTypeDict> getCarTypeDicts() { | |||
| return repository.getAll(CarTypeDict.class, Order.asc("id")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] { 22 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "venders", method = RequestMethod.GET) | |||
| List<Vender> getVenders() { | |||
| return repository.getAll(Vender.class, Order.asc("id")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "qrcode", method = RequestMethod.GET) | |||
| MakeQRCode getQrcode(Integer id) { | |||
| MakeQRCode code = repository.get(MakeQRCode.class, id); | |||
| return code; | |||
| } | |||
| /** | |||
| * 导出二维码列 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| // vGasRecords/getSetupcheckExcel | |||
| @RequestMapping(value = "getExcel", method = RequestMethod.GET) | |||
| public void exportExcel(MakeQRCode vo, infrastructure.support.records.Pagination pagination, Context context, Integer search_ref, String search_refStatus, String start_refitDate, String end_refitDate, HttpServletResponse response) { | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = makeQRCodeService.getExportExcel(vo, pager, context, search_ref, search_refStatus, start_refitDate, end_refitDate) ; | |||
| String title = "二维码列表.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| /** | |||
| * 得到气瓶 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottle", method = RequestMethod.GET) | |||
| List<BottleView> getbottleByCar(Integer carid){ | |||
| return airBottleRepository.getBottlesByCarMybatis(carid); | |||
| } | |||
| } | |||
| @ -0,0 +1,114 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.service.RefitService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 已审核清洁汽车改装证 | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "refitIssuance") | |||
| public class RefitIssuanceController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| RefitService refitService; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitIssuances", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getRefitIssuances(Refit vo, infrastructure.support.records.Pagination pagination, Context context, String platenum, Integer search_ref, String start_approveDate,String end_approveDate) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // 如果是成都市改装管理部门不做区县过滤 | |||
| // String districtCode = ""; | |||
| String districtId = ""; | |||
| if(!context.getDistrict().getCode().equals("510100")) { | |||
| // districtCode = context.getDistrict().getCode(); | |||
| // districtId = districtRepository.getDistrictWithCode(districtCode, "").getId(); | |||
| districtId = context.getDistrict().getAreaDict().getId() + ""; | |||
| } | |||
| pagination.setRows(refitRepository.getRefitIssuance(vo, districtId, pagination, platenum, search_ref,start_approveDate,end_approveDate)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "overrule", method = RequestMethod.PUT) | |||
| void overrule(Refit refit,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| Refit refitbean = repository.get(Refit.class, refit.getId()); | |||
| refitbean.setApproveMsg(refit.getApproveMsg()); | |||
| refitbean.setRefitStatus(6); | |||
| if(dept!=null) | |||
| refitbean.setTouchDeptId(dept.getId()); | |||
| if(cngUser!=null) | |||
| refitbean.setTouchUserId(cngUser.getId()); | |||
| refitbean.setDateUpdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); | |||
| CngCdCar cngCdCar = refitbean.getCar(); | |||
| cngCdCar.setCarState(1); | |||
| cngCdCar.setRefitState(6); | |||
| if(dept!=null) | |||
| cngCdCar.setAuthDeptid(dept); | |||
| if(cngUser!=null) | |||
| cngCdCar.setCngUser(cngUser); | |||
| refitService.overrule(refitbean, cngCdCar); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRefitById", method = RequestMethod.GET) | |||
| Refit getRefit(Integer id) { | |||
| Refit refit = repository.get(Refit.class, id); | |||
| return refit; | |||
| } | |||
| } | |||
| @ -0,0 +1,41 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "refitScrapped") | |||
| public class RefitScrappedController { | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitScrappeds", method = RequestMethod.GET) | |||
| Pagination getRefitScrapped(Refit vo, Pagination pagination, Context context, String platenum, String refitNum, Integer search_ref) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(refitRepository.getRefitScrapped(vo, permissionFilter, pagination, platenum.trim(), refitNum.trim(), search_ref)); | |||
| return pagination; | |||
| } | |||
| } | |||
| @ -0,0 +1,116 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import infrastructure.support.records.Order; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.WorkingTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 改装信息查询 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "refitinquiry") | |||
| public class RefitinquiryController { | |||
| private SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquirys", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getRefitinquirys(Refit vo, infrastructure.support.records.Pagination pagination, Context context, String platenum, Integer search_ref, Integer search_refStatus, String start_refitDate, String end_refitDate,Integer search_working) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(refitRepository.getRefits(vo, permissionFilter, pagination, platenum, search_ref, search_refStatus, start_refitDate, end_refitDate,search_working)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] { 22 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "working", method = RequestMethod.GET) | |||
| List<WorkingTypeDict> getWorkings() { | |||
| return repository.getAll(WorkingTypeDict.class, Order.asc("id")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottles(Integer carId) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if(null != carId){ | |||
| list = bottleRepository.getBottleByCarId(carId); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="defaultSearch" , method= RequestMethod.GET) | |||
| Map<String,String> defaultSearch(){ | |||
| Map<String,String> map = new HashMap<String,String>(); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 6); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf.format(date); | |||
| String endDate = sdf.format(new Date()); | |||
| map.put("startDate", beginDate); | |||
| map.put("endDate", endDate); | |||
| return map; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRefitById", method = RequestMethod.GET) | |||
| Refit getRefit(Integer id) { | |||
| Refit refit = repository.get(Refit.class, id); | |||
| return refit; | |||
| } | |||
| } | |||
| @ -0,0 +1,156 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.service.RefitService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 清洁汽车改装证核发 | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "refitthrough") | |||
| public class RefitthroughController { | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CngCdCarStrategy cngCdCarStrategy; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| RefitService refitService; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitthroughs", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getRefitIssuances(infrastructure.support.records.Pagination pagination, Context context, String platenum, Integer search_ref, Integer search_refstatus) { | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // 如果是成都市改装管理部门不做区县过滤 | |||
| // String districtCode = ""; | |||
| String districtId = ""; | |||
| if(!context.getDistrict().getCode().equals("510100")) { | |||
| // districtCode = context.getDistrict().getCode(); | |||
| // districtId = districtRepository.getDistrictWithCode(districtCode, "").getId(); | |||
| districtId = context.getDistrict().getAreaDict().getId() + ""; | |||
| } | |||
| pagination.setRows(cngCdCarStrategy.getRefitthroughs(districtId, pagination, platenum.trim(), search_ref)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "pass", method = RequestMethod.PUT) | |||
| void pass(Integer id,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| if(car.getRefitState()!=2 && car.getRefitState()!=3){ | |||
| throw new AppException("该改装证信息处于不可核发状态,请先申请改装"); | |||
| } | |||
| car.setRefitState(5); | |||
| if(dept!=null) | |||
| car.setAuthDeptid(dept); | |||
| if(cngUser!=null) { | |||
| car.setCngUser(cngUser); | |||
| } | |||
| car.setDateUpdate(new Date()); | |||
| car.setIsPassRefit(1); | |||
| Refit refitbean = refitRepository.getRefitAllCar(id); | |||
| if(cngUser!=null) | |||
| refitbean.setPerson(cngUser.getId()); | |||
| refitbean.setApproveDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); | |||
| if(dept!=null) | |||
| refitbean.setTouchDeptId(dept.getId()); | |||
| refitbean.setTouchDeptId(dept.getId()); | |||
| // if(cngUser!=null) | |||
| refitbean.setRefitStatus(5); | |||
| refitbean.setDateUpdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); | |||
| refitService.pass(refitbean, car); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "unpass", method = RequestMethod.PUT) | |||
| void unpass(CngCdCar CngCdCar,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| CngCdCar car = repository.get(CngCdCar.class, CngCdCar.getId()); | |||
| if(car.getRefitState()!=2 && car.getRefitState()!=3){ | |||
| throw new AppException("该改装证信息处于不可核发状态"); | |||
| } | |||
| car.setCarState(1); | |||
| car.setRefitState(6); | |||
| if(dept!=null) | |||
| car.setAuthDeptid(dept); | |||
| if(cngUser!=null) | |||
| car.setCngUser(cngUser); | |||
| car.setDateUpdate(new Date()); | |||
| Refit refitbean = refitRepository.getRefitAllCar(CngCdCar.getId()); | |||
| refitbean.setRefitStatus(6); | |||
| if(dept!=null) | |||
| refitbean.setTouchDeptId(dept.getId()); | |||
| if(cngUser!=null) | |||
| refitbean.setTouchUserId(cngUser.getId()); | |||
| refitbean.setApproveMsg(CngCdCar.getApproveMsg()); | |||
| if(cngUser!=null) | |||
| refitbean.setPerson(cngUser.getId()); | |||
| if (null != cngUser) { | |||
| refitbean.setPerson(cngUser.getId()); | |||
| } | |||
| refitService.unpass(refitbean, car); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarById", method = RequestMethod.GET) | |||
| CngCdCar getCar(Integer id) { | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| Refit refit = refitRepository.getRefitByCarId(car.getId()); | |||
| car.setOverruleDate(refit.getOverruleDate()); | |||
| car.setOverruleMsg(refit.getOverruleMsg()); | |||
| car.setOverruleUser(refit.getOverruleUser()); | |||
| return car; | |||
| } | |||
| } | |||
| @ -0,0 +1,93 @@ | |||
| package com.ciotea.cdcng.front.application.carPremises; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carPremises.refittingCarOut.RefittingCarOutRepo; | |||
| import com.ciotea.cdcng.front.domain.carPremises.refittingCarOut.RefittingCarOutService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value = "refittingCarOut") | |||
| public class RefittingCarOutController { | |||
| @Resource | |||
| private RefittingCarOutRepo refittingCarOutRepo; | |||
| @Resource | |||
| private CngUserRepository cngUserRepository; | |||
| @Resource | |||
| private AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| private RefittingCarOutService refittingCarOutService; | |||
| @ResponseBody | |||
| @RequestMapping(value="list", method = RequestMethod.GET) | |||
| Pagination getRefittingCarList(CngCdCar bean, Integer search_ref, Context context, Pagination pagination){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(refittingCarOutRepo.getList(permissionFilter, bean, search_ref, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="logouts", method = RequestMethod.PUT) | |||
| CngCdCar logoutCar(CngCdCar car, Context context) { | |||
| CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| AuthorityDepartment dept = deptRepository.findByMemo(context.getDepartment().getId()); | |||
| car.setCngUser(user); | |||
| if(dept!=null){ | |||
| car.setAuthDeptid(dept); | |||
| } | |||
| return refittingCarOutService.logoutCar(car); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottleByCarId(Integer id) { | |||
| return refittingCarOutRepo.findBottleById(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="logoutCars", method = RequestMethod.GET) | |||
| Pagination getCngcdCarByOut(CngCdCar bean, Context context, Pagination pagination){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(refittingCarOutRepo.getCngcdCarByOut(permissionFilter, bean, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="logoutBottles", method = RequestMethod.GET) | |||
| List<Bottle> getLogoutBottlesByCarId(Integer id) { | |||
| return refittingCarOutRepo.findBottleByCarId(id,4); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="regain", method = RequestMethod.PUT) | |||
| CngCdCar regain(CngCdCar car, Context context) { | |||
| CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| AuthorityDepartment dept = deptRepository.findByMemo(context.getDepartment().getId()); | |||
| car.setCngUser(user); | |||
| if(dept!=null){ | |||
| car.setAuthDeptid(dept); | |||
| } | |||
| return refittingCarOutService.regainCar(car); | |||
| } | |||
| } | |||
| @ -0,0 +1,816 @@ | |||
| package com.ciotea.cdcng.front.application.chart; | |||
| import infrastructure.spring.web.cache.ResponseBodyCacheManager; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.utils.StringUtil; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.text.ParseException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Timer; | |||
| import java.util.TimerTask; | |||
| import javax.annotation.PostConstruct; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.carChart.repository.CarChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.carChart.service.CarChartService; | |||
| import com.ciotea.cdcng.front.domain.chart.carChart.vo.CarVo; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.service.CarUseService; | |||
| import com.ciotea.cdcng.front.domain.chart.checkChart.repository.CheckChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.checkChart.service.CheckChartService; | |||
| import com.ciotea.cdcng.front.domain.chart.checkChart.vo.CheckVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.AreaVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.DayGasVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.StationVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.TypeVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.YearGasVo; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.repository.TagChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.service.TagChartService; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.vo.CreateTagVo; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.vo.DateTagVo; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.vo.RemoveTagVo; | |||
| import com.ciotea.cdcng.front.domain.chart.tagChart.vo.TagVo; | |||
| import com.ciotea.cdcng.front.domain.chart.useChart.repository.UseChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.useChart.service.UseChartService; | |||
| import com.ciotea.cdcng.front.domain.chart.useChart.vo.UseVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| @Controller | |||
| @RequestMapping(value = "chart") | |||
| public class ChartController { | |||
| @Resource | |||
| CarChartRepository carChartRepository; | |||
| @Resource | |||
| TagChartRepository tagChartRepository; | |||
| @Resource | |||
| UseChartRepository useChartRepository; | |||
| @Resource | |||
| CheckChartRepository checkChartRepository; | |||
| @Resource | |||
| CarUseRepository carUseRepository; | |||
| @Resource | |||
| TagChartService tagChartService; | |||
| @Resource | |||
| CarChartService carChartService; | |||
| @Resource | |||
| CheckChartService checkChartService; | |||
| @Resource | |||
| UseChartService useChartService; | |||
| @Resource | |||
| CarUseService carUseService; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| ResponseBodyCacheManager responseBodyCacheManager; | |||
| private PermissionFilter fiter = null; | |||
| private String years = null; | |||
| @PostConstruct | |||
| private void init() { | |||
| new Timer(true).schedule(new TimerTask() { | |||
| @Override | |||
| public void run() { | |||
| try { | |||
| if(fiter != null){ | |||
| PermissionFilter permissionFilter = fiter; | |||
| responseBodyCacheManager.cache("/chart/tagDictChart?list=&filterType=&filterStrings=", getTagDictChart(permissionFilter), 3600); | |||
| responseBodyCacheManager.cache("/chart/tagCreateChart?list=&filterType=&filterStrings=", getTagCreateChart(permissionFilter), 3600); | |||
| responseBodyCacheManager.cache("/chart/tagRemoveChart?list=&filterType=&filterStrings=", getTagRemoveChart(permissionFilter), 3600); | |||
| responseBodyCacheManager.cache("/chart/useChart?list=&filterType=&filterStrings=", getuseChart(permissionFilter), 3600); | |||
| if(years!=null){ | |||
| String year = years; | |||
| responseBodyCacheManager.cache("/chart/checkChart?year=&list=&filterType=&filterStrings=", getCheckChart(year,permissionFilter), 3600); | |||
| } | |||
| } | |||
| } catch (Throwable throwable) {} | |||
| } | |||
| }, 3 * 1000L, 1800 * 1000L); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "carChart", method = RequestMethod.GET) | |||
| List<List<CarVo>> getCarChart(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| return carChartService.getCarChart(permissionFilter); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "tagDictChart", method = RequestMethod.GET) | |||
| List<List<TagVo>> getTagDictChart(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return tagChartService.getTagDictChart(permissionFilter); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "tagCreateChart", method = RequestMethod.GET) | |||
| List<CreateTagVo> getTagCreateChart(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<CreateTagVo> list = tagChartRepository.getCreateChart(permissionFilter); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "tagRemoveChart", method = RequestMethod.GET) | |||
| List<List<RemoveTagVo>> getTagRemoveChart(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return tagChartService.getTagRemoveChart(permissionFilter); | |||
| } | |||
| // | |||
| // @PostConstruct | |||
| // private void init() { | |||
| // | |||
| // new Timer(true).schedule(new TimerTask() { | |||
| // @Override | |||
| // public void run() { | |||
| // try { | |||
| // responseBodyCacheManager.cache("/chart/tagDateChart?start_date=&end_date=", getTagDateChart("", "", null), 600); | |||
| // } catch (Throwable throwable) {} | |||
| // } | |||
| // }, 3 * 1000L, 530 * 1000L); | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "tagDateChart", method = RequestMethod.GET) | |||
| List<List<DateTagVo>> getTagDateChart(String start_date,String end_date,Context context) throws ParseException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(!StringUtil.isNullOrBlank(start_date) || !StringUtil.isNullOrBlank(end_date)){ | |||
| if(!Tool.isDate2(start_date) || !Tool.isDate2(end_date)){ | |||
| throw new AppException("请输入正确的日期格式,如2012-01-10"); | |||
| } | |||
| } | |||
| return tagChartService.getTagDateChart(start_date,end_date,permissionFilter); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "useChart", method = RequestMethod.GET) | |||
| List<List<UseVo>> getuseChart(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return useChartService.getuseChart(permissionFilter); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "checkChart", method = RequestMethod.GET) | |||
| List<List<CheckVo>> getCheckChart(String year,PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| years = year; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return checkChartService.getCheckChart(year,permissionFilter); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "checkChartForCarAndBott", method = RequestMethod.GET) | |||
| List<List<CheckVo>> getCheckChartForCarAndBott(String year,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return checkChartService.getCheckChartForCarAndBott(year,permissionFilter); | |||
| } | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "carUseChart", method = RequestMethod.GET) | |||
| // List<CarUseVo> getCarUseChart(){ | |||
| // return carUseRepository.getCarUseChart(); | |||
| // } | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "carUseAreaChart", method = RequestMethod.GET) | |||
| // List<List<CarUseAreaVo>> getCarUseAreaChart(){ | |||
| // return carUseService.getCarUseAreaChart(); | |||
| // } | |||
| //导出[检查站-电子标签统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportRfidtagExcelForCheck", method = RequestMethod.GET) | |||
| void exportExcel1(String start_date,String end_date,HttpServletRequest req, HttpServletResponse res) throws ParseException, FileNotFoundException, IOException{ | |||
| //获取数据 | |||
| List<List<DateTagVo>> list = tagChartService.getTagDateChart(start_date, end_date, null); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/rfidChart/rfidChart2.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| tempRow.createCell(0).setCellValue(/*list.get(0).get(0).getType()+*/"时间"); | |||
| tempRow.createCell(1).setCellValue(list.get(0).get(0).getType()+"数量"); | |||
| tempRow.createCell(2).setCellValue(list.get(1).get(0).getType()+"数量"); | |||
| tempRow.createCell(3).setCellValue(list.get(2).get(0).getType()+"数量"); | |||
| tempRow.createCell(4).setCellValue(list.get(3).get(0).getType()+"数量"); | |||
| //填充数据 | |||
| for(int i = 0;i<list.get(0).size();i++){ | |||
| Row row = sheet.createRow(i+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(i).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(i).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(i).getCount()); | |||
| row.createCell(3).setCellValue(list.get(2).get(i).getCount()); | |||
| row.createCell(4).setCellValue(list.get(3).get(i).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("电子标签统计(检查站).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[检查站-车辆气瓶统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportCarExcelForCheck", method = RequestMethod.GET) | |||
| void exportExcel2(HttpServletRequest req, HttpServletResponse res,Context context) throws FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<CarVo>> list = carChartService.getCarChart(permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/carChart/carChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getIsorig()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getArea()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getCount()); | |||
| row.createCell(3).setCellValue(list.get(2).get(j).getCount()); | |||
| row.createCell(4).setCellValue(list.get(3).get(j).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("车辆气瓶统计(检查站).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[检查站-车辆气瓶统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportCheckExcelForCheck", method = RequestMethod.GET) | |||
| void exportExcel3(String year,HttpServletRequest req, HttpServletResponse res,Context context) throws FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<CheckVo>> list = checkChartService.getCheckChartForCarAndBott(year,permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getIspass()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getCount()); | |||
| row.createCell(3).setCellValue(list.get(2).get(j).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("定检统计(检查站).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[质监局-标签区域统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportRfidtagExcelForQualityDict", method = RequestMethod.GET) | |||
| void exportExcel4(HttpServletRequest req, HttpServletResponse res,Context context) throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<TagVo>> list = tagChartService.getTagDictChart(permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getTagType()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getArea()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("标签区域统计(质监局).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[质监局-标签发放统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportRfidtagExcelForQualityCreate", method = RequestMethod.GET) | |||
| void exportExcel5(HttpServletRequest req, HttpServletResponse res,Context context) throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<CreateTagVo> list = tagChartRepository.getCreateChart(permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow1 = sheet.createRow(0); | |||
| Row tempRow2 = sheet.createRow(1); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(list.get(i).getName()); | |||
| tempRow2.createCell(i).setCellValue(list.get(i).getValue()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("标签发放统计(质监局).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[质监局-标签报废统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportRfidtagExcelForQualityRemove", method = RequestMethod.GET) | |||
| void exportExcel6(HttpServletRequest req, HttpServletResponse res,Context context) throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<RemoveTagVo>> list = tagChartService.getTagRemoveChart(permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getName()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getMemo()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getValue()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getValue()); | |||
| row.createCell(3).setCellValue(list.get(2).get(j).getValue()); | |||
| row.createCell(4).setCellValue(list.get(3).get(j).getValue()); | |||
| row.createCell(5).setCellValue(list.get(4).get(j).getValue()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("标签报废统计(质监局).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[质监局-气瓶使用登记证发放统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportUsetagExcelForQuality", method = RequestMethod.GET) | |||
| void exportExcel7(HttpServletRequest req, HttpServletResponse res,Context context) throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<UseVo>> list = useChartService.getuseChart(permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getName()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getArea()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getCount()); | |||
| row.createCell(3).setCellValue(list.get(2).get(j).getCount()); | |||
| row.createCell(4).setCellValue(list.get(3).get(j).getCount()); | |||
| row.createCell(5).setCellValue(list.get(4).get(j).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("气瓶使用登记证统计(质监局).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出[质监局-气瓶使用登记证发放统计]的电子表格 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportCheckExcelForQuality", method = RequestMethod.GET) | |||
| void exportExcel8(String year,Context context,HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<CheckVo>> list = checkChartService.getCheckChart(year,permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(list.get(i).get(0).getIspass()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getCount()); | |||
| row.createCell(2).setCellValue(list.get(1).get(j).getCount()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("定检统计(质监局).xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| // //导出[质监局-气瓶使用登记证发放统计]的电子表格 | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "exportCaruseExcelForQuality", method = RequestMethod.GET) | |||
| // void exportExcel9(HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| // List<List<CarUseAreaVo>> list1 = carUseService.getCarUseAreaChart(); | |||
| // List<CarUseVo> list2 = carUseRepository.getCarUseChart(); | |||
| // //创建Workbook | |||
| // String path = ServletUtil.getWebRootPath(req, "/app/chart/checkChart/checkChart.xlsx"); | |||
| // Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| // Sheet sheet1 = wb.getSheetAt(0); | |||
| // Sheet sheet2 = wb.getSheetAt(1); | |||
| // | |||
| // Row tempRow1 = sheet1.createRow(0); | |||
| // for(int i = 0;i<list1.size();i++){ | |||
| // tempRow1.createCell(i+1).setCellValue(list1.get(i).get(0).getName()); | |||
| // } | |||
| // for(int j = 0;j<list1.get(0).size();j++){ | |||
| // Row row = sheet1.createRow(j+1); | |||
| // row.createCell(0).setCellValue(list1.get(0).get(j).getArea()); | |||
| // row.createCell(1).setCellValue(list1.get(0).get(j).getCount()); | |||
| // row.createCell(2).setCellValue(list1.get(1).get(j).getCount()); | |||
| // row.createCell(3).setCellValue(list1.get(2).get(j).getCount()); | |||
| // row.createCell(4).setCellValue(list1.get(3).get(j).getCount()); | |||
| // row.createCell(5).setCellValue(list1.get(4).get(j).getCount()); | |||
| // row.createCell(6).setCellValue(list1.get(5).get(j).getCount()); | |||
| // row.createCell(7).setCellValue(list1.get(6).get(j).getCount()); | |||
| // row.createCell(8).setCellValue(list1.get(7).get(j).getCount()); | |||
| // row.createCell(9).setCellValue(list1.get(8).get(j).getCount()); | |||
| // row.createCell(10).setCellValue(list1.get(9).get(j).getCount()); | |||
| // } | |||
| // Row tempRow2 = sheet2.createRow(0); | |||
| // Row tempRow3 = sheet2.createRow(1); | |||
| // for(int i = 0;i<list1.size();i++){ | |||
| // tempRow2.createCell(i).setCellValue(list2.get(i).getName()); | |||
| // tempRow3.createCell(i).setCellValue(list2.get(i).getCount()); | |||
| // } | |||
| // | |||
| // ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| // wb.write(bos); | |||
| // byte[] bytes = bos.toByteArray(); | |||
| // ServletUtil.respondFileInfo(res, new FileInfo("车辆在用统计(能源办).xlsx", bytes.length, new Date())); | |||
| // ServletUtil.respondBytes(res, bytes); | |||
| // | |||
| // } | |||
| //加气统计方法 | |||
| @ResponseBody | |||
| @RequestMapping(value = "monthGasChart", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> getMonthGasChart(String year,String month,String[] type,String[] station,String[] area){ | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| int lastDayNum = Integer.parseInt(lastDay); | |||
| List<List<MonthGasVo>> list = new ArrayList<List<MonthGasVo>>(); | |||
| if(type.length == 0&&station.length>0){ | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,station[i],"",""); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length > 0&&station.length == 0){ | |||
| for(int i = 0;i<type.length;i++){ | |||
| TypeVo vo = gasChartRepository.getTypeName(type[i]); | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,"",type[i],""); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length == 0&&station.length == 0){ | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,"","",area[i]); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| //加气统计方法 | |||
| @ResponseBody | |||
| @RequestMapping(value = "yearGasChart", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getMonthGasChart(String year,String[] type,String[] station,String[] area){ | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| String[] testArr = new String[24]; | |||
| for(int h = 0;h<24;h++){ | |||
| testArr[h] = h+""; | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(type.length == 0&&station.length>0){ | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChart(year,station[i],"",""); | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j < 13;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[1])==j)){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(j+"月"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(tempList.get(flag).getDate()); | |||
| tempVo.setName(tempList.get(flag).getName()); | |||
| tempVo.setSum(tempList.get(flag).getSum()); | |||
| tempVo.setDate(tempVo.getDate().split("-")[1]+"月"); | |||
| resultList.add(tempVo); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length > 0&&station.length == 0){ | |||
| for(int i = 0;i<type.length;i++){ | |||
| TypeVo vo = gasChartRepository.getTypeName(type[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChart(year,"",type[i],""); | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j < 13;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[1])==j)){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(j+"月"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(tempList.get(flag).getDate()); | |||
| tempVo.setName(tempList.get(flag).getName()); | |||
| tempVo.setSum(tempList.get(flag).getSum()); | |||
| tempVo.setDate(tempVo.getDate().split("-")[1]+"月"); | |||
| resultList.add(tempVo); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length == 0&&station.length == 0){ | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChart(year,"","",area[i]); | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j < 13;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[1])==j)){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(j+"月"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(tempList.get(flag).getDate()); | |||
| tempVo.setName(tempList.get(flag).getName()); | |||
| tempVo.setSum(tempList.get(flag).getSum()); | |||
| tempVo.setDate(tempVo.getDate().split("-")[1]+"月"); | |||
| resultList.add(tempVo); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| // list.add(tempList); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "dayGasChart", method = RequestMethod.GET) | |||
| List<List<DayGasVo>> getDayGasChart(String date,String[] type,String[] station,String[] area){ | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| String[] testArr = new String[24]; | |||
| for(int h = 0;h<24;h++){ | |||
| testArr[h] = h+""; | |||
| } | |||
| List<List<DayGasVo>> list = new ArrayList<List<DayGasVo>>(); | |||
| if(type.length == 0&&station.length>0){ | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| List<DayGasVo> tempList = gasChartRepository.getDayChart(date,station[i],"",""); | |||
| List<DayGasVo> resultList = new ArrayList<DayGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 0;j < 24;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split(":")[0])==j)){ | |||
| DayGasVo tempVo = new DayGasVo(); | |||
| tempVo.setDate(j+":00:00"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length > 0&&station.length == 0){ | |||
| for(int i = 0;i<type.length;i++){ | |||
| TypeVo vo = gasChartRepository.getTypeName(type[i]); | |||
| List<DayGasVo> tempList = gasChartRepository.getDayChart(date,"",type[i],""); | |||
| List<DayGasVo> resultList = new ArrayList<DayGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 0;j < 24;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split(":")[0])==j)){ | |||
| DayGasVo tempVo = new DayGasVo(); | |||
| tempVo.setDate(j+":00:00"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(type.length == 0&&station.length == 0){ | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<DayGasVo> tempList = gasChartRepository.getDayChart(date,"","",area[i]); | |||
| List<DayGasVo> resultList = new ArrayList<DayGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 0;j < 24;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split(":")[0])==j)){ | |||
| DayGasVo tempVo = new DayGasVo(); | |||
| tempVo.setDate(j+":00:00"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| // 获取区域信息 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| // 获取选中的加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDictLists", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDictListss(Integer dictId) { | |||
| return gasrangeRepository.getgetCngTypeDictLists(dictId); | |||
| } | |||
| // 根据区域ID动态填充加气站列表 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| } | |||
| @ -0,0 +1,742 @@ | |||
| package com.ciotea.cdcng.front.application.chart; | |||
| import infrastructure.spring.web.cache.ResponseBodyCacheManager; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Timer; | |||
| import java.util.TimerTask; | |||
| import javax.annotation.PostConstruct; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasNumChart.repository.GasNumChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasNumChart.service.GasNumChartService; | |||
| import com.ciotea.cdcng.front.domain.chart.gasNumChart.vo.YearGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| @Controller | |||
| @RequestMapping(value = "chartNum") | |||
| public class GasNumChartController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| GasNumChartRepository chartRepository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| GasNumChartService gasNumChartService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| // @Resource | |||
| // ResponseBodyCacheManager responseBodyCacheManager; | |||
| // 获取选中的加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDictLists", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDictListss(Integer dictId) { | |||
| return gasrangeRepository.getgetCngTypeDictLists(dictId); | |||
| } | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| // @PostConstruct | |||
| // private void init() { | |||
| // | |||
| // new Timer(true).schedule(new TimerTask() { | |||
| // @Override | |||
| // public void run() { | |||
| // try { | |||
| // // 缓存 | |||
| // List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| // list = getYearGasChart("", "", null, 1, 1, null); | |||
| // responseBodyCacheManager.cache("/chartNum/yearGasChart?beginYear=&endYear=&than=1&dimension=1", list, 600); | |||
| // } catch (Throwable throwable) {} | |||
| // } | |||
| // }, 5 * 1000L, 550 * 1000L); | |||
| // } | |||
| /** | |||
| * 折线 | |||
| * @param beginYear 开始日期 | |||
| * @param endYear 结束日期 | |||
| * @param type 加气属性 | |||
| * @param than 统计方式:环比(1)、同比(2) | |||
| * @param dimension 统计维度: 年(1)、月(2)、日(3) | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "yearGasChart", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getYearGasChart(String beginYear,String endYear,String[] type,Integer than,Integer dimension,Context context/*,PermissionFilter permissionFilter*/){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| if(""!=beginYear && beginYear.length()>0 && "".equals(endYear)){ | |||
| throw new AppException("请选择结束日期"); | |||
| } | |||
| if(""!=endYear && endYear.length()>0 && "".equals(beginYear)){ | |||
| throw new AppException("请选择开始日期"); | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(than==1){//环比 | |||
| if(dimension==1){//年 | |||
| List<YearGasVo> resultList = gasNumChartService.getThanYearLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| }else if(dimension==2){//月 | |||
| List<YearGasVo> resultList = gasNumChartService.getThanMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| }else{//日 | |||
| List<YearGasVo> resultList = gasNumChartService.getThanDayLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| } | |||
| }else{//同比 | |||
| if(dimension==1){//年 | |||
| List<YearGasVo> resultList = gasNumChartService.getThanYearLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| }else if(dimension==2){//月 | |||
| if(beginYear=="" && endYear==""){ | |||
| List<YearGasVo> resultList = gasNumChartService.getThanOneMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| }else{ | |||
| List<YearGasVo> resultList = gasNumChartService.getThanTwoMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| } | |||
| }else{//日 | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| /** | |||
| * 柱状 | |||
| * @param beginYear 开始日期 | |||
| * @param endYear 结束日期 | |||
| * @param type 加气属性 | |||
| * @param than 统计方式:环比(1)、同比(2) | |||
| * @param dimension 统计维度: 年(1)、月(2)、日(3) | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasYearChartColumn", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getYearGasChartColumn(String beginYear,String endYear,String[] type,Integer than,Integer dimension,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<YearGasVo>> reslist = new ArrayList<List<YearGasVo>>(); | |||
| if(""!=beginYear && beginYear.length()>0 && "".equals(endYear)){ | |||
| throw new AppException("请选择结束日期"); | |||
| } | |||
| if(""!=endYear && endYear.length()>0 && "".equals(beginYear)){ | |||
| throw new AppException("请选择开始日期"); | |||
| } | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| if(than==1){//环比 | |||
| if(dimension==1){//年 | |||
| reslist = gasNumChartService.getThanYearColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| }else if(dimension==2){//月 | |||
| reslist = gasNumChartService.getThanMonthColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| }else{//日 | |||
| reslist = gasNumChartService.getThanDayColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| } | |||
| }else{//同比 | |||
| if(dimension==1){//年 | |||
| reslist = gasNumChartService.getThanYearColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| }else if(dimension==2){//月 | |||
| reslist = gasNumChartService.getThanTwoMonthColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| }else{//日 | |||
| } | |||
| } | |||
| return reslist; | |||
| } | |||
| //导出excel,折线 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getLineExcel", method = RequestMethod.GET) | |||
| void getLineExcel(String beginYear,String endYear,String[] type,Integer than,Integer dimension, | |||
| HttpServletRequest req, HttpServletResponse res,Context context) | |||
| throws ParseException, FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(""!=beginYear && beginYear.length()>0 && "".equals(endYear)){ | |||
| throw new AppException("请选择结束日期"); | |||
| } | |||
| if(""!=endYear && endYear.length()>0 && "".equals(beginYear)){ | |||
| throw new AppException("请选择开始日期"); | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/gasNumChart/gasNumChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| String begintime=""; | |||
| String endtime=""; | |||
| String year=""; | |||
| Date date =new Date(); | |||
| SimpleDateFormat format = new SimpleDateFormat("yyyy"); | |||
| String strDate = format.format(date); | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |||
| String dateTime = dateFormat.format(date);//日 | |||
| Integer beanDate = Integer.parseInt(strDate)-4; | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(than==1){//环比 | |||
| if(dimension==1){//年 | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= beanDate+""; | |||
| endtime = strDate; | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| begintime= begin; | |||
| endtime = end; | |||
| } | |||
| List<YearGasVo> resultList = gasNumChartService.getThanYearLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i).setCellValue("年份"); | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(begintime+"年至"+endtime+"年加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| }else if(dimension==2){//月 | |||
| String begintimestr = ""; | |||
| String endtimestr = ""; | |||
| String yearstr = ""; | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= "01"; | |||
| endtime = dateTime.substring(5, 7); | |||
| year = dateTime.substring(0, 4); | |||
| yearstr = dateTime.substring(0, 4); | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| String beginMonth = beginYear.substring(5, 7); | |||
| String endMonth = endYear.substring(5, 7); | |||
| if(begin.equals(end)){ | |||
| begintime = beginMonth; | |||
| endtime = endMonth; | |||
| year = begin; | |||
| yearstr = end; | |||
| }else{ | |||
| begintime = beginMonth; | |||
| endtime = "12"; | |||
| year = begin; | |||
| begintimestr = "01"; | |||
| endtimestr = endMonth; | |||
| yearstr = end; | |||
| } | |||
| } | |||
| List<YearGasVo> resultList = gasNumChartService.getThanMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i).setCellValue("月份"); | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(year+"-"+begintime+"至"+yearstr+"-"+endtime+"加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| }else{//日 | |||
| String begintimestr = ""; | |||
| String endtimestr = ""; | |||
| List<YearGasVo> tempListstr=new ArrayList<YearGasVo>(); | |||
| String years = ""; | |||
| String monthStr=""; | |||
| String months= ""; | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= "01"; | |||
| endtime = dateTime.substring(8,10); | |||
| months= dateTime.substring(5,7); | |||
| year= dateTime.substring(0,4); | |||
| monthStr= dateTime.substring(5,7); | |||
| years= dateTime.substring(0,4); | |||
| }else{ | |||
| String begin = beginYear.substring(5, 7); | |||
| String end = endYear.substring(5, 7); | |||
| if(begin.equals(end)){ | |||
| begintime=beginYear.substring(8, 10); | |||
| endtime = endYear.substring(8, 10); | |||
| months= begin; | |||
| year=beginYear.substring(0,4); | |||
| monthStr= begin; | |||
| years=beginYear.substring(0,4); | |||
| }else{ | |||
| begintime = beginYear.substring(8, 10); | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(begin)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(begin)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(begin)-1])){ | |||
| int yearNum = Integer.parseInt(beginYear.substring(0,4)); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| endtimestr=lastDay; | |||
| year = beginYear.substring(0, 4); | |||
| months = beginYear.substring(5, 7); | |||
| years = endYear.substring(0, 4);; | |||
| begintimestr="01"; | |||
| endtime = endYear.substring(8, 10); | |||
| monthStr = endYear.substring(5, 7); | |||
| } | |||
| } | |||
| List<YearGasVo> resultList = gasNumChartService.getThanDayLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(year+"-"+months+"-"+begintime+"至"+years+"-"+monthStr+"-"+endtime+"加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()+"号"); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{//同比 | |||
| if(dimension==1){//年 | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= beanDate+""; | |||
| endtime = strDate; | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| begintime= begin; | |||
| endtime = end; | |||
| } | |||
| List<YearGasVo> resultList = gasNumChartService.getThanYearLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| }else if(dimension==2){//月 | |||
| if(beginYear=="" && endYear==""){ | |||
| List<YearGasVo> resultList = gasNumChartService.getThanOneMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(list.get(0).get(0).getDate()+"至"+list.get(0).get(2).getDate()+"加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| List<YearGasVo> resultList = gasNumChartService.getThanTwoMonthLineChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| list.add(resultList); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow.createCell(i+1).setCellValue("加气总量"); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| for(int i = 0;i<list.size();i++){ | |||
| tempRow1.createCell(i).setCellValue(list.get(0).get(0).getDate()+"至"+list.get(0).get(2).getDate()+"加气量统计"); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(list.get(0).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{//日 | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("加气量统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //柱状,导出 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getColumnExcel", method = RequestMethod.GET) | |||
| void getColumnExcel(String beginYear,String endYear,String[] type,Integer than,Integer dimension, | |||
| HttpServletRequest req, HttpServletResponse res,Context context) | |||
| throws ParseException, FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(""!=beginYear && beginYear.length()>0 && "".equals(endYear)){ | |||
| throw new AppException("请选择结束日期"); | |||
| } | |||
| if(""!=endYear && endYear.length()>0 && "".equals(beginYear)){ | |||
| throw new AppException("请选择开始日期"); | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/gasNumChart/gasNumChart.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| if(type == null){ | |||
| type = new String[]{}; | |||
| } | |||
| String begintime=""; | |||
| String endtime=""; | |||
| String year=""; | |||
| Date date =new Date(); | |||
| SimpleDateFormat format = new SimpleDateFormat("yyyy"); | |||
| String strDate = format.format(date); | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |||
| String dateTime = dateFormat.format(date);//日 | |||
| Integer beanDate = Integer.parseInt(strDate)-4; | |||
| List<List<YearGasVo>> reslist = new ArrayList<List<YearGasVo>>(); | |||
| if(than==1){//环比 | |||
| if(dimension==1){//年 | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= beanDate+""; | |||
| endtime = strDate; | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| begintime= begin; | |||
| endtime = end; | |||
| } | |||
| List<CngTypeDict> lsitType = gasrangeRepository.getCngTypeDict(); | |||
| reslist = gasNumChartService.getThanYearColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| tempRow.createCell(0).setCellValue("年份"); | |||
| if(type.length>0){ | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"年至"+endtime+"年加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| for(int k=0;k<lsitType.size();k++){ | |||
| tempRow.createCell(k+1).setCellValue(lsitType.get(k).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"年至"+endtime+"年加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(reslist.get(0).get(j).getSum()); | |||
| row.createCell(2).setCellValue(reslist.get(1).get(j).getSum()); | |||
| row.createCell(3).setCellValue(reslist.get(2).get(j).getSum()); | |||
| row.createCell(4).setCellValue(reslist.get(3).get(j).getSum()); | |||
| row.createCell(5).setCellValue(reslist.get(4).get(j).getSum()); | |||
| row.createCell(6).setCellValue(reslist.get(5).get(j).getSum()); | |||
| row.createCell(7).setCellValue(reslist.get(6).get(j).getSum()); | |||
| } | |||
| } | |||
| }else if(dimension==2){//月 | |||
| String begintimestr = ""; | |||
| String endtimestr = ""; | |||
| String yearstr = ""; | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= "01"; | |||
| endtime = dateTime.substring(5, 7); | |||
| year = dateTime.substring(0, 4); | |||
| yearstr = dateTime.substring(0, 4); | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| String beginMonth = beginYear.substring(5, 7); | |||
| String endMonth = endYear.substring(5, 7); | |||
| if(begin.equals(end)){ | |||
| begintime = beginMonth; | |||
| endtime = endMonth; | |||
| year = begin; | |||
| yearstr = end; | |||
| }else{ | |||
| begintime = beginMonth; | |||
| endtimestr = "12"; | |||
| year = begin; | |||
| begintimestr = "01"; | |||
| endtime = endMonth; | |||
| yearstr = end; | |||
| } | |||
| } | |||
| List<CngTypeDict> lsitType = gasrangeRepository.getCngTypeDict(); | |||
| reslist = gasNumChartService.getThanMonthColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| tempRow.createCell(0).setCellValue("月份"); | |||
| if(type.length>0){ | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(year+"-"+begintime+"至"+yearstr+"-"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| for(int k=0;k<lsitType.size();k++){ | |||
| tempRow.createCell(k+1).setCellValue(lsitType.get(k).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(year+"-"+begintime+"至"+yearstr+"-"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(reslist.get(0).get(j).getSum()); | |||
| row.createCell(2).setCellValue(reslist.get(1).get(j).getSum()); | |||
| row.createCell(3).setCellValue(reslist.get(2).get(j).getSum()); | |||
| row.createCell(4).setCellValue(reslist.get(3).get(j).getSum()); | |||
| row.createCell(5).setCellValue(reslist.get(4).get(j).getSum()); | |||
| row.createCell(6).setCellValue(reslist.get(5).get(j).getSum()); | |||
| row.createCell(7).setCellValue(reslist.get(6).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{//日 | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= dateTime.substring(0, 7)+"-01"; | |||
| endtime = dateTime; | |||
| }else{ | |||
| begintime= beginYear; | |||
| endtime = endYear; | |||
| } | |||
| List<CngTypeDict> lsitType = gasrangeRepository.getCngTypeDict(); | |||
| reslist = gasNumChartService.getThanDayColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| if(type.length>0){ | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()+"号"); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int k=0;k<lsitType.size();k++){ | |||
| tempRow.createCell(k+1).setCellValue(lsitType.get(k).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()+"号"); | |||
| row.createCell(1).setCellValue(reslist.get(0).get(j).getSum()); | |||
| row.createCell(2).setCellValue(reslist.get(1).get(j).getSum()); | |||
| row.createCell(3).setCellValue(reslist.get(2).get(j).getSum()); | |||
| row.createCell(4).setCellValue(reslist.get(3).get(j).getSum()); | |||
| row.createCell(5).setCellValue(reslist.get(4).get(j).getSum()); | |||
| row.createCell(6).setCellValue(reslist.get(5).get(j).getSum()); | |||
| row.createCell(7).setCellValue(reslist.get(6).get(j).getSum()); | |||
| } | |||
| } | |||
| } | |||
| }else{//同比 | |||
| if(dimension==1){//年 | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= beanDate+""; | |||
| endtime = strDate; | |||
| }else{ | |||
| String begin = beginYear.substring(0, 4); | |||
| String end = endYear.substring(0, 4); | |||
| begintime= begin; | |||
| endtime = end; | |||
| } | |||
| List<CngTypeDict> lsitType = gasrangeRepository.getCngTypeDict(); | |||
| reslist = gasNumChartService.getThanYearColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| if(type.length>0){ | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| for(int k=0;k<lsitType.size();k++){ | |||
| tempRow.createCell(k+1).setCellValue(lsitType.get(k).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(reslist.get(0).get(j).getSum()); | |||
| row.createCell(2).setCellValue(reslist.get(1).get(j).getSum()); | |||
| row.createCell(3).setCellValue(reslist.get(2).get(j).getSum()); | |||
| row.createCell(4).setCellValue(reslist.get(3).get(j).getSum()); | |||
| row.createCell(5).setCellValue(reslist.get(4).get(j).getSum()); | |||
| row.createCell(6).setCellValue(reslist.get(5).get(j).getSum()); | |||
| row.createCell(7).setCellValue(reslist.get(6).get(j).getSum()); | |||
| } | |||
| } | |||
| }else if(dimension==2){//月 | |||
| List<CngTypeDict> lsitType = gasrangeRepository.getCngTypeDict(); | |||
| reslist = gasNumChartService.getThanTwoMonthColumnChart(beginYear, endYear, type, than, dimension,permissionFilter); | |||
| if(beginYear=="" && endYear==""){ | |||
| begintime= beanDate+""; | |||
| endtime = strDate; | |||
| }else{ | |||
| begintime = beginYear.substring(0, 4); | |||
| endtime = endYear.substring(0, 4); | |||
| } | |||
| if(type.length>0){ | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| tempRow.createCell(0).setCellValue("日期"); | |||
| for(int k=0;k<lsitType.size();k++){ | |||
| tempRow.createCell(k+1).setCellValue(lsitType.get(k).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(begintime+"至"+endtime+"加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getDate()); | |||
| row.createCell(1).setCellValue(reslist.get(0).get(j).getSum()); | |||
| row.createCell(2).setCellValue(reslist.get(1).get(j).getSum()); | |||
| row.createCell(3).setCellValue(reslist.get(2).get(j).getSum()); | |||
| row.createCell(4).setCellValue(reslist.get(3).get(j).getSum()); | |||
| row.createCell(5).setCellValue(reslist.get(4).get(j).getSum()); | |||
| row.createCell(6).setCellValue(reslist.get(5).get(j).getSum()); | |||
| row.createCell(7).setCellValue(reslist.get(6).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{//日 | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("加气量统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,795 @@ | |||
| package com.ciotea.cdcng.front.application.chart; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasStaticChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.AreaVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.StationVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.YearGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "gasStaticChart") | |||
| public class GasStaticChartController { | |||
| @Resource | |||
| GasStaticChartRepository gasChartRepository; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| Repository repository; | |||
| private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| // 获取区域信息 | |||
| @ResponseBody//gasStaticChart/getaddress | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| @ResponseBody//gasStaticChart/getGasInfos | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<StationVo> getGasInfos(Integer areaId) { | |||
| return gasChartRepository.getStation(areaId); | |||
| } | |||
| // 加气属性 | |||
| @ResponseBody//gasStaticChart/getCngTypeDict | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| /** | |||
| * 折线图统计 | |||
| * @param date 日期 | |||
| * @param type 加气属性 | |||
| * @param station 加气站 | |||
| * @param area 区域 | |||
| * @param dimension 年,月,日选择 | |||
| * @return | |||
| */ | |||
| @ResponseBody//gasStaticChart/getGasChartByLine | |||
| @RequestMapping(value = "getGasChartByLine", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getGasChartByLine(String date,String[] type,String[] station,String[] area,Integer dimension,Context context,Integer isExport){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(dimension==1){ | |||
| //年统计 | |||
| //截取年 | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| String year = date.substring(0, 4); | |||
| if(station.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| tempList = gasChartRepository.getYearChart(year,station[i],type,"",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| }else if(area.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| tempList = gasChartRepository.getYearChart(year,"",type,area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| } | |||
| }else if(dimension==2){ | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| //月统计 | |||
| String lastDay = ""; | |||
| //截取年 | |||
| String year = date.substring(0, 4); | |||
| //截取月 | |||
| String month = date.substring(5, 7); | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| if(station.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| tempList = gasChartRepository.getMonthChart(year,month,lastDay,station[i],type,"",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| }else if(area.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| tempList = gasChartRepository.getMonthChart(year, month, lastDay, "", type, area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| } | |||
| }else{ | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| //日统计 | |||
| if(station.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| tempList = gasChartRepository.getDayChart(date, station[i], type, "",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| }else if(area.length>0){ | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| tempList = gasChartRepository.getDayChart(date, "", type, area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| //+++++++++++++++++++++++++++++++++++++++++++++++++++柱形图统计+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
| /** | |||
| * 柱形图统计 | |||
| * @param date | |||
| * @param type | |||
| * @param station | |||
| * @param area | |||
| * @param dimension | |||
| * @return | |||
| */ | |||
| @ResponseBody//gasStaticChart/getGasChartByColumn | |||
| @RequestMapping(value = "getGasChartByColumn", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getGasChartByColumn(String date,String[] type,String[] station,String[] area,Integer dimension,Context context,Integer isExport){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(dimension==1){ | |||
| //年统计 | |||
| //截取年 | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| String year = date.substring(0, 4); | |||
| if(station.length>0){ | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChartByColumn(year, station[i], type[j], "",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(area.length>0){ | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChartByColumn(year, "", type[j], area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| }else if(dimension==2){ | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| //月统计 | |||
| String lastDay = ""; | |||
| //截取年 | |||
| String year = date.substring(0, 4); | |||
| //截取月 | |||
| String month = date.substring(5, 7); | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| if(station.length>0){ | |||
| //tempList = gasChartRepository.getMonthChartByColumn(year, month, lastDay, station[i], type, "",permissionFilter); | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| List<YearGasVo> tempList = gasChartRepository.getMonthChartByColumn(year, month, lastDay, station[i], type[j], "",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(area.length>0){ | |||
| //tempList = gasChartRepository.getMonthChartByColumn(year, month, lastDay, "", type[j], area[i],permissionFilter); | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getMonthChartByColumn(year, month, lastDay, "", type[j], area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| }else{ | |||
| //日统计 | |||
| if(StringUtil.isNullOrEmpty(date)){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| if(station.length>0){ | |||
| //tempList = gasChartRepository.getDayChartByColumn(date, station[i], type[j], "",permissionFilter); | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<station.length;i++){ | |||
| StationVo vo = gasChartRepository.getStationName(station[i]); | |||
| if(isExport ==null){ | |||
| if(i>20){ | |||
| //只显示20个加气站 | |||
| break; | |||
| } | |||
| } | |||
| List<YearGasVo> tempList = gasChartRepository.getDayChartByColumn(date, station[i], type[j], "",permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| }else if(area.length>0){ | |||
| //tempList = gasChartRepository.getDayChartByColumn(date, "", type[j], area[i],permissionFilter); | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getDayChartByColumn(date, "", type[j], area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| /** | |||
| * 折线默认图 | |||
| * @param year | |||
| * @param month | |||
| * @param type | |||
| * @param station | |||
| * @param area | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody//gasStaticChart/getGasChartByLineDefault | |||
| @RequestMapping(value = "getGasChartByLineDefault", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getGasChartByLineDefault(String year,String month,String[] type,String[] station,String[] area,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //月统计 | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| List<YearGasVo> tempList = new ArrayList<YearGasVo>(); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| tempList = gasChartRepository.getMonthChart(year, month, lastDay, "", type, area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| tempList.add(tempVo); | |||
| } | |||
| list.add(tempList); | |||
| } | |||
| return list; | |||
| } | |||
| /** | |||
| * 柱形默认图 | |||
| * @param year | |||
| * @param month | |||
| * @param type | |||
| * @param station | |||
| * @param area | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody//gasStaticChart/getGasChartByColumnDefault | |||
| @RequestMapping(value = "getGasChartByColumnDefault", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getGasChartByDefault(String year,String month,String[] type,String[] station,String[] area,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| /*List<CngTypeDict> list1 = gasrangeRepository.getCngTypeDict(); | |||
| for (CngTypeDict cngTypeDict : list1) { | |||
| if(type==null){ | |||
| type = new String[]{String.valueOf(cngTypeDict.getId())}; | |||
| System.out.println(type); | |||
| } | |||
| } | |||
| List<AreaDict> list2 = getAreaDicts(context); | |||
| for (AreaDict areaDict : list2) { | |||
| if(area==null){ | |||
| area = new String[]{String.valueOf(areaDict.getId())}; | |||
| System.out.println(area); | |||
| } | |||
| }*/ | |||
| //月统计 | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| for (int j = 0; j < type.length; j++) { | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| CngTypeDict cngtype = repository.get(CngTypeDict.class, Integer.parseInt(type[j])); | |||
| for(int i = 0;i<area.length;i++){ | |||
| AreaVo vo = gasChartRepository.getAreaName(area[i]); | |||
| List<YearGasVo> tempList = gasChartRepository.getMonthChartByColumn(year, month, lastDay, "", type[j], area[i],permissionFilter); | |||
| //做非空判断,避免空数据 | |||
| if(tempList.size()==0){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setType(cngtype.getDictValue()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| for(YearGasVo tempVo : tempList){ | |||
| tempVo.setName(tempVo.getName()); | |||
| tempVo.setType(tempVo.getType()); | |||
| tempVo.setSum(tempVo.getSum()); | |||
| resultList.add(tempVo); | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| return list; | |||
| } | |||
| //+++++++++++++++++++++++++++++++++++++++++++++++++++导出excel++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
| //导出excel,折线 | |||
| @ResponseBody//gasStaticChart/getLineExcel | |||
| @RequestMapping(value = "getLineExcel", method = RequestMethod.GET) | |||
| public void getLineExcel(String date,String[] type,String[] station,String[] area,Integer dimension,HttpServletRequest req, HttpServletResponse res,Context context) | |||
| throws ParseException, FileNotFoundException, IOException{ | |||
| //PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/gasStaticChart/gasStaticChart.xls"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| if(dimension==1){ | |||
| //年 | |||
| if(date!=null){ | |||
| date.substring(0, 4); | |||
| }else{ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> list = getGasChartByLine(date, type, station, area, dimension,context,1); | |||
| tempRow.createCell(0).setCellValue(area.length>0?"区域":"加气站"); | |||
| tempRow.createCell(1).setCellValue("加气总量"); | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"年加气量统计"); | |||
| for(int i=0;i<list.size();i++){ | |||
| for(int j = 0;j<list.get(i).size();j++){ | |||
| Row row = sheet.createRow(i+j+2); | |||
| row.createCell(0).setCellValue(list.get(i).get(j).getName()); | |||
| row.createCell(1).setCellValue(list.get(i).get(j).getSum()); | |||
| } | |||
| } | |||
| }else if(dimension==2){ | |||
| //月 | |||
| if(date!=null){ | |||
| date.substring(0, 7); | |||
| }else{ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> list = getGasChartByLine(date, type, station, area, dimension,context,1); | |||
| tempRow.createCell(0).setCellValue(area.length>0?"区域":"加气站"); | |||
| tempRow.createCell(1).setCellValue("加气总量"); | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"月加气量统计"); | |||
| for(int i=0;i<list.size();i++){ | |||
| for(int j = 0;j<list.get(i).size();j++){ | |||
| Row row = sheet.createRow(i+j+2); | |||
| row.createCell(0).setCellValue(list.get(i).get(j).getName()); | |||
| row.createCell(1).setCellValue(list.get(i).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| //日 | |||
| //月 | |||
| if(date==null){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> list = getGasChartByLine(date, type, station, area, dimension,context,1); | |||
| tempRow.createCell(0).setCellValue(area.length>0?"区域":"加气站"); | |||
| tempRow.createCell(1).setCellValue("加气总量"); | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"年加气量统计"); | |||
| for(int i=0;i<list.size();i++){ | |||
| for(int j = 0;j<list.get(i).size();j++){ | |||
| Row row = sheet.createRow(i+j+2); | |||
| row.createCell(0).setCellValue(list.get(i).get(j).getName()); | |||
| row.createCell(1).setCellValue(list.get(i).get(j).getSum()); | |||
| } | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("区域加气站加气量统计.xls", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| //导出excel,柱形 | |||
| @ResponseBody//gasStaticChart/getColumnExcel | |||
| @RequestMapping(value = "getColumnExcel", method = RequestMethod.GET) | |||
| public void getColumnExcel(String date,String[] type,String[] station,String[] area,Integer dimension,HttpServletRequest req, HttpServletResponse res,Context context) | |||
| throws ParseException, FileNotFoundException, IOException{ | |||
| if(station == null){ | |||
| station = new String[]{}; | |||
| } | |||
| if(area == null){ | |||
| area = new String[]{}; | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/chart/gasStaticChart/gasStaticChart.xls"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| if(dimension==1){ | |||
| //年 | |||
| if(date!=null){ | |||
| date.substring(0, 4); | |||
| }else{ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> reslist = getGasChartByColumn(date, type, station, area, dimension,context,1); | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"年加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getName()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else if(dimension==2){ | |||
| //月 | |||
| if(date!=null){ | |||
| date.substring(0, 7); | |||
| }else{ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> reslist = getGasChartByColumn(date, type, station, area, dimension,context,1); | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"月加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getName()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| }else{ | |||
| //日 | |||
| //月 | |||
| if(date==null){ | |||
| throw new AppException("日期不能为空!"); | |||
| } | |||
| List<List<YearGasVo>> reslist = getGasChartByColumn(date, type, station, area, dimension,context,1); | |||
| for(int k=0;k<type.length;k++){ | |||
| tempRow.createCell(k+1).setCellValue((repository.get(CngTypeDict.class, Integer.parseInt(type[k]))).getDictValue()); | |||
| } | |||
| Row tempRow1 = sheet.createRow(0); | |||
| tempRow1.createCell(0).setCellValue(date+"日加气量统计"); | |||
| for(int j = 0;j<reslist.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(reslist.get(0).get(j).getName()); | |||
| for(int k=0;k<type.length;k++){ | |||
| row.createCell(k+1).setCellValue(reslist.get(k).get(j).getSum()); | |||
| } | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("区域加气站加气量统计.xls", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,314 @@ | |||
| package com.ciotea.cdcng.front.application.config; | |||
| import infrastructure.support.records.Order; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Organization; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Position; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Role; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepttypedict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.service.system.DepartmentService; | |||
| import com.ciotea.cdcng.front.domain.service.system.DistrictService; | |||
| import com.ciotea.cdcng.front.domain.service.system.OrganizationService; | |||
| import com.ciotea.cdcng.front.domain.service.system.PositionService; | |||
| import com.ciotea.cdcng.front.domain.service.system.UserService; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "config") | |||
| public class ConfigController { | |||
| @Resource | |||
| Repository commonRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| DistrictService districtService; | |||
| @Resource | |||
| OrganizationService organizationService; | |||
| @Resource | |||
| DepartmentService departmentService; | |||
| @Resource | |||
| PositionService positionService; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| UserService userService; | |||
| @ResponseBody | |||
| @RequestMapping(value = "district", method = RequestMethod.POST) | |||
| District postDistrict(District district) { | |||
| return districtService.addDistrict(district); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "district", method = RequestMethod.PUT) | |||
| District putDistrict(District district) { | |||
| return districtService.updateDistrict(district); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "district", method = RequestMethod.DELETE) | |||
| void deleteDistrict(String id) { | |||
| districtService.removeDistrict(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "district/childrenTreeNodes", method = RequestMethod.GET) | |||
| List<Map<String, Object>> getDistrictChildrenNodes(String id) { | |||
| // 根据pid获取根节点或者子节点 | |||
| List<District> list; | |||
| if (StringUtil.isNullOrEmpty(id) || id.equals("#")) { | |||
| list = districtRepository.getRootDistricts(); | |||
| } else { | |||
| District district = commonRepository.get(District.class, id); | |||
| list = district == null ? new ArrayList<District>() : district.getChildren(); | |||
| } | |||
| // 构造树需要的数据结构 | |||
| List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>(); | |||
| for (District district : list) { | |||
| Map<String, Object> map = new HashMap<String, Object>(); | |||
| map.put("id", district.getId()); | |||
| map.put("text", district.getName() + "[" + district.getCode() + "]"); | |||
| map.put("children", (district.getChildren().size() > 0)); | |||
| // 自定义的属性 | |||
| map.put("name", district.getName()); | |||
| map.put("code", district.getCode()); | |||
| ret.add(map); | |||
| } | |||
| return ret; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "district/organizations", method = RequestMethod.GET) | |||
| List<Organization> getDistrictOrganizations(String districtId) { | |||
| District district = commonRepository.get(District.class, districtId); | |||
| return district == null ? new ArrayList<Organization>() : district.getOrganizations(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "organizations", method = RequestMethod.GET) | |||
| Pagination getOrganizations(String code_name_like, String type, Pagination pagination) { | |||
| List<Organization> list = districtRepository.searchOrganizations(code_name_like, type, pagination); | |||
| return pagination.setRows(list); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "organization", method = RequestMethod.POST) | |||
| Organization postOrganization(Organization organization) { | |||
| return organizationService.addOrganization(organization); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "organization", method = RequestMethod.PUT) | |||
| Organization putOrganization(Organization organization) { | |||
| return organizationService.updateOrganization(organization); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "organization", method = RequestMethod.DELETE) | |||
| void deleteOrganization(String id) { | |||
| organizationService.removeOrganization(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "organization/movement", method = RequestMethod.POST) | |||
| void postOrganizationMovement(String organizationId, String districtCode) { | |||
| organizationService.addOrganizationMovement(organizationId, districtCode); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department/childrenTreeNodes", method = RequestMethod.GET) | |||
| List<Map<String, Object>> getDepartmentChildrenNodes(String organizationId, String id) { | |||
| // 根据pid获取根节点或者子节点 | |||
| List<Department> list; | |||
| if (StringUtil.isNullOrEmpty(id) || id.equals("#")) { | |||
| if (StringUtil.isNullOrEmpty(organizationId) || "-1".equals(organizationId)) { | |||
| list = new ArrayList<Department>(); | |||
| } else { | |||
| list = districtRepository.getRootDepartments(organizationId); | |||
| } | |||
| } else { | |||
| Department department = commonRepository.get(Department.class, id); | |||
| list = department == null ? new ArrayList<Department>() : department.getChildren(); | |||
| } | |||
| // 构造树需要的数据结构 | |||
| List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>(); | |||
| for (Department dept : list) { | |||
| Map<String, Object> map = new HashMap<String, Object>(); | |||
| map.put("id", dept.getId()); | |||
| map.put("text", dept.getName()); | |||
| map.put("children", (dept.getChildren().size() > 0)); | |||
| map.put("type", dept.getDeptType()); | |||
| ret.add(map); | |||
| } | |||
| return ret; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.POST) | |||
| Department postDepartment(Department department) { | |||
| Department bean = departmentService.addDepartment(department); | |||
| //同步到cng部门表 | |||
| AuthorityDepartment authorityDepartment = new AuthorityDepartment(); | |||
| AuthorityDepartment auDept = authorityDepartmentRepository.findByDeptName(department.getName()); | |||
| if(auDept==null){ | |||
| authorityDepartment.setRowState(1); | |||
| authorityDepartment.setDateJoined(new Date()); | |||
| authorityDepartment.setDeptType(commonRepository.get(AuthorityDepttypedict.class, department.getDeptType().getId())); | |||
| authorityDepartment.setDeptName(department.getName()); | |||
| authorityDepartment.setNodeState(0); | |||
| authorityDepartment.setMemo(bean.getId()); | |||
| commonRepository.save(authorityDepartment); | |||
| } | |||
| return bean; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.PUT) | |||
| Department putDepartment(Department department) { | |||
| Department bean = departmentService.updateDepartment(department); | |||
| //同步修改到cng部门表 | |||
| AuthorityDepartment authorityDepartment = authorityDepartmentRepository.findByMemo(department.getId()); | |||
| if(null!=authorityDepartment){ | |||
| authorityDepartment.setDateUpdate(new Date()); | |||
| authorityDepartment.setDeptName(department.getName()); | |||
| authorityDepartment.setDeptType(commonRepository.get(AuthorityDepttypedict.class, department.getDeptType().getId())); | |||
| commonRepository.save(authorityDepartment); | |||
| } | |||
| return bean; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.DELETE) | |||
| void deleteDepartment(String id) { | |||
| departmentService.removeDepartment(id); | |||
| //同步删除到cng部门表 | |||
| AuthorityDepartment authorityDepartment = authorityDepartmentRepository.findByMemo(id); | |||
| if(null!=authorityDepartment){ | |||
| commonRepository.remove(authorityDepartment); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "synDepartment", method = RequestMethod.PUT) | |||
| void synDepartments() { | |||
| List<Department> list = commonRepository.getAll(Department.class, Order.asc("id")); | |||
| for(Department department : list){ | |||
| AuthorityDepartment auDept = authorityDepartmentRepository.findByDeptName(department.getName()); | |||
| if(auDept != null){ | |||
| auDept.setMemo(department.getId()); | |||
| commonRepository.save(auDept); | |||
| } | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "positions", method = RequestMethod.GET) | |||
| List<Position> getPositions(String departmentId) { | |||
| Department department = commonRepository.get(Department.class, departmentId); | |||
| return department == null ? new ArrayList<Position>() : department.getPositions(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position", method = RequestMethod.POST) | |||
| Position postPosition(Position position) { | |||
| return positionService.addPosition(position); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position", method = RequestMethod.PUT) | |||
| Position putPosition(Position position) { | |||
| return positionService.updatePosition(position); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position", method = RequestMethod.DELETE) | |||
| void deletePosition(String id) { | |||
| positionService.removePosition(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position/roles", method = RequestMethod.GET) | |||
| Set<Role> getPositionRoles(String positionId) { | |||
| Position position = commonRepository.get(Position.class, positionId); | |||
| return position == null ? new HashSet<Role>() : position.getRoles(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position/role", method = RequestMethod.POST) | |||
| void postPositionRole(String positionId, String roleId) { | |||
| positionService.addRoleToPosition(positionId, roleId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position/role", method = RequestMethod.DELETE) | |||
| void deletePositionRole(String positionId, String roleId) { | |||
| positionService.removeRoleFromPosition(positionId, roleId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "position/users", method = RequestMethod.GET) | |||
| Set<User> getPositionUsers(String positionId) { | |||
| Position position = commonRepository.get(Position.class, positionId); | |||
| return position == null ? new HashSet<User>() : position.getUsers(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/position", method = RequestMethod.POST) | |||
| void postUserPosition(String username, String positionId) { | |||
| userService.addUserPositionMapping(username, positionId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/position", method = RequestMethod.DELETE) | |||
| void deleteUserPosition(String username, String positionId) { | |||
| userService.removeUserPositionMapping(username, positionId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "roles", method = RequestMethod.GET) | |||
| List<Role> getRoles() { | |||
| return commonRepository.getAll(Role.class, Order.asc("order")); | |||
| } | |||
| } | |||
| @ -0,0 +1,97 @@ | |||
| package com.ciotea.cdcng.front.application.config; | |||
| import infrastructure.support.records.Order; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepttypedict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.service.AuthorityDepartmentService; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| /** | |||
| * 部门管理 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "department") | |||
| public class DepartmentController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| AuthorityDepartmentService authorityDepartmentService; | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.GET) | |||
| Pagination getDepartments(AuthorityDepartment vo, Pagination pagination,Integer type) { | |||
| pagination.setRows(authorityDepartmentRepository.getAll(vo, pagination, type)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 系统机构jstree获取的部门对象 | |||
| * @param dept_id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getDepartment", method = RequestMethod.GET) | |||
| Department getAuthorityDepartment(String dept_id){ | |||
| Department bean = repository.get(Department.class, dept_id); | |||
| return bean; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.POST) | |||
| AuthorityDepartment addAuthorityDepartment(AuthorityDepartment authorityDepartment){ | |||
| authorityDepartment.setDateJoined(new Date()); | |||
| return authorityDepartmentService.addAuthorityDepartment(authorityDepartment); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.PUT) | |||
| AuthorityDepartment editAuthorityDepartment(AuthorityDepartment authorityDepartment){ | |||
| return authorityDepartmentService.updateAuthorityDepartment(authorityDepartment); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "department", method = RequestMethod.DELETE) | |||
| void editAuthorityDepartment(Integer id){ | |||
| repository.remove(repository.get(AuthorityDepartment.class, id)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "departmentType", method = RequestMethod.GET) | |||
| List<AuthorityDepttypedict> getDepartmentTypes(){ | |||
| List<AuthorityDepttypedict> list = repository.getAll(AuthorityDepttypedict.class, Order.asc("id")); | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,138 @@ | |||
| package com.ciotea.cdcng.front.application.config; | |||
| import infrastructure.support.records.Order; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Module; | |||
| import com.ciotea.cdcng.front.domain.entity.system.ModuleGroup; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Operation; | |||
| import com.ciotea.cdcng.front.domain.repository.system.ModuleGroupRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.service.system.ModuleGroupService; | |||
| import com.ciotea.cdcng.front.domain.service.system.ModuleService; | |||
| import com.ciotea.cdcng.front.domain.service.system.OperationService; | |||
| @Controller | |||
| @RequestMapping(value = "module-management") | |||
| public class ModuleController { | |||
| @Resource | |||
| Repository commonRepository; | |||
| @Resource | |||
| ModuleGroupRepository moduleGroupRepository; | |||
| @Resource | |||
| ModuleGroupService moduleGroupService; | |||
| @Resource | |||
| ModuleService moduleService; | |||
| @Resource | |||
| OperationService operationService; | |||
| // 模块组 | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroups", method = RequestMethod.GET) | |||
| List<ModuleGroup> getModuleGroups() { | |||
| return commonRepository.getAll(ModuleGroup.class, Order.asc("order")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroup", method = RequestMethod.POST) | |||
| ModuleGroup postModuleGroup(ModuleGroup moduleGroup) { | |||
| return moduleGroupService.addModuleGroup(moduleGroup); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroup", method = RequestMethod.PUT) | |||
| ModuleGroup putModuleGroup(ModuleGroup moduleGroup) { | |||
| return moduleGroupService.updateModuleGroup(moduleGroup); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroup", method = RequestMethod.DELETE) | |||
| void deleteModuleGroup(String id) { | |||
| moduleGroupService.removeModuleGroup(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroup/up", method = RequestMethod.POST) | |||
| void postModuleGroupUp(String id) { | |||
| moduleGroupService.moduleGroupUp(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroup/modules", method = RequestMethod.GET) | |||
| List<Module> getModulesOfGroup(String moduleGroupId) { | |||
| return commonRepository.get(ModuleGroup.class, moduleGroupId).getModules(); | |||
| } | |||
| // 模块 | |||
| @ResponseBody | |||
| @RequestMapping(value = "module", method = RequestMethod.POST) | |||
| Module postModule(Module module) { | |||
| return moduleService.addModule(module); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "module", method = RequestMethod.PUT) | |||
| Module putModule(Module module) { | |||
| return moduleService.updateModule(module); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "module", method = RequestMethod.DELETE) | |||
| void deleteModule(String id) { | |||
| moduleService.removeModule(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "module/up", method = RequestMethod.POST) | |||
| void postModuleUp(String id) { | |||
| moduleService.moduleUp(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "module/operations", method = RequestMethod.GET) | |||
| List<Operation> getOperationsOfModule(String moduleId) { | |||
| return commonRepository.get(Module.class, moduleId).getOperations(); | |||
| } | |||
| // 操作 | |||
| @ResponseBody | |||
| @RequestMapping(value = "operation", method = RequestMethod.POST) | |||
| Operation postOperation(Operation operation) { | |||
| return operationService.addOperation(operation); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "operation", method = RequestMethod.PUT) | |||
| Operation putOperation(Operation operation) { | |||
| return operationService.updateOperation(operation); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "operation", method = RequestMethod.DELETE) | |||
| void deleteOperation(String id) { | |||
| operationService.removeOperation(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "operation/up", method = RequestMethod.POST) | |||
| void postOperationUp(String id) { | |||
| operationService.operationUp(id); | |||
| } | |||
| } | |||
| @ -0,0 +1,123 @@ | |||
| package com.ciotea.cdcng.front.application.config; | |||
| import infrastructure.support.records.Order; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Module; | |||
| import com.ciotea.cdcng.front.domain.entity.system.ModuleGroup; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Operation; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Role; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.RoleRepository; | |||
| import com.ciotea.cdcng.front.domain.service.system.RoleService; | |||
| @Controller | |||
| @RequestMapping(value = "role-management") | |||
| public class RoleController { | |||
| @Resource | |||
| Repository commonRepository; | |||
| @Resource | |||
| RoleRepository roleRepository; | |||
| @Resource | |||
| RoleService roleService; | |||
| @ResponseBody | |||
| @RequestMapping(value = "roles", method = RequestMethod.GET) | |||
| List<Role> getRoles() { | |||
| return commonRepository.getAll(Role.class, Order.asc("order")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role", method = RequestMethod.POST) | |||
| Role postRole(Role role) { | |||
| return roleService.addRole(role); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role", method = RequestMethod.PUT) | |||
| Role putRole(Role role) { | |||
| return roleService.updateRole(role); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role", method = RequestMethod.DELETE) | |||
| void deleteRole(String id) { | |||
| roleService.removeRole(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/up", method = RequestMethod.POST) | |||
| void postRoleUp(String roleId) { | |||
| roleService.roleUp(roleId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/modules", method = RequestMethod.GET) | |||
| List<Module> getModulesOfRole(String roleId) { | |||
| return commonRepository.get(Role.class, roleId).getModules(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/module", method = RequestMethod.POST) | |||
| void postRoleModule(String roleId, String moduleId) { | |||
| roleService.addModuleToRole(roleId, moduleId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/module", method = RequestMethod.DELETE) | |||
| void deleteRoleModule(String roleId, String moduleId) { | |||
| roleService.removeModuleFromRole(roleId, moduleId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/operations", method = RequestMethod.GET) | |||
| List<Operation> getRoleOperations(String roleId) { | |||
| return commonRepository.get(Role.class, roleId).getOperations(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/operation", method = RequestMethod.POST) | |||
| void postRoleOperation(String roleId, String operationId) { | |||
| roleService.addOperationToRole(roleId, operationId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "role/operation", method = RequestMethod.DELETE) | |||
| void deleteRoleOperation(String roleId, String operationId) { | |||
| roleService.removeOperationFromRole(roleId, operationId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "moduleGroups", method = RequestMethod.GET) | |||
| List<ModuleGroup> getModuleGroups() { | |||
| return commonRepository.getAll(ModuleGroup.class, Order.asc("order")); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "modules", method = RequestMethod.GET) | |||
| List<Module> getModules(String moduleGroupId) { | |||
| ModuleGroup group = commonRepository.get(ModuleGroup.class, moduleGroupId); | |||
| return group == null ? commonRepository.getAll(Module.class, Order.asc("group.order"), | |||
| Order.asc("order")) : group.getModules(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "module/operations", method = RequestMethod.GET) | |||
| List<Operation> getOperationsOfModule(String moduleId) { | |||
| return commonRepository.get(Module.class, moduleId).getOperations(); | |||
| } | |||
| } | |||
| @ -0,0 +1,237 @@ | |||
| package com.ciotea.cdcng.front.application.config; | |||
| import infrastructure.ftp.FileInfo; | |||
| import infrastructure.ftp.FtpTemplate; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Order; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.IOException; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| import java.util.UUID; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Position; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.UserRepository; | |||
| import com.ciotea.cdcng.front.domain.service.system.UserService; | |||
| import com.ciotea.cdcng.front.domain.user.vo.UserCa; | |||
| import com.ciotea.cdcng.front.infrastructure.support.application.Constants.YesNo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.FileUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.fasterxml.jackson.core.JsonEncoding; | |||
| @Controller | |||
| @RequestMapping(value = "user-management") | |||
| public class UserController { | |||
| @Resource | |||
| Repository commonRepository; | |||
| @Resource | |||
| UserRepository userRepository; | |||
| @Resource | |||
| UserService userService; | |||
| @Resource | |||
| FtpTemplate ftpTemplate; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| Repository repository; | |||
| private static final String tempDir = "/usrs/local/temp/cng/signature/"; | |||
| // 用户 | |||
| @ResponseBody | |||
| @RequestMapping(value = "users", method = RequestMethod.GET) | |||
| Pagination getUsers(String username_name_like, Pagination pagination) { | |||
| return pagination.setRows(userRepository.searchUsers(username_name_like, pagination)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user", method = RequestMethod.POST) | |||
| User postUser(User user) { | |||
| User bean = userService.addUser(user); | |||
| CngUser cngUser = cngUserRepository.findByUserName(bean.getUsername()); | |||
| if(null!=cngUser){ | |||
| cngUser.setSysUserId(bean); | |||
| commonRepository.save(cngUser); | |||
| }else{ | |||
| CngUser cngUserBean = new CngUser(); | |||
| cngUserBean.setUsername(bean.getUsername()); | |||
| cngUserBean.setLastName(bean.getName()); | |||
| cngUserBean.setIsStaff(1); | |||
| cngUserBean.setIsActive(1); | |||
| cngUserBean.setIsSuperuser(0); | |||
| cngUserBean.setDateJoined(new Date()); | |||
| cngUserBean.setSysUserId(bean); | |||
| commonRepository.save(cngUserBean); | |||
| } | |||
| return bean; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user", method = RequestMethod.PUT) | |||
| User putUser(User user) { | |||
| User bean = repository.get(User.class, user.getId()); | |||
| if(!user.getSignature().equals(bean.getSignature())){ | |||
| if(null!=bean.getSignature() && bean.getSignature().length()>0){ | |||
| String oldName = bean.getId()+"/"+bean.getSignature(); | |||
| FileInfo info = ftpTemplate.getFileInfo("cngfile/signature/"+oldName); | |||
| if(null!=info){ | |||
| ftpTemplate.removeFile("cngfile/signature/"+oldName); | |||
| } | |||
| } | |||
| } | |||
| return userService.updateUser(user); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user", method = RequestMethod.DELETE) | |||
| void deleteUser(String id) { | |||
| userService.removeUser(id); | |||
| //同步删除cng表里的user信息 | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(id); | |||
| if(null!=cngUser){ | |||
| commonRepository.remove(cngUser); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/password-restting", method = RequestMethod.POST) | |||
| void postUserPasswordRestting(String userId, String password) { | |||
| userService.addUserPasswordResetting(userId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/password", method = RequestMethod.PUT) | |||
| void putUserPassword(String userId, String password) { | |||
| userService.updateUserPassword(userId, password); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/lock", method = RequestMethod.PUT) | |||
| User putUserLock(String userId) { | |||
| return userService.updateUserLockState(userId, YesNo.YES); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/unlock", method = RequestMethod.PUT) | |||
| User putUserUnlock(String userId) { | |||
| return userService.updateUserLockState(userId, YesNo.NO); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "user/positions", method = RequestMethod.GET) | |||
| Set<Position> getUserPositions(String userId) { | |||
| User user = commonRepository.get(User.class, userId); | |||
| return user == null ? new HashSet<Position>() : user.getPositions(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "userca", method = RequestMethod.PUT) | |||
| User putUserCA(String userId, UserCa userCa) { | |||
| return userService.updateUserCA(userId, userCa); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "userca", method = RequestMethod.DELETE) | |||
| User deleteUserCA(String userId) { | |||
| return userService.removeUserCA(userId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "synUser", method = RequestMethod.PUT) | |||
| void synUsers() { | |||
| List<User> list = commonRepository.getAll(User.class, Order.asc("username")); | |||
| for(User user : list){ | |||
| CngUser cngUser = cngUserRepository.findByUserName(user.getUsername()); | |||
| if(cngUser != null){ | |||
| cngUser.setSysUserId(user); | |||
| commonRepository.save(cngUser); | |||
| } | |||
| } | |||
| }; | |||
| /** | |||
| * 文件上传(临时文件存放区) | |||
| * | |||
| * @param req | |||
| * @param resp | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "fileUpload", method = RequestMethod.POST) | |||
| void postFileUp(MultipartHttpServletRequest req, HttpServletResponse resp) { | |||
| try { | |||
| MultipartFile multipartFile = req.getFile("file"); | |||
| // String fileName = multipartFile.getOriginalFilename(); | |||
| // String[] str = fileName.split("[.]"); | |||
| // int i = str.length - 1; | |||
| // if (!"png".equalsIgnoreCase(str[i]) && !"jpg".equalsIgnoreCase(str[i]) | |||
| // && !"bmp".equalsIgnoreCase(str[i]) | |||
| // && !"jpeg".equalsIgnoreCase(str[i])) { | |||
| // throw new AppException("请选择以png,jpg,bmp,jpeg结尾的图片签名"); | |||
| // } | |||
| File temp = FileUtil.createFile(tempDir | |||
| + UUID.randomUUID().toString() + ".tmp"); | |||
| // FileInputStream fis = new FileInputStream(temp); | |||
| // ftpTemplate.saveFile(multipartFile.getName(), multipartFile.getInputStream()); | |||
| multipartFile.transferTo(temp); | |||
| Map<String, String> ret = new HashMap<String, String>(); | |||
| ret.put("path", temp.getPath()); | |||
| ret.put("name", multipartFile.getOriginalFilename()); | |||
| resp.setContentType("text/plain"); | |||
| resp.setCharacterEncoding("UTF-8"); | |||
| new ObjectMapper().getFactory().createJsonGenerator(resp.getOutputStream(),JsonEncoding.UTF8).writeObject(ret); | |||
| resp.getOutputStream().flush(); | |||
| } catch (IOException e) { | |||
| throw new AppException("文件上传失败", e); | |||
| } | |||
| } | |||
| /** | |||
| * 上传签名 | |||
| * | |||
| * @param fileUrl | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "uploadAnnex", method = RequestMethod.GET) | |||
| void uploadAnnex(String signatureUrl, String id, String signature,HttpServletRequest req){ | |||
| userService.uploadAnnex(signatureUrl, id, signature,ServletUtil.getWebRootPath(req, "signature")); | |||
| } | |||
| } | |||
| @ -0,0 +1,36 @@ | |||
| package com.ciotea.cdcng.front.application.dictionary; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.dictionary.repository.DictionaryRepository; | |||
| import com.ciotea.cdcng.front.domain.dictionary.vo.ValveFactoryVo; | |||
| import com.ciotea.cdcng.front.domain.dictionary.vo.ValveModelVo; | |||
| @Controller | |||
| @RequestMapping(value = "dictionary") | |||
| public class DictionaryController { | |||
| @Resource | |||
| DictionaryRepository dictionaryRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "valveFactorys", method = RequestMethod.GET) | |||
| List<ValveFactoryVo> getValveFactorys() { | |||
| return dictionaryRepository.getValveFactorys(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "valveModels", method = RequestMethod.GET) | |||
| List<ValveModelVo> getValveModels(Integer factoryId) { | |||
| return dictionaryRepository.getValveModelByFactoryId(factoryId); | |||
| } | |||
| } | |||
| @ -0,0 +1,234 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Collections; | |||
| import java.util.Comparator; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.AddVolumeTimeBucketVo; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.repository.AddVolumeTimeBucketRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.service.AddVolumeTimeBucketService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 加气总量分段统计 | |||
| * @author luoc | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "timeBucket") | |||
| public class AddVolumeTimeBucketController { | |||
| @Resource | |||
| AddVolumeTimeBucketRepository addVolumeTimeBucketRepository; | |||
| @Resource | |||
| AddVolumeTimeBucketService addVolumeTimeBucketService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| private String[] hour = new String[]{"00","01","02","03","04","05","06","07","08","09", | |||
| "10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; | |||
| /** | |||
| * 获取加气条件 | |||
| * @param startDate 开始时间 | |||
| * @param endDate 离线时间 | |||
| * @param flag 间隔时间 | |||
| * @param area 区域 | |||
| * @param choose 查询方式(3种情况) | |||
| * @param cngType 加气属性 | |||
| * @param station 加气站 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "timeBuckets", method = RequestMethod.GET) | |||
| List<AddVolumeTimeBucketVo> getTimeBuckets(String startDate,String endDate, String flag, | |||
| String area, String choose, String[] cngType, String[] station,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<AddVolumeTimeBucketVo> addVolumeList = new ArrayList<AddVolumeTimeBucketVo>(); | |||
| // 所有 | |||
| if (choose.equals("all")) { | |||
| List<AddVolumeTimeBucketVo> addVoList = addVolumeTimeBucketRepository.getTimeBucket(startDate, endDate, flag, null, choose,cngType, null,permissionFilter); | |||
| addVoList = Tool.CompletionAll(addVoList, hour); | |||
| List<AddVolumeTimeBucketVo> processList = createChartData(Integer.parseInt(flag), addVoList); | |||
| addVolumeList.addAll(processList); | |||
| } | |||
| // 查询方式选择"区域"时为area | |||
| else if (choose.equals("area")) { | |||
| List<AddVolumeTimeBucketVo> addVoList = addVolumeTimeBucketRepository.getTimeBucket(startDate, endDate, flag, area, choose,cngType, null,permissionFilter); | |||
| addVoList = Tool.CompletionAll(addVoList, hour); | |||
| List<AddVolumeTimeBucketVo> processList = createChartData(Integer.parseInt(flag), addVoList); | |||
| addVolumeList.addAll(processList); | |||
| } | |||
| // 站点 | |||
| else if (choose.equals("station")) { | |||
| List<String> stationList = new ArrayList<String>(); | |||
| for (int i = 0; i < station.length; i++) { | |||
| FillGasStation bean = repository.get(FillGasStation.class,Integer.parseInt(station[i])); | |||
| stationList.add(bean.getCode()); | |||
| } | |||
| List<AddVolumeTimeBucketVo> addVoList = addVolumeTimeBucketRepository | |||
| .getTimeBucket(startDate, endDate, flag, null, choose, | |||
| cngType, stationList,permissionFilter); | |||
| addVoList = Tool.CompletionAll(addVoList, hour); | |||
| List<AddVolumeTimeBucketVo> processList = createChartData(Integer.parseInt(flag), addVoList); | |||
| addVolumeList.addAll(processList); | |||
| } | |||
| return addVolumeList; | |||
| } | |||
| /** | |||
| * 按时间 间隔返回数组 | |||
| * @param interval 时间间隔 | |||
| * @param dbVos 加气量数据 | |||
| * @return | |||
| */ | |||
| public List<AddVolumeTimeBucketVo> createChartData(int interval, List<AddVolumeTimeBucketVo> dbVos) { | |||
| Collections.sort(dbVos, new Comparator<AddVolumeTimeBucketVo>() { | |||
| @Override | |||
| public int compare(AddVolumeTimeBucketVo o1, AddVolumeTimeBucketVo o2) { | |||
| return Integer.parseInt(o1.getHourInterval()) - Integer.parseInt(o2.getHourInterval()); | |||
| } | |||
| }); | |||
| double dd =24.0/interval; | |||
| int interv = (int)Math.ceil(dd); | |||
| List<AddVolumeTimeBucketVo> chartL = new ArrayList<AddVolumeTimeBucketVo>(interv); | |||
| for (AddVolumeTimeBucketVo vo : dbVos) { | |||
| int hour = Integer.parseInt(vo.getHourInterval()); | |||
| int index = interval==1?(int)Math.floor(hour/interval)-1:(int)Math.floor(hour/interval); | |||
| if (index >= interv && interval != 1) { | |||
| continue; | |||
| } | |||
| if (index < chartL.size() && chartL.get(index) !=null) { | |||
| AddVolumeTimeBucketVo dvo = chartL.get(index); | |||
| BigDecimal bg = new BigDecimal(dvo.getValue()); | |||
| BigDecimal f0 = bg.setScale(2, BigDecimal.ROUND_HALF_UP); | |||
| BigDecimal bg1 = new BigDecimal(vo.getValue()); | |||
| BigDecimal f1 = bg1.setScale(2, BigDecimal.ROUND_HALF_UP); | |||
| BigDecimal sum = f0.add(f1); | |||
| dvo.setValue(sum.doubleValue()); | |||
| } else { | |||
| AddVolumeTimeBucketVo dvo = new AddVolumeTimeBucketVo(); | |||
| BigDecimal bg = new BigDecimal(vo.getValue()); | |||
| BigDecimal f0 = bg.setScale(2, BigDecimal.ROUND_HALF_UP); | |||
| dvo.setValue(f0.doubleValue()); | |||
| int hourStart = index * interval; | |||
| int hourEnd = hourStart + interval; | |||
| if (hourEnd > 24) { | |||
| hourEnd = 24; | |||
| } | |||
| if(interval == 1) { | |||
| dvo.setHourInterval(hourStart + "-" + String.valueOf(hourStart + 1)); | |||
| } else { | |||
| dvo.setHourInterval(hourStart + "-" + hourEnd); | |||
| } | |||
| chartL.add(dvo); | |||
| } | |||
| } | |||
| return chartL; | |||
| } | |||
| /* *//** | |||
| * 导出加气总量分段统计数据 | |||
| * @return | |||
| *//* | |||
| @ResponseBody | |||
| // vGasRecords/getSetupcheckExcel | |||
| @RequestMapping(value = "getTimeBucketExcel", method = RequestMethod.GET) | |||
| public void exportExcel(String startDate,String endDate, String flag, | |||
| String area, String choose, String[] cngType, String[] station, infrastructure.support.records.Pagination pagination,Context context, HttpServletResponse response) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| Pagination pager = new Pagination(); | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = addVolumeTimeBucketService.getExportExcel(startDate, endDate, flag, area, choose, cngType, station, pager,permissionFilter); | |||
| String title = "加气总量分段统计.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| }*/ | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "homeAir", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> monthAir(String year,String month,String type3,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<CngTypeDict> listCngType = gasrangeRepository.getCngTypeDict(); | |||
| String type[] = new String[listCngType.size()]; | |||
| for(int i=0; i<listCngType.size(); i++){ | |||
| type[i] = listCngType.get(i).getId() + ""; | |||
| } | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| List<List<MonthGasVo>> list = new ArrayList<List<MonthGasVo>>(); | |||
| List<MonthGasVo> sum = gasChartRepository.getMonthChartSum(year,month,lastDay,"",type,"",permissionFilter); | |||
| if(sum.size() < 1 ){ | |||
| for(int k = 1 ; k <= Integer.parseInt(lastDay) ; k ++){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+k); | |||
| tempVo.setName("总和"); | |||
| tempVo.setSum("0"); | |||
| sum.add(tempVo); | |||
| } | |||
| } | |||
| list.add(sum); | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,80 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.BlacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.service.BlacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "black") | |||
| public class BlacklistcarController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| BlacklistcarRepository blacklistcarRepository; | |||
| @Resource | |||
| BlacklistcarService blacklistcarService; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| // 获取黑名单 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarBy", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCngCdCarBy(String platenum, | |||
| String vin, infrastructure.support.records.Pagination pagination, | |||
| Context context) { | |||
| PermissionFilter permissionFilter = cnguserRepository.permissionFilter(context); | |||
| pagination.setRows(blacklistcarRepository.getCarPlatenum(platenum, vin,pagination, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 新增黑名单车辆 | |||
| * | |||
| * @param car | |||
| * @param remark | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "addblackcar", method = RequestMethod.PUT) | |||
| void addBlackCar(CngCdCar car, Context context) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| this.blacklistcarService.addCarremark(car, cnguser, authdept); | |||
| } | |||
| /** | |||
| * 车辆详情 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCardetail", method = RequestMethod.GET) | |||
| CngCdCar getCardetail(Integer id) { | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.bottleGroup.repository.bottleGroupRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "bottleGroups") | |||
| public class BottleGroupController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| bottleGroupRepository bottleGroup; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBottGroups", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getBottGroups(Integer ccnum, String date_start, | |||
| String date_end,String onlineList,infrastructure.support.records.Pagination pagination, | |||
| Context context) { | |||
| List<Integer> listGas = Tool.StringByList(onlineList); | |||
| pagination.setRows(bottleGroup.getBottGroup(ccnum, date_start, date_end, listGas, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 区域 | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| /** | |||
| * 加气站 | |||
| * @param areaId | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| } | |||
| @ -0,0 +1,60 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Order; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.carInfomation.repository.CarInfoisorigRespository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "infoIsorig") | |||
| public class CarInfoisorigController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CarInfoisorigRespository carInformationRespository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| // 获取过户车信息 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarinfoList", method = RequestMethod.GET) | |||
| Pagination getCarinfomation(Pagination pagination, CngCdCar car, | |||
| Integer cngdict, String orig, Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository | |||
| .permissionFilter(context); | |||
| pagination.setRows(carInformationRespository.getCngCarisorigtype( | |||
| pagination, car, cngdict, orig, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 加气属性 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getDiceValue", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDiceValue() { | |||
| List<CngTypeDict> list = repository.getAll(CngTypeDict.class, | |||
| Order.asc("id")); | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,79 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.bottle.repository.TroublebottleRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "troubleInfo") | |||
| public class CngTroublebottleController { | |||
| @Resource | |||
| TroublebottleRepository troublebottleRepository; | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| @ResponseBody | |||
| @RequestMapping(value = "getTroubleInfo", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getTroublebottles( | |||
| String platenum, String startTime, String endTime, | |||
| infrastructure.support.records.Pagination pagination, | |||
| Context context) { | |||
| PermissionFilter permissionFilter = cnguserRepository | |||
| .permissionFilter(context); | |||
| pagination.setRows(troublebottleRepository.getTroublebottle(platenum, | |||
| startTime, endTime, pagination, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getfillname", method = RequestMethod.GET) | |||
| FillGasStation getGasStationName(String code) { | |||
| return gasunlineRepository.getGasStationName(code); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarTroubleInfo", method = RequestMethod.GET) | |||
| Bottle getBottletroubleInfos(String uid) { | |||
| Bottle bottle = troublebottleRepository.getBottletroubleInfo(uid); | |||
| return bottle; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "defaultSearch", method = RequestMethod.GET) | |||
| Map<String, String> defaultSearch() { | |||
| Map<String, String> map = new HashMap<String, String>(); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 12); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf.format(date); | |||
| String endDate = sdf.format(new Date()); | |||
| map.put("startDate", beginDate); | |||
| map.put("endDate", endDate); | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,160 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.service.system.TempFileService; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.entity.CarImport; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.repository.CarUploadExcelRepository; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.service.CarUploadExcelService; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; | |||
| import com.fasterxml.jackson.core.JsonEncoding; | |||
| @Controller | |||
| @RequestMapping(value = "cardictInfo") | |||
| public class CngcarDictExcelController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CarUploadExcelRepository carUploadExcelRepository; | |||
| @Resource | |||
| TempFileService tempFileService; | |||
| @Resource | |||
| CarUploadExcelService carUploadExcelService; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| // 信息查询 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngcarUpload", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCngCdBusBy(CarImport bean, String platenum, Integer cngTypeDict_id, | |||
| infrastructure.support.records.Pagination pagination,Context context) { | |||
| //权限过滤 | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return pagination.setRows(carUploadExcelRepository.findCarUploadExcel(bean, platenum,cngTypeDict_id, permissionFilter, pagination)); | |||
| } | |||
| /** | |||
| * 加气属性 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCngTypeDictAll" , method= RequestMethod.GET) | |||
| List<CngTypeDict> selectcngAll(){ | |||
| return carTypeDictRepository.selectCngTypeDict(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "updateCarUpload", method = RequestMethod.POST) | |||
| String UpdateCarUpload(String importCorpPath, String importCorpFile, | |||
| Context context) { | |||
| if (importCorpFile == null || "".equals(importCorpFile)) { | |||
| return "请选择文件后导入"; | |||
| } | |||
| Workbook wb = null; | |||
| File file = tempFileService.getFile(importCorpPath); | |||
| if (importCorpFile.endsWith(".xls")) { | |||
| try { | |||
| wb = new HSSFWorkbook(new FileInputStream(file)); | |||
| } catch (Exception e) { | |||
| return "上传的文档无法识别!"; | |||
| } | |||
| } else if (importCorpFile.endsWith(".xlsx")) { | |||
| try { | |||
| wb = new XSSFWorkbook(new FileInputStream(file)); | |||
| } catch (Exception e) { | |||
| return "上传的文档无法识别!"; | |||
| } | |||
| } else { | |||
| return "您的文档格式不正确!"; | |||
| } | |||
| return carUploadExcelService.importFile(wb, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "updateCarRowState", method = RequestMethod.POST) | |||
| String UpdateCarRowState(String importCorpPath, String importCorpFile, | |||
| Context context) { | |||
| if (importCorpFile == null || "".equals(importCorpFile)) { | |||
| return "请选择文件后导入"; | |||
| } | |||
| Workbook wb = null; | |||
| File file = tempFileService.getFile(importCorpPath); | |||
| if (importCorpFile.endsWith(".xls")) { | |||
| try { | |||
| wb = new HSSFWorkbook(new FileInputStream(file)); | |||
| } catch (Exception e) { | |||
| return "上传的文档无法识别!"; | |||
| } | |||
| } else if (importCorpFile.endsWith(".xlsx")) { | |||
| try { | |||
| wb = new XSSFWorkbook(new FileInputStream(file)); | |||
| } catch (Exception e) { | |||
| return "上传的文档无法识别!"; | |||
| } | |||
| } else { | |||
| return "您的文档格式不正确!"; | |||
| } | |||
| return carUploadExcelService.importDel(wb, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "fileUpload", method = RequestMethod.POST) | |||
| void postFileUp(MultipartHttpServletRequest req, HttpServletResponse resp) { | |||
| try { | |||
| MultipartFile multipartFile = req.getFile("file"); | |||
| File temp = tempFileService.buildTempFile(); | |||
| multipartFile.transferTo(temp); | |||
| Map<String, String> ret = new HashMap<String, String>(); | |||
| ret.put("path", temp.getPath()); | |||
| ret.put("name", multipartFile.getOriginalFilename()); | |||
| resp.setContentType("text/plain"); | |||
| resp.setCharacterEncoding("UTF-8"); | |||
| new ObjectMapper() | |||
| .getFactory() | |||
| .createJsonGenerator(resp.getOutputStream(), | |||
| JsonEncoding.UTF8).writeObject(ret); | |||
| resp.getOutputStream().flush(); | |||
| } catch (IOException e) { | |||
| throw new AppException("文件上传失败", e); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,187 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.repository.ExportExcelByUtil; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.repository.ExportYreasMonthRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.vo.ExportYreasMonthVo; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| /** | |||
| * 成都市CNG加气站月销售量统计表 | |||
| * 创建人: lk | |||
| * 创建时间: [2014年12月9日 上午11:01:44] | |||
| * 版本: [v1.0] | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "exportMonthExcel") | |||
| public class ExportMonthExcelController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| ExportYreasMonthRepository exportYreasMonthRepository; | |||
| @Resource | |||
| ExportExcelByUtil exportExcelByUtil; | |||
| Double float1= (Double) 0.00; | |||
| Double float2= (Double) 0.00; | |||
| Double float3= (Double) 0.00; | |||
| Double float4= (Double) 0.00; | |||
| Double floattotal= (Double) 0.00; | |||
| Double float1s= (Double) 0.00; | |||
| Double float2s= (Double) 0.00; | |||
| Double float3s= (Double) 0.00; | |||
| Double float4s= (Double) 0.00; | |||
| Double floattotals= (Double) 0.00; | |||
| int num =1; | |||
| int number=1; | |||
| @ResponseBody | |||
| @RequestMapping(value="getMonthExcel", method = RequestMethod.GET) | |||
| public void ExportYearExcel(HttpServletRequest req, HttpServletResponse res,String yreas,String month)throws Exception{ | |||
| if(yreas==""){ | |||
| throw new AppException("请选择日期."); | |||
| } | |||
| if(month==""){ | |||
| throw new AppException("请选择日期."); | |||
| } | |||
| Integer[] code = {17,18,19,20,21,22}; | |||
| List<Integer> listCode = new ArrayList<Integer>(); | |||
| listCode.add(16); | |||
| for(int i=23;i<36;i++){ | |||
| listCode.add(i); | |||
| } | |||
| List<ExportYreasMonthVo> list = exportYreasMonthRepository.getDeptCodeExcel(yreas,month,code); | |||
| Integer[] codes = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}; | |||
| List<ExportYreasMonthVo> total = exportYreasMonthRepository.getTotal(code,yreas,month); | |||
| List<ExportYreasMonthVo> totalAll = exportYreasMonthRepository.getTotalsAll(codes, yreas,month); | |||
| for(int i=0;i<totalAll.size();i++){ | |||
| float1s=totalAll.get(i).getTransit()+float1s; | |||
| float2s=totalAll.get(i).getTaxi()+float2s; | |||
| float3s=totalAll.get(i).getPrivates()+float3s; | |||
| float4s=totalAll.get(i).getNonlocal()+float4s; | |||
| floattotals=totalAll.get(i).getTotal()+floattotals; | |||
| } | |||
| for(int i=0;i<total.size();i++){ | |||
| float1=total.get(i).getTransit()+float1; | |||
| float2=total.get(i).getTaxi()+float2; | |||
| float3=total.get(i).getPrivates()+float3; | |||
| float4=total.get(i).getNonlocal()+float4; | |||
| floattotal=total.get(i).getTotal()+floattotal; | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/energy/gasExportYearExcel/month.xls"); | |||
| Workbook wb = new HSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row row0 = sheet.createRow(0); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 18, 0, "成都CNG加气站("+month+")月销售量统计表", row0,org.apache.poi.hssf.usermodel.HSSFCellStyle.ALIGN_CENTER); | |||
| //17-22 | |||
| for(int j = 0;j<list.size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(j+1); | |||
| row.createCell(1).setCellValue(list.get(j).getArea()); | |||
| row.createCell(2).setCellValue(list.get(j).getDeptCode()); | |||
| row.createCell(3).setCellValue(list.get(j).getTotal()); | |||
| row.createCell(4).setCellValue(list.get(j).getTransit()); | |||
| row.createCell(5).setCellValue(list.get(j).getTaxi()); | |||
| row.createCell(6).setCellValue(list.get(j).getPrivates()); | |||
| row.createCell(7).setCellValue(list.get(j).getNonlocal()); | |||
| row.createCell(8).setCellValue(list.get(j).getRemark()); | |||
| } | |||
| Row row1 = sheet.createRow(list.size()+2); | |||
| row1.createCell(0).setCellValue(""); | |||
| row1.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 11, 2, "小计:", row1,org.apache.poi.hssf.usermodel.HSSFCellStyle.ALIGN_RIGHT); | |||
| row1.createCell(3).setCellValue(floattotal); | |||
| row1.createCell(4).setCellValue(float1); | |||
| row1.createCell(5).setCellValue(float2); | |||
| row1.createCell(6).setCellValue(float3); | |||
| row1.createCell(7).setCellValue(float4); | |||
| for(int k=0;k<listCode.size();k++){ | |||
| List<ExportYreasMonthVo> listExcels = exportYreasMonthRepository.getDeptCodeExcels(yreas,month,listCode.get(k)); | |||
| List<ExportYreasMonthVo> listTotals = exportYreasMonthRepository.getTotals(listCode.get(k), yreas,month); | |||
| for(int j=0;j<listExcels.size();j++){ | |||
| Row row2 = sheet.createRow(list.size()+num+2); | |||
| row2.createCell(0).setCellValue(list.size()+number); | |||
| row2.createCell(1).setCellValue(listExcels.get(j).getArea()); | |||
| row2.createCell(2).setCellValue(listExcels.get(j).getDeptCode()); | |||
| row2.createCell(3).setCellValue(listExcels.get(j).getTotal()); | |||
| row2.createCell(4).setCellValue(listExcels.get(j).getTransit()); | |||
| row2.createCell(5).setCellValue(listExcels.get(j).getTaxi()); | |||
| row2.createCell(6).setCellValue(listExcels.get(j).getPrivates()); | |||
| row2.createCell(7).setCellValue(listExcels.get(j).getNonlocal()); | |||
| row2.createCell(8).setCellValue(listExcels.get(j).getRemark()); | |||
| num++; | |||
| number++; | |||
| } | |||
| if(listTotals.size()>0){ | |||
| Row row3 = sheet.createRow(list.size()+2+num); | |||
| row3.createCell(0).setCellValue(""); | |||
| row3.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 11, 2, "小计:", row3,org.apache.poi.hssf.usermodel.HSSFCellStyle.ALIGN_RIGHT); | |||
| row3.createCell(3).setCellValue(listTotals.get(0).getTotal()); | |||
| row3.createCell(4).setCellValue(listTotals.get(0).getTransit()); | |||
| row3.createCell(5).setCellValue(listTotals.get(0).getTaxi()); | |||
| row3.createCell(6).setCellValue(listTotals.get(0).getPrivates()); | |||
| row3.createCell(7).setCellValue(listTotals.get(0).getNonlocal()); | |||
| row3.createCell(8).setCellValue(listTotals.get(0).getRemark()); | |||
| num++; | |||
| } | |||
| } | |||
| if(num!=1){ | |||
| Row row4 = sheet.createRow(list.size()+2+num); | |||
| row4.createCell(0).setCellValue(""); | |||
| row4.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 14, 2, "合计:", row4,org.apache.poi.hssf.usermodel.HSSFCellStyle.ALIGN_RIGHT); | |||
| row4.createCell(3).setCellValue(floattotals); | |||
| row4.createCell(4).setCellValue(float1s); | |||
| row4.createCell(5).setCellValue(float2s); | |||
| row4.createCell(6).setCellValue(float3s); | |||
| row4.createCell(7).setCellValue(float4s); | |||
| } | |||
| num=1; | |||
| number=1; | |||
| float1= (Double) 0.00; | |||
| float2= (Double) 0.00; | |||
| float3= (Double) 0.00; | |||
| float4= (Double) 0.00; | |||
| floattotal= (Double) 0.00; | |||
| float1s= (Double) 0.00; | |||
| float2s= (Double) 0.00; | |||
| float3s= (Double) 0.00; | |||
| float4s= (Double) 0.00; | |||
| floattotals= (Double) 0.00; | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("加气量统计表"+yreas+"年"+month+"月(月总量和加气属性).xls", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,126 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportRfidtag.repository.ExportRfidtagRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportRfidtag.vo.ExportRfidtagVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.AreaRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| @Controller | |||
| @RequestMapping(value = "exportRfidtagExcel") | |||
| public class ExportRfidtagController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| ExportRfidtagRepository exportRfidtagRepository; | |||
| @Resource | |||
| AreaRepository areaRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value="getExportRfidtag", method = RequestMethod.GET) | |||
| public void ExportYearExcel(HttpServletRequest req, HttpServletResponse res,String loginDate,String endDate) throws FileNotFoundException, IOException{ | |||
| List<Integer> list =new ArrayList<Integer>(); | |||
| List<Integer> list1 =new ArrayList<Integer>(); | |||
| List<Integer> listAreas =new ArrayList<Integer>(); | |||
| List<AreaDict> areaDicts = areaRepository.getAll(); | |||
| for(AreaDict areaDict : areaDicts){ | |||
| if(areaDict.getId() > 16 && areaDict.getId() < 23){ | |||
| list.add(areaDict.getId()); | |||
| }else{ | |||
| list1.add(areaDict.getId()); | |||
| } | |||
| listAreas.add(areaDict.getId()); | |||
| } | |||
| //主城区 | |||
| List<ExportRfidtagVo> exportbottle = exportRfidtagRepository.getRfidtag( loginDate, endDate,list); | |||
| //非主城区 | |||
| List<ExportRfidtagVo> exportcar = exportRfidtagRepository.getRfidtag(loginDate, endDate,list1); | |||
| //合计 | |||
| List<ExportRfidtagVo> exportTotal = exportRfidtagRepository.gasRfidtagTotal(loginDate, endDate,listAreas); | |||
| String path = ServletUtil.getWebRootPath(req, "/app/energy/gasExportRfidtag/exportRfidtag.xls"); | |||
| Workbook wb = new HSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row row0 = sheet.createRow(1); | |||
| row0.createCell(0).setCellValue("统计时间:"+loginDate+" 至 "+endDate); | |||
| for(int j = 0;j<exportbottle.size();j++){ | |||
| Row row = sheet.createRow(5+j); | |||
| row.createCell(0).setCellValue(exportbottle.get(j).getArea()); | |||
| row.createCell(1).setCellValue(exportbottle.get(j).getCarCounts55()); | |||
| row.createCell(2).setCellValue(exportbottle.get(j).getBottCounts55()); | |||
| row.createCell(3).setCellValue(exportbottle.get(j).getCarCounts61()); | |||
| row.createCell(4).setCellValue(exportbottle.get(j).getBottCounts61()); | |||
| row.createCell(5).setCellValue(exportbottle.get(j).getCarCounts60()); | |||
| row.createCell(6).setCellValue(exportbottle.get(j).getBottCounts60()); | |||
| row.createCell(7).setCellValue(exportbottle.get(j).getCarCounts63()); | |||
| row.createCell(8).setCellValue(exportbottle.get(j).getBottCounts63()); | |||
| row.createCell(9).setCellValue(exportbottle.get(j).getCarCounts62()); | |||
| row.createCell(10).setCellValue(exportbottle.get(j).getBottCounts62()); | |||
| row.createCell(11).setCellValue(exportbottle.get(j).getTotal()); | |||
| } | |||
| for(int j=0;j<exportcar.size();j++){ | |||
| Row row = sheet.createRow(5+exportbottle.size()+j); | |||
| row.createCell(0).setCellValue(exportcar.get(j).getArea()); | |||
| row.createCell(1).setCellValue(exportcar.get(j).getCarCounts55()); | |||
| row.createCell(2).setCellValue(exportcar.get(j).getBottCounts55()); | |||
| row.createCell(3).setCellValue(exportcar.get(j).getCarCounts61()); | |||
| row.createCell(4).setCellValue(exportcar.get(j).getBottCounts61()); | |||
| row.createCell(5).setCellValue(exportcar.get(j).getCarCounts60()); | |||
| row.createCell(6).setCellValue(exportcar.get(j).getBottCounts60()); | |||
| row.createCell(7).setCellValue(exportcar.get(j).getCarCounts63()); | |||
| row.createCell(8).setCellValue(exportcar.get(j).getBottCounts63()); | |||
| row.createCell(9).setCellValue(exportcar.get(j).getCarCounts62()); | |||
| row.createCell(10).setCellValue(exportcar.get(j).getBottCounts62()); | |||
| row.createCell(11).setCellValue(exportcar.get(j).getTotal()); | |||
| } | |||
| for(int j=0;j<exportTotal.size();j++){ | |||
| Row row = sheet.createRow(5+exportbottle.size()+exportcar.size()); | |||
| row.createCell(0).setCellValue("合计"); | |||
| row.createCell(1).setCellValue(exportTotal.get(j).getCarCounts55()); | |||
| row.createCell(2).setCellValue(exportTotal.get(j).getBottCounts55()); | |||
| row.createCell(3).setCellValue(exportTotal.get(j).getCarCounts61()); | |||
| row.createCell(4).setCellValue(exportTotal.get(j).getBottCounts61()); | |||
| row.createCell(5).setCellValue(exportTotal.get(j).getCarCounts60()); | |||
| row.createCell(6).setCellValue(exportTotal.get(j).getBottCounts60()); | |||
| row.createCell(7).setCellValue(exportTotal.get(j).getCarCounts63()); | |||
| row.createCell(8).setCellValue(exportTotal.get(j).getBottCounts63()); | |||
| row.createCell(9).setCellValue(exportTotal.get(j).getCarCounts62()); | |||
| row.createCell(10).setCellValue(exportTotal.get(j).getBottCounts62()); | |||
| row.createCell(11).setCellValue(exportTotal.get(j).getTotal()); | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("电子标签发放统计表.xls", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,270 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.repository.ExportExcelByUtil; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.repository.MonthDataTransferRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.GasExportYearExcel.vo.ExportMonth; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| /** | |||
| * 成都市CNG加气站年销售量统计表 | |||
| * 创建人: lk | |||
| * 创建时间: [2014年12月9日 上午11:01:44] | |||
| * 版本: [v1.0] | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "exportYearExcel") | |||
| public class ExportYearExcelController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| MonthDataTransferRepository dataTransferRepository; | |||
| @Resource | |||
| ExportExcelByUtil exportExcelByUtil; | |||
| Double float1= (Double) 0.00; | |||
| Double float2= (Double) 0.00; | |||
| Double float3= (Double) 0.00; | |||
| Double float4= (Double) 0.00; | |||
| Double float5= (Double) 0.00; | |||
| Double float6= (Double) 0.00; | |||
| Double float7= (Double) 0.00; | |||
| Double float8= (Double) 0.00; | |||
| Double float9= (Double) 0.00; | |||
| Double float10= (Double) 0.00; | |||
| Double float11= (Double) 0.00; | |||
| Double float12= (Double) 0.00; | |||
| Double floattotal= (Double) 0.00; | |||
| Double float1s= (Double) 0.00; | |||
| Double float2s= (Double) 0.00; | |||
| Double float3s= (Double) 0.00; | |||
| Double float4s= (Double) 0.00; | |||
| Double float5s= (Double) 0.00; | |||
| Double float6s= (Double) 0.00; | |||
| Double float7s= (Double) 0.00; | |||
| Double float8s= (Double) 0.00; | |||
| Double float9s= (Double) 0.00; | |||
| Double float10s= (Double) 0.00; | |||
| Double float11s= (Double) 0.00; | |||
| Double float12s= (Double) 0.00; | |||
| Double floattotals= (Double) 0.00; | |||
| int num =1; | |||
| int number=1; | |||
| int areaCount=0; | |||
| @ResponseBody | |||
| @RequestMapping(value="getYearExcel", method = RequestMethod.GET) | |||
| public void ExportYearExcel(HttpServletRequest req, HttpServletResponse res,String years)throws Exception{ | |||
| if(years==""){ | |||
| throw new AppException("请选择日期."); | |||
| } | |||
| Integer[] code = {17,18,19,20,21,22}; | |||
| List<Integer> listCode = new ArrayList<Integer>(); | |||
| listCode.add(16); | |||
| for(int i=23;i<36;i++){ | |||
| listCode.add(i); | |||
| } | |||
| List<ExportMonth> list = dataTransferRepository.getDeptCodeExcel(years,code); | |||
| Integer[] codes = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35}; | |||
| // Integer[] codeCount = {16,23,24,25,26,27,28,29,30,31,32,33,345,35}; | |||
| List<ExportMonth> total = dataTransferRepository.getTotal(code,years); | |||
| List<ExportMonth> totalAll = dataTransferRepository.getTotalsAll(codes, years); | |||
| // List<ExportAreaCount> count = dataTransferRepository.getCount(code); | |||
| // List<ExportAreaCount> counts = dataTransferRepository.getCount(codeCount); | |||
| if(totalAll.size()>0){ | |||
| for(int i=0;i<totalAll.size();i++){ | |||
| float1s=totalAll.get(i).getJanuary()+float1s; | |||
| float2s=totalAll.get(i).getFebruary()+float2s; | |||
| float3s=totalAll.get(i).getMarch()+float3s; | |||
| float4s=totalAll.get(i).getApril()+float4s; | |||
| float5s=totalAll.get(i).getMay()+float5s; | |||
| float6s=totalAll.get(i).getJune()+float6s; | |||
| float7s=totalAll.get(i).getJuly()+float7s; | |||
| float8s=totalAll.get(i).getAugust()+float8s; | |||
| float9s=totalAll.get(i).getSeptember()+float9s; | |||
| float10s=totalAll.get(i).getOctorber()+float10s; | |||
| float11s=totalAll.get(i).getNovember()+float11s; | |||
| float12s=totalAll.get(i).getDecember()+float12s; | |||
| floattotals=totalAll.get(i).getTotal()+floattotals; | |||
| } | |||
| } | |||
| if(total.size()>0){ | |||
| for(int i=0;i<total.size();i++){ | |||
| float1=total.get(i).getJanuary()+float1; | |||
| float2=total.get(i).getFebruary()+float2; | |||
| float3=total.get(i).getMarch()+float3; | |||
| float4=total.get(i).getApril()+float4; | |||
| float5=total.get(i).getMay()+float5; | |||
| float6=total.get(i).getJune()+float6; | |||
| float7=total.get(i).getJuly()+float7; | |||
| float8=total.get(i).getAugust()+float8; | |||
| float9=total.get(i).getSeptember()+float9; | |||
| float10=total.get(i).getOctorber()+float10; | |||
| float11=total.get(i).getNovember()+float11; | |||
| float12=total.get(i).getDecember()+float12; | |||
| floattotal=total.get(i).getTotal()+floattotal; | |||
| } | |||
| } | |||
| String path = ServletUtil.getWebRootPath(req, "/app/energy/gasExportYearExcel/cngYears.xls"); | |||
| Workbook wb = new HSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row row0 = sheet.createRow(0); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 18, 0, "成都CNG加气站"+years+"年销售量统计表", row0,HSSFCellStyle.ALIGN_CENTER); | |||
| //17-22 | |||
| for(int j = 0;j<list.size();j++){ | |||
| Row row = sheet.createRow(j+2); | |||
| row.createCell(0).setCellValue(j+1); | |||
| row.createCell(1).setCellValue(list.get(j).getArea()); | |||
| row.createCell(2).setCellValue(list.get(j).getDeptCode()); | |||
| row.createCell(3).setCellValue(list.get(j).getJanuary()); | |||
| row.createCell(4).setCellValue(list.get(j).getFebruary()); | |||
| row.createCell(5).setCellValue(list.get(j).getMarch()); | |||
| row.createCell(6).setCellValue(list.get(j).getApril()); | |||
| row.createCell(7).setCellValue(list.get(j).getMay()); | |||
| row.createCell(8).setCellValue(list.get(j).getJune()); | |||
| row.createCell(9).setCellValue(list.get(j).getJuly()); | |||
| row.createCell(10).setCellValue(list.get(j).getAugust()); | |||
| row.createCell(11).setCellValue(list.get(j).getSeptember()); | |||
| row.createCell(12).setCellValue(list.get(j).getOctorber()); | |||
| row.createCell(13).setCellValue(list.get(j).getNovember()); | |||
| row.createCell(14).setCellValue(list.get(j).getDecember()); | |||
| row.createCell(15).setCellValue(list.get(j).getTotal()); | |||
| } | |||
| Row row1 = sheet.createRow(list.size()+2); | |||
| row1.createCell(0).setCellValue(""); | |||
| row1.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 11, 2, "小计:", row1,HSSFCellStyle.ALIGN_RIGHT); | |||
| row1.createCell(3).setCellValue(float1); | |||
| row1.createCell(4).setCellValue(float2); | |||
| row1.createCell(5).setCellValue(float3); | |||
| row1.createCell(6).setCellValue(float4); | |||
| row1.createCell(7).setCellValue(float5); | |||
| row1.createCell(8).setCellValue(float6); | |||
| row1.createCell(9).setCellValue(float7); | |||
| row1.createCell(10).setCellValue(float8); | |||
| row1.createCell(11).setCellValue(float9); | |||
| row1.createCell(12).setCellValue(float10); | |||
| row1.createCell(13).setCellValue(float11); | |||
| row1.createCell(14).setCellValue(float12); | |||
| row1.createCell(15).setCellValue(floattotal); | |||
| //非中心城区 | |||
| for(int k=0;k<listCode.size();k++){ | |||
| List<ExportMonth> listExcels = dataTransferRepository.getDeptCodeExcels(years,listCode.get(k)); | |||
| List<ExportMonth> listTotals = dataTransferRepository.getTotals(listCode.get(k), years); | |||
| if(listExcels.size()>0){ | |||
| for(int j=0;j<listExcels.size();j++){ | |||
| Row row2 = sheet.createRow(list.size()+num+2); | |||
| row2.createCell(0).setCellValue(list.size()+number); | |||
| row2.createCell(1).setCellValue(listExcels.get(j).getArea()); | |||
| row2.createCell(2).setCellValue(listExcels.get(j).getDeptCode()); | |||
| row2.createCell(3).setCellValue(listExcels.get(j).getJanuary()); | |||
| row2.createCell(4).setCellValue(listExcels.get(j).getFebruary()); | |||
| row2.createCell(5).setCellValue(listExcels.get(j).getMarch()); | |||
| row2.createCell(6).setCellValue(listExcels.get(j).getApril()); | |||
| row2.createCell(7).setCellValue(listExcels.get(j).getMay()); | |||
| row2.createCell(8).setCellValue(listExcels.get(j).getJune()); | |||
| row2.createCell(9).setCellValue(listExcels.get(j).getJuly()); | |||
| row2.createCell(10).setCellValue(listExcels.get(j).getAugust()); | |||
| row2.createCell(11).setCellValue(listExcels.get(j).getSeptember()); | |||
| row2.createCell(12).setCellValue(listExcels.get(j).getOctorber()); | |||
| row2.createCell(13).setCellValue(listExcels.get(j).getNovember()); | |||
| row2.createCell(14).setCellValue(listExcels.get(j).getDecember()); | |||
| row2.createCell(15).setCellValue(listExcels.get(j).getTotal()); | |||
| num++; | |||
| number++; | |||
| } | |||
| } | |||
| if(listTotals.size()>0){ | |||
| Row row3 = sheet.createRow(list.size()+num+2); | |||
| row3.createCell(0).setCellValue(""); | |||
| row3.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 11, 2, "小计:", row3,HSSFCellStyle.ALIGN_RIGHT); | |||
| row3.createCell(3).setCellValue(listTotals.get(0).getJanuary()); | |||
| row3.createCell(4).setCellValue(listTotals.get(0).getFebruary()); | |||
| row3.createCell(5).setCellValue(listTotals.get(0).getMarch()); | |||
| row3.createCell(6).setCellValue(listTotals.get(0).getApril()); | |||
| row3.createCell(7).setCellValue(listTotals.get(0).getMay()); | |||
| row3.createCell(8).setCellValue(listTotals.get(0).getJune()); | |||
| row3.createCell(9).setCellValue(listTotals.get(0).getJuly()); | |||
| row3.createCell(10).setCellValue(listTotals.get(0).getAugust()); | |||
| row3.createCell(11).setCellValue(listTotals.get(0).getSeptember()); | |||
| row3.createCell(12).setCellValue(listTotals.get(0).getOctorber()); | |||
| row3.createCell(13).setCellValue(listTotals.get(0).getNovember()); | |||
| row3.createCell(14).setCellValue(listTotals.get(0).getDecember()); | |||
| row3.createCell(15).setCellValue(listTotals.get(0).getTotal()); | |||
| num++; | |||
| } | |||
| } | |||
| Row row4 = sheet.createRow(list.size()+num+2); | |||
| row4.createCell(0).setCellValue(""); | |||
| row4.createCell(1).setCellValue(""); | |||
| // exportExcelByUtil.excelByUtil(wb, "微软雅黑", 14, 2, "合计:", row4,HSSFCellStyle.ALIGN_RIGHT); | |||
| row4.createCell(3).setCellValue(float1s); | |||
| row4.createCell(4).setCellValue(float2s); | |||
| row4.createCell(5).setCellValue(float3s); | |||
| row4.createCell(6).setCellValue(float4s); | |||
| row4.createCell(7).setCellValue(float5s); | |||
| row4.createCell(8).setCellValue(float6s); | |||
| row4.createCell(9).setCellValue(float7s); | |||
| row4.createCell(10).setCellValue(float8s); | |||
| row4.createCell(11).setCellValue(float9s); | |||
| row4.createCell(12).setCellValue(float10s); | |||
| row4.createCell(13).setCellValue(float11s); | |||
| row4.createCell(14).setCellValue(float12s); | |||
| row4.createCell(15).setCellValue(floattotals); | |||
| num=1; | |||
| number=1; | |||
| float1= (Double) 0.00; | |||
| float2= (Double) 0.00; | |||
| float3= (Double) 0.00; | |||
| float4= (Double) 0.00; | |||
| float5= (Double) 0.00; | |||
| float6= (Double) 0.00; | |||
| float7= (Double) 0.00; | |||
| float8= (Double) 0.00; | |||
| float9= (Double) 0.00; | |||
| float10= (Double) 0.00; | |||
| float11= (Double) 0.00; | |||
| float12= (Double) 0.00; | |||
| floattotal= (Double) 0.00; | |||
| float1s= (Double) 0.00; | |||
| float2s= (Double) 0.00; | |||
| float3s= (Double) 0.00; | |||
| float4s= (Double) 0.00; | |||
| float5s= (Double) 0.00; | |||
| float6s= (Double) 0.00; | |||
| float7s= (Double) 0.00; | |||
| float8s= (Double) 0.00; | |||
| float9s= (Double) 0.00; | |||
| float10s= (Double) 0.00; | |||
| float11s= (Double) 0.00; | |||
| float12s= (Double) 0.00; | |||
| floattotals= (Double) 0.00; | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("成都市CNG加气站年销售量统计表.xls", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,114 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.Gastation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.StaionState; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.FillGasStationRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasFillingstationRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.service.FillGasStationService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "station") | |||
| public class FillGasStationController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| FillGasStationRepository fillGasStationRepository; | |||
| @Resource | |||
| GasFillingstationRepository gasFillingstationRepository; | |||
| @Resource | |||
| FillGasStationService fillGasStationService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| // 获取加气站列表 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGastation", method = RequestMethod.GET) | |||
| Pagination getCngCdCarBy(String name, Integer owner, Integer states, | |||
| Integer areadict, Pagination pagination, Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(fillGasStationRepository.getGasConditions(name, owner, states, areadict, pagination, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| // 加气站信息 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasdetail", method = RequestMethod.GET) | |||
| FillGasStation getGasdetail(Integer id) { | |||
| return repository.get(FillGasStation.class, id); | |||
| } | |||
| // 加气站状态 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasStationstate", method = RequestMethod.GET) | |||
| List<Gastation> getGasStationstates(Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return fillGasStationRepository.getStatemodel(permissionFilter); | |||
| } | |||
| // 所属公司 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasDepartment", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getDepartments() { | |||
| return gasFillingstationRepository.getAuthDepartment(); | |||
| } | |||
| // 所有区域 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasAreaDict", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return fillGasStationRepository.getAreaDictid(district); | |||
| } | |||
| // 获取加气站状态名称及数量 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasStaionState", method = RequestMethod.GET) | |||
| List<StaionState> getStaionStates() { | |||
| return fillGasStationRepository.getStaionState(); | |||
| } | |||
| // 恢复运营/审核通过 | |||
| @ResponseBody | |||
| @RequestMapping(value = "relieveStation", method = RequestMethod.PUT) | |||
| FillGasStation relieveStationgas(Context context, FillGasStation station) { | |||
| return fillGasStationService.relieveStationga(station); | |||
| } | |||
| // 审核不通过 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasFillRemark", method = RequestMethod.PUT) | |||
| FillGasStation updateStationgas(Context context, FillGasStation station) { | |||
| return fillGasStationService.updateNotCheckMsg(context, station); | |||
| } | |||
| // 停运 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasStopRemark", method = RequestMethod.PUT) | |||
| FillGasStation updateStopRemark(Context context, FillGasStation station) { | |||
| return fillGasStationService.updateFillGastation(context, station); | |||
| } | |||
| } | |||
| @ -0,0 +1,101 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.Blacklistcarreport; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.GasblacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.service.GasblacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "report") | |||
| public class GasBlacklistcarController { | |||
| private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| @Resource | |||
| GasblacklistcarService gasblacklistcarService; | |||
| @Resource | |||
| GasblacklistcarRepository gasblacklistcarRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getlistCarreport", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getGasBlacklistcarreport( | |||
| infrastructure.support.records.Pagination pagination, | |||
| String platenum, String certCode, String checkState, | |||
| String start_blackDate, String end_blackDate, Context context) { | |||
| PermissionFilter permissionFilter = cnguserRepository.permissionFilter( | |||
| context.getDepartment(), context.getDistrict()); | |||
| pagination.setRows(gasblacklistcarRepository.getBlacklistcarreport( | |||
| pagination, platenum, certCode, checkState, start_blackDate, | |||
| end_blackDate, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 获取加气站名称 | |||
| * | |||
| * @param deptcode | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getfillname", method = RequestMethod.GET) | |||
| FillGasStation getGasStationname(String deptcode) { | |||
| return gasblacklistcarRepository.getGasname(deptcode); | |||
| } | |||
| /** | |||
| * 站控黑名单上报审核 | |||
| * | |||
| * @param car | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "addCarreport", method = RequestMethod.PUT) | |||
| void addCarreports(Blacklistcarreport car, Context context) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| this.gasblacklistcarService.addCarreport(cnguser, authdept, car); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "defaultSearch", method = RequestMethod.GET) | |||
| Map<String, String> defaultSearch() { | |||
| Map<String, String> map = new HashMap<String, String>(); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 12); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf.format(date); | |||
| String endDate = sdf.format(new Date()); | |||
| map.put("startDate", beginDate); | |||
| map.put("endDate", endDate); | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,68 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.ciotea.cdcng.front.domain.energy.gasFilledException.entity.GasFilledException; | |||
| import com.ciotea.cdcng.front.domain.energy.gasFilledException.repository.GasFilledExceptionRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gasFilledException.service.GasFilledExceptionService; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelReportVo; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import infrastructure.support.records.Pagination; | |||
| /** | |||
| * 加气异常信息 | |||
| * | |||
| */ | |||
| @RestController | |||
| public class GasFilledExceptionController { | |||
| @Autowired | |||
| private GasFilledExceptionRepository gasFilledExceptionRepository; | |||
| @Autowired | |||
| private GasFilledExceptionService gasFilledExceptionService; | |||
| @RequestMapping(value = "/gasFilledException/page", method = RequestMethod.GET) | |||
| public Pagination getPage(String exception,String platenum,String vin,String station,String startTime,String endTime,Context context , Pagination pagination) { | |||
| int pageNum = pagination.getPage(); | |||
| List<GasFilledException> page = gasFilledExceptionRepository.getPage(exception,platenum,vin,station,startTime,endTime,pagination); | |||
| pagination.setRows(page); | |||
| pagination.setPage(pageNum); | |||
| return pagination; | |||
| } | |||
| @RequestMapping(value = "/gasFilledException/getExceptionExcel", method = RequestMethod.GET) | |||
| public void getExceptionExcel(String exception,String platenum,String vin,String station,String startTime,String endTime,Context context , Pagination pagination, HttpServletResponse response) { | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = gasFilledExceptionService.getExceptionExcel(exception,platenum,vin,station,startTime,endTime,pager) ; | |||
| String title = "异常加气信息表.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,157 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasFillingstationRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.service.GasFillingstationService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 加气站信息申报 | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "gasFilled") | |||
| public class GasFillingstationController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| GasFillingstationRepository gasFillingstationRepository; | |||
| @Resource | |||
| GasFillingstationService gasFillingstationService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasFilling", method = RequestMethod.GET) | |||
| Pagination getGasFillingstations(Pagination pagination, Context context, | |||
| String name, Integer owner, Integer areadict, String code, String ip) { | |||
| PermissionFilter permissionFilter = cnguserRepository | |||
| .permissionFilter(context); | |||
| pagination.setRows(gasFillingstationRepository.getGasFillingstation( | |||
| pagination, permissionFilter, name, owner, areadict, code, ip)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getStaiton", method = RequestMethod.GET) | |||
| FillGasStation getStaiton(Context context) { | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| FillGasStation station = new FillGasStation(); | |||
| if(cngUser!=null){ | |||
| station = gasFillingstationRepository.getStation(cngUser.getId()); | |||
| } | |||
| return station; | |||
| } | |||
| // 所属公司 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasDepartment", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getDepartments() { | |||
| return gasFillingstationRepository.getAuthDepartment(); | |||
| } | |||
| // 所属区域 | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasAreaDict", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasFillingstationRepository.getAreaDictid(district); | |||
| } | |||
| // 删除 | |||
| @ResponseBody | |||
| @RequestMapping(value = "deleteGasfilled", method = RequestMethod.DELETE) | |||
| FillGasStation deleteGasfilleds(Context context, Integer id) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| return gasFillingstationService.deleteGasfilled(cnguser, authdept, id); | |||
| } | |||
| // 申报 | |||
| @ResponseBody | |||
| @RequestMapping(value = "apply", method = RequestMethod.PUT) | |||
| FillGasStation apply(Context context, Integer id) { | |||
| FillGasStation station = repository.get(FillGasStation.class, id); | |||
| if(station.getState() != null){ | |||
| if(station.getState().getCode()!=2){ | |||
| throw new AppException("该加气站已提交过申请"); | |||
| } | |||
| } | |||
| return gasFillingstationService.applyStation(station); | |||
| } | |||
| // 新增 | |||
| @ResponseBody | |||
| @RequestMapping(value = "makeGasFilled", method = RequestMethod.POST) | |||
| FillGasStation saveGasFilleds(Context context, FillGasStation fillGasStation) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| return gasFillingstationService.saveGasFilleds(cnguser, authdept, | |||
| fillGasStation); | |||
| } | |||
| // 修改 | |||
| @ResponseBody | |||
| @RequestMapping(value = "makeGasFilled", method = RequestMethod.PUT) | |||
| FillGasStation updateGasFilleds(Context context, | |||
| FillGasStation fillGasStation) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| return gasFillingstationService.updateGasFilled(cnguser, authdept, | |||
| fillGasStation); | |||
| } | |||
| //保存 | |||
| @ResponseBody | |||
| @RequestMapping(value = "saveStation", method = RequestMethod.POST) | |||
| FillGasStation saveStation(Context context, FillGasStation fillGasStation) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| if(fillGasStation.getId()==null){ | |||
| return gasFillingstationService.saveGasFilleds(cnguser, authdept,fillGasStation); | |||
| }else{ | |||
| return gasFillingstationService.updateGasFilled(cnguser, authdept,fillGasStation); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,115 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.vo.StationNumVo; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 离线数据统计 | |||
| * @author luochao | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "offline") | |||
| public class GasOfflineController { | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "offlines", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getOfflines(infrastructure.support.records.Pagination pagination, | |||
| String stationName,String[] areaValue) { | |||
| if(areaValue == null){ | |||
| areaValue = new String[]{}; | |||
| } | |||
| pagination.setRows(gasunlineRepository.getOffline(pagination,stationName,areaValue)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getOrgRecords", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getOrgRecords( | |||
| infrastructure.support.records.Pagination pagination, | |||
| String stationCode) { | |||
| pagination.setRows(gasunlineRepository.getOrgRecord(pagination, | |||
| stationCode)); | |||
| return pagination; | |||
| } | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "getCounts", method = RequestMethod.GET) | |||
| // Map<String,Integer> getCount() { | |||
| // Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| // List<Departmentunline> count = gasunlineRepository.getCounts(null, null); | |||
| // List<Departmentunline> list = gasunlineRepository.getCounts(2880,10080); | |||
| // List<Departmentunline> listd = gasunlineRepository.getCounts(10080,21600); | |||
| // List<Departmentunline> listdd = gasunlineRepository.getCounts(21600,43200); | |||
| // List<Departmentunline> listm = gasunlineRepository.getCounts(43200,null); | |||
| // map.put("count", count.size()); | |||
| // map.put("h", list.size()); | |||
| // map.put("d", listd.size()); | |||
| // map.put("dd", listdd.size()); | |||
| // map.put("m", listm.size()); | |||
| // return map; | |||
| // | |||
| // } | |||
| /** | |||
| * 加气站离线总量 | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "allOffline", method = RequestMethod.GET) | |||
| Map<String,Integer> getBottcertSend(Context context){ | |||
| List<StationNumVo> allOffline = gasunlineRepository.getAllOffline(); //所有 | |||
| Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| map.put("allOffline", allOffline.get(0).getAllOffline()); | |||
| return map; | |||
| } | |||
| /** | |||
| * 加气站在营数量 | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationOpen", method = RequestMethod.GET) | |||
| Map<String,Integer> StationOpenss(Context context){ | |||
| List<StationNumVo> stationOpen = gasunlineRepository.getStationOpen(); | |||
| Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| map.put("stationOpen", stationOpen.get(0).getStationOpen()); | |||
| return map; | |||
| } | |||
| /** | |||
| * 区域 | |||
| * | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddres", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| } | |||
| @ -0,0 +1,69 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.vo.UnlineViewStation; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.StatisticsVo; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "online") | |||
| public class GasOnlineController { | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasGasonline", method = RequestMethod.GET) | |||
| List<UnlineViewStation> getGasOnline(String name, String online, String onlineList, Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<UnlineViewStation> list = gasOnlineRepository.getGasStation(name, online, onlineList, permissionFilter); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasOnlineCount", method = RequestMethod.GET) | |||
| List<StatisticsVo> stationCount(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<StatisticsVo> list = new ArrayList<StatisticsVo>(); | |||
| StatisticsVo online = gasunlineRepository.getStationCountOnline(permissionFilter); | |||
| StatisticsVo offline = gasunlineRepository.getStationPieCountOffline(permissionFilter); | |||
| list.add(online); | |||
| list.add(offline); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| } | |||
| @ -0,0 +1,72 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "unline") | |||
| public class GasUnlineController { | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasUnlines", method = RequestMethod.GET) | |||
| Pagination getGasUnlines(Pagination pagination, String name, | |||
| String startTime, String endTime, String onlineList, Context context) { | |||
| District district = context.getDistrict(); | |||
| List<Integer> listGas = Tool.StringByList(onlineList); | |||
| return pagination.setRows(gasunlineRepository.gasUnlines(pagination, | |||
| name, startTime, endTime, listGas, district)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getfillname", method = RequestMethod.GET) | |||
| FillGasStation getGasStationName(String code) { | |||
| return gasunlineRepository.getGasStationName(code); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationUnlines", method = RequestMethod.GET) | |||
| Pagination getStationUnlines(Pagination pagination, String code, | |||
| String startTime, String endTime) { | |||
| return pagination.setRows(gasunlineRepository.getStationUnline( | |||
| pagination, code, startTime, endTime)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasunlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| } | |||
| @ -0,0 +1,84 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.Gasinterval; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasintervalRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.service.GasintervalService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.records.Pagination; | |||
| /** | |||
| * | |||
| * @author fuxj | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "energy") | |||
| public class GasintervalController { | |||
| @Resource | |||
| GasintervalRepository gasintervalRepository; | |||
| @Resource | |||
| GasintervalService gasintervalService; | |||
| /** | |||
| * | |||
| * 加气时间间隔设置列表 | |||
| * | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasintervalList", method = RequestMethod.GET) | |||
| Pagination getGasinterval(Gasinterval gas, Pagination pagination) { | |||
| return pagination.setRows(gasintervalRepository | |||
| .getGasinterval(gas, pagination)); | |||
| } | |||
| /** | |||
| * 新增加气时间间隔 | |||
| * | |||
| * @param gas | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasinterval", method = RequestMethod.POST) | |||
| Gasinterval addGasinterval(Context context, Gasinterval gas) { | |||
| User user = context.getUser(); | |||
| return gasintervalService.addGasinterval(gas, user); | |||
| } | |||
| /** | |||
| * 修改加气时间间隔 | |||
| * | |||
| * @param gas | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasinterval", method = RequestMethod.PUT) | |||
| Gasinterval updateGasinterval(Gasinterval gas, Integer isenable, Context context) { | |||
| return gasintervalService.updateGasinterval(gas, isenable, context); | |||
| } | |||
| /** | |||
| * 删除加气时间间隔 | |||
| * | |||
| * @param gas | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "gasinterval", method = RequestMethod.DELETE) | |||
| void deleteGasinterval(Integer id, Context context) { | |||
| gasintervalService.deleteGasinterval(id, context); | |||
| } | |||
| } | |||
| @ -0,0 +1,169 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.Gasrange; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.GasrangeDepts; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.GasrangeTypes; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.service.GasrangeService; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.vo.GasrangeView; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "gasrange") | |||
| public class GasrangeController { | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| GasrangeService gasrangeService; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasrange", method = RequestMethod.GET) | |||
| Pagination getGasranges(Context context, Pagination pagination, | |||
| String isvalid) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| return pagination.setRows(gasrangeRepository.getGasranges(cnguser, | |||
| pagination, isvalid)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasrangeView", method = RequestMethod.GET) | |||
| GasrangeView getGasrangeViews(Integer id) { | |||
| return gasrangeRepository.getGasrangeView(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasDepts", method = RequestMethod.GET) | |||
| List<GasrangeDepts> getGasrangeDept(Integer id) { | |||
| return gasrangeRepository.getGasrangeDepts(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasTypes", method = RequestMethod.GET) | |||
| List<GasrangeTypes> getGasrangeType(Integer id) { | |||
| return gasrangeRepository.getGasrangeTypes(id); | |||
| } | |||
| // 禁用启用 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getIsvalids", method = RequestMethod.PUT) | |||
| Gasrange getGasrangeIsvalids(Context context, Integer id) { | |||
| User user = context.getUser(); | |||
| return gasrangeService.addIsvalids(id, user); | |||
| } | |||
| // 删除 | |||
| @ResponseBody | |||
| @RequestMapping(value = "deleteRages", method = RequestMethod.DELETE) | |||
| Gasrange deleteGasranges(Integer id, Context context) { | |||
| User user = context.getUser(); | |||
| return gasrangeService.deleteGasrange(id, user); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "addGasrange", method = RequestMethod.POST) | |||
| Gasrange addGasranges(Context context, String gasOnlineListString, | |||
| String gasTypeListString, String startTime, String endTime) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| List<Integer> listdict = Tool.StringByList(gasTypeListString);// 加气属性 | |||
| List<Integer> listGas = Tool.StringByList(gasOnlineListString);// 单位编号 | |||
| return gasrangeService.addGasrange(cnguser, authdept, listdict, | |||
| listGas, startTime, endTime, gasOnlineListString, | |||
| gasTypeListString); | |||
| } | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| // 获取区域信息 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| // 根据区域ID动态填充加气站列表 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| // 获取选中的区域 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getAreaDictLists", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDictLists(Integer areaId) { | |||
| return gasrangeRepository.getAreaDicts(areaId); | |||
| } | |||
| // 获取选中的加气站 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getFillGasStationLists", method = RequestMethod.GET) | |||
| List<FillGasStation> getFillGasStationLists(Integer gasId) { | |||
| return gasrangeRepository.getgetFillGasStationList(gasId); | |||
| } | |||
| // 获取选中的加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDictLists", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDictListss(Integer dictId) { | |||
| return gasrangeRepository.getgetCngTypeDictLists(dictId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "updateGasrange", method = RequestMethod.PUT) | |||
| Gasrange updateGasranges(Context context, Integer gasId, String startTime, | |||
| String endTime, String gasOnlineListString, String gasTypeListString) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| List<Integer> listdict = Tool.StringByList(gasTypeListString);// 加气属性 | |||
| List<Integer> listGas = Tool.StringByList(gasOnlineListString);// 单位编号 | |||
| return gasrangeService.updateGasrange(cnguser, authdept, gasId, | |||
| startTime, endTime, listdict, listGas, gasOnlineListString, | |||
| gasTypeListString); | |||
| } | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.instruction.Instruction; | |||
| import com.ciotea.cdcng.front.domain.energy.instruction.InstructionMain; | |||
| import com.ciotea.cdcng.front.domain.energy.instruction.InstructionRepo; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value = "instruction") | |||
| public class InstructionController { | |||
| @Resource | |||
| InstructionRepo instructionRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "", method = RequestMethod.GET) | |||
| Pagination getInstructionMains(Pagination pagination, String instructionType, String start, String end, String sendState) { | |||
| List<InstructionMain> list = instructionRepo.getInstructionMains(pagination, instructionType, start, end, sendState); | |||
| return pagination.setRows(list); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "instructions", method = RequestMethod.GET) | |||
| List<Instruction> getInstructions(Integer type, String syncCode, String dateUpdate) { | |||
| List<Instruction> list = instructionRepo.getInstructions(type, syncCode, dateUpdate); | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,82 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.offgas.OffgasRepo; | |||
| import com.ciotea.cdcng.front.domain.energy.offgas.OffgasService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 尾气检测 | |||
| * @author liguo | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "offgas") | |||
| public class OffgasController { | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| OffgasRepo offgasRepo; | |||
| @Resource | |||
| OffgasService offgasService; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "list", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getCleanCarRefitting(infrastructure.support.records.Pagination pagination, Context context, String platenum, Integer offgas) { | |||
| String districtCode = ""; | |||
| String districtId = ""; | |||
| if(!context.getDistrict().getCode().equals("510100")) { | |||
| districtCode = context.getDistrict().getCode(); | |||
| districtId = districtRepository.getDistrictWithCode(districtCode, "").getId(); | |||
| } | |||
| pagination.setRows(offgasRepo.getList(districtId, pagination, platenum.trim(), offgas)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "audit", method = RequestMethod.PUT) | |||
| void audit(Integer carId, Integer offgas) { | |||
| offgasService.audit(carId, offgas); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarById", method = RequestMethod.GET) | |||
| CngCdCar getCar(Integer id) { | |||
| CngCdCar car = repository.get(CngCdCar.class, id); | |||
| return car; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottles(Integer carId) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if(null != carId){ | |||
| list = bottleRepository.getBottleByCarId(carId); | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,81 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.BlacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.service.BlacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "relieve") | |||
| public class ReBlacklistcarController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| BlacklistcarRepository blacklistcarRepository; | |||
| @Resource | |||
| BlacklistcarService blacklistcarService; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| //获取黑名单车辆 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBlackcar", method = RequestMethod.GET) | |||
| Pagination getCngCdCarBy(String platenum, String vin, | |||
| Pagination pagination, Context context) { | |||
| PermissionFilter permissionFilter = cnguserRepository | |||
| .permissionFilter(context); | |||
| return pagination.setRows(blacklistcarRepository.getBlicklistcar( | |||
| platenum, vin, pagination, permissionFilter)); | |||
| } | |||
| /** | |||
| * 车辆详情 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBlackCardetail", method = RequestMethod.GET) | |||
| CngCdCar getCardetail(Integer id) { | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| /** | |||
| * 解除车辆黑名单 | |||
| * | |||
| * @param car | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "relieveBlackcar", method = RequestMethod.PUT) | |||
| void addBlackCar(CngCdCar car, Context context) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| this.blacklistcarService.updateBlackListcar(car, cnguser, authdept); | |||
| } | |||
| } | |||
| @ -0,0 +1,290 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.Filereceive; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.Filesend; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.repository.MessageRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.service.FileService; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.service.MessageService; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.repository.FileRepository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.FileUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; | |||
| import com.fasterxml.jackson.core.JsonEncoding; | |||
| import infrastructure.ftp.FileInfo; | |||
| import infrastructure.ftp.FtpTemplate; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import infrastructure.support.utils.ServletUtil; | |||
| @Controller | |||
| @RequestMapping(value = "file/facade") | |||
| public class SendFileController { | |||
| @Resource | |||
| MessageService messageService; | |||
| @Resource | |||
| FileService fileService; | |||
| @Resource | |||
| FtpTemplate ftpTemplate; | |||
| @Resource | |||
| MessageRepository messageRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| private static final String tempDir = "/usrslk/local/temp/cng/"; | |||
| /** | |||
| * 文件上传(临时文件存放区) | |||
| * | |||
| * @param req | |||
| * @param resp | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "fileUpload", method = RequestMethod.POST) | |||
| void postFileUp(MultipartHttpServletRequest req, HttpServletResponse resp) { | |||
| try { | |||
| MultipartFile multipartFile = req.getFile("file"); | |||
| String fileName = multipartFile.getOriginalFilename(); | |||
| String[] str = fileName.split("[.]"); | |||
| int i = str.length - 1; | |||
| if (!"xls".equals(str[i]) && !"xlsx".equals(str[i]) | |||
| && !"docx".equals(str[i]) && !"doc".equals(str[i]) | |||
| && !"pdf".equals(str[i])) { | |||
| throw new AppException("请选择以xls,xlsx,docx,doc,pdf结尾的文件"); | |||
| } | |||
| File temp = FileUtil.createFile(tempDir | |||
| + UUID.randomUUID().toString() + ".tmp"); | |||
| multipartFile.transferTo(temp); | |||
| Map<String, String> ret = new HashMap<String, String>(); | |||
| ret.put("path", temp.getPath()); | |||
| ret.put("name", multipartFile.getOriginalFilename()); | |||
| resp.setContentType("text/plain"); | |||
| resp.setCharacterEncoding("UTF-8"); | |||
| new ObjectMapper() | |||
| .getFactory() | |||
| .createJsonGenerator(resp.getOutputStream(), | |||
| JsonEncoding.UTF8).writeObject(ret); | |||
| resp.getOutputStream().flush(); | |||
| } catch (IOException e) { | |||
| throw new AppException("文件上传失败", e); | |||
| } | |||
| } | |||
| /** | |||
| * 上传附件 | |||
| * | |||
| * @param path | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "uploadAnnex", method = RequestMethod.GET) | |||
| void uploadAnnex(String fileUrl, Integer id, String fileListName, | |||
| Context context, String addList,HttpServletRequest req) { | |||
| fileService.uploadAnnexList(fileUrl, addList, id, ServletUtil.getWebRootPath(req, "cdcngfile")); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param context | |||
| * @param onlineList | |||
| * 选中加气站的id | |||
| * @param receiveDepts | |||
| * @param fileSendLists | |||
| * @param filePath | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "addSendFile", method = RequestMethod.POST) | |||
| Filesend addSendFile(Context context, String onlineList, | |||
| String receiveDepts, String fileSendLists, String filePath) { | |||
| return fileService.addSendFile(onlineList, context, receiveDepts, | |||
| fileSendLists, filePath); | |||
| } | |||
| /** | |||
| * 收件箱 | |||
| * | |||
| * @param pagination | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "receives", method = RequestMethod.GET) | |||
| Pagination getReceives(Pagination pagination, Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| List<Filereceive> receiives = new ArrayList<Filereceive>(); | |||
| if (null != dept) { | |||
| receiives = messageRepository.getFilereceiveByDept(dept.getId(),pagination); | |||
| } | |||
| return pagination.setRows(receiives); | |||
| } | |||
| /** | |||
| * 发件箱 | |||
| * | |||
| * @param pagination | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "messages", method = RequestMethod.GET) | |||
| Pagination getGasinterval(Pagination pagination, Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository | |||
| .findByMemo(context.getDepartment().getId()); | |||
| List<Filesend> li = new ArrayList<Filesend>(); | |||
| if (null != dept) { | |||
| List<Filesend> list = messageRepository.getFilesendByTypeFile( | |||
| dept.getId(), 2, pagination); | |||
| for (Filesend filesend : list) { | |||
| List<String> showDepts = new ArrayList<String>(); | |||
| for (Filereceive receive : filesend.getReceives()) { | |||
| if (receive.getFillGasStation() != null) { | |||
| String fills[] = (receive.getFillGasStation()) | |||
| .split(","); | |||
| String beans = ""; | |||
| for (int k = 0; k < fills.length; k++) { | |||
| FillGasStation bea = messageRepository | |||
| .getFillGas(fills[k]); | |||
| beans += bea.getName() + ","; | |||
| } | |||
| showDepts.add(beans); | |||
| } else { | |||
| if(receive.getDept()!=null){ | |||
| showDepts.add(receive.getDept().getDeptName()); | |||
| } | |||
| } | |||
| } | |||
| filesend.setShowDept(showDepts.toString().substring(1, | |||
| showDepts.toString().length() - 1)); | |||
| li.add(filesend); | |||
| } | |||
| } | |||
| return pagination.setRows(li); | |||
| } | |||
| // 下载查看 | |||
| @ResponseBody | |||
| @RequestMapping(value = "uploadUrl", method = RequestMethod.GET) | |||
| Pagination getAttachment(Integer id, Pagination pag,HttpServletRequest req) { | |||
| return fileService.uploadUrl(id, pag); | |||
| } | |||
| @Resource | |||
| FileRepository fileRepository; | |||
| @Resource | |||
| Repository repository; | |||
| // 下载 | |||
| @ResponseBody | |||
| @RequestMapping(value = "download", method = RequestMethod.GET) | |||
| void download(String file, Integer sendId, Integer recvId, | |||
| HttpServletResponse response) throws IOException { | |||
| FileInfo fileInfo = ftpTemplate.getFileInfo(file); | |||
| if(fileInfo == null) { | |||
| String str = file.substring(file.lastIndexOf("/") + 1, file.length()); | |||
| throw new AppException("文件:" + str + "不存在"); | |||
| } else { | |||
| ServletUtil.respondFileInfo(response, fileInfo); | |||
| ftpTemplate.getFile(file, response.getOutputStream()); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "updateFile", method = RequestMethod.GET) | |||
| void getFileBySave(String file, Integer sendId, Integer recvId, | |||
| HttpServletResponse response) throws IOException { | |||
| if (sendId != null && recvId != null) { | |||
| Filesend filesend = repository.get(Filesend.class, sendId); | |||
| filesend.setIsrecv(1); | |||
| repository.save(filesend); | |||
| Filereceive recv = repository.get(Filereceive.class, recvId); | |||
| if (recv.getFirstDownTime() == null) { | |||
| recv.setFirstDownTime(new Date()); | |||
| } | |||
| recv.setLastDownTime(new Date()); | |||
| Integer count = recv.getDownCount() + 1; | |||
| recv.setDownCount(count); | |||
| recv.setReceiveType(1); | |||
| repository.save(recv); | |||
| } | |||
| } | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "viewFile", method = RequestMethod.GET) | |||
| // String viewFile(String file, String outputFile) { | |||
| // WordReader.extractDoc(file, "i:/ee.html"); | |||
| // return ""; | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "findSendFileById", method = RequestMethod.GET) | |||
| Filereceive findSendFileById(Integer id) { | |||
| return repository.get(Filereceive.class, id); | |||
| } | |||
| /** | |||
| * * //得到当前登录用户所属的区域 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| List<AreaDict> findByArea(Context context) { | |||
| return messageRepository.findArea(context); | |||
| } | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| /** | |||
| * 根据区域id得到加气站 | |||
| * | |||
| * @param areaId | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| } | |||
| @ -0,0 +1,169 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.Filereceive; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.Filesend; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.PottingMessage; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.entity.SendRecvMsg; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.repository.MessageRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.energyMesg.service.MessageService; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepttypedict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "sendMessage") | |||
| public class SendMessageController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| MessageRepository messageRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| MessageService messageService; | |||
| @ResponseBody | |||
| @RequestMapping(value = "messages", method = RequestMethod.GET) | |||
| Pagination getGasinterval(Pagination pagination,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| List<Filesend> li = new ArrayList<Filesend>(); | |||
| if(null!=dept){ | |||
| List<Filesend> list = messageRepository.getFilesendByType(dept.getId(),1, pagination); | |||
| for(Filesend filesend : list){ | |||
| List<String> showDepts = new ArrayList<String>(); | |||
| for(Filereceive receive : filesend.getReceives()){ | |||
| if(receive.getFillGasStation()!=null){ | |||
| String fills[] = (receive.getFillGasStation()).split(","); | |||
| String beans=""; | |||
| for(int k = 0; k<fills.length; k++){ | |||
| FillGasStation bea = messageRepository.getFillGas(fills[k]); | |||
| beans+=bea.getName()+","; | |||
| } | |||
| showDepts.add(beans); | |||
| }else{ | |||
| if(receive.getDept()!=null){ | |||
| showDepts.add(receive.getDept().getDeptName()); | |||
| } | |||
| } | |||
| } | |||
| filesend.setShowDept(showDepts.toString().substring(1,showDepts.toString().length()-1)); | |||
| li.add(filesend); | |||
| } | |||
| } | |||
| return pagination.setRows(li); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "receives", method = RequestMethod.GET) | |||
| Pagination getReceives(Pagination pagination,Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| List<Filereceive> receiives = new ArrayList<Filereceive>(); | |||
| if(null!=dept){ | |||
| receiives = messageRepository.getFilereceiveByeDeptId(dept.getId(),pagination); | |||
| } | |||
| return pagination.setRows(receiives); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "sendMsg", method = RequestMethod.POST) | |||
| void sendMsg(Context context,String sendContent,String receiveDepts,String onlineList) { | |||
| messageService.addFilesend(onlineList,sendContent, receiveDepts, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "receive", method = RequestMethod.PUT) | |||
| void updateReceive(Context context,String receiveId) { | |||
| messageService.updateFilereceive(context, Integer.parseInt(receiveId)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "showNum", method = RequestMethod.GET) | |||
| List<Integer> showNum(Context context) { | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| List<Integer> list = new ArrayList<Integer>(); | |||
| if(null!=dept){ | |||
| List<Filereceive> listMsg = messageRepository.getMsgNum(dept.getId()); | |||
| List<Filereceive> listFile = messageRepository.getFileNum(dept.getId()); | |||
| list.add(listMsg.size()); | |||
| list.add(listFile.size()); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "depts", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> depts(String deptTypeId) { | |||
| List<AuthorityDepartment> list = new ArrayList<AuthorityDepartment>(); | |||
| if(!StringUtil.isNullOrEmpty(deptTypeId)){ | |||
| list = authorityDepartmentRepository.findByDeptType(Integer.parseInt(deptTypeId)); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "pottingMessage", method = RequestMethod.GET) | |||
| List<PottingMessage> editMakeQRCode(Context context) { | |||
| // Integer deptId = null; | |||
| // if(context.getUser().getUsername().equals("admin")){ | |||
| // | |||
| // } | |||
| List<SendRecvMsg> listRecvs = messageRepository.findBySendType(context.getDepartment().getDeptType().getId()); | |||
| List<PottingMessage> listMessages = new ArrayList<PottingMessage>(); | |||
| for (SendRecvMsg re : listRecvs) { | |||
| PottingMessage message = new PottingMessage(); | |||
| message.setDeptTypes(repository.get(AuthorityDepttypedict.class, re.getRecv())); | |||
| message.setDepts(authorityDepartmentRepository.findByDeptType(re.getRecv())); | |||
| listMessages.add(message); | |||
| } | |||
| return listMessages; | |||
| } | |||
| /** | |||
| * * //得到当前登录用户所属的区域 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddress",method = RequestMethod.GET) | |||
| List<AreaDict> findByArea(Context context){ | |||
| return messageRepository.findArea(context); | |||
| } | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| /** | |||
| * 根据区域id得到加气站 | |||
| * @param areaId | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| } | |||
| @ -0,0 +1,323 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.Collections; | |||
| import java.util.Comparator; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.StationAirVo; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.repository.StatisticsRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.service.StatisticsService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| @Controller | |||
| @RequestMapping(value = "stationAir") | |||
| public class StationAirController { | |||
| @Resource | |||
| StatisticsRepository statisticsRepository; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarUseRepository carUseRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @Resource | |||
| StatisticsService gtatisticsService; | |||
| private String[] hour = new String[]{"00","01","02","03","04","05","06","07","08","09", | |||
| "10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; | |||
| @ResponseBody | |||
| @RequestMapping(value = "air", method = RequestMethod.GET) | |||
| List<List<StationAirVo>> stationAir(String startDate,String endDate, String flag, | |||
| String area, String choose, String[] cngType, String[] station,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // List<StationAirVo> vo = new ArrayList<StationAirVo>(); | |||
| // if(cngType.length < 0){ | |||
| // throw new AppException("请先确定统计方式是否正确"); | |||
| // } | |||
| if(!(Tool.isDate(startDate)) && !(Tool.isDate(endDate))){ | |||
| throw new AppException("请检查时间格式是否正确"); | |||
| } | |||
| if(Tool.isDate(startDate) && Tool.isDate(endDate)){ | |||
| long longstr1 = Long.valueOf(startDate.replaceAll("[-]","")); | |||
| long longstr2 = Long.valueOf(endDate.replaceAll("[-]","")); | |||
| if(longstr1 > longstr2){ | |||
| throw new AppException("开始时间必须小于结束时间"); | |||
| } | |||
| } | |||
| List<List<StationAirVo>> res = new ArrayList<List<StationAirVo>>(); | |||
| //全部 | |||
| if(choose.equals("all")){ | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag,null,null,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| } | |||
| //区域 | |||
| else if(choose.equals("area")){ | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag, area,null,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| } | |||
| //站点 | |||
| else if(choose.equals("station")){ | |||
| List<String> stationList = new ArrayList<String>(); | |||
| for(int i = 0; i < station.length; i++){ | |||
| FillGasStation bean = repository.get(FillGasStation.class, Integer.parseInt(station[i])); | |||
| stationList.add(bean.getCode()); | |||
| } | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag, null, stationList,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| } | |||
| return res; | |||
| } | |||
| //导出加气量分段统计数据 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportStationAirExcel", method = RequestMethod.GET) | |||
| void exportExcel2(String startDate,String endDate, String flag, String area, String choose,String[] cngType, String[] station, Pagination pagination,Context context,HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<StationAirVo>> list = gtatisticsService.getExportExcel(startDate, endDate, flag, area, choose, cngType, station, pagination, permissionFilter); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/energy/stationAir/stationAir.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| int i; | |||
| tempRow.createCell(0).setCellValue("时间段"); | |||
| for(i=1;i<=list.size();i++){ | |||
| tempRow.createCell(i).setCellValue(list.get(i-1).get(0).getName()); | |||
| } | |||
| for(int j = 0;j<list.get(0).size();j++){ | |||
| Row row = sheet.createRow(j+1); | |||
| row.createCell(0).setCellValue(list.get(0).get(j).getDate()); | |||
| int m; | |||
| for(m=1;m<=list.size();m++){ | |||
| row.createCell(m).setCellValue(list.get(m-1).get(j).getSum()); | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("加气量分段统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "homeAir", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> monthAir(String year,String month,String type3,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<CngTypeDict> listCngType = gasrangeRepository.getCngTypeDict(); | |||
| String type[] = new String[listCngType.size()]; | |||
| for(int i=0; i<listCngType.size(); i++){ | |||
| type[i] = listCngType.get(i).getId() + ""; | |||
| } | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| int lastDayNum = Integer.parseInt(lastDay); | |||
| List<List<MonthGasVo>> list = new ArrayList<List<MonthGasVo>>(); | |||
| for(int i = 0;i<type.length;i++){ | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,"",type[i],"",permissionFilter); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setSum("0"); | |||
| tempVo.setName(repository.get(CngTypeDict.class, Integer.parseInt(type[i])).getDictValue()); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| return list; | |||
| } | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| public List<StationAirVo> createChartData(int interval, List<StationAirVo> dbVos) { | |||
| Collections.sort(dbVos, new Comparator<StationAirVo>() { | |||
| @Override | |||
| public int compare(StationAirVo o1, StationAirVo o2) { | |||
| return Integer.parseInt(o1.getDate()) - Integer.parseInt(o2.getDate()); | |||
| } | |||
| }); | |||
| double dd =24.0/interval; | |||
| int interv = (int)Math.ceil(dd); | |||
| List<StationAirVo> chartL = new ArrayList<StationAirVo>(interv); | |||
| for (StationAirVo vo : dbVos) { | |||
| int hour = Integer.parseInt(vo.getDate()); | |||
| int index = (int)Math.floor(hour/interval); | |||
| if (index >= interv && interval != 1) { | |||
| continue; | |||
| } | |||
| if (index < chartL.size() && chartL.get(index) !=null) { | |||
| StationAirVo dvo = chartL.get(index); | |||
| Double sum = Double.valueOf(dvo.getSum()) + Double.valueOf(vo.getSum()); | |||
| dvo.setSum(sum.toString()); | |||
| } else { | |||
| CngTypeDict cngtype = statisticsRepository.getCngTypeByCode(vo.getName()); | |||
| StationAirVo dvo = new StationAirVo(); | |||
| dvo.setSum(vo.getSum()); | |||
| dvo.setName(cngtype.getDictValue()); | |||
| int hourStart = index * interval; | |||
| int hourEnd = hourStart + interval; | |||
| if (hourEnd > 24) { | |||
| hourEnd = 24; | |||
| } | |||
| if(interval == 1) { | |||
| dvo.setDate(hourStart + "-" + String.valueOf(hourStart + 1)); | |||
| } else { | |||
| dvo.setDate(hourStart + "-" + hourEnd); | |||
| } | |||
| chartL.add(dvo); | |||
| } | |||
| } | |||
| // for (TimeBucketVo vo : chartL) { | |||
| // System.out.println(vo.getDate() + ":" + vo.getSum()); | |||
| // } | |||
| return chartL; | |||
| } | |||
| } | |||
| @ -0,0 +1,339 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.StationAirVo; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.repository.StatisticsRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.service.StatisticsService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "stationAirLine") | |||
| public class StationAirLineController { | |||
| @Resource | |||
| StatisticsRepository statisticsRepository; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarUseRepository carUseRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @Resource | |||
| StatisticsService statisticsService; | |||
| private String[] hour = new String[]{"00","01","02","03","04","05","06","07","08","09", | |||
| "10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; | |||
| @ResponseBody | |||
| @RequestMapping(value = "air", method = RequestMethod.GET) | |||
| List<List<StationAirVo>> stationAir(String startDate,String endDate, String flag, | |||
| String area, String choose, String[] cngType, String[] station,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // List<StationAirVo> vo = new ArrayList<StationAirVo>(); | |||
| // if(cngType.length < 0){ | |||
| // throw new AppException("请先确定统计方式是否正确"); | |||
| // } | |||
| if(!(Tool.isDate(startDate)) && !(Tool.isDate(endDate))){ | |||
| throw new AppException("请检查时间格式是否正确"); | |||
| } | |||
| if(Tool.isDate(startDate) && Tool.isDate(endDate)){ | |||
| long longstr1 = Long.valueOf(startDate.replaceAll("[-]","")); | |||
| long longstr2 = Long.valueOf(endDate.replaceAll("[-]","")); | |||
| if(longstr1 > longstr2){ | |||
| throw new AppException("开始时间必须小于结束时间"); | |||
| } | |||
| } | |||
| List<List<StationAirVo>> res = new ArrayList<List<StationAirVo>>(); | |||
| List<StationAirVo> sumList = new ArrayList<StationAirVo>(); | |||
| //全部 | |||
| if(choose.equals("all")){ | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag,null,null,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = statisticsService.createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| //总和 | |||
| sumList = statisticsRepository.stationSum(startDate, endDate, cngType, flag,null,null,permissionFilter); | |||
| if(sumList.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName("总和"); | |||
| tempVo.setSum("0"); | |||
| sumList.add(tempVo); | |||
| } | |||
| } | |||
| sumList = Tool.Completion(sumList, hour); | |||
| List<StationAirVo> resSum = statisticsService.createChartData(Integer.parseInt(flag),sumList); | |||
| res.add(resSum); | |||
| } | |||
| //区域 | |||
| else if(choose.equals("area")){ | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag, area,null,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = statisticsService.createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| //总和 | |||
| sumList = statisticsRepository.stationSum(startDate, endDate, cngType, flag, area,null,permissionFilter); | |||
| if(sumList.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName("总和"); | |||
| tempVo.setSum("0"); | |||
| sumList.add(tempVo); | |||
| } | |||
| } | |||
| sumList = Tool.Completion(sumList, hour); | |||
| List<StationAirVo> resSum = statisticsService.createChartData(Integer.parseInt(flag),sumList); | |||
| res.add(resSum); | |||
| } | |||
| //站点 | |||
| else if(choose.equals("station")){ | |||
| List<String> stationList = new ArrayList<String>(); | |||
| for(int i = 0; i < station.length; i++){ | |||
| FillGasStation bean = repository.get(FillGasStation.class, Integer.parseInt(station[i])); | |||
| stationList.add(bean.getCode()); | |||
| } | |||
| for(int i = 0;i<cngType.length; i++){ | |||
| List<StationAirVo> list = statisticsRepository.stationAll(startDate, endDate, cngType[i], flag, null, stationList,permissionFilter); | |||
| if(list.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName(cngType[i]); | |||
| tempVo.setSum("0"); | |||
| list.add(tempVo); | |||
| } | |||
| } | |||
| list = Tool.Completion(list, hour); | |||
| List<StationAirVo> list2 = statisticsService.createChartData(Integer.parseInt(flag),list); | |||
| res.add(list2); | |||
| } | |||
| //总和 | |||
| sumList = statisticsRepository.stationSum(startDate, endDate, cngType, flag, null, stationList,permissionFilter); | |||
| if(sumList.size() < 1 ){ | |||
| for(int k = 0 ; k< 24 ; k ++){ | |||
| StationAirVo tempVo = new StationAirVo(); | |||
| tempVo.setDate(hour[k]); | |||
| tempVo.setName("总和"); | |||
| tempVo.setSum("0"); | |||
| sumList.add(tempVo); | |||
| } | |||
| } | |||
| sumList = Tool.Completion(sumList, hour); | |||
| List<StationAirVo> resSum = statisticsService.createChartData(Integer.parseInt(flag),sumList); | |||
| res.add(resSum); | |||
| } | |||
| return res; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "homeAir", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> monthAir(String year,String month,String type3,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // year = "2014"; | |||
| // month = "05"; | |||
| List<CngTypeDict> listCngType = gasrangeRepository.getCngTypeDict(); | |||
| String type[] = new String[listCngType.size()]; | |||
| for(int i=0; i<listCngType.size(); i++){ | |||
| type[i] = listCngType.get(i).getId() + ""; | |||
| } | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| int lastDayNum = Integer.parseInt(lastDay); | |||
| List<List<MonthGasVo>> list = new ArrayList<List<MonthGasVo>>(); | |||
| for(int i = 0;i<type.length;i++){ | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,"",type[i],"",permissionFilter); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setSum("0"); | |||
| tempVo.setName(repository.get(CngTypeDict.class, Integer.parseInt(type[i])).getDictValue()); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| List<MonthGasVo> sum = gasChartRepository.getMonthChartSum(year,month,lastDay,"",type,"",permissionFilter); | |||
| if(sum.size() < 1 ){ | |||
| for(int k = 1 ; k <= Integer.parseInt(lastDay) ; k ++){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(k+""); | |||
| tempVo.setName("总和"); | |||
| tempVo.setSum("0"); | |||
| sum.add(tempVo); | |||
| } | |||
| } | |||
| list.add(sum); | |||
| return list; | |||
| } | |||
| // public List<StationAirVo> createChartData(int interval, List<StationAirVo> dbVos) { | |||
| // Collections.sort(dbVos, new Comparator<StationAirVo>() { | |||
| // @Override | |||
| // public int compare(StationAirVo o1, StationAirVo o2) { | |||
| // return Integer.parseInt(o1.getDate()) - Integer.parseInt(o2.getDate()); | |||
| // } | |||
| // | |||
| // }); | |||
| // | |||
| // double dd =24.0/interval; | |||
| // int interv = (int)Math.ceil(dd); | |||
| // List<StationAirVo> chartL = new ArrayList<StationAirVo>(interv); | |||
| // for (StationAirVo vo : dbVos) { | |||
| // int hour = Integer.parseInt(vo.getDate()) + 1; | |||
| // int index = (int)Math.floor(hour/interval); | |||
| // if (index >= interv && interval != 1) { | |||
| // continue; | |||
| // } | |||
| // if (index < chartL.size() && chartL.get(index) !=null) { | |||
| // StationAirVo dvo = chartL.get(index); | |||
| // Double sum = Double.valueOf(dvo.getSum()) + Double.valueOf(vo.getSum()); | |||
| // dvo.setSum(sum.toString()); | |||
| // } else { | |||
| // CngTypeDict cngtype = statisticsRepository.getCngTypeByCode(vo.getName()); | |||
| // StationAirVo dvo = new StationAirVo(); | |||
| // dvo.setSum(vo.getSum()); | |||
| // if(cngtype == null){ | |||
| // dvo.setName("总和"); | |||
| // }else{ | |||
| // dvo.setName(cngtype.getDictValue()); | |||
| // } | |||
| // int hourStart = index * interval; | |||
| // int hourEnd = hourStart + interval - 1; | |||
| // if (hourEnd > 23) { | |||
| // hourEnd = 23; | |||
| // } | |||
| // if(interval == 1) { | |||
| // dvo.setDate(String.valueOf(hourStart- 1)); | |||
| // } else { | |||
| // dvo.setDate(hourStart + "-" + hourEnd); | |||
| // } | |||
| // chartL.add(dvo); | |||
| // } | |||
| // } | |||
| // return chartL; | |||
| // } | |||
| } | |||
| @ -0,0 +1,378 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.spring.web.cache.ResponseBodyCacheManager; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.carUseChart.vo.CarUseAreaVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.repository.GasChartRepository; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.DayGasVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.TypeVo; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.YearGasVo; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasunlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.vo.StationVo; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.StatisticsVo; | |||
| import com.ciotea.cdcng.front.domain.energy.testStatistics.repository.StatisticsRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "statistics") | |||
| public class StatisticsController { | |||
| @Resource | |||
| StatisticsRepository statisticsRepository; | |||
| @Resource | |||
| GasChartRepository gasChartRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarUseRepository carUseRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| GasunlineRepository gasunlineRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "air", method = RequestMethod.GET) | |||
| List<StatisticsVo> getCarUseChart(){ | |||
| List<StatisticsVo> list = statisticsRepository.getStatisticsAir(); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationOfflineList", method = RequestMethod.GET) | |||
| Pagination getOfflines(Pagination pagination,String stationName,String[] areaValue,Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(areaValue == null){ | |||
| areaValue = new String[]{}; | |||
| } | |||
| pagination.setRows(gasunlineRepository.stationOfflineList(pagination,stationName,areaValue, permissionFilter)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "actualUnlines", method = RequestMethod.GET) | |||
| List<StationVo> actualUnlines(Context context) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return gasunlineRepository.actualUnlines(permissionFilter); | |||
| } | |||
| //TODO | |||
| @Resource | |||
| ResponseBodyCacheManager responseBodyCacheManager; | |||
| // @PostConstruct | |||
| // private void init() { | |||
| // | |||
| // new Timer(true).schedule(new TimerTask() { | |||
| // @Override | |||
| // public void run() { | |||
| // try { | |||
| // // 缓存 | |||
| // PermissionFilter permissionFilter = new PermissionFilter(); | |||
| // permissionFilter.setFilterType(2); | |||
| // permissionFilter.setFilterStrings(""); | |||
| // responseBodyCacheManager.cache("/statistics/stationCount?filterType=2&filterStrings=", stationCount(permissionFilter), 600); | |||
| // responseBodyCacheManager.cache("/statistics/stationSum?filterType=2&filterStrings=", getCarUseAreaChart(permissionFilter), 600); | |||
| // } catch (Throwable throwable) {} | |||
| // } | |||
| // }, 3 * 1000L, 530 * 1000L); | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationCount", method = RequestMethod.GET) | |||
| List<StatisticsVo> stationCount(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<StatisticsVo> list = new ArrayList<StatisticsVo>(); | |||
| StatisticsVo online = gasunlineRepository.getStationCountOnline(permissionFilter); | |||
| StatisticsVo offline = gasunlineRepository.getStationPieCountOffline(permissionFilter); | |||
| list.add(online); | |||
| list.add(offline); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationOnOffCount", method = RequestMethod.GET) | |||
| Map<String,Integer> stationOnOffCount(Context context){ | |||
| Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| StatisticsVo online = gasunlineRepository.getStationCountOnline(permissionFilter); | |||
| StatisticsVo offline = gasunlineRepository.getStationCountOffline(permissionFilter); | |||
| map.put("online", Integer.parseInt(online.getCount())); | |||
| map.put("offline", Integer.parseInt(offline.getCount())); | |||
| StatisticsVo sum = gasunlineRepository.getCounts(permissionFilter); | |||
| map.put("sum",Integer.parseInt(sum.getCount())); | |||
| // map.put("sum", Integer.parseInt(online.getCount())+Integer.parseInt(offline.getCount())); | |||
| return map; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "yearAir", method = RequestMethod.GET) | |||
| List<List<YearGasVo>> getYearAir(String year,String[] type2,String[] station,String[] area,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<CngTypeDict> listCngType = gasrangeRepository.getCngTypeDict(); | |||
| String type[] = new String[listCngType.size()]; | |||
| for(int i=0; i<listCngType.size(); i++){ | |||
| type[i] = listCngType.get(i).getId() + ""; | |||
| } | |||
| List<List<YearGasVo>> list = new ArrayList<List<YearGasVo>>(); | |||
| if(type.length > 0){ | |||
| for(int i = 0;i<type.length;i++){ | |||
| TypeVo vo = gasChartRepository.getTypeName(type[i]); | |||
| // if(vo==null && type[i].equals("33")){ | |||
| // vo = new TypeVo(); | |||
| // vo.setName("公交集团"); | |||
| // } | |||
| List<YearGasVo> tempList = gasChartRepository.getYearChart(year,"",type[i],"",permissionFilter); | |||
| List<YearGasVo> resultList = new ArrayList<YearGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j < 13;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[1])==j)){ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(j+"月"); | |||
| tempVo.setName(vo.getName()); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| YearGasVo tempVo = new YearGasVo(); | |||
| tempVo.setDate(tempList.get(flag).getDate()); | |||
| tempVo.setName(tempList.get(flag).getName()); | |||
| tempVo.setSum(Tool.StringByInt(tempList.get(flag).getSum())); | |||
| tempVo.setDate(tempVo.getDate().split("-")[1]+"月"); | |||
| resultList.add(tempVo); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "monthAir", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> monthAir(String year,String month,String[] type,String[] station,String[] area,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| String lastDay = ""; | |||
| //判断月的天数 | |||
| String[] testArr = new String[]{"1","2","1","0","1","0","1","1","0","1","0","1"}; | |||
| if(("1").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "31"; | |||
| }else if(("0").equals(testArr[Integer.parseInt(month)-1])){ | |||
| lastDay = "30"; | |||
| }else if(("2").equals(testArr[Integer.parseInt(month)-1])){ | |||
| int yearNum = Integer.parseInt(year); | |||
| if(yearNum % 4 == 0 && ((yearNum % 100 != 0) || (yearNum % 400 == 0))){ | |||
| lastDay = "29"; | |||
| }else{ | |||
| lastDay = "28"; | |||
| } | |||
| } | |||
| int lastDayNum = Integer.parseInt(lastDay); | |||
| List<List<MonthGasVo>> list = new ArrayList<List<MonthGasVo>>(); | |||
| List<MonthGasVo> tempList = gasChartRepository.getMonthChart(year,month,lastDay,"","","",permissionFilter); | |||
| List<MonthGasVo> resultList = new ArrayList<MonthGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 1;j <= lastDayNum;j++){ | |||
| if(tempList.size()==0||!(Integer.parseInt(tempList.get(flag).getDate().split("-")[2])==j)){ | |||
| MonthGasVo tempVo = new MonthGasVo(); | |||
| tempVo.setDate(year+"-"+month+"-"+j); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "dayAir", method = RequestMethod.GET) | |||
| List<List<DayGasVo>> dayAir(String date,String[] type,String[] station,String[] area,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| String[] testArr = new String[24]; | |||
| for(int h = 0;h<24;h++){ | |||
| testArr[h] = h+""; | |||
| } | |||
| List<List<DayGasVo>> list = new ArrayList<List<DayGasVo>>(); | |||
| List<DayGasVo> tempList = gasChartRepository.getDayChart(date,"","","",permissionFilter); | |||
| List<DayGasVo> resultList = new ArrayList<DayGasVo>(); | |||
| int flag = 0; | |||
| for(int j = 0;j < 24;j++){ | |||
| if(tempList.size()<=flag||!(Integer.parseInt(tempList.get(flag).getDate().split(":")[0])==j)){ | |||
| DayGasVo tempVo = new DayGasVo(); | |||
| tempVo.setDate(j+":00:00"); | |||
| tempVo.setSum("0"); | |||
| resultList.add(tempVo); | |||
| }else{ | |||
| resultList.add(tempList.get(flag)); | |||
| if(flag<tempList.size()-1){ | |||
| flag++; | |||
| } | |||
| } | |||
| } | |||
| list.add(resultList); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "sum", method = RequestMethod.GET) | |||
| Map<String,String> getSum(Integer year, Integer quarter, Integer month,Context context,PermissionFilter permissionFilter){ | |||
| Map<String,String> result = new HashMap<String,String>(); | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| StatisticsVo yearSum = statisticsRepository.getSum(year+"-01-01", year+1+"-01-01",permissionFilter); //year | |||
| if(yearSum!=null){ | |||
| result.put("year", yearSum.getCount()); | |||
| }else{ | |||
| result.put("year", "0"); | |||
| } | |||
| Integer quarterNum = 0; | |||
| Integer yearNum = 0; | |||
| if(quarter == 10){ | |||
| yearNum = year + 1; | |||
| quarterNum = 1; | |||
| }else{ | |||
| yearNum = year; | |||
| quarterNum = quarter+3; | |||
| } | |||
| StatisticsVo quarterSum = statisticsRepository.getSum(year+"-"+quarter+"-01", yearNum+"-"+quarterNum+"-01",permissionFilter); | |||
| if(quarterSum!=null){ | |||
| result.put("quarter", quarterSum.getCount()); | |||
| }else{ | |||
| result.put("quarter", "0"); | |||
| } | |||
| int maxDaysByDate = Tool.getDaysByYearMonth(year, month); | |||
| StatisticsVo monthSum = statisticsRepository.getSum(year+"-"+month+"-01", year+"-"+month+"-"+maxDaysByDate,permissionFilter); | |||
| if(monthSum!=null){ | |||
| result.put("month", monthSum.getCount()); | |||
| }else{ | |||
| result.put("month", "0"); | |||
| } | |||
| return result; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stationSum", method = RequestMethod.GET) | |||
| List<List<CarUseAreaVo>> getCarUseAreaChart(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<CarUseAreaVo>> resultList = new ArrayList<List<CarUseAreaVo>>(); | |||
| List<CarUseAreaVo> listOnline = new ArrayList<CarUseAreaVo>(); | |||
| List<CarUseAreaVo> listOffline = new ArrayList<CarUseAreaVo>(); | |||
| List<CarUseAreaVo> on = gasunlineRepository.stationSumOnline(permissionFilter); | |||
| List<CarUseAreaVo> off = gasunlineRepository.stationSumOffline(permissionFilter); | |||
| List<AreaDict> areaList = carTypeDictRepository.selectAreaDict(); | |||
| for (AreaDict area : areaList) { | |||
| int flag = 0; | |||
| for (CarUseAreaVo online : on) { | |||
| if (online.getArea().equals(area.getId().toString())) { | |||
| CarUseAreaVo vo = new CarUseAreaVo(); | |||
| vo.setCount(online.getCount()); | |||
| vo.setArea(area.getDictValue()); | |||
| vo.setName(online.getName()); | |||
| listOnline.add(vo); | |||
| flag ++; | |||
| break ; | |||
| } | |||
| } | |||
| if(flag==0){ | |||
| CarUseAreaVo vo = new CarUseAreaVo(); | |||
| vo.setCount("0"); | |||
| vo.setArea(area.getDictValue()); | |||
| vo.setName("在线"); | |||
| listOnline.add(vo); | |||
| } | |||
| } | |||
| for(AreaDict area : areaList){ | |||
| int flag = 0; | |||
| for(CarUseAreaVo offline : off){ | |||
| if(offline.getArea().equals(area.getId().toString())){ | |||
| CarUseAreaVo vo = new CarUseAreaVo(); | |||
| vo.setCount(offline.getCount()); | |||
| vo.setArea(area.getDictValue()); | |||
| vo.setName(offline.getName()); | |||
| listOffline.add(vo); | |||
| flag ++; | |||
| break ; | |||
| } | |||
| } | |||
| if(flag==0){ | |||
| CarUseAreaVo vo = new CarUseAreaVo(); | |||
| vo.setCount("0"); | |||
| vo.setArea(area.getDictValue()); | |||
| vo.setName("离线"); | |||
| listOffline.add(vo); | |||
| } | |||
| } | |||
| resultList.add(listOnline); | |||
| resultList.add(listOffline); | |||
| return resultList; | |||
| } | |||
| } | |||
| @ -0,0 +1,273 @@ | |||
| package com.ciotea.cdcng.front.application.energy; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.FillGasStationRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.vehicleGasRecords.repository.VehicleGasRecordsRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.vehicleGasRecords.service.VehicleGasRecordsService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.District; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelReportVo; | |||
| import com.ciotea.cdcng.front.domain.excel.ExcelUtil; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| /** | |||
| * 车辆加气记录查询 | |||
| * | |||
| * @return | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "vGasRecords") | |||
| public class VehicleGasRecordsController { | |||
| @Resource | |||
| VehicleGasRecordsRepository vehicleGasRecordsRepository; | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| VehicleGasRecordsService vehicleGasRecordsService; | |||
| @Resource | |||
| FillGasStationRepository fillGasStationRepository; | |||
| // @Resource | |||
| // ResponseBodyCacheManager responseBodyCacheManager; | |||
| // | |||
| // @PostConstruct | |||
| // private void init() { | |||
| // | |||
| // new Timer(true).schedule(new TimerTask() { | |||
| // @Override | |||
| // public void run() { | |||
| // try { | |||
| // // 缓存 | |||
| // Pagination pagination = new Pagination(); | |||
| // pagination.setPage(1); | |||
| // pagination.setPageSize(15); | |||
| // pagination = getVehicleGasRecords("72", "", "", "", "2014-02-01", "2014-05-01", null, pagination); | |||
| // responseBodyCacheManager.cache("/vGasRecords/vehicleGasRecords?date_start=2014-02-01&date_end=2014-05-01&ccnum=&outside=&plateNum=&cngType=&gasStation=72&page=1&pageSize=15", pagination, 600); | |||
| // } catch (Throwable throwable) {} | |||
| // } | |||
| // }, 2 * 1000L, 520 * 1000L); | |||
| // } | |||
| /** | |||
| * 获取车辆加气记录数据 | |||
| * @param gasStation 加气站 | |||
| * @param plateNum 车牌号 | |||
| * @param ccnum 气瓶登记证号 | |||
| * @param cngType 加气属性 | |||
| * @param date_start 开始时间 | |||
| * @param date_end 结束时间 | |||
| * @param outside 本地外地 | |||
| * @param pagination 分页 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "vehicleGasRecords", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getVehicleGasRecords(String gasStation, String plateNum, String ccnum,String cngType, String date_start, String date_end, Integer outside, infrastructure.support.records.Pagination pagination) { | |||
| if(gasStation.equals("")){ | |||
| throw new AppException("请选择加气站"); | |||
| } | |||
| if(date_start.equals("") || date_end.equals("")){ | |||
| throw new AppException("请输入时间"); | |||
| } | |||
| if(!(Tool.isDate(date_start)) && !(Tool.isDate(date_end))){ | |||
| throw new AppException("请检查时间格式是否正确"); | |||
| } | |||
| if(Tool.isDate(date_start) && Tool.isDate(date_end)){ | |||
| long longstr1 = Long.valueOf(date_start.replaceAll("[-]","")); | |||
| long longstr2 = Long.valueOf(date_end.replaceAll("[-]","")); | |||
| if(longstr1 > longstr2){ | |||
| throw new AppException("开始时间必须小于结束时间"); | |||
| } | |||
| } | |||
| pagination.setRows(vehicleGasRecordsRepository.getVehicleGasRecords(gasStation, plateNum, ccnum, cngType,date_start, date_end, outside, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 区域 | |||
| * | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getaddres", method = RequestMethod.GET) | |||
| List<AreaDict> getAreaDicts(Context context) { | |||
| District district = context.getDistrict(); | |||
| return gasOnlineRepository.getAreaDict(district); | |||
| } | |||
| /** | |||
| * 加气站 | |||
| * | |||
| * @param areaId | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getGasInfo", method = RequestMethod.GET) | |||
| List<FillGasStation> getGasInfos(Integer areaId) { | |||
| return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| } | |||
| /** | |||
| * 得到加气属性信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "selectCngTypeDictAll", method = RequestMethod.GET) | |||
| List<CngTypeDict> selectcngAll() { | |||
| return carTypeDictRepository.selectCngTypeDict(); | |||
| } | |||
| /** | |||
| * 导出车辆加气记录 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| // vGasRecords/getSetupcheckExcel | |||
| @RequestMapping(value = "getSetupcheckExcel", method = RequestMethod.GET) | |||
| public void exportExcel(String gasStation, String plateNum, String ccnum,String cngType, String date_start, String date_end, Integer outside, infrastructure.support.records.Pagination pagination, HttpServletResponse response) { | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = vehicleGasRecordsService.getExportExcel(gasStation, plateNum, ccnum, cngType,date_start, date_end, outside, pager); | |||
| String title = "车辆加气记录.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| // TODO Auto-generated catch block | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "stations", method = RequestMethod.GET) | |||
| List<FillGasStation> getStations(Context context) { | |||
| List<FillGasStation> resultList = new ArrayList<FillGasStation>(); | |||
| List<FillGasStation> stationList = fillGasStationRepository.getStations(); | |||
| if(stationList != null && stationList.size() > 0){ | |||
| resultList = stationList; | |||
| } | |||
| return resultList; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "filleds", method = RequestMethod.GET) | |||
| Pagination filleds(String gasStation, String platenum, String cngType, String date_start,String date_end, Pagination pagination) { | |||
| if(date_start.equals("") || date_end.equals("")){ | |||
| SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd"); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 1); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf2.format(date); | |||
| String endDate = sdf2.format(new Date()); | |||
| date_start = beginDate; | |||
| date_end = endDate; | |||
| } | |||
| pagination.setRows(vehicleGasRecordsRepository.filleds(gasStation,platenum,cngType,date_start, date_end, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getFilledExcel", method = RequestMethod.GET) | |||
| public void getFilledExcel(String gasStation, String plateNum,String cngType, String date_start, String date_end, Pagination pagination, HttpServletResponse response) { | |||
| if(date_start.equals("") || date_end.equals("")){ | |||
| SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd"); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 1); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf2.format(date); | |||
| String endDate = sdf2.format(new Date()); | |||
| date_start = beginDate; | |||
| date_end = endDate; | |||
| } | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = vehicleGasRecordsService.getExportExcel(gasStation, plateNum,cngType, date_start, date_end,pager); | |||
| String title = "中油节能车辆加气记录.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getSumFilledExcel", method = RequestMethod.GET) | |||
| public void getSumFilledExcel(String gasStation, String plateNum,String cngType, String cngTypeName, String date_start, String date_end, Pagination pagination, HttpServletResponse response) { | |||
| if(date_start.equals("") || date_end.equals("")){ | |||
| SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd"); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 1); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf2.format(date); | |||
| String endDate = sdf2.format(new Date()); | |||
| date_start = beginDate; | |||
| date_end = endDate; | |||
| } | |||
| Pagination pager = new Pagination(); | |||
| //打印时给pager设置最大值,便于打印所有数据;如果不设置将会根据默认的页数显示条数打印该页的数据。 | |||
| pager.setPageSize(Integer.MAX_VALUE); | |||
| ExcelReportVo exlVo = vehicleGasRecordsService.getSumExportExcel(gasStation, plateNum,cngType, cngTypeName,date_start, date_end,pager); | |||
| String title = "中油节能车辆加气合计.xlsx"; | |||
| try { | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| ExcelUtil.createExcel(exlVo, bos); | |||
| // byte[] bytes = new byte[1024*6]; | |||
| byte[] bytes = bos.toByteArray(); | |||
| bos.flush(); | |||
| bos.close(); | |||
| ServletUtil.respondFileInfo(response, new FileInfo(title, bytes.length, new Date())); | |||
| ServletUtil.respondBytes(response, bytes); | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,130 @@ | |||
| package com.ciotea.cdcng.front.application.inspection; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.utils.StringUtil; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.chart.gasChart.vo.MonthGasVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.AreaRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.BottleCertRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "inspectionHome") | |||
| public class InspectionHomeController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleCertRepository bottleCertRepository; | |||
| @Resource | |||
| AreaRepository areaRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| private SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleCert", method = RequestMethod.GET) | |||
| List<List<MonthGasVo>> getCarUseAreaChart(String start_date,String end_date,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<MonthGasVo>> res = new ArrayList<List<MonthGasVo>>(); | |||
| //设置当前时间的前一个月 | |||
| if(start_date.equals("") || end_date.equals("")){ | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(new Date()); | |||
| end_date = sdf.format(c.getTime()); | |||
| c.add(Calendar.MONTH, -1); | |||
| start_date = sdf.format(c.getTime()); | |||
| } | |||
| if(!StringUtil.isNullOrBlank(start_date) || !StringUtil.isNullOrBlank(end_date)){ | |||
| if(!Tool.isDate2(start_date) || !Tool.isDate2(end_date)){ | |||
| throw new AppException("请输入正确的日期格式,如2012-01-10"); | |||
| } | |||
| } | |||
| List<String> dayList = Tool.dayNum(start_date, end_date); | |||
| List<MonthGasVo> list = bottleCertRepository.getBottleCertStatis(start_date, end_date,permissionFilter); | |||
| if(list.size() < dayList.size()){ | |||
| list = Tool.CompletionBottleCert(list, dayList); | |||
| } | |||
| res.add(list); | |||
| return res; | |||
| } | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "bottleCert", method = RequestMethod.GET) | |||
| // List<List<CarUseAreaVo>> getCarUseAreaChart(String start_date,String end_date,Context context){ | |||
| // start_date = "2012-01-01"; | |||
| // end_date = "2015-01-01"; | |||
| // List<List<CarUseAreaVo>> resList = new ArrayList<List<CarUseAreaVo>>(); | |||
| // List<AreaDict> areaTemp = areaRepository.getAll(); | |||
| // List<String> areaList = new ArrayList<String>(); //区域ID集合 | |||
| // for(AreaDict area : areaTemp){ | |||
| // areaList.add(area.getId()+""); | |||
| // } | |||
| // | |||
| // if(start_date.equals("") || end_date.equals("")){ | |||
| // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |||
| // Date tempDate = new Date(); | |||
| // start_date = sdf.format(tempDate); | |||
| // end_date = sdf.format(tempDate); | |||
| // } | |||
| // | |||
| // //检验站 | |||
| // Integer types[] = new Integer[] { 17 }; | |||
| // List<AuthorityDepartment> deptList = authorityDepartmentRepository.findByDeptTypes(types); | |||
| // | |||
| // List<CarUseAreaVo> list = bottleCertRepository.getBottleCertStatis( start_date, end_date); | |||
| // if(list.size() < areaList.size()){ | |||
| // List<CarUseAreaVo> temp =Tool.CompletionBottleCert(list, areaList); | |||
| // List<CarUseAreaVo> res = new ArrayList<CarUseAreaVo>(); | |||
| // for(CarUseAreaVo vo : temp){ | |||
| // AreaDict areaBean = repository.get(AreaDict.class, vo.getArea()+""); | |||
| // vo.setArea(areaBean.getDictValue()); | |||
| // res.add(vo); | |||
| // } | |||
| // | |||
| // resList.add(res); | |||
| // }else{ | |||
| // | |||
| // for(CarUseAreaVo vo : list){ | |||
| // AreaDict areaBean = repository.get(AreaDict.class, vo.getArea()+""); | |||
| // vo.setArea(areaBean.getDictValue()); | |||
| // list.add(vo); | |||
| // } | |||
| // | |||
| // resList.add(list); | |||
| // } | |||
| // | |||
| // | |||
| // return resList; | |||
| // } | |||
| } | |||
| @ -0,0 +1,24 @@ | |||
| package com.ciotea.cdcng.front.application.log; | |||
| import infrastructure.support.records.Pagination; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.log.userLogin.UserLoginLogRepo; | |||
| @Controller | |||
| @RequestMapping(value = "userLoginLog") | |||
| public class UserLoginLogController { | |||
| @Autowired | |||
| private UserLoginLogRepo userLoginLogRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getList", method = RequestMethod.GET) | |||
| public Pagination getList(String username, String name, String deptName, String starttime, String endtime, Pagination pagination){ | |||
| return pagination.setRows(userLoginLogRepo.getList(username, name, deptName, starttime, endtime, pagination)); | |||
| } | |||
| } | |||
| @ -0,0 +1,89 @@ | |||
| package com.ciotea.cdcng.front.application.manage.facade; | |||
| import java.io.File; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Position; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.service.system.TempFileService; | |||
| import com.ciotea.cdcng.front.domain.service.system.UserService; | |||
| import com.ciotea.cdcng.front.infrastructure.servlet.checkCode.RandomValidateCode; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; | |||
| import com.fasterxml.jackson.core.JsonEncoding; | |||
| import infrastructure.support.exception.AppException; | |||
| @Controller | |||
| @RequestMapping(value = "facade") | |||
| public class FacedeController { | |||
| @Resource | |||
| TempFileService tempFileService; | |||
| @Resource | |||
| UserService userService; | |||
| @ResponseBody | |||
| @RequestMapping(value = "fileUpload", method = RequestMethod.POST) | |||
| void postFileUp(MultipartHttpServletRequest req, HttpServletResponse resp) { | |||
| try { | |||
| MultipartFile multipartFile = req.getFile("file"); | |||
| File temp = tempFileService.buildTempFile(); | |||
| multipartFile.transferTo(temp); | |||
| Map<String, String> ret = new HashMap<String, String>(); | |||
| ret.put("path", temp.getPath()); | |||
| ret.put("name", multipartFile.getOriginalFilename()); | |||
| // TODO ServletUtil | |||
| resp.setContentType("text/plain"); | |||
| resp.setCharacterEncoding("UTF-8"); | |||
| new ObjectMapper().getFactory().createJsonGenerator(resp.getOutputStream(), JsonEncoding.UTF8).writeObject(ret); | |||
| resp.getOutputStream().flush(); | |||
| } catch (IOException e) { | |||
| throw new AppException("文件上传失败", e); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "login-position", method = RequestMethod.GET) | |||
| Position getLoginPosition(Context ctx) { | |||
| User user = ctx.getUser(); | |||
| Position loginPosition = user.getLoginPosition(); | |||
| return loginPosition; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "login-position", method = RequestMethod.PUT) | |||
| void putLoginPosition(HttpServletRequest req, String positionId, Context ctx) throws FileNotFoundException, IOException { | |||
| userService.updateLoginPosition(ctx.getUser().getId(), positionId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "positions", method = RequestMethod.GET) | |||
| Set<Position> getPositions(Context ctx) { | |||
| return ctx.getUser().getPositions(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "checkCodeImg", method = RequestMethod.GET) | |||
| void getCheckCodeImg(HttpServletRequest request, HttpServletResponse response) throws IOException { | |||
| RandomValidateCode rvc = new RandomValidateCode(); | |||
| rvc.getRandcode(request, response); | |||
| } | |||
| } | |||
| @ -0,0 +1,264 @@ | |||
| package com.ciotea.cdcng.front.application.mobile; | |||
| import java.io.IOException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.ciotea.cdcng.front.application.mobile.auth.AppResponse; | |||
| import com.ciotea.cdcng.front.application.mobile.auth.AuthException; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.FillGasStationRepository; | |||
| import com.ciotea.cdcng.front.domain.mobile.GasStation; | |||
| import com.ciotea.cdcng.front.domain.mobile.auth.JwtUser; | |||
| import com.ciotea.cdcng.front.domain.mobile.auth.JwtUtil; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReport; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReportRepo; | |||
| import com.ciotea.cdcng.front.domain.stationReport.StationReportService; | |||
| import io.jsonwebtoken.ExpiredJwtException; | |||
| import io.jsonwebtoken.JwtException; | |||
| @Controller | |||
| @RequestMapping(value = "m") | |||
| public class MobileController { | |||
| // @Value("${jwt.header}") | |||
| private String header = "token"; | |||
| @Autowired | |||
| private JwtUtil jwtUtil; | |||
| @Resource | |||
| StationReportRepo stationReportRepo; | |||
| @Resource | |||
| StationReportService stationReportService; | |||
| @Resource | |||
| FillGasStationRepository stationRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "save", method = RequestMethod.POST) | |||
| void saveReport(HttpServletRequest request, HttpServletResponse response, StationReport stationReport) | |||
| throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| String authToken = request.getHeader(header); | |||
| if (authToken == null || authToken.length() == 0) { | |||
| throw new AuthException(102, "No JWT token found in request headers"); | |||
| } | |||
| try { | |||
| JwtUser parsedUser = jwtUtil.parseToken(authToken); | |||
| stationReportService.savestationReport(stationReport, parsedUser.getUsername()); | |||
| resultInfo = new AppResponse(0, null, null); | |||
| } catch (ExpiredJwtException e) { | |||
| throw new AuthException(104, e.getMessage()); | |||
| } catch (JwtException | ClassCastException e) { | |||
| throw new AuthException(103, "JWT token is not valid"); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "list", method = RequestMethod.POST) | |||
| public void reports(HttpServletRequest request, HttpServletResponse response, String startTime, String endTime, | |||
| Pagination pagination) throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| String authToken = request.getHeader(header); | |||
| if (authToken == null || authToken.length() == 0) { | |||
| throw new AuthException(102, "No JWT token found in request headers"); | |||
| } | |||
| try { | |||
| JwtUser parsedUser = jwtUtil.parseToken(authToken); | |||
| pagination.setRows( | |||
| stationReportRepo.getList(startTime, endTime, String.valueOf(parsedUser.getStationId()))); | |||
| resultInfo = new AppResponse(0, null, pagination); | |||
| } catch (ExpiredJwtException e) { | |||
| throw new AuthException(104, e.getMessage()); | |||
| } catch (JwtException | ClassCastException e) { | |||
| throw new AuthException(103, "JWT token is not valid"); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "detail", method = RequestMethod.POST) | |||
| public void reportDetail(HttpServletRequest request, HttpServletResponse response, String id) throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| String authToken = request.getHeader(header); | |||
| if (authToken == null || authToken.length() == 0) { | |||
| throw new AuthException(102, "No JWT token found in request headers"); | |||
| } | |||
| try { | |||
| StationReport report = stationReportRepo.getById(id); | |||
| resultInfo = new AppResponse(0, null, report); | |||
| } catch (ExpiredJwtException e) { | |||
| throw new AuthException(104, e.getMessage()); | |||
| } catch (JwtException | ClassCastException e) { | |||
| throw new AuthException(103, "JWT token is not valid"); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "station", method = RequestMethod.POST) | |||
| public void stationMSg(HttpServletRequest request, HttpServletResponse response) throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| String authToken = request.getHeader(header); | |||
| if (authToken == null || authToken.length() == 0) { | |||
| throw new AuthException(102, "No JWT token found in request headers"); | |||
| } | |||
| try { | |||
| JwtUser parsedUser = jwtUtil.parseToken(authToken); | |||
| FillGasStation station = stationRepo.getFillGasStation(parsedUser.getUsername()); | |||
| GasStation gasStation = new GasStation(); | |||
| gasStation.setId(station.getId()); | |||
| gasStation.setCode(station.getCode()); | |||
| gasStation.setName(station.getName()); | |||
| gasStation.setAddr(station.getAddr()); | |||
| gasStation.setTel(station.getTel()); | |||
| resultInfo = new AppResponse(0, null, gasStation); | |||
| } catch (ExpiredJwtException e) { | |||
| throw new AuthException(104, e.getMessage()); | |||
| } catch (JwtException | ClassCastException e) { | |||
| throw new AuthException(103, "JWT token is not valid"); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "check", method = RequestMethod.POST) | |||
| public void check(HttpServletRequest request, HttpServletResponse response) throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| String authToken = request.getHeader(header); | |||
| if (authToken == null || authToken.length() == 0) { | |||
| throw new AuthException(102, "No JWT token found in request headers"); | |||
| } | |||
| try { | |||
| JwtUser parsedUser = jwtUtil.parseToken(authToken); | |||
| String nowDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString().split(" ")[0]; | |||
| List<StationReport> reports = stationReportRepo.getList(nowDate, nowDate, String.valueOf(parsedUser.getStationId())); | |||
| resultInfo = new AppResponse(0, null, reports != null && reports.size() > 0); | |||
| } catch (ExpiredJwtException e) { | |||
| throw new AuthException(104, e.getMessage()); | |||
| } catch (JwtException | ClassCastException e) { | |||
| throw new AuthException(103, "JWT token is not valid"); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| } | |||
| @ -0,0 +1,115 @@ | |||
| package com.ciotea.cdcng.front.application.mobile; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import org.apache.ibatis.session.RowBounds; | |||
| public class Pagination implements Serializable{ | |||
| private static final long serialVersionUID = 1L; | |||
| private int page = 1; | |||
| private int pages = 1; | |||
| private int pageSize = 10; | |||
| private int total = 0; | |||
| private List<?> rows = new ArrayList<Object>(); | |||
| public Pagination() { | |||
| } | |||
| public int calculateOffset() { | |||
| int offset = 0; | |||
| try { | |||
| if (page < 1) | |||
| page = 1; | |||
| if (page > (int) Math.ceil((double) total / pageSize)) | |||
| page = (int) Math.ceil((double) total / pageSize); | |||
| offset = (page - 1) * pageSize; | |||
| if (offset < 0) | |||
| offset = 0; | |||
| } catch (Exception e) { | |||
| } | |||
| return offset; | |||
| } | |||
| public <T> List<T> doPaging(List<T> totalList) { | |||
| // get total | |||
| total = totalList.size(); | |||
| // get pages | |||
| this.pages = (int) Math.ceil((double) total / pageSize); | |||
| if (this.pages < 1) { | |||
| this.pages = 1; | |||
| } | |||
| // get rows | |||
| int fromIndex = calculateOffset(); | |||
| int toIndex = fromIndex + pageSize; | |||
| if (toIndex > total) { | |||
| toIndex = total; | |||
| } | |||
| return totalList.subList(fromIndex, toIndex); | |||
| } | |||
| public RowBounds toRowBounds() { | |||
| return new RowBounds(page, pageSize); | |||
| } | |||
| public int getPage() { | |||
| return page; | |||
| } | |||
| public void setPage(int page) { | |||
| this.page = page; | |||
| } | |||
| public int getPages() { | |||
| return pages; | |||
| } | |||
| public void setPages(int pages) { | |||
| this.pages = pages; | |||
| } | |||
| public int getPageSize() { | |||
| return pageSize; | |||
| } | |||
| public void setPageSize(int pageSize) { | |||
| this.pageSize = pageSize; | |||
| } | |||
| public int getTotal() { | |||
| return total; | |||
| } | |||
| public void setTotal(int total) { | |||
| this.total = total; | |||
| } | |||
| public List<?> getRows() { | |||
| return rows; | |||
| } | |||
| public Pagination setRows(List<?> rows) { | |||
| this.total = (int) rows.size(); | |||
| this.pages = (int) Math.ceil((double) total / pageSize); | |||
| if (this.pages < 1) { | |||
| this.pages = 1; | |||
| } | |||
| if (page > this.pages) { | |||
| this.rows = new ArrayList<>(); | |||
| } else { | |||
| this.rows = doPaging(rows); | |||
| } | |||
| return this; | |||
| } | |||
| } | |||
| @ -0,0 +1,13 @@ | |||
| package com.ciotea.cdcng.front.application.mobile.auth; | |||
| public class AppResponse { | |||
| public int code; | |||
| public String message; | |||
| public Object data; | |||
| public AppResponse(int code, String message, Object data) { | |||
| this.code = code; | |||
| this.message = message; | |||
| this.data = data; | |||
| } | |||
| } | |||
| @ -0,0 +1,93 @@ | |||
| package com.ciotea.cdcng.front.application.mobile.auth; | |||
| import java.io.IOException; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.ExceptionHandler; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.entity.FillGasStation; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.FillGasStationRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.mobile.LoginResult; | |||
| import com.ciotea.cdcng.front.domain.mobile.auth.JwtUser; | |||
| import com.ciotea.cdcng.front.domain.mobile.auth.JwtUtil; | |||
| import com.ciotea.cdcng.front.domain.repository.system.UserRepository; | |||
| import com.ciotea.cdcng.front.infrastructure.support.application.Constants.YesNo; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.EncryptUtil; | |||
| @RestController | |||
| @RequestMapping(value = "m") | |||
| public class AuthController { | |||
| @Autowired | |||
| private UserRepository userRepository; | |||
| @Autowired | |||
| private JwtUtil jwtUtil; | |||
| @Resource | |||
| FillGasStationRepository stationRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "login", method = RequestMethod.POST) | |||
| @ExceptionHandler(AuthException.class) | |||
| public void getToken(HttpServletResponse response, String username, String password) throws IOException { | |||
| AppResponse resultInfo = null; | |||
| try { | |||
| User user = userRepository.getCachedUserWithUsername(username); | |||
| if (user == null) { | |||
| throw new AuthException(302, "用户不存在"); | |||
| } else if (user.getIsLocked() == YesNo.YES) { | |||
| throw new AuthException(303, "用户已被禁用"); | |||
| } else if (!EncryptUtil.match(password, user.getPassword())) { | |||
| throw new AuthException(301, "用户名或密码错误"); | |||
| } else { | |||
| JwtUser jwtUser = new JwtUser(); | |||
| jwtUser.setId(user.getId()); | |||
| jwtUser.setUsername(user.getUsername()); | |||
| FillGasStation station = stationRepo.getFillGasStation(user.getUsername()); | |||
| if (station != null) { | |||
| jwtUser.setStationId(String.valueOf(station.getId())); | |||
| } | |||
| LoginResult loginResult = new LoginResult(); | |||
| loginResult.setToken(jwtUtil.generateToken(jwtUser)); | |||
| loginResult.setId(user.getId()); | |||
| loginResult.setName(user.getName()); | |||
| loginResult.setDepartmentName(user.getLoginPosition().getDepartment().getName()); | |||
| resultInfo = new AppResponse(0, null, loginResult); | |||
| } | |||
| } catch (Exception exception) { | |||
| int code = 201; | |||
| String msg = ""; | |||
| if (exception instanceof AuthException) { | |||
| code = ((AuthException) exception).getCode(); | |||
| msg = ((AuthException) exception).getMessage(); | |||
| } else { | |||
| msg = exception.getLocalizedMessage(); | |||
| } | |||
| resultInfo = new AppResponse(code, msg, null); | |||
| } | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(resultInfo)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "/logout", method = RequestMethod.POST) | |||
| public void logout(HttpServletResponse response) throws IOException { | |||
| response.addHeader("Content-Type", "application/json;charset=UTF-8"); | |||
| response.getWriter().append(JSON.toJSONString(new AppResponse(0, null, null))); | |||
| } | |||
| } | |||
| @ -0,0 +1,26 @@ | |||
| package com.ciotea.cdcng.front.application.mobile.auth; | |||
| import org.springframework.security.core.AuthenticationException; | |||
| public class AuthException extends AuthenticationException { | |||
| private static final long serialVersionUID = 1L; | |||
| private int code; | |||
| public AuthException(String msg) { | |||
| super(msg); | |||
| } | |||
| public AuthException(int code, String msg) { | |||
| super(msg); | |||
| this.code = code; | |||
| } | |||
| public int getCode() { | |||
| return code; | |||
| } | |||
| public void setCode(int code) { | |||
| this.code = code; | |||
| } | |||
| } | |||
| @ -0,0 +1,60 @@ | |||
| package com.ciotea.cdcng.front.application.ptyw; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.ptyw.syncblacklistcar.SyncBlacklistcar; | |||
| import com.ciotea.cdcng.front.domain.ptyw.syncblacklistcar.SyncBlacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.ptyw.syncblacklistcar.SyncBlacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "syncBlacklistcar") | |||
| public class SyncBlacklistcarController { | |||
| @Resource | |||
| SyncBlacklistcarService syncBlacklistcarService; | |||
| @Resource | |||
| SyncBlacklistcarRepository syncBlacklistcarRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "", method = RequestMethod.GET) | |||
| public Pagination query(SyncBlacklistcar bean, Pagination pagination){ | |||
| return pagination.setRows(syncBlacklistcarRepository.query(bean, pagination)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "", method = RequestMethod.POST) | |||
| public SyncBlacklistcar create (SyncBlacklistcar bean, Context context){ | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| bean.setRegUsername(regUser.getLastName()+regUser.getFirstName()); | |||
| return syncBlacklistcarService.create(bean); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "", method = RequestMethod.PUT) | |||
| public SyncBlacklistcar update (SyncBlacklistcar bean, Context context){ | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| String firstName = ""; | |||
| if(regUser.getFirstName()!=null){ | |||
| firstName = regUser.getFirstName(); | |||
| } | |||
| bean.setRegUsername(regUser.getLastName()+ firstName); | |||
| return syncBlacklistcarService.update(bean); | |||
| } | |||
| } | |||
| @ -0,0 +1,208 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.CarAndBottleTatle; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.CarAndBottleTatle.repository.CarAndBottleTatleRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.CarAndBottleTatle.service.CarAndBottleTatleService; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.CarAndBottleTatle.vo.CarAndBottleTatleVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "carAndBottleTatle") | |||
| public class CarAndBottleTatleController { | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| CarAndBottleTatleRepository andBottleTatleRepository; | |||
| @Resource | |||
| CarAndBottleTatleService andBottleTatleService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return carTypeDictRepository.selectByArea(permissionFilter); | |||
| } | |||
| // List<AreaDict> selectAreaDictAll(){ | |||
| // return carTypeDictRepository.selectAreaDict(); | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value="selectDeptTypeAll" , method= RequestMethod.GET) | |||
| List<AuthorityDepartment> selectDeptAll(){ | |||
| return carTypeDictRepository.selectRegDept(17); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="carAndBottles" , method= RequestMethod.GET) | |||
| List<List<CarAndBottleTatleVo>> carAndBottles(Context context,String[] area,String[] dept, | |||
| String[] type,Integer isorig,String start,String end,Integer isCarOrBottle ){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if(area!=null && area.length>0){ | |||
| if((dept==null || dept.length<1)&&(type==null || type.length<1)){ | |||
| throw new AppException("请选择加气属性或检验站."); | |||
| } | |||
| }else if(dept!=null && dept.length>0){ | |||
| if((area==null || area.length<1)&&(type==null || type.length<1)){ | |||
| throw new AppException("请选择加气属性或区域."); | |||
| } | |||
| }else if(type!=null && type.length>0){ | |||
| if((area==null || area.length<1)&&(dept==null || dept.length<1)){ | |||
| throw new AppException("请选择检验站或区域."); | |||
| } | |||
| }else{ | |||
| throw new AppException("请在前三项中选择任意两项."); | |||
| } | |||
| // if((start==null || start.length()<1)&&(end==null || end.length()<1)){ | |||
| // throw new AppException("请选择日期."); | |||
| // } | |||
| if(StringUtil.isNullOrEmpty(start) || StringUtil.isNullOrEmpty(end)){ | |||
| throw new AppException("请选择时间"); | |||
| } | |||
| List<List<CarAndBottleTatleVo>> all = new ArrayList<List<CarAndBottleTatleVo>>(); | |||
| if(isCarOrBottle==1){ | |||
| if(area!=null && area.length>0){ | |||
| for(int i=0;i<area.length;i++){ | |||
| List<CarAndBottleTatleVo> list = andBottleTatleService.getCarAndBottles( permissionFilter,isorig,type, area[i],dept,start,end); | |||
| all.add(list); | |||
| } | |||
| }else{ | |||
| for(int i=0;i<dept.length;i++){ | |||
| List<CarAndBottleTatleVo> list = andBottleTatleService.getCarAndBottleByDept(permissionFilter,isorig, type, dept[i], start, end); | |||
| all.add(list); | |||
| } | |||
| } | |||
| } | |||
| if(isCarOrBottle==2){ | |||
| if(area!=null && area.length>0){ | |||
| for(int i=0;i<area.length;i++){ | |||
| List<CarAndBottleTatleVo> list = andBottleTatleService.getBottCarAndBottles( permissionFilter,isorig,type, area[i],dept,start,end); | |||
| all.add(list); | |||
| } | |||
| }else{ | |||
| for(int i=0;i<dept.length;i++){ | |||
| List<CarAndBottleTatleVo> list = andBottleTatleService.getBottCarAndBottleByDept( permissionFilter,isorig, type, dept[i], start, end); | |||
| all.add(list); | |||
| } | |||
| } | |||
| } | |||
| return all; | |||
| } | |||
| /** | |||
| * 导出excel表格 | |||
| * @param context | |||
| * @param area | |||
| * @param dept | |||
| * @param type | |||
| * @param isorig | |||
| * @param start | |||
| * @param end | |||
| * @param isCarOrBottle | |||
| * @param req | |||
| * @param res | |||
| * @throws Exception | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="carAndBottlesExcel" , method= RequestMethod.GET) | |||
| public void exportExcel(Context context,String[] area,String[] dept, | |||
| String[] type,Integer isorig,String start,String end,Integer isCarOrBottle, | |||
| HttpServletRequest req, HttpServletResponse res) throws Exception{ | |||
| List<List<CarAndBottleTatleVo>> all = this.carAndBottles(context, area, dept, type, isorig, start, end, isCarOrBottle); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/CarAndBottleTatle/CarAndBottleTatle.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| for(int i=0;i<all.get(0).size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(all.get(0).get(i).getTypeName()); | |||
| } | |||
| tempRow.createCell(all.get(0).size()+1).setCellValue("合计"); | |||
| for(int i = 0;i<all.size(); i++){ | |||
| Row row = sheet.createRow(2+i); | |||
| row.createCell(0).setCellValue(all.get(i).get(0).getAreaName()); | |||
| for(int k=0;k<all.get(i).size();k++){ | |||
| row.createCell(1+k).setCellValue(all.get(i).get(k).getNum()); | |||
| } | |||
| row.createCell(all.get(i).size()+1).setCellValue(all.get(i).get(all.get(i).size()-1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(2+all.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| int[] sum={0,0,0,0,0,0,0,0}; | |||
| // for(int i=0;i<all.get(0).size();i++){//行 | |||
| // sum[i]=0; | |||
| // } | |||
| int count=0; | |||
| for(int i = 0;i<all.size(); i++){ | |||
| count = count+all.get(i).get(all.get(i).size()-1).getSum(); | |||
| } | |||
| for(int i=0;i<all.get(0).size();i++){ | |||
| for(int k=0;k<all.size();k++){ | |||
| sum[i] = sum[i]+all.get(k).get(i).getNum(); | |||
| } | |||
| } | |||
| for(int j=0;j<all.get(0).size();j++){ | |||
| row1.createCell(j+1).setCellValue(sum[j]); | |||
| } | |||
| row1.createCell(all.get(0).size()+1).setCellValue(count); | |||
| // count=0; | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| if(isCarOrBottle==1){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("车辆统计.xlsx", bytes.length, new Date())); | |||
| }if(isCarOrBottle==2){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("气瓶统计.xlsx", bytes.length, new Date())); | |||
| } | |||
| // ServletUtil.respondFileInfo(res, new FileInfo("车辆、气瓶统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,105 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.CarLock; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.BlacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.service.BlacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "check/carLock") | |||
| public class CarLockController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| BlacklistcarRepository blacklistcarRepository; | |||
| @Resource | |||
| BlacklistcarService blacklistcarService; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| /** | |||
| * 获取黑名单 | |||
| * | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "getBlicklistcar", method = RequestMethod.GET) | |||
| // Pagination getBlicklistcar(String platenum, String vin, | |||
| // Pagination pagination) { | |||
| // pagination.setRows(blacklistcarRepository.getBlicklistcar(platenum, | |||
| // vin, pagination)); | |||
| // return pagination; | |||
| // } | |||
| /** | |||
| * 新增黑名单车辆 | |||
| * | |||
| * @param car | |||
| * @param remark | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "addblackcar", method = RequestMethod.PUT) | |||
| void addBlackCar(CngCdCar car, Context context) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| this.blacklistcarService.addCarremark(car, cnguser, authdept); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarBy", method = RequestMethod.GET) | |||
| Pagination getCngCdCarBy(String platenum, String vin, | |||
| Pagination pagination, Context context) { | |||
| List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| pagination.setRows(blacklistcarRepository.getCarPlatenumByVin(list, | |||
| platenum, vin, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 车辆详情 | |||
| * | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCardetail", method = RequestMethod.GET) | |||
| CngCdCar getCardetail(Integer id) { | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| } | |||
| @ -0,0 +1,95 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.CarLock; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.BlacklistcarRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.service.BlacklistcarService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.entity.system.Department; | |||
| import com.ciotea.cdcng.front.domain.entity.system.User; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "check/carUnlock") | |||
| public class CarUnlockController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| BlacklistcarRepository blacklistcarRepository; | |||
| @Resource | |||
| BlacklistcarService blacklistcarService; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository deptRepository; | |||
| @Resource | |||
| CngUserRepository cnguserRepository; | |||
| /** | |||
| * 获取黑名单车辆 | |||
| * | |||
| * @param platenum | |||
| * 车牌号 | |||
| * @param vin | |||
| * 车架号 | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBlackcar", method = RequestMethod.GET) | |||
| Pagination getCngCdCarBy(String platenum, String vin, | |||
| Pagination pagination, Context context) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| PermissionFilter permissionFilter = cnguserRepository.permissionFilter( | |||
| context.getDepartment(), context.getDistrict()); | |||
| return pagination.setRows(blacklistcarRepository.getBlickListCar( | |||
| permissionFilter, platenum, vin, pagination)); | |||
| } | |||
| /** | |||
| * 车辆详情 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBlackCardetail", method = RequestMethod.GET) | |||
| CngCdCar getCardetail(Integer id) { | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| /** | |||
| * 解除车辆黑名单 | |||
| * | |||
| * @param car | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "relieveBlackcar", method = RequestMethod.PUT) | |||
| void addBlackCar(CngCdCar car, Context context) { | |||
| User user = context.getUser(); | |||
| CngUser cnguser = cnguserRepository.findBySysUserId(user.getId()); | |||
| Department dept = context.getPosition().getDepartment(); | |||
| AuthorityDepartment authdept = deptRepository.findByMemo(dept.getId()); | |||
| this.blacklistcarService.updateBlackListcar(car, cnguser, authdept); | |||
| } | |||
| } | |||
| @ -0,0 +1,69 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.OtherPlacesCar; | |||
| /*package application.qualityCheck.OtherPlacesCar; | |||
| import java.util.List; | |||
| import infrastructure.spring.web.Context; | |||
| import infrastructure.support.record.Order; | |||
| import infrastructure.support.record.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import domain.energy.carInfomation.repository.CarInfoisorigRespository; | |||
| import domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import domain.repository.system.DepartmentRepository; | |||
| import domain.repository.system.Repository; | |||
| @Controller | |||
| @RequestMapping(value = "otherPlaces") | |||
| public class OtherPlacesCarController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CarInfoisorigRespository carInformationRespository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| *//** | |||
| * 获取过户车信息 | |||
| * | |||
| * @param platenum | |||
| * @param vin | |||
| * @param cngTypeDict | |||
| * @param isorigtype | |||
| * @return | |||
| *//* | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCarinfoList", method = RequestMethod.GET) | |||
| Pagination getCarinfomation(Pagination pagination, CngCdCar car, | |||
| Integer cngdict, String orig, Context context) { | |||
| List<Integer> list = departmentRepository | |||
| .getLoginerDepartmentType(context); | |||
| pagination.setRows(carInformationRespository.getCngCarisorigtype( | |||
| pagination, car, cngdict, orig, list)); | |||
| return pagination; | |||
| } | |||
| *//** | |||
| * 加气属性 | |||
| * | |||
| * @return | |||
| *//* | |||
| @ResponseBody | |||
| @RequestMapping(value = "getDiceValue", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDiceValue() { | |||
| List<CngTypeDict> list = repository.getAll(CngTypeDict.class, | |||
| Order.asc("id")); | |||
| return list; | |||
| } | |||
| } | |||
| */ | |||
| @ -0,0 +1,84 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.bottleInfoQuery; | |||
| //package application.qualityCheck.bottleInfoQuery; | |||
| // | |||
| //import infrastructure.spring.web.Context; | |||
| //import infrastructure.support.record.Pagination; | |||
| //import infrastructure.support.utils.StringUtil; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //import javax.annotation.Resource; | |||
| // | |||
| //import org.springframework.stereotype.Controller; | |||
| //import org.springframework.web.bind.annotation.RequestMapping; | |||
| //import org.springframework.web.bind.annotation.RequestMethod; | |||
| //import org.springframework.web.bind.annotation.ResponseBody; | |||
| // | |||
| //import domain.refittingFactory.refittingCar.entity.Bottle; | |||
| //import domain.repository.system.CngUserRepository; | |||
| //import domain.repository.system.DistrictRepository; | |||
| //import domain.repository.system.Repository; | |||
| //import domain.specialInspection.allquery.entity.Vender; | |||
| //import domain.specialInspection.allquery.repository.BottleRepository; | |||
| // | |||
| ///** | |||
| // * 气瓶信息查询 | |||
| // */ | |||
| //@Controller | |||
| //@RequestMapping(value = "bottleInfoQuery") | |||
| //public class BottleInfoQueryController { | |||
| // | |||
| // @Resource | |||
| // Repository repository; | |||
| // | |||
| // @Resource | |||
| // BottleRepository bottleRepository; | |||
| // | |||
| // @Resource | |||
| // DistrictRepository districtRepository; | |||
| // | |||
| // @Resource | |||
| // CngUserRepository cngUserRepository; | |||
| // | |||
| // /** | |||
| // * | |||
| // * 获取气瓶列表 | |||
| // * @param bottle | |||
| // * @param platenum | |||
| // * @param madeVenderds | |||
| // * @param pagination | |||
| // * @return | |||
| // */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "bottlelists", method = RequestMethod.GET) | |||
| // Pagination getBottle(Bottle bottle, Context context,String platenum, Integer madeVenderds, Pagination pagination) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| // return pagination.setRows(bottleRepository.getQualityCheckBottleInfoQuery(bottle, list, platenum, madeVenderds, pagination)); | |||
| // } | |||
| // | |||
| // /** | |||
| // * 获取厂家 | |||
| // * @return | |||
| // */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "venders", method = RequestMethod.GET) | |||
| // List<Vender> getVender() { | |||
| // return bottleRepository.getVender(); | |||
| // } | |||
| // | |||
| // /** | |||
| // * 根据车牌号获取气瓶列表 | |||
| // * | |||
| // * @param platenum | |||
| // * @return | |||
| // */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "bottlePlatenum", method = RequestMethod.GET) | |||
| // List<Bottle> getBottleByPlatenum(String platenum) { | |||
| // | |||
| // if(!StringUtil.isNullOrEmpty(platenum)) { | |||
| // return bottleRepository.getBottleByPlatenum(platenum); | |||
| // } | |||
| // return null; | |||
| // } | |||
| //} | |||
| @ -0,0 +1,96 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.bottleLock; | |||
| import infrastructure.support.exception.AppException; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.service.AirBottleService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="check/bottleLock") | |||
| public class BottleLockController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| AirBottleRepository bottleRepository; | |||
| @Resource | |||
| AirBottleService airBottleService; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| /** | |||
| * 查询所有气瓶 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottleLock", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getBottleLock(String platenum,String bottCode,infrastructure.support.records.Pagination pagination,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| Bottle bean = new Bottle(); | |||
| bean.setBottCode(bottCode); | |||
| pagination.setRows(bottleRepository.getBottleLock(permissionFilter,platenum, bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 气瓶锁定 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottleLock", method = RequestMethod.PUT) | |||
| Bottle update(Bottle bott,Context context){ | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| // CngUser cngUser= repository.get(CngUser.class, userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| Bottle bean = repository.get(Bottle.class, bott.getId()); | |||
| if(bean.getBottState()!=2){ | |||
| throw new AppException("该气瓶处于不可锁定状态。"); | |||
| } | |||
| bean.setLockReson(bott.getLockReson()); | |||
| if(null!=regDept){ | |||
| bean.setTouchDeptId(regDept.getId()); | |||
| } | |||
| bean.setTouchUserId(regUser.getId()); | |||
| //锁定气瓶 | |||
| bean.setBottState(5); | |||
| return airBottleService.updateBottleLock(bean, regUser); | |||
| } | |||
| /** | |||
| * 详细信息 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="findBottleById", method = RequestMethod.GET) | |||
| Bottle findBottleById(Integer id){ | |||
| if(id==null || "".equals(id)){ | |||
| throw new AppException("请选择气瓶!"); | |||
| } | |||
| return repository.get(Bottle.class, id); | |||
| } | |||
| } | |||
| @ -0,0 +1,80 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.bottleLock; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.service.AirBottleService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="check/bottleUnlock") | |||
| public class BottleUnlockController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| AirBottleRepository bottleRepository; | |||
| @Resource | |||
| AirBottleService airBottleService; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| /** | |||
| * 查询所有气瓶 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottleUnlock", method = RequestMethod.GET) | |||
| Pagination getBottleLock(String platenum,String bottCode,Pagination pagination,Context context){ | |||
| Bottle bean = new Bottle(); | |||
| bean.setBottCode(bottCode); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context); | |||
| pagination.setRows(bottleRepository.getBottleUnlock( permissionFilter,platenum, bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 气瓶解锁 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottleUnlock", method = RequestMethod.PUT) | |||
| Bottle update(Integer ids,Context context){ | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| Bottle bean = repository.get(Bottle.class, ids); | |||
| // bean.setLockReson(bott.getLockReson()); | |||
| if(bean.getBottState()!=5){ | |||
| throw new AppException("该气瓶处于不可解锁状态。"); | |||
| } | |||
| bean.setTouchDeptId(regDept.getId()); | |||
| bean.setTouchUserId(regUser.getId()); | |||
| bean.setLockReson(""); | |||
| //改为气瓶初始状态 | |||
| bean.setBottState(2); | |||
| return airBottleService.updateBottleUnLock(bean, regUser); | |||
| } | |||
| } | |||
| @ -0,0 +1,287 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.bottleRegCertificate; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.Bottcert; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.AreaRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.BottleCertRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.rfidTagScrap.vo.RfidTagScrapVo; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "bottleRegCertificate") | |||
| public class BottleRegCertificateController { | |||
| private SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |||
| @Resource | |||
| BottleCertRepository bottleCertRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AreaRepository areaRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleRegCertificates", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getBottleRegCertificates(Bottcert vo, Context context, infrastructure.support.records.Pagination pagination, String platenum, String start_date, String end_date, Integer search_ref) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(bottleCertRepository.getBottleRegCertificates(vo, permissionFilter, pagination, platenum, start_date, end_date, search_ref)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] { 17 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottles(Integer carId) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if(null != carId){ | |||
| list = bottleRepository.getBottleByCarId(carId); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="defaultSearch" , method= RequestMethod.GET) | |||
| Map<String,String> defaultSearch(){ | |||
| Map<String,String> map = new HashMap<String,String>(); | |||
| Calendar now = Calendar.getInstance(); | |||
| now.add(Calendar.MONTH, 0 - 6); | |||
| Date date = now.getTime(); | |||
| String beginDate = sdf.format(date); | |||
| String endDate = sdf.format(new Date()); | |||
| map.put("startDate", beginDate); | |||
| map.put("endDate", endDate); | |||
| return map; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBottcertById", method = RequestMethod.GET) | |||
| Bottcert getBottcert(Integer id) { | |||
| Bottcert bottcert = repository.get(Bottcert.class, id); | |||
| return bottcert; | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return carTypeDictRepository.selectByArea(permissionFilter); | |||
| } | |||
| // List<AreaDict> selectAreaDictAll(){ | |||
| // return carTypeDictRepository.selectAreaDict(); | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "table", method = RequestMethod.GET) | |||
| List<List<RfidTagScrapVo>> table(Context context, String depts[], String areas, String startDate, String endDate, String isorig,String deptArray,String areaArray[]) { | |||
| if(StringUtil.isNullOrEmpty(areas)){ | |||
| throw new AppException("请勾选行政区域"); | |||
| } | |||
| if(StringUtil.isNullOrEmpty(deptArray)){ | |||
| throw new AppException("请勾选选择部门"); | |||
| } | |||
| if(StringUtil.isNullOrEmpty(startDate) || StringUtil.isNullOrEmpty(endDate)){ | |||
| throw new AppException("请选择完整的起止时间"); | |||
| } | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<RfidTagScrapVo>> resList = new ArrayList<List<RfidTagScrapVo>>(); | |||
| for(int i = 0; i<areaArray.length; i++){ | |||
| AreaDict area = repository.get(AreaDict.class, Integer.parseInt(areaArray[i])); | |||
| Integer sum = 0; | |||
| List<RfidTagScrapVo> list = bottleCertRepository.getTable(areaArray[i], deptArray, isorig, startDate, endDate, permissionFilter); | |||
| List<RfidTagScrapVo> tempList = new ArrayList<RfidTagScrapVo>(); | |||
| if(list.size()==0){ | |||
| for(int x = 0; x < depts.length; x++){ | |||
| RfidTagScrapVo emptyVo = new RfidTagScrapVo(); | |||
| emptyVo.setArea(area.getDictValue()); | |||
| emptyVo.setDeptName(depts[x]); | |||
| emptyVo.setSum(0); | |||
| emptyVo.setCount(0); | |||
| tempList.add(emptyVo); | |||
| } | |||
| resList.add(tempList); | |||
| }else{ | |||
| for(int j = 0; j<depts.length; j++){ | |||
| RfidTagScrapVo emptyVo = new RfidTagScrapVo(); | |||
| emptyVo.setDeptName(depts[j]); | |||
| emptyVo.setArea(area.getDictValue()); | |||
| emptyVo.setCount(0); | |||
| sum = sum + emptyVo.getCount(); | |||
| emptyVo.setSum(sum); | |||
| tempList.add(emptyVo); | |||
| for(int x = 0; x < list.size(); x ++){ | |||
| if(depts[j].equals(list.get(x).getDeptName())){ | |||
| sum = sum + list.get(x).getCount(); | |||
| tempList.get(j).setDeptName(list.get(x).getDeptName()); | |||
| tempList.get(j).setCount(list.get(x).getCount()); | |||
| tempList.get(j).setSum(sum); | |||
| tempList.get(j).setArea(area.getDictValue()); | |||
| } | |||
| } | |||
| } | |||
| resList.add(tempList); | |||
| } | |||
| } | |||
| return resList; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="tableExcel" , method= RequestMethod.GET) | |||
| void exportExcel(Context context, String depts[], String areas, String startDate, String endDate, String isorig,String deptArray,String areaArray[], | |||
| HttpServletRequest req, HttpServletResponse res) throws Exception{ | |||
| List<List<RfidTagScrapVo>> all = this.table(context, depts, areas, startDate, endDate, isorig, deptArray, areaArray); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/bottleCertTable/bottleCertTable.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| for(int i=0;i<depts.length;i++){ | |||
| if("55".equals(depts[i])){ | |||
| tempRow.createCell(i+1).setCellValue("成都市特种设备检验院"); | |||
| } | |||
| if("60".equals(depts[i])){ | |||
| tempRow.createCell(i+1).setCellValue("成都六菱高压气瓶检测有限责任公司"); | |||
| } | |||
| if("61".equals(depts[i])){ | |||
| tempRow.createCell(i+1).setCellValue("郫县南方燃气汽车检测技术有限公司"); | |||
| } | |||
| if("62".equals(depts[i])){ | |||
| tempRow.createCell(i+1).setCellValue("成都高地清洁汽车检测技术有限公司"); | |||
| } | |||
| if("63".equals(depts[i])){ | |||
| tempRow.createCell(i+1).setCellValue("四川兰特清洁汽车安全评价检测有限公司"); | |||
| } | |||
| } | |||
| tempRow.createCell(all.get(0).size()+1).setCellValue("合计"); | |||
| for(int i = 0;i<all.size(); i++){ | |||
| Row row = sheet.createRow(2+i); | |||
| row.createCell(0).setCellValue(all.get(i).get(0).getArea()); | |||
| for(int k=0;k<all.get(i).size();k++){ | |||
| row.createCell(1+k).setCellValue(all.get(i).get(k).getCount()); | |||
| } | |||
| row.createCell(all.get(i).size()+1).setCellValue(all.get(i).get(all.get(i).size()-1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(2+all.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| int count0=0; | |||
| int count1=0; | |||
| int count2=0; | |||
| int count3=0; | |||
| int count4=0; | |||
| int count5=0; | |||
| for(int j=0;j<depts.length;j++){ | |||
| for(int k=0;k<all.size();k++){ | |||
| for(int i=0;i<depts.length;i++){ | |||
| if("55".equals(depts[i])){ | |||
| count0 = count0+all.get(k).get(i).getCount(); | |||
| } | |||
| if("60".equals(depts[i])){ | |||
| count1 = count1+all.get(k).get(i).getCount(); | |||
| } | |||
| if("61".equals(depts[i])){ | |||
| count2 = count2+all.get(k).get(i).getCount(); | |||
| } | |||
| if("62".equals(depts[i])){ | |||
| count3 = count3+all.get(k).get(i).getCount(); | |||
| } | |||
| if("63".equals(depts[i])){ | |||
| count4 = count4+all.get(k).get(i).getCount(); | |||
| } | |||
| } | |||
| count5 = count5+all.get(k).get(depts.length-1).getSum(); | |||
| } | |||
| if("55".equals(depts[j])){ | |||
| row1.createCell(j+1).setCellValue(count0); | |||
| } | |||
| if("60".equals(depts[j])){ | |||
| row1.createCell(j+1).setCellValue(count1); | |||
| } | |||
| if("61".equals(depts[j])){ | |||
| row1.createCell(j+1).setCellValue(count2); | |||
| } | |||
| if("62".equals(depts[j])){ | |||
| row1.createCell(j+1).setCellValue(count3); | |||
| } | |||
| if("63".equals(depts[j])){ | |||
| row1.createCell(j+1).setCellValue(count4); | |||
| } | |||
| count0=0; | |||
| count1=0; | |||
| count2=0; | |||
| count3=0; | |||
| count4=0; | |||
| row1.createCell(depts.length+1).setCellValue(count5); | |||
| count5=0; | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("气瓶使用登记统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,426 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.bottleSegment; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.certrange.entity.Certrange; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.certrange.repository.BottleSegmentRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.certrange.service.BottleSegmentService; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.certrange.vo.CertrangeVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.BottleCert; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.BottleCertRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "bottleSegment") | |||
| public class BottleSegmentController { | |||
| @Resource | |||
| BottleSegmentRepository bottleSegmentRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| BottleSegmentService bottleSegmentService; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| BottleCertRepository bottleCertRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| private LogOperation logOperation; | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleSegments", method = RequestMethod.GET) | |||
| Pagination getbottleSegments(Certrange vo, Context context, Pagination pagination, Integer search_ref) { | |||
| List<AuthorityDepartment> departmentList = carTypeDictRepository.selectRegDept(17); // 得到所有检验单位 | |||
| List<Certrange> certrange = bottleSegmentRepository.getBottleSegments(vo, null, pagination, search_ref); | |||
| List<CertrangeVo> listVo= new ArrayList<CertrangeVo>(); | |||
| for(AuthorityDepartment department:departmentList){ | |||
| Certrange rangeBean = bottleSegmentRepository.findByDeptId(department.getId(), 1); | |||
| int index =0; | |||
| String letter = ""; | |||
| if(rangeBean != null){ | |||
| for(int i = 0; i < rangeBean.getRangeFrom().length(); i++){ | |||
| if(Character.isLetter(rangeBean.getRangeFrom().charAt(i))){ // 判断字符串中是否包含字母 | |||
| index = i; | |||
| } | |||
| } | |||
| letter = rangeBean.getRangeFrom().substring(index, index + 1); | |||
| } | |||
| BottleCert bottleCert = bottleCertRepository.getBottleCertByDeptId(department.getId(), index, letter); // 得到该检验单位在使用的最大号段 | |||
| CertrangeVo cervo = new CertrangeVo(); | |||
| cervo.setId(department.getId()); | |||
| cervo.setDeptName(department.getDeptName()); | |||
| cervo.setIndex(""); | |||
| cervo.setRangeFrom(""); | |||
| cervo.setRangeTo(""); | |||
| cervo.setIsuse(0); | |||
| for(int i = 0; i < certrange.size(); i++){ // bottleCert.getId() 已赋值为部门id | |||
| if(certrange.get(i).getIsuse()==1 && certrange.get(i).getCheckDept().getId() == bottleCert.getId()){ | |||
| certrange.get(i).setIndex(bottleCert.getCode()); | |||
| } | |||
| } | |||
| listVo.add(cervo); | |||
| } | |||
| if(listVo.size()>0){ | |||
| for(CertrangeVo cer : listVo){ | |||
| for(int i = 0; i < certrange.size(); i++){ | |||
| if(cer.getId()==certrange.get(i).getCheckDept().getId()){ | |||
| cer.setIndex(certrange.get(i).getIndex()); | |||
| cer.setRangeFrom(certrange.get(i).getRangeFrom()); | |||
| cer.setRangeTo(certrange.get(i).getRangeTo()); | |||
| cer.setIsuse(certrange.get(i).getIsuse()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| pagination.setRows(listVo); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleSegmentId", method = RequestMethod.GET) | |||
| Pagination getbottleSegment(Pagination pagination, Integer id) { | |||
| List<AuthorityDepartment> departmentList = carTypeDictRepository.selectRegDept(17); // 得到所有检验单位 | |||
| List<Certrange> certrange=new ArrayList<Certrange>(); | |||
| if(null!=id){ | |||
| certrange = bottleSegmentRepository.getBottleSegmentId(id, null, pagination, null); | |||
| for(int i = 0; i < certrange.size(); i++){ | |||
| for(AuthorityDepartment department:departmentList){ | |||
| Certrange rangeBean = bottleSegmentRepository.findByDeptId(department.getId(), 1); | |||
| int index =0; | |||
| String letter = ""; | |||
| if(rangeBean != null){ | |||
| for(int k = 0; k < rangeBean.getRangeFrom().length(); k++){ | |||
| if(Character.isLetter(rangeBean.getRangeFrom().charAt(k))){ // 判断字符串中是否包含字母 | |||
| index = k; | |||
| } | |||
| } | |||
| letter = rangeBean.getRangeFrom().substring(index, index + 1); | |||
| } | |||
| BottleCert bottleCert = bottleCertRepository.getBottleCertByDeptId(department.getId(), index, letter); // 得到该检验单位在使用的最大号段 | |||
| if(certrange.get(i).getIsuse()==1 && certrange.get(i).getCheckDept().getId()==bottleCert.getId()){ | |||
| certrange.get(i).setIndex(bottleCert.getCode()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| pagination.setRows(certrange); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleSegment", method = RequestMethod.POST) | |||
| void addBottleSegment(Certrange vo, Context context) { | |||
| if(!context.getDistrict().getCode().equals("510100")){ | |||
| throw new AppException("只有成都市质监局才能操作使用!"); | |||
| } | |||
| List<Certrange> list = bottleSegmentRepository.getByDeptId(vo.getCheckDept().getId(), 2); | |||
| if(list != null && list.size() > 0){ | |||
| throw new AppException("该检验站已存在未使用号段,请勿重新添加。"); | |||
| } | |||
| if(StringUtil.isNullOrEmpty(vo.getRangeFrom()) || StringUtil.isNullOrEmpty(vo.getRangeTo())){ | |||
| throw new AppException("请输入完整的号段起始值。"); | |||
| } | |||
| // 开始号段 | |||
| boolean isLetterFrom = false; | |||
| int numberFrom =0; | |||
| int indexFrom = 0; | |||
| for(int i = 0; i < vo.getRangeFrom().length(); i++){ | |||
| if(Character.isLetter(vo.getRangeFrom().charAt(i))){ // 判断字符串中是否包含字母 | |||
| numberFrom = i; | |||
| isLetterFrom = true; | |||
| indexFrom ++; | |||
| } | |||
| } | |||
| // 结束号段 | |||
| boolean isLetterTo = false; | |||
| int numberTo = 0; | |||
| int indexTo = 0; | |||
| for(int i = 0; i< vo.getRangeTo().length(); i++){ | |||
| if(Character.isLetter(vo.getRangeTo().charAt(i))){ | |||
| numberTo = i; | |||
| isLetterTo = true; | |||
| indexTo ++; | |||
| } | |||
| } | |||
| if(indexFrom != indexTo){ | |||
| throw new AppException("两边的字母数量不一致。"); | |||
| } | |||
| if(!vo.getRangeFrom().substring(numberFrom,numberFrom+1).matches("^[A-Z]{1}$") || !vo.getRangeTo().substring(numberTo,numberTo+1).matches("^[A-Z]{1}$")){ | |||
| throw new AppException("字母必须为大写字母。"); | |||
| } | |||
| if(numberFrom != numberTo){ | |||
| throw new AppException("请确认两边的字母位置不一致。"); | |||
| } | |||
| if(!(vo.getRangeFrom().substring(numberFrom, numberFrom + 1)).equals(vo.getRangeTo().substring(numberTo, numberTo + 1)) ){ | |||
| throw new AppException("请确认该检验站的号段的编码字母是否一致。"); | |||
| } | |||
| String[] str = vo.getRangeFrom().split(vo.getRangeFrom().substring(numberFrom, numberFrom + 1)); | |||
| String strFrom = ""; | |||
| for(int k = 0; k < str.length; k++){ | |||
| strFrom = strFrom + str[k]; | |||
| } | |||
| String[] strTwo = vo.getRangeTo().split(vo.getRangeTo().substring(numberTo, numberTo + 1)); | |||
| String strTo = ""; | |||
| for(int k = 0; k < strTwo.length; k++){ | |||
| strTo = strTo + strTwo[k]; | |||
| } | |||
| if(Integer.parseInt(strFrom) >= Integer.parseInt(strTo)){ | |||
| throw new AppException("该号段的起始值有误,请重新填写。"); | |||
| } | |||
| Integer vorangeFrom = Integer.parseInt(strFrom); | |||
| Integer vorangeTo = Integer.parseInt(strTo); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| Date date = new Date(); | |||
| try { | |||
| date = sdf.parse("2016-08-01"); | |||
| } catch (ParseException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| List<Certrange> allList = bottleSegmentRepository.getAll(date); | |||
| for(Certrange range : allList){ | |||
| boolean isLetterRangeFrom = false; | |||
| int numberRangeFrom =0; | |||
| for(int i = 0; i < range.getRangeFrom().length(); i++){ | |||
| if(Character.isLetter(range.getRangeFrom().charAt(i))){ // 判断字符串中是否包含字母 | |||
| numberRangeFrom = i; | |||
| isLetterRangeFrom = true; | |||
| } | |||
| } | |||
| boolean isLetterRangeTo = false; | |||
| int numberRangeTo = 0; | |||
| for(int i = 0; i< range.getRangeTo().length(); i++){ | |||
| if(Character.isLetter(range.getRangeTo().charAt(i))){ | |||
| numberRangeTo = i; | |||
| isLetterRangeTo = true; | |||
| } | |||
| } | |||
| if(numberRangeFrom == numberFrom && numberRangeTo == numberTo){ | |||
| // 开始号码 | |||
| String[] strRange = range.getRangeFrom().split(range.getRangeFrom().substring(numberRangeFrom, numberRangeFrom + 1)); | |||
| String strRangeFrom = ""; | |||
| if(str.length > 1 ){ | |||
| strRangeFrom = strRange[0] + strRange[1]; | |||
| }else{ | |||
| strRangeFrom = strRange[0]; | |||
| } | |||
| // 结束号码 | |||
| String[] strRangeTwo = range.getRangeTo().split(range.getRangeTo().substring(numberRangeTo, numberRangeTo + 1)); | |||
| String strRangeTo = ""; | |||
| if(strRangeTwo.length > 0){ | |||
| strRangeTo= strRangeTwo[0] + strRangeTwo[1]; | |||
| }else{ | |||
| strRangeTo = strRangeTwo[0]; | |||
| } | |||
| if(Tool.isInteger(strRangeFrom) && Tool.isInteger(strRangeTo)){ | |||
| Integer rangeFrom = Integer.parseInt(strRangeFrom); | |||
| Integer rangeTo = Integer.parseInt(strRangeTo); | |||
| if((vo.getRangeFrom().substring(numberFrom, numberFrom + 1)).equals(range.getRangeFrom().substring(numberFrom, numberFrom + 1))){ | |||
| if(vorangeFrom >= rangeFrom && vorangeFrom <= rangeTo || vorangeTo >= rangeFrom && vorangeTo <= rangeTo){ | |||
| throw new AppException("该号段的起始值或存在于其他号段中,请重新填写。"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| bottleSegmentService.addBottleSegment(vo, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleSegmentUP", method = RequestMethod.PUT) | |||
| void updateBottleSegment(Certrange vo, Context context) { | |||
| if(vo.getId()==null){ | |||
| throw new AppException("请选择一条数据后,再操作"); | |||
| } | |||
| if(!context.getDistrict().getCode().equals("510100")){ | |||
| throw new AppException("只有成都市质监局才能操作使用!"); | |||
| } | |||
| List<Certrange> list = bottleSegmentRepository.getByDeptId(vo.getCheckDept().getId(), 2,vo.getId()); | |||
| if(list!=null && list.size()>0){ | |||
| throw new AppException("该检验站已存在未使用号段,请勿重新添加"); | |||
| } | |||
| if(StringUtil.isNullOrEmpty(vo.getRangeFrom()) || StringUtil.isNullOrEmpty(vo.getRangeTo())){ | |||
| throw new AppException("请输入完整的号段起始值"); | |||
| } | |||
| // 开始号段 | |||
| boolean isLetterFrom = false; | |||
| int numberFrom =0; | |||
| int indexFrom = 0; | |||
| for(int i = 0; i < vo.getRangeFrom().length(); i++){ | |||
| if(Character.isLetter(vo.getRangeFrom().charAt(i))){ // 判断字符串中是否包含字母 | |||
| numberFrom = i; | |||
| isLetterFrom = true; | |||
| indexFrom ++; | |||
| } | |||
| } | |||
| // 结束号段 | |||
| boolean isLetterTo = false; | |||
| int numberTo = 0; | |||
| int indexTo = 0; | |||
| for(int i = 0; i< vo.getRangeTo().length(); i++){ | |||
| if(Character.isLetter(vo.getRangeTo().charAt(i))){ | |||
| numberTo = i; | |||
| isLetterTo = true; | |||
| indexTo ++; | |||
| } | |||
| } | |||
| if(indexFrom != indexTo){ | |||
| throw new AppException("两边的字母数量不一致。"); | |||
| } | |||
| if(!vo.getRangeFrom().substring(numberFrom,numberFrom+1).matches("^[A-Z]{1}$") || !vo.getRangeTo().substring(numberTo,numberTo+1).matches("^[A-Z]{1}$")){ | |||
| throw new AppException("字母必须为大写字母。"); | |||
| } | |||
| if(numberFrom != numberTo){ | |||
| throw new AppException("请确认两边的字母位置不一致。"); | |||
| } | |||
| if(!(vo.getRangeFrom().substring(numberFrom, numberFrom + 1)).equals(vo.getRangeTo().substring(numberTo, numberTo + 1)) ){ | |||
| throw new AppException("请确认该检验站的号段的编码字母是否一致。"); | |||
| } | |||
| String[] str = vo.getRangeFrom().split(vo.getRangeFrom().substring(numberFrom, numberFrom + 1)); | |||
| String strFrom = ""; | |||
| for(int k = 0; k < str.length; k++){ | |||
| strFrom = strFrom + str[k]; | |||
| } | |||
| String[] strTwo = vo.getRangeTo().split(vo.getRangeTo().substring(numberTo, numberTo + 1)); | |||
| String strTo = ""; | |||
| for(int k = 0; k < strTwo.length; k++){ | |||
| strTo = strTo + strTwo[k]; | |||
| } | |||
| if(Integer.parseInt(strFrom) >= Integer.parseInt(strTo)){ | |||
| throw new AppException("该号段的起始值有误,请重新填写。"); | |||
| } | |||
| Integer vorangeFrom = Integer.parseInt(strFrom); | |||
| Integer vorangeTo = Integer.parseInt(strTo); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| Date date = new Date(); | |||
| try { | |||
| date = sdf.parse("2016-08-01"); | |||
| } catch (ParseException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| List<Certrange> allList = bottleSegmentRepository.getAll(date); | |||
| for(Certrange range : allList){ | |||
| boolean isLetterRangeFrom = false; | |||
| int numberRangeFrom =0; | |||
| for(int i = 0; i < range.getRangeFrom().length(); i++){ | |||
| if(Character.isLetter(range.getRangeFrom().charAt(i))){ // 判断字符串中是否包含字母 | |||
| numberRangeFrom = i; | |||
| isLetterRangeFrom = true; | |||
| } | |||
| } | |||
| boolean isLetterRangeTo = false; | |||
| int numberRangeTo = 0; | |||
| for(int i = 0; i< range.getRangeTo().length(); i++){ | |||
| if(Character.isLetter(range.getRangeTo().charAt(i))){ | |||
| numberRangeTo = i; | |||
| isLetterRangeTo = true; | |||
| } | |||
| } | |||
| if(numberRangeFrom == numberFrom && numberRangeTo == numberTo){ | |||
| // 开始号码 | |||
| String[] strRange = range.getRangeFrom().split(range.getRangeFrom().substring(numberRangeFrom, numberRangeFrom + 1)); | |||
| String strRangeFrom = ""; | |||
| if(str.length > 1 ){ | |||
| strRangeFrom = strRange[0] + strRange[1]; | |||
| }else{ | |||
| strRangeFrom = strRange[0]; | |||
| } | |||
| // 结束号码 | |||
| String[] strRangeTwo = range.getRangeTo().split(range.getRangeTo().substring(numberRangeTo, numberRangeTo + 1)); | |||
| String strRangeTo = ""; | |||
| if(strRangeTwo.length > 0){ | |||
| strRangeTo= strRangeTwo[0] + strRangeTwo[1]; | |||
| }else{ | |||
| strRangeTo = strRangeTwo[0]; | |||
| } | |||
| if(Tool.isInteger(strRangeFrom) && Tool.isInteger(strRangeTo)){ | |||
| Integer rangeFrom = Integer.parseInt(strRangeFrom); | |||
| Integer rangeTo = Integer.parseInt(strRangeTo); | |||
| if((vo.getRangeFrom().substring(numberFrom, numberFrom + 1)).equals(range.getRangeFrom().substring(numberFrom, numberFrom + 1))){ | |||
| if(vorangeFrom >= rangeFrom && vorangeFrom <= rangeTo || vorangeTo >= rangeFrom && vorangeTo <= rangeTo){ | |||
| throw new AppException("该号段的起始值或存在于其他号段中,请重新填写。"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| bottleSegmentService.updateBottleSegment(vo, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottleSegment", method = RequestMethod.PUT) | |||
| void delBottleSegment(Integer id,Context context) { | |||
| if(!context.getDistrict().getCode().equals("510100")){ | |||
| throw new AppException("只有成都市质监局才能操作使用!"); | |||
| } | |||
| Certrange certrange = repository.get(Certrange.class, id); | |||
| if (null != certrange) { | |||
| if(certrange.getIsuse()==1){ | |||
| throw new AppException("该气瓶使用登记证号段正在使用,无法删除。"); | |||
| }else{ | |||
| certrange.setRowState(2); | |||
| repository.save(certrange); | |||
| logOperation.saveCertrangeLog(certrange, context.getUser().getUsername(), Operations.DELETE, "登记证号段设置-删除"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,166 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.checkBottleTable; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.checkBottleTable.repository.CheckBottleTableRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.checkBottleTable.vo.CheckBottleVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| /** | |||
| * 2021.04.13 | |||
| * @author yuchen | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "checkBottle") | |||
| public class CheckBottleTableController { | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CheckBottleTableRepository checkBottleTableRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] { 17 }; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "table", method = RequestMethod.GET) | |||
| List<List<CheckBottleVo>> getCheckBottleTable(Context context, String depts[], String startDate, String endDate, String deptStr) { | |||
| if(StringUtil.isNullOrEmpty(deptStr)){ | |||
| throw new AppException("请勾选选择部门"); | |||
| } | |||
| if(StringUtil.isNullOrEmpty(startDate) || StringUtil.isNullOrEmpty(endDate)){ | |||
| throw new AppException("请选择时间"); | |||
| } | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<CheckBottleVo>> resList = new ArrayList<List<CheckBottleVo>>(); | |||
| Integer rowState[] = new Integer[]{1,2}; | |||
| for(int i = 0; i<depts.length; i++){ | |||
| //查询到部门信息 | |||
| AuthorityDepartment dept = repository.get(AuthorityDepartment.class, Integer.parseInt(depts[i])); | |||
| Integer sum = 0; | |||
| //查询统计数据 | |||
| List<CheckBottleVo> list = checkBottleTableRepository.getCheckBottleTable(depts[i], startDate, endDate, permissionFilter,""); | |||
| List<CheckBottleVo> tempList = new ArrayList<CheckBottleVo>(); | |||
| if(list.size()==0){ | |||
| for(int x = 0; x < 2; x++){ | |||
| CheckBottleVo emptyVo = new CheckBottleVo(); | |||
| emptyVo.setRowState(x+1); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setSum(0); | |||
| emptyVo.setCount(0); | |||
| tempList.add(emptyVo); | |||
| } | |||
| resList.add(tempList); | |||
| } | |||
| else{ | |||
| for(int j = 0; j<2; j++){ | |||
| CheckBottleVo emptyVo = new CheckBottleVo(); | |||
| emptyVo.setRowState(j+1); | |||
| emptyVo.setDeptName(dept.getDeptName()); | |||
| emptyVo.setCount(0); | |||
| sum = sum + emptyVo.getCount(); | |||
| emptyVo.setSum(sum); | |||
| tempList.add(emptyVo); | |||
| for(int x = 0; x < list.size(); x ++){ | |||
| if(rowState[j].equals(list.get(x).getRowState())){ | |||
| sum = sum + list.get(x).getCount(); | |||
| tempList.get(j).setRowState(list.get(x).getRowState()); | |||
| tempList.get(j).setCount(list.get(x).getCount()); | |||
| tempList.get(j).setSum(sum); | |||
| tempList.get(j).setDeptName(dept.getDeptName()); | |||
| } | |||
| } | |||
| } | |||
| resList.add(tempList); | |||
| } | |||
| } | |||
| return resList; | |||
| } | |||
| //导出检验气瓶统计 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportExcel", method = RequestMethod.GET) | |||
| void exportExcel(Context context, String depts[], String startDate, String endDate, String deptStr ,HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| List<List<CheckBottleVo>> listAll = this.getCheckBottleTable(context, depts, startDate, endDate, deptStr); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/checkBottleTable/checkBottleTable.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| tempRow.createCell(1).setCellValue("合格"); | |||
| tempRow.createCell(2).setCellValue("不合格"); | |||
| tempRow.createCell(3).setCellValue("合计"); | |||
| for(int i = 0;i<listAll.size(); i++){ | |||
| Row row = sheet.createRow(1+i); | |||
| row.createCell(0).setCellValue(listAll.get(i).get(0).getDeptName()); | |||
| for(int k=0;k<listAll.get(i).size();k++){ | |||
| row.createCell(1+k).setCellValue(listAll.get(i).get(k).getCount()); | |||
| } | |||
| row.createCell(listAll.get(i).size()+1).setCellValue(listAll.get(i).get(listAll.get(i).size()-1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(1+listAll.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| int count0=0; | |||
| int count1=0; | |||
| int count2=0; | |||
| for(int k=0;k<listAll.size();k++){ | |||
| count0 = count0+listAll.get(k).get(0).getCount(); | |||
| count1 = count1+listAll.get(k).get(1).getCount(); | |||
| count2 = count2+listAll.get(k).get(1).getSum(); | |||
| } | |||
| row1.createCell(1).setCellValue(count0); | |||
| row1.createCell(2).setCellValue(count1); | |||
| row1.createCell(3).setCellValue(count2); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("检验气瓶统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,149 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.checkLog; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CheckLogRegular; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Owner; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checklog.service.ChecklogService; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.fasterxml.jackson.core.JsonGenerationException; | |||
| import com.fasterxml.jackson.databind.JsonMappingException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| @Controller | |||
| @RequestMapping(value="check/checkLog") | |||
| public class CheckLogController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| ChecklogRepository checklogRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| ChecklogService checklogService; | |||
| /** | |||
| * 定期检测记录查询 | |||
| * @param start_refitDate | |||
| * @param name | |||
| * @param ispass | |||
| * @param regDept_id | |||
| * @param context | |||
| * @param pagination | |||
| * @param platenum | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "CheckLogs", method = RequestMethod.GET) | |||
| Pagination getRfidtagUnlock(String start_refitDate,String end_refitDate,String bottCode,String name,String ispass, | |||
| Integer regDept_id, Context context,Pagination pagination,String platenum) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| Owner owner = new Owner(); | |||
| owner.setName(name.trim()); | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setPlatenum(platenum.trim()); | |||
| car.setOwner(owner); | |||
| AuthorityDepartment regDept = new AuthorityDepartment(); | |||
| regDept.setId(regDept_id); | |||
| CheckLogRegular bean = new CheckLogRegular(); | |||
| bean.setIspass(ispass); | |||
| bean.setAuthorityDepartment(regDept); | |||
| bean.setCar(car); | |||
| // pagination.setRows(checklogRepository.getCheckLogAll(bottCode,start_refitDate,end_refitDate,permissionFilter, bean, pagination)); | |||
| return checklogRepository.getCheckLogAll(bottCode,start_refitDate,end_refitDate,permissionFilter, bean, pagination); | |||
| } | |||
| /** | |||
| * 获得所有检验单位 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectDeptTypeAll" , method= RequestMethod.GET) | |||
| List<AuthorityDepartment> selectDeptAll(){ | |||
| return carTypeDictRepository.selectRegDept(17); | |||
| } | |||
| /** | |||
| * 根据carid查询气瓶 | |||
| * @param carid | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCar" , method= RequestMethod.GET) | |||
| Bottle getBottleByCar(String carid){ | |||
| return airBottleRepository.getBottleByCar(Integer.parseInt(carid)); | |||
| } | |||
| /** | |||
| * 根据car id 查询气瓶详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCarId",method = RequestMethod.GET) | |||
| Pagination getBottleByCarId(String id,Pagination pagination){ | |||
| pagination.setRows(carStrategy.getBottleAll(Integer.parseInt(id), pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 根据CheckLogRegular的id查询车辆详细信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="findByCngCdCar",method = RequestMethod.GET) | |||
| CheckLogRegular findByCngCdCar(Integer id){ | |||
| return repository.get(CheckLogRegular.class, id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "syncLogs", method = RequestMethod.POST) | |||
| Map<String,String> getLogs(String bottleCode) throws JsonGenerationException, JsonMappingException, IOException { | |||
| Map<String, String> map = new HashMap<String,String>(); | |||
| String str = checklogService.syncLogs(bottleCode); | |||
| map.put("msg", str); | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.matterBottle; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "matterBottle") | |||
| public class MatterBottleController { | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "matterBottles", method = RequestMethod.GET) | |||
| Pagination getMatterBottles(Bottle vo, Context context, Pagination pagination, String platenum) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(bottleRepository.getMatterBottles(vo, permissionFilter, pagination, platenum)); | |||
| return pagination; | |||
| } | |||
| } | |||
| @ -0,0 +1,158 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.nextCheckTatle; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.nextCheckTatle.service.NextCheckTableService; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.nextCheckTatle.vo.NextCheckTableVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| @Controller | |||
| @RequestMapping(value = "nextCheckTatle") | |||
| public class nextCheckTatleController { | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| NextCheckTableService checkTableService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| // 加气属性 | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| return gasrangeRepository.getCngTypeDict(); | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return carTypeDictRepository.selectByArea(permissionFilter); | |||
| } | |||
| // List<AreaDict> selectAreaDictAll(){ | |||
| // return carTypeDictRepository.selectAreaDict(); | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value="nextCheckTableByCar" , method= RequestMethod.GET) | |||
| List<List<NextCheckTableVo>> carAndBottleByBott(Context context,String[] area,String[] type,String start,String end ,Integer isCarOrBottle){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| if((type==null || type.length<1)){ | |||
| throw new AppException("请选择加气属性."); | |||
| } | |||
| if((area==null || area.length<1)){ | |||
| throw new AppException("请选择区域."); | |||
| } | |||
| // if((start==null || start.length()<1)&&(end==null || end.length()<1)){ | |||
| // throw new AppException("请选择日期."); | |||
| // } | |||
| if(StringUtil.isNullOrEmpty(start) || StringUtil.isNullOrEmpty(end)){ | |||
| throw new AppException("请选择时间"); | |||
| } | |||
| List<List<NextCheckTableVo>> all = new ArrayList<List<NextCheckTableVo>>(); | |||
| if(area!=null && area.length>0 && type!=null && type.length>0){ | |||
| for(int i=0;i<area.length;i++){ | |||
| if(isCarOrBottle==1){ | |||
| List<NextCheckTableVo> list = checkTableService.selectNextCheckTableByCar( permissionFilter,area[i], type, start, end); | |||
| all.add(list); | |||
| } | |||
| if(isCarOrBottle==2){ | |||
| List<NextCheckTableVo> list = checkTableService.selectNextCheckTableByBottle( permissionFilter,area[i], type, start, end); | |||
| all.add(list); | |||
| } | |||
| } | |||
| } | |||
| return all; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="nextCheckTableByCarExcel" , method= RequestMethod.GET) | |||
| public void exportExcel(Context context,String[] area,String[] type,String start,String end ,Integer isCarOrBottle, | |||
| HttpServletRequest req, HttpServletResponse res) throws Exception{ | |||
| List<List<NextCheckTableVo>> all = this.carAndBottleByBott(context, area, type, start, end, isCarOrBottle); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/nextCheckTatle/nextCheckTatle.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| for(int i=0;i<all.get(0).size();i++){ | |||
| tempRow.createCell(i+1).setCellValue(all.get(0).get(i).getTypeName()); | |||
| } | |||
| tempRow.createCell(all.get(0).size()+1).setCellValue("合计"); | |||
| for(int i = 0;i<all.size(); i++){ | |||
| Row row = sheet.createRow(2+i); | |||
| row.createCell(0).setCellValue(all.get(i).get(0).getAreaName()); | |||
| for(int k=0;k<all.get(i).size();k++){ | |||
| row.createCell(1+k).setCellValue(all.get(i).get(k).getNum()); | |||
| } | |||
| row.createCell(all.get(i).size()+1).setCellValue(all.get(i).get(all.get(i).size()-1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(2+all.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| int[] sum={0,0,0,0,0,0,0,0}; | |||
| // for(int i=0;i<all.get(0).size();i++){//行 | |||
| // sum[i]=0; | |||
| // } | |||
| int count=0; | |||
| for(int i = 0;i<all.size(); i++){ | |||
| count = count+all.get(i).get(all.get(i).size()-1).getSum(); | |||
| } | |||
| for(int i=0;i<all.get(0).size();i++){ | |||
| for(int k=0;k<all.size();k++){ | |||
| sum[i] = sum[i]+all.get(k).get(i).getNum(); | |||
| } | |||
| } | |||
| for(int j=0;j<all.get(0).size();j++){ | |||
| row1.createCell(j+1).setCellValue(sum[j]); | |||
| } | |||
| row1.createCell(all.get(0).size()+1).setCellValue(count); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| if(isCarOrBottle==1){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("车辆下次检验统计.xlsx", bytes.length, new Date())); | |||
| } | |||
| if(isCarOrBottle==2){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("气瓶下次检验统计.xlsx", bytes.length, new Date())); | |||
| } | |||
| // ServletUtil.respondFileInfo(res, new FileInfo("车辆、气瓶下次检验统计.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| } | |||
| @ -0,0 +1,91 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityDiscardTagQuery; | |||
| //package application.qualityCheck.qualityDiscardTagQuery; | |||
| // | |||
| //import infrastructure.spring.web.Context; | |||
| //import infrastructure.support.record.Pagination; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //import javax.annotation.Resource; | |||
| // | |||
| //import org.springframework.stereotype.Controller; | |||
| //import org.springframework.web.bind.annotation.RequestMapping; | |||
| //import org.springframework.web.bind.annotation.RequestMethod; | |||
| //import org.springframework.web.bind.annotation.ResponseBody; | |||
| // | |||
| //import domain.energy.blackcar.repository.RfidtagRepository; | |||
| //import domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| //import domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| //import domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| //import domain.refittingFactory.refittingCar.entity.RfidTagLock; | |||
| //import domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| //import domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| //import domain.repository.system.DepartmentRepository; | |||
| //import domain.repository.system.DistrictRepository; | |||
| // | |||
| ///** | |||
| // * 电子标签 | |||
| // * | |||
| // * @author | |||
| // * | |||
| // */ | |||
| //@Controller | |||
| //@RequestMapping(value = "discardTagQuery") | |||
| //public class QualityDiscardTagQueryController { | |||
| // @Resource | |||
| // RfidtagRepository rfidtagRepository; | |||
| // @Resource | |||
| // domain.repository.system.Repository repository; | |||
| // @Resource | |||
| // DepartmentRepository departmentRepository; | |||
| // @Resource | |||
| // CarTypeDictRepository carTypeDictRepository; | |||
| // @Resource | |||
| // AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| // | |||
| // @Resource | |||
| // DistrictRepository districtRepository; | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "rfidtags", method = RequestMethod.GET) | |||
| // Pagination getRfidtagUnlock(String start_refitDate, String end_refitDate, String tagtype, Integer regDept_id, String memo, Integer cngTypeDict_id, Context context, Pagination pagination, String platenum) { | |||
| // | |||
| // // List<Integer> list = | |||
| // // departmentRepository.getLoginerDepartmentType(context); | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| // // 得到当前登陆用户的id | |||
| // String userId = context.getPosition().getDepartment().getId(); | |||
| // AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(userId); | |||
| // | |||
| // CngTypeDict cngTypeDict = new CngTypeDict(); | |||
| // cngTypeDict.setId(cngTypeDict_id); | |||
| // | |||
| // CngCdCar car = new CngCdCar(); | |||
| // car.setPlatenum(platenum); | |||
| // car.setCngTypeDict(cngTypeDict); | |||
| // | |||
| // RfidTagLock bean = new RfidTagLock(); | |||
| // bean.setIscngtag(tagtype); | |||
| // bean.setCar(car); | |||
| // bean.setMemo(memo); | |||
| // bean.setRegDept(dept); | |||
| // bean.setRowState(2); | |||
| // pagination.setRows(rfidtagRepository.findQualityByScrapRfidTag(list, regDept_id, start_refitDate, end_refitDate, bean, pagination)); | |||
| // return pagination; | |||
| // } | |||
| // | |||
| // /** | |||
| // * 得到所属区域信息 | |||
| // */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "selectCngTypeDictAll", method = RequestMethod.GET) | |||
| // List<CngTypeDict> selectcngAll() { | |||
| // return carTypeDictRepository.selectCngTypeDict(); | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "selectDeptTypeAll", method = RequestMethod.GET) | |||
| // List<AuthorityDepartment> selectDeptAll() { | |||
| // return carTypeDictRepository.selectRegDept(17); | |||
| // } | |||
| //} | |||
| @ -0,0 +1,56 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityGasOnlineQuery; | |||
| //package application.qualityCheck.qualityGasOnlineQuery; | |||
| // | |||
| //import infrastructure.spring.web.Context; | |||
| //import infrastructure.support.record.Pagination; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //import javax.annotation.Resource; | |||
| // | |||
| //import org.springframework.stereotype.Controller; | |||
| //import org.springframework.web.bind.annotation.RequestMapping; | |||
| //import org.springframework.web.bind.annotation.RequestMethod; | |||
| //import org.springframework.web.bind.annotation.ResponseBody; | |||
| // | |||
| //import domain.energy.gstation.entity.FillGasStation; | |||
| //import domain.energy.gstation.repository.GasOnlineRepository; | |||
| //import domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| //import domain.repository.system.DepartmentRepository; | |||
| //import domain.tool.Tool; | |||
| // | |||
| //@Controller | |||
| //@RequestMapping(value = "gasOnlineQuery") | |||
| //public class QualityGasOnlineQueryController { | |||
| // | |||
| // @Resource | |||
| // GasOnlineRepository gasOnlineRepository; | |||
| // | |||
| // @Resource | |||
| // DepartmentRepository departmentRepository; | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "gasGasonline", method = RequestMethod.GET) | |||
| // Pagination getGasOnline(Pagination pagination, String online, | |||
| // String onlineList, Context context) { | |||
| // List<Integer> list = departmentRepository | |||
| // .getLoginerDepartmentType(context); | |||
| // List<Integer> listGas = Tool.StringByList(onlineList); | |||
| // pagination.setRows(gasOnlineRepository.getGasStation(pagination, | |||
| // online, listGas, list)); | |||
| // return pagination; | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "getaddress", method = RequestMethod.GET) | |||
| // List<AreaDict> getAreaDicts() { | |||
| // return gasOnlineRepository.getAreaDict(); | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "getGasInfos", method = RequestMethod.GET) | |||
| // List<FillGasStation> getGasInfos(Integer areaId) { | |||
| // return gasOnlineRepository.getGasInfosByAreaId(areaId); | |||
| // } | |||
| // | |||
| //} | |||
| @ -0,0 +1,97 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityHome; | |||
| import infrastructure.spring.web.cache.ResponseBodyCacheManager; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Timer; | |||
| import java.util.TimerTask; | |||
| import javax.annotation.PostConstruct; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.qualityHome.entity.BottcertVo; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.qualityHome.entity.RfidVo; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.qualityHome.repository.QualityHomeRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "qualityHome") | |||
| public class QualityHomeController { | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| QualityHomeRepository qualityHomeRepository; | |||
| @Resource | |||
| ResponseBodyCacheManager responseBodyCacheManager; | |||
| private PermissionFilter fiter = null; | |||
| @PostConstruct | |||
| private void init() { | |||
| new Timer(true).schedule(new TimerTask() { | |||
| @Override | |||
| public void run() { | |||
| try { | |||
| if(fiter != null){ | |||
| PermissionFilter permissionFilter = fiter; | |||
| responseBodyCacheManager.cache("/qualityHome/amount?list=&filterType=&filterStrings=", getsendAmount(permissionFilter), 3600); | |||
| responseBodyCacheManager.cache("/qualityHome/bortAmount?list=&filterType=&filterStrings=", getBottcertSend(permissionFilter), 3600); | |||
| } | |||
| } catch (Throwable throwable) {} | |||
| } | |||
| }, 3 * 1000L, 1800 * 1000L); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "amount", method = RequestMethod.GET) | |||
| Map<String,Integer> getsendAmount(/*Context context*/PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<RfidVo> sendAmount = qualityHomeRepository.getSend("sendAmount",permissionFilter); //所有 | |||
| List<RfidVo> inUseAmount = qualityHomeRepository.getSend("inUseAmount",permissionFilter); | |||
| List<RfidVo> scrapAmount = qualityHomeRepository.getSend("scrapAmount",permissionFilter); | |||
| Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| map.put("sendAmount", sendAmount.get(0).getSendAmount()); | |||
| map.put("inUseAmount", inUseAmount.get(0).getSendAmount()); | |||
| map.put("scrapAmount", scrapAmount.get(0).getSendAmount()); | |||
| return map; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bortAmount", method = RequestMethod.GET) | |||
| Map<String,Integer> getBottcertSend(PermissionFilter permissionFilter){ | |||
| if(permissionFilter.getList() == null){ | |||
| permissionFilter.setList(new ArrayList<Integer>()); | |||
| } | |||
| fiter = permissionFilter; | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<BottcertVo> sendAmount = qualityHomeRepository.getBottcertSend("sendAmount",permissionFilter); //所有 | |||
| List<BottcertVo> inUseAmount = qualityHomeRepository.getBottcertSend("inUseAmount",permissionFilter); | |||
| Map<String,Integer> map = new HashMap<String,Integer>(); | |||
| map.put("sendAmount", sendAmount.get(0).getSendAmount()); | |||
| map.put("inUseAmount", inUseAmount.get(0).getSendAmount()); | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,82 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityRefitinquiry; | |||
| //package application.qualityCheck.qualityRefitinquiry; | |||
| // | |||
| //import infrastructure.spring.web.Context; | |||
| //import infrastructure.support.record.Pagination; | |||
| //import infrastructure.support.utils.StringUtil; | |||
| // | |||
| //import java.util.ArrayList; | |||
| //import java.util.List; | |||
| // | |||
| //import javax.annotation.Resource; | |||
| // | |||
| //import org.springframework.stereotype.Controller; | |||
| //import org.springframework.web.bind.annotation.RequestMapping; | |||
| //import org.springframework.web.bind.annotation.RequestMethod; | |||
| //import org.springframework.web.bind.annotation.ResponseBody; | |||
| // | |||
| //import domain.refittingFactory.refit.entity.Refit; | |||
| //import domain.refittingFactory.refit.repository.RefitRepository; | |||
| //import domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| //import domain.refittingFactory.refittingCar.entity.Bottle; | |||
| //import domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| //import domain.repository.system.DepartmentRepository; | |||
| //import domain.repository.system.DistrictRepository; | |||
| //import domain.repository.system.Repository; | |||
| //import domain.specialInspection.allquery.repository.BottleRepository; | |||
| // | |||
| ///** | |||
| // * 改装信息查询 | |||
| // * | |||
| // */ | |||
| // | |||
| //@Controller | |||
| //@RequestMapping(value = "qualityRefitinquiry") | |||
| //public class QualityRefitinquiryController { | |||
| // | |||
| // @Resource | |||
| // RefitRepository refitRepository; | |||
| // | |||
| // @Resource | |||
| // Repository repository; | |||
| // | |||
| // @Resource | |||
| // AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| // | |||
| // @Resource | |||
| // BottleRepository bottleRepository; | |||
| // | |||
| // @Resource | |||
| // DepartmentRepository departmentRepository; | |||
| // | |||
| // @Resource | |||
| // DistrictRepository districtRepository; | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "refitinquirys", method = RequestMethod.GET) | |||
| // Pagination getRefitinquirys(Refit vo, Pagination pagination, Context context, String platenum, Integer search_ref, Integer search_refStatus, String start_refitDate, String end_refitDate) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| // pagination.setRows(refitRepository.getQualityRefits(vo, list, pagination, platenum, search_ref, search_refStatus, start_refitDate, end_refitDate)); | |||
| // | |||
| // return pagination; | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| // List<AuthorityDepartment> getRegDepts() { | |||
| // Integer types[] = new Integer[] { 22 }; | |||
| // List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| // return list; | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| // List<Bottle> getBottles(String platenum) { | |||
| // List<Bottle> list = new ArrayList<Bottle>(); | |||
| // if (!StringUtil.isNullOrEmpty(platenum)) { | |||
| // list = bottleRepository.getBottleByPlatenum(platenum); | |||
| // } | |||
| // return list; | |||
| // } | |||
| // | |||
| //} | |||
| @ -0,0 +1,132 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityRfidtagLock; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.RfidTag; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.RfidtagRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="quality/RfidTag") | |||
| public class QualityRfidtagLockController { | |||
| @Resource | |||
| RfidtagRepository rfidtagRepository; | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "RfidTags", method = RequestMethod.GET) | |||
| Pagination getRfidtagUnlock(String start_refitDate,String end_refitDate,String tagtype, | |||
| Integer regDept_id,Integer areaDict_id,Integer cngTypeDict_id, Context context, | |||
| Pagination pagination,String platenum) { | |||
| //得到当前登陆用户的id | |||
| // String userId= context.getPosition().getDepartment().getId(); | |||
| // AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(userId); | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| AreaDict areaDict = new AreaDict(); | |||
| areaDict.setId(areaDict_id); | |||
| CngTypeDict cngTypeDict = new CngTypeDict(); | |||
| cngTypeDict.setId(cngTypeDict_id); | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setPlatenum(platenum); | |||
| car.setAreaDict(areaDict); | |||
| car.setCngTypeDict(cngTypeDict); | |||
| AuthorityDepartment regDept = new AuthorityDepartment(); | |||
| regDept.setId(regDept_id); | |||
| RfidTag bean = new RfidTag(); | |||
| bean.setIsvaild("1"); | |||
| bean.setIscngtag(tagtype); | |||
| bean.setCar(car); | |||
| bean.setRegDept(regDept); | |||
| pagination.setRows(rfidtagRepository.findByRfidTagByCheck( permissionFilter,start_refitDate, end_refitDate, bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(){ | |||
| return carTypeDictRepository.selectAreaDict(); | |||
| } | |||
| /** | |||
| * 得到气瓶信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCngTypeDictAll" , method= RequestMethod.GET) | |||
| List<CngTypeDict> selectcngAll(){ | |||
| return carTypeDictRepository.selectCngTypeDict(); | |||
| } | |||
| /** | |||
| * 得到 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectDeptTypeAll" , method= RequestMethod.GET) | |||
| List<AuthorityDepartment> selectDeptAll(){ | |||
| return carTypeDictRepository.selectRegDept(17); | |||
| } | |||
| //加入黑名单 | |||
| @ResponseBody | |||
| @RequestMapping(value = "RfidTags", method = RequestMethod.PUT) | |||
| RfidTag updateRfidTag(RfidTag rfid){ | |||
| RfidTag bean = repository.get(RfidTag.class, rfid.getId()); | |||
| //黑名单原因 | |||
| bean.setRemark(rfid.getRemark()); | |||
| Date time = new Date(); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(time); | |||
| //更新时间 | |||
| bean.setDateUpdate(startTime); | |||
| bean.setIsvaild("0"); | |||
| return repository.save(bean); | |||
| } | |||
| } | |||
| @ -0,0 +1,84 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.qualityTagQuery; | |||
| //package application.qualityCheck.qualityTagQuery; | |||
| // | |||
| //import infrastructure.spring.web.Context; | |||
| //import infrastructure.support.record.Pagination; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //import javax.annotation.Resource; | |||
| // | |||
| //import org.springframework.stereotype.Controller; | |||
| //import org.springframework.web.bind.annotation.RequestMapping; | |||
| //import org.springframework.web.bind.annotation.RequestMethod; | |||
| //import org.springframework.web.bind.annotation.ResponseBody; | |||
| // | |||
| //import domain.energy.blackcar.repository.RfidtagRepository; | |||
| //import domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| //import domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| //import domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| //import domain.refittingFactory.refittingCar.entity.RfidTagLock; | |||
| //import domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| //import domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| //import domain.repository.system.DepartmentRepository; | |||
| //import domain.repository.system.DistrictRepository; | |||
| // | |||
| //@Controller | |||
| //@RequestMapping(value = "qualityTagQuery") | |||
| //public class QualityTagQueryController { | |||
| // @Resource | |||
| // RfidtagRepository rfidtagRepository; | |||
| // @Resource | |||
| // domain.repository.system.Repository repository; | |||
| // @Resource | |||
| // DepartmentRepository departmentRepository; | |||
| // @Resource | |||
| // CarTypeDictRepository carTypeDictRepository; | |||
| // @Resource | |||
| // AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| // @Resource | |||
| // DistrictRepository districtRepository; | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "rfidtags", method = RequestMethod.GET) | |||
| // Pagination getRfidtagUnlock(String start_refitDate, String end_refitDate, String tagtype, Integer regDept_id, String isvaild, Integer cngTypeDict_id, Context context, Pagination pagination, String platenum) { | |||
| // List<Integer> list = districtRepository.getLoginDistrict(context); | |||
| // // List<Integer> list = | |||
| // // departmentRepository.getLoginerDepartmentType(context); | |||
| // // 得到当前登陆用户的id | |||
| // String userId = context.getPosition().getDepartment().getId(); | |||
| // AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(userId); | |||
| // | |||
| // CngTypeDict cngTypeDict = new CngTypeDict(); | |||
| // cngTypeDict.setId(cngTypeDict_id); | |||
| // | |||
| // CngCdCar car = new CngCdCar(); | |||
| // car.setPlatenum(platenum); | |||
| // car.setCngTypeDict(cngTypeDict); | |||
| // | |||
| // RfidTagLock bean = new RfidTagLock(); | |||
| // bean.setIscngtag(tagtype); | |||
| // bean.setCar(car); | |||
| // bean.setIsvaild(isvaild); | |||
| // bean.setRowState(1); | |||
| // bean.setRegDept(dept); | |||
| // | |||
| // pagination.setRows(rfidtagRepository.findByQualityTagQuery(list,regDept_id, start_refitDate, end_refitDate, bean, pagination)); | |||
| // return pagination; | |||
| // } | |||
| // | |||
| // /** | |||
| // * 得到所属区域信息 | |||
| // */ | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "selectCngTypeDictAll", method = RequestMethod.GET) | |||
| // List<CngTypeDict> selectcngAll() { | |||
| // return carTypeDictRepository.selectCngTypeDict(); | |||
| // } | |||
| // | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "selectDeptTypeAll", method = RequestMethod.GET) | |||
| // List<AuthorityDepartment> selectDeptAll() { | |||
| // return carTypeDictRepository.selectRegDept(17); | |||
| // } | |||
| //} | |||
| @ -0,0 +1,182 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.rfidtagIssueTable; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Order; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasOnlineRepository; | |||
| import com.ciotea.cdcng.front.domain.energy.gstation.repository.GasrangeRepository; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.rfidtagIssue.service.RfidtagIssueTableService; | |||
| import com.ciotea.cdcng.front.domain.qualityCheck.rfidtagIssue.vo.RfidtagIssueVo; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| /** | |||
| * | |||
| * @author luochao | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "rfidtagIssue") | |||
| public class RfidtagIssueTableController { | |||
| @Resource | |||
| GasOnlineRepository gasOnlineRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| GasrangeRepository gasrangeRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| RfidtagIssueTableService rfidtagIssueTableService; | |||
| @Resource | |||
| Repository repository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRfidtagIssue", method = RequestMethod.GET) | |||
| List<List<RfidtagIssueVo>> getRfidtagIssues(Context context,String[] cngType, String[] deptId, String[] areaValue,Integer isOrig,String isvaild, String date_start, String date_end ,String isCngtag) { | |||
| if(StringUtil.isNullOrEmpty(date_start) || StringUtil.isNullOrEmpty(date_end)){ | |||
| throw new AppException("请选择时间"); | |||
| } | |||
| if(cngType==null || cngType.length<1){ | |||
| } | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<RfidtagIssueVo>> listAll = new ArrayList<List<RfidtagIssueVo>>(); | |||
| if(areaValue != null && areaValue.length > 0){ | |||
| for(int i = 0;i < areaValue.length; i++){ | |||
| List<RfidtagIssueVo> list = rfidtagIssueTableService.getRfidtagIssues(permissionFilter,cngType,deptId,areaValue[i],isOrig,isvaild,date_start, date_end, isCngtag); | |||
| listAll.add(list); | |||
| } | |||
| }else{ | |||
| for(int i = 0; i < deptId.length; i++){ | |||
| List<RfidtagIssueVo> list = rfidtagIssueTableService.getRfidtagIssuesDept(permissionFilter,cngType, deptId[i], isOrig,isvaild, date_start, date_end, isCngtag); | |||
| listAll.add(list); | |||
| } | |||
| } | |||
| return listAll; | |||
| } | |||
| //导出电子标签发放统计数据 | |||
| @ResponseBody | |||
| @RequestMapping(value = "exportExcel", method = RequestMethod.GET) | |||
| void exportExcel(Context context,String[] cngType, String[] deptId, String[] areaValue,Integer isOrig,String isvaild, String date_start, String date_end ,String isCngtag,HttpServletRequest req, HttpServletResponse res) throws FileNotFoundException, IOException{ | |||
| List<List<RfidtagIssueVo>> listAll = this.getRfidtagIssues(context, cngType, deptId, areaValue, isOrig,isvaild, date_start, date_end, isCngtag); | |||
| //创建Workbook | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/rfidtagIssueTable/rfidtagIssueTable.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(1); | |||
| for(int i = 0; i <listAll.get(0).size(); i++){ | |||
| tempRow.createCell(i+1).setCellValue(listAll.get(0).get(i).getTypeName()); | |||
| } | |||
| tempRow.createCell(listAll.get(0).size() + 1).setCellValue("合计"); | |||
| for(int i = 0; i < listAll.size(); i++){ | |||
| Row row = sheet.createRow(2 + i); | |||
| row.createCell(0).setCellValue(listAll.get(i).get(0).getAreaName()); | |||
| for(int k = 0;k < listAll.get(i).size(); k++){ | |||
| row.createCell(1 + k).setCellValue(listAll.get(i).get(k).getNum()); | |||
| } | |||
| row.createCell(listAll.get(i).size() + 1).setCellValue(listAll.get(i).get(listAll.get(i).size() - 1).getSum()); | |||
| } | |||
| Row row1 = sheet.createRow(2 + listAll.size()); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| // int[] sum={0,0,0,0,0,0,0,0}; | |||
| int[] sum = new int[listAll.get(0).size()]; | |||
| for(int i = 0; i < listAll.get(0).size(); i++){//行 | |||
| sum[i]=0; | |||
| } | |||
| int count = 0; | |||
| for(int i = 0; i < listAll.size(); i++){ | |||
| count = count + listAll.get(i).get(listAll.get(i).size() - 1).getSum(); | |||
| } | |||
| for(int i = 0; i < listAll.get(0).size(); i++){ | |||
| for(int k = 0; k < listAll.size(); k++){ | |||
| sum[i] = sum[i] + listAll.get(k).get(i).getNum(); | |||
| } | |||
| } | |||
| for(int j = 0; j < listAll.get(0).size(); j++){ | |||
| row1.createCell(j + 1).setCellValue(sum[j]); | |||
| } | |||
| row1.createCell(listAll.get(0).size() + 1).setCellValue(count); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| if(isCngtag.equals("0")){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("车辆电子标签发放统计.xlsx", bytes.length, new Date())); | |||
| }if(isCngtag.equals("1")){ | |||
| ServletUtil.respondFileInfo(res, new FileInfo("气瓶电子标签发放统计.xlsx", bytes.length, new Date())); | |||
| } | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| /** | |||
| * 得到加气属性 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngTypeDict", method = RequestMethod.GET) | |||
| List<CngTypeDict> getCngTypeDicts() { | |||
| // return gasrangeRepository.getCngTypeDict(); | |||
| return repository.getAll(CngTypeDict.class, Order.asc("id")); | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "selectAreaDictAll", method = RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| return carTypeDictRepository.selectByArea(permissionFilter); | |||
| } | |||
| // List<AreaDict> selectAreaDictAll() { | |||
| // return carTypeDictRepository.selectAreaDict(); | |||
| // } | |||
| /** | |||
| * 得到加气站 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "selectDeptTypeAll", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> selectDeptAll() { | |||
| return carTypeDictRepository.selectRegDept(17); | |||
| } | |||
| } | |||
| @ -0,0 +1,166 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.rfidtagUnlock; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.BlacklistCar; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.ModelHandler; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.entity.RfidTag; | |||
| import com.ciotea.cdcng.front.domain.energy.blackcar.repository.RfidtagRepository; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="check/rfidtagUnlock") | |||
| public class RfidtagUnlockController { | |||
| @Resource | |||
| RfidtagRepository rfidtagRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| private LogOperation logOperation; | |||
| @ResponseBody | |||
| @RequestMapping(value = "rfidtagUnlock", method = RequestMethod.GET) | |||
| Pagination getRfidtagUnlock(String start_refitDate,String end_refitDate,String tagtype, | |||
| Integer regDept_id,Integer areaDict_id,Integer cngTypeDict_id, Context context, | |||
| Pagination pagination,String platenum) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| AreaDict areaDict = new AreaDict(); | |||
| areaDict.setId(areaDict_id); | |||
| CngTypeDict cngTypeDict = new CngTypeDict(); | |||
| cngTypeDict.setId(cngTypeDict_id); | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setPlatenum(platenum.trim()); | |||
| car.setAreaDict(areaDict); | |||
| car.setCngTypeDict(cngTypeDict); | |||
| AuthorityDepartment regDept = new AuthorityDepartment(); | |||
| regDept.setId(regDept_id); | |||
| RfidTag bean = new RfidTag(); | |||
| bean.setIsvaild("0"); | |||
| bean.setIscngtag(tagtype); | |||
| bean.setCar(car); | |||
| bean.setRegDept(regDept); | |||
| pagination.setRows(rfidtagRepository.findByRfidTag(start_refitDate, end_refitDate, permissionFilter, bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(){ | |||
| return carTypeDictRepository.selectAreaDict(); | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCngTypeDictAll" , method= RequestMethod.GET) | |||
| List<CngTypeDict> selectcngAll(){ | |||
| return carTypeDictRepository.selectCngTypeDict(); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="selectDeptTypeAll" , method= RequestMethod.GET) | |||
| List<AuthorityDepartment> selectDeptAll(){ | |||
| return carTypeDictRepository.selectRegDept(17); | |||
| } | |||
| //解锁 | |||
| @ResponseBody | |||
| @RequestMapping(value = "rfidtagUnlock", method = RequestMethod.PUT) | |||
| RfidTag updateRfidTag(Integer id, Context context){ | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| if(id==null){ | |||
| throw new AppException("请选择有电子标签的车辆!"); | |||
| } | |||
| RfidTag bean = repository.get(RfidTag.class, id); | |||
| //检验标签是否可以解除 | |||
| if(null != bean.getBottle()){ | |||
| List<RfidTag> list = rfidtagRepository.getRfidTagByBottleId(bean.getBottle().getId(), bean.getIscngtag()); | |||
| if(list.size()>0){ | |||
| throw new AppException("该标签类型的气瓶已有电子标签,本标签不予解除黑名单!"); | |||
| } | |||
| } | |||
| if(!"0".equals(bean.getIsvaild())){ | |||
| throw new AppException("该电子标签处于不可解除黑名单状态"); | |||
| } | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(new Date()); | |||
| //更新时间 | |||
| bean.setDateUpdate(startTime); | |||
| bean.setIsvaild("1"); | |||
| bean.setRemark(""); | |||
| bean.setTouchDept(regDept); | |||
| bean.setTouchUserId(regUser.getId()); | |||
| //车辆黑名单(下发) | |||
| BlacklistCar blacklistCar = new BlacklistCar(); | |||
| blacklistCar.setSyncCode(bean.getSyncCode()); | |||
| blacklistCar.setRegUsername(context.getUser().getName()); | |||
| blacklistCar.setPlateNum(bean.getCar().getPlatenum()); | |||
| blacklistCar.setUid(bean.getCode()); | |||
| // blacklistCar.setRemark(bean.getRemark()); | |||
| blacklistCar.setHandleType(ModelHandler.HANDLE_TYPE_DELETE); | |||
| blacklistCar.setDateJoined(new Date()); | |||
| blacklistCar.setDateUpdate(new Date()); | |||
| blacklistCar.setLockDate(new Date()); | |||
| BlacklistCar blacklistCar2 = repository.save(blacklistCar); | |||
| repository.save(bean); | |||
| logOperation.saveBlacklistcarLog(blacklistCar2, context.getUser().getUsername(), Operations.INSERT, "解除电子标签黑名单"); | |||
| logOperation.saveCngcdRfidtagLog(bean, context.getUser().getUsername(), Operations.UPDATE, "解除电子标签黑名单"); | |||
| return bean; | |||
| } | |||
| } | |||
| @ -0,0 +1,72 @@ | |||
| package com.ciotea.cdcng.front.application.qualityCheck.setupCheckRecord; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.setupCheckRecord.repository.SetupCheckRecordRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DistrictRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.Setupcheck; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "setupCheckRecord") | |||
| public class SetupCheckRecordController { | |||
| @Resource | |||
| SetupCheckRecordRepository setupCheckRecordRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DistrictRepository districtRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| Repository repository; | |||
| // @ResponseBody | |||
| // @RequestMapping(value = "setupCheckRecords", method = RequestMethod.GET) | |||
| // Pagination getBottleRegCertificates(Setupcheck vo, Context context, Pagination pagination, String platenum, String vin, Integer search_ref, String start_date, String end_date, String ownerName) { | |||
| // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| // pagination.setRows(setupCheckRecordRepository.getSetupcheckRecords(vo, permissionFilter, pagination, platenum, vin, search_ref, start_date, end_date, ownerName)); | |||
| // return pagination; | |||
| // } | |||
| @ResponseBody | |||
| @RequestMapping(value = "setupCheckRecords", method = RequestMethod.GET) | |||
| infrastructure.support.records.Pagination getBottleRegCertificates(Setupcheck vo, Context context, infrastructure.support.records.Pagination pagination, String platenum, String vin, Integer search_ref, String start_date, String end_date, String ownerName) { | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(setupCheckRecordRepository.getSetupcheckRecords(vo, permissionFilter, pagination, platenum, vin, search_ref, start_date, end_date, ownerName)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) | |||
| List<AuthorityDepartment> getRegDepts() { | |||
| Integer types[] = new Integer[] {22}; | |||
| List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getSetupById", method = RequestMethod.GET) | |||
| Setupcheck getRefit(Integer id) { | |||
| Setupcheck setupcheck = repository.get(Setupcheck.class, id); | |||
| return setupcheck; | |||
| } | |||
| } | |||
| @ -0,0 +1,79 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.Setupcheck; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.Setupcheck; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.SetupCheckRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| /** | |||
| * 监检查询 | |||
| * @author | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value="change/setupcheck") | |||
| public class SetupcheckChangeController { | |||
| @Resource | |||
| SetupCheckRepository checkRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| /** | |||
| * 查询 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "setupcheck", method = RequestMethod.GET) | |||
| Pagination selectSetupcheck(String platenum,String vin,Integer checkStatus, Pagination pagination,Context context){ | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //得到登陆用户 | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| CngCdCar carBean= new CngCdCar(); | |||
| carBean.setPlatenum(platenum.trim()); | |||
| carBean.setVin(vin.trim()); | |||
| Setupcheck bean = new Setupcheck(); | |||
| bean.setRegDept(regDept); | |||
| bean.setCar(carBean); | |||
| bean.setCheckStatus(checkStatus); | |||
| pagination.setRows(checkRepository.getSetupcheckByCarMybatis(permissionFilter,bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 根据car id 查询气瓶详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCarId",method = RequestMethod.GET) | |||
| Pagination getBottleByCarId(Integer id,Pagination pagination){ | |||
| pagination.setRows(carStrategy.getBottleAll(id, pagination)); | |||
| return pagination; | |||
| } | |||
| } | |||
| @ -0,0 +1,359 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.applied; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.text.DecimalFormat; | |||
| import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.log.LogOperation; | |||
| import com.ciotea.cdcng.front.domain.log.Operations; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.service.AirBottleService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.service.RefitService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.service.CngCdCarService; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.BottleCert; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.Setupcheck; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.BottleCertRepository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.SetupCheckRepository; | |||
| import com.ciotea.cdcng.front.domain.tool.Tool; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value = "change/applied") | |||
| public class AppliedController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| @Resource | |||
| AirBottleService airBottleService; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| BottleCertRepository bottleCertRepository; | |||
| @Resource | |||
| CngCdCarService carService; | |||
| @Resource | |||
| RefitService refitService; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| SetupCheckRepository checkRepository; | |||
| @Resource | |||
| LogOperation logOperation; | |||
| /** | |||
| * 改装申请 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "applieds", method = RequestMethod.GET) | |||
| Pagination getChangeAppliedAll(Refit refit, String platenum, String vin, | |||
| String start_refitDate, String end_refitDate, | |||
| Pagination pagination, Context context) { | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository | |||
| .findByMemo(userId); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter( | |||
| context.getDepartment(), context.getDistrict()); | |||
| CngCdCar car = new CngCdCar(); | |||
| if (regDept != null) { | |||
| car.setRegDept(regDept); | |||
| } | |||
| refit.setCar(car); | |||
| pagination.setRows(refitRepository.getRefitByCarsMybatis(permissionFilter, | |||
| refit, pagination, platenum, vin, start_refitDate, | |||
| end_refitDate)); | |||
| return pagination; | |||
| } | |||
| // 流程单的添加 | |||
| @ResponseBody | |||
| @RequestMapping(value = "applieds", method = RequestMethod.POST) | |||
| BottleCert addBottcert(BottleCert bean, Context context) { | |||
| if (bean.getCar().getId() == null) { | |||
| throw new AppException("请先选择未申请的车辆"); | |||
| } | |||
| SimpleDateFormat sdf = new SimpleDateFormat(" yyyy-MM-dd HH:mm:ss "); | |||
| String str = sdf.format(new Date()); | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository | |||
| .findByMemo(userId); | |||
| CngUser user = authorityDepartmentRepository.findByUser(context | |||
| .getUser().getId()); | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setId(bean.getCar().getId()); | |||
| car.setRegDept(regDept); | |||
| bean.setRowState(0);// 默认是0,特检院那边好获取 | |||
| bean.setDateJoined(str); | |||
| bean.setDateUpdate(str); | |||
| bean.setPrintCount("0");// 打印次数 | |||
| bean.setRegUserId(user.getId()); | |||
| bean.setAuthorityDepartment(regDept); | |||
| bean.setCar(car); | |||
| return airBottleService.addBottcert(bean); | |||
| } | |||
| // 流程单的修改 | |||
| @ResponseBody | |||
| @RequestMapping(value = "applieds", method = RequestMethod.PUT) | |||
| BottleCert updateBottcert(BottleCert bean, Context context) { | |||
| if (bean.getId() == null) { | |||
| throw new AppException("请选择有流程单记录的车辆"); | |||
| } | |||
| BottleCert bo = repository.get(BottleCert.class, bean.getId()); | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository | |||
| .findByMemo(userId); | |||
| CngUser user = authorityDepartmentRepository.findByUser(context | |||
| .getUser().getId()); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String str = sdf.format(new Date()); | |||
| bo.setCode(bean.getCode()); | |||
| bo.setPrintCode(bean.getPrintCode()); | |||
| bo.setIsReplaceBot(bean.getIsReplaceBot()); | |||
| bo.setDate(bean.getDate()); | |||
| bo.setDateUpdate(str); | |||
| bo.setTouchDept(regDept); | |||
| bo.setTouchUserId(user.getId()); | |||
| return airBottleService.updateBottcert(bo); | |||
| } | |||
| // 添加监检合格证编号 | |||
| @ResponseBody | |||
| @RequestMapping(value = "addSetupcheck", method = RequestMethod.POST) | |||
| Setupcheck addSetupcheck(Integer refitStatus, Integer id, Setupcheck bean, | |||
| Context context) { | |||
| if (bean.getCar().getId() == null) { | |||
| throw new AppException("请先选择未申请的车辆"); | |||
| } | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository | |||
| .findByMemo(userId); | |||
| CngUser user = authorityDepartmentRepository.findByUser(context | |||
| .getUser().getId()); | |||
| // refit | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setId(bean.getCar().getId()); | |||
| if (null != regDept) { | |||
| car.setAuthDeptid(regDept); | |||
| } | |||
| bean.setRowState(1); | |||
| bean.setCar(car); | |||
| bean.setCheckStatus(0); | |||
| bean.setPrintCount(0);// 打印次数 | |||
| bean.setDateJoined(new Date()); | |||
| bean.setDateUpdate(new Date()); | |||
| bean.setRegDept(regDept); | |||
| bean.setRegUserd(user.getId()); | |||
| bean.setTouchDept(regDept); | |||
| bean.setTouchUser(user.getId()); | |||
| return airBottleService.addSetupcheck(bean); | |||
| } | |||
| // 修改监检合格证编号 | |||
| @ResponseBody | |||
| @RequestMapping(value = "updateSetupcheck", method = RequestMethod.PUT) | |||
| Setupcheck updateSetupcheck(Setupcheck setupcheck, Context context) { | |||
| if (setupcheck.getId() == null) { | |||
| throw new AppException("请选择有监检合格证编号的车辆"); | |||
| } | |||
| Setupcheck bean = repository.get(Setupcheck.class, setupcheck.getId()); | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository | |||
| .findByMemo(userId); | |||
| CngUser user = authorityDepartmentRepository.findByUser(context | |||
| .getUser().getId()); | |||
| CngCdCar car = new CngCdCar(); | |||
| car.setId(bean.getCar().getId()); | |||
| if (null != regDept) { | |||
| car.setAuthDeptid(regDept); | |||
| } | |||
| bean.setRowState(1); | |||
| bean.setDateUpdate(new Date()); | |||
| bean.setTouchDept(regDept); | |||
| bean.setTouchUser(user.getId()); | |||
| bean.setSetupCode(setupcheck.getSetupCode()); | |||
| bean.setCar(car); | |||
| return airBottleService.updateSetupcheck(bean); | |||
| } | |||
| // 申请 | |||
| @ResponseBody | |||
| @RequestMapping(value = "changeApplieds", method = RequestMethod.PUT) | |||
| void applieds(Integer id, Context context) { | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| Refit refit = repository.get(Refit.class, id); | |||
| CngUser user = authorityDepartmentRepository.findByUser(context.getUser().getId()); | |||
| if (refit != null) { | |||
| if (refit.getCar() != null) { | |||
| CngCdCar car = repository.get(CngCdCar.class, refit.getCar().getId()); | |||
| if (refit.getCar().getRefitState() != 5 && refit.getCar().getRefitState() != 7) { | |||
| if (refit.getRefitStatus() != 1 && refit.getRefitStatus() != 4 && refit.getRefitStatus() != 6 && refit.getRefitStatus() != -1) { | |||
| throw new AppException("该改装信息处于不可申请状态。"); | |||
| } | |||
| refit.setRefitStatus(2); | |||
| SimpleDateFormat sdf = new SimpleDateFormat( | |||
| "yyyy-MM-dd HH:mm:ss"); | |||
| String str = sdf.format(new Date()); | |||
| refit.setDateUpdate(str); | |||
| refit.setTouchDeptId(regDept.getId()); | |||
| refit.setTouchUserId(user.getId()); | |||
| // 已经经过汽车处审核不需要再进行审核,直接通过 | |||
| if (car.getIsPassRefit() != null && car.getIsPassRefit() == 1) { | |||
| refit.setRefitStatus(5); | |||
| } | |||
| repository.save(refit); | |||
| logOperation.saveCngcdRefitLog(refit, context.getUser().getUsername(), Operations.UPDATE, "改装申请时,修改状态"); | |||
| car.setCarState(2); | |||
| car.setRefitState(2); | |||
| car.setDateUpdate(new Date()); | |||
| car.setCngUser(user); | |||
| car.setAuthDeptid(regDept); | |||
| // 已经经过汽车处审核不需要再进行审核,直接通过 | |||
| if (car.getIsPassRefit() != null && car.getIsPassRefit() == 1) { | |||
| car.setRefitState(5); | |||
| } | |||
| repository.save(car); | |||
| logOperation.saveCngcdCarLog(car, context.getUser().getUsername(), Operations.UPDATE, "改装申请时,修改车辆状态、改装状态"); | |||
| } else { | |||
| car.setCheck_state(0); | |||
| car.setCngUser(user); | |||
| car.setAuthDeptid(regDept); | |||
| repository.save(car); | |||
| logOperation.saveCngcdCarLog(car, context.getUser().getUsername(), Operations.UPDATE, "改装申请时,修改检验状态为0"); | |||
| } | |||
| List<Setupcheck> check = checkRepository.getSetupcheckByCar(car.getId()); | |||
| if (check.size() > 0) { | |||
| if (check.get(0).getSetupCode() != "") { | |||
| Setupcheck setup = repository.get(Setupcheck.class, check.get(0).getId()); | |||
| setup.setSetupCode(check.get(0).getSetupCode()); | |||
| setup.setDateUpdate(new Date()); | |||
| setup.setTouchDept(regDept); | |||
| setup.setTouchUser(user.getId()); | |||
| repository.save(setup); | |||
| logOperation.saveSetupcheckLog(setup, context.getUser().getUsername(), Operations.UPDATE, "修改监检合格证编号"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 根据carid查询监检 | |||
| * | |||
| * @param carid | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getSetupCheckList", method = RequestMethod.GET) | |||
| List<Setupcheck> getSetupCheckList(Integer carid) { | |||
| return checkRepository.getSetupcheckByCar(carid); | |||
| } | |||
| // 根据carid得到bottle | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBottleCar", method = RequestMethod.GET) | |||
| List<Bottle> getBottleCar(Integer id) { | |||
| return airBottleRepository.findBottleByCar(id); | |||
| } | |||
| // 根据carid得到BottleCert | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBottleCertBycar", method = RequestMethod.GET) | |||
| BottleCert getBottleCertBycar(Integer id) { | |||
| return bottleCertRepository.getbottleCertByCar(id); | |||
| } | |||
| // 根据carid得到Setupcheck | |||
| @ResponseBody | |||
| @RequestMapping(value = "getSetupcheckBycar", method = RequestMethod.GET) | |||
| Setupcheck getSetupcheckBycar(Integer id) { | |||
| return airBottleRepository.getSetupcheck(id); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getBottCertByCarList", method = RequestMethod.GET) | |||
| List<BottleCert> getbottCertByCar(Integer carid) { | |||
| return bottleCertRepository.getBottCertByCarList(carid); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getMaxCode", method = RequestMethod.GET) | |||
| Map<String, String> getMaxCode(Context context) { | |||
| Map<String, String> map = new HashMap<String, String>(); | |||
| String code = ""; | |||
| Calendar calendar = Calendar.getInstance(); | |||
| int year = calendar.get(Calendar.YEAR); | |||
| AuthorityDepartment dept = authorityDepartmentRepository.findByMemo(context.getDepartment().getId()); | |||
| if (dept == null || dept.getDeptCode() == null) { | |||
| throw new AppException("没有该部门信息或者没有该部门单号Code,请联系维护人员"); | |||
| } | |||
| List<Setupcheck> list = checkRepository.getDeptCodeList("GCN" + dept.getDeptCode() + year); | |||
| // List<Integer> subList = new ArrayList<Integer>(); | |||
| String num = "00001"; | |||
| NumberFormat nf = new DecimalFormat("00000"); | |||
| if (list != null && !list.isEmpty()) { | |||
| String str = list.get(0).getSetupCode(); | |||
| if (str != null && str.length() >= 15) { | |||
| String subStr = str.substring(10, 15); | |||
| if (Tool.isNum(subStr)) { | |||
| Integer temp = Integer.parseInt(subStr) + 1; | |||
| num = nf.format(temp); | |||
| } | |||
| } | |||
| // for(Setupcheck setup : list){ | |||
| // if(setup.getSetupCode()!=null && setup.getSetupCode().length() >=15){ | |||
| // String str = setup.getSetupCode().substring(0,10); | |||
| // if(Tool.isNum(str)){ | |||
| // subList.add(Integer.parseInt(str)); | |||
| // } | |||
| // } | |||
| // } | |||
| } | |||
| code = "GCN" + dept.getDeptCode() + year + num; | |||
| map.put("code", code); | |||
| return map; | |||
| } | |||
| } | |||
| @ -0,0 +1,223 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.bottle; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.service.AirBottleService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.entity.Vender; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.bottlegroup.entity.BottType; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value="bottle/bottle") | |||
| public class AirBottleController{ | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| AirBottleRepository bottleRepository; | |||
| @Resource | |||
| AirBottleService airBottleService; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| /** | |||
| * 查询气瓶登记 | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottles", method = RequestMethod.GET) | |||
| Pagination refitPlatenum(String platenum,String vin,Integer refitState,Pagination pagination,Context context){ | |||
| CngCdCar bean = new CngCdCar(); | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| bean.setRegDept(regDept); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| bean.setRowState(1); | |||
| bean.setPlatenum(platenum.trim()); | |||
| bean.setRefitState(refitState); | |||
| bean.setVin(vin.trim()); | |||
| pagination.setRows(bottleRepository.selectBottleByMybatis(permissionFilter,bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 添加 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.POST) | |||
| void addBottle(Bottle bean, Context context){ | |||
| String daptId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(daptId); | |||
| String userId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(userId); | |||
| if(bean.getCar().getId() == null){ | |||
| throw new AppException("请选择车辆!"); | |||
| } | |||
| bean.setRegUser(regUser.getId()); | |||
| bean.setRegDept(regDept); | |||
| CngCdCar car = repository.get(CngCdCar.class, bean.getCar().getId()); | |||
| if(car.getCarState() != 1 && (car.getCarState() != 2 && car.getRefitState() != -1)){ | |||
| throw new AppException("该车辆处于不可添加气瓶状态。"); | |||
| } | |||
| // 驳回状态(特检院驳回的原因为更换气瓶,则改装厂修改气瓶信息后可以重新进行改装申请) | |||
| if(car.getRefitState() == -1) { | |||
| Refit refit = refitRepository.getRefitByCarId(car.getId()); | |||
| if(refit != null && refit.getRefitStatus() == -1) { | |||
| if(refit.getOverruleMsg().equals("更换气瓶")) { | |||
| car.setCarState(1); | |||
| car.setRefitState(1); | |||
| refit.setRefitStatus(1); | |||
| repository.save(car); | |||
| repository.save(refit); | |||
| } | |||
| } | |||
| } | |||
| if("1".equals(car.getIsorig()) || "2".equals(car.getIsorig())){ | |||
| car.setCheck_state(5); | |||
| } | |||
| int getBottleNum = car.getBottleNum() + 1; | |||
| car.setBottleNum(getBottleNum); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(new Date()); | |||
| bean.setDateJoined(startTime); | |||
| bean.setDateUpdate(startTime); | |||
| bean.setCar(car); | |||
| bean.setRowState(1); | |||
| //气瓶状态(默认为初始状态) | |||
| bean.setBottState(1); | |||
| airBottleService.addBottle(bean); | |||
| } | |||
| /** | |||
| * 修改 | |||
| * @param bean | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottles",method = RequestMethod.PUT) | |||
| Bottle updateBottle(Bottle bean,Context context){ | |||
| if(bean.getId()==null){ | |||
| throw new AppException("请先选择气瓶!"); | |||
| } | |||
| Bottle bo = repository.get(Bottle.class, bean.getId()); | |||
| if(bo.getCar().getCarState()!=1 && (bo.getCar().getCarState()!=2 && bo.getCar().getRefitState()!=-1)){ | |||
| throw new AppException("该车辆处于不可修改状态。"); | |||
| } | |||
| String daptId=context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(daptId); | |||
| //得到用户 | |||
| String userId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(userId); | |||
| Date time = new Date(); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(time); | |||
| if(null!=regUser.getId()){ | |||
| bo.setTouchUserId(regUser.getId()); | |||
| } | |||
| if(null!=regDept){ | |||
| bo.setTouchDeptId(regDept.getId()); | |||
| } | |||
| CngCdCar car = repository.get(CngCdCar.class, bean.getCar().getId()); | |||
| // 驳回状态(特检院驳回的原因为更换气瓶,则改装厂修改气瓶信息后可以重新进行改装申请) | |||
| if(car.getRefitState() == -1) { | |||
| Refit refit = refitRepository.getRefitByCarId(car.getId()); | |||
| if(refit != null && refit.getRefitStatus() == -1) { | |||
| if(refit.getOverruleMsg().equals("更换气瓶")) { | |||
| car.setCarState(1); | |||
| car.setRefitState(1); | |||
| refit.setRefitStatus(1); | |||
| repository.save(car); | |||
| repository.save(refit); | |||
| } | |||
| } | |||
| } | |||
| bo.setBottCode(bean.getBottCode()); | |||
| bo.setBottType(bean.getBottType()); | |||
| bo.setBottModel(bean.getBottModel()); | |||
| bo.setBottMaterial(bean.getBottMaterial()); | |||
| bo.setWeight(bean.getWeight()); | |||
| bo.setCapacity(bean.getCapacity()); | |||
| bo.setWaterPress(bean.getWaterPress()); | |||
| bo.setWorkPress(bean.getWorkPress()); | |||
| bo.setRatedFillCount(bean.getRatedFillCount()); | |||
| bo.setMadeVenderd(bean.getMadeVenderd()); | |||
| bo.setMadeDate(bean.getMadeDate()); | |||
| bo.setValidYear(bean.getValidYear()); | |||
| bo.setInstallDate(bean.getInstallDate()); | |||
| bo.setDateUpdate(startTime); | |||
| return airBottleService.updateBottle(bo); | |||
| } | |||
| /** | |||
| * 得到气瓶类型 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectBottTypeAll", method = RequestMethod.GET) | |||
| List<BottType> selectAll(){ | |||
| return bottleRepository.selectBottTypeAll(); | |||
| } | |||
| /** | |||
| * 得到生产厂家 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectVenderAll", method = RequestMethod.GET) | |||
| List<Vender> selectVenderAll(){ | |||
| return bottleRepository.selectVenderAll(); | |||
| } | |||
| //删除 | |||
| @ResponseBody | |||
| @RequestMapping(value = "deleteBottles", method = RequestMethod.PUT) | |||
| void removeCngCdCar(Integer ids, Context context){ | |||
| if(ids==null){ | |||
| throw new AppException("请先选择气瓶!"); | |||
| } | |||
| airBottleService.removeBottle(ids, context); | |||
| } | |||
| } | |||
| @ -0,0 +1,130 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.maintenance; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.carPremises.maintainRecord.entity.MaintainRecord; | |||
| import com.ciotea.cdcng.front.domain.carPremises.maintainRecord.repository.MaintainRecordRepository; | |||
| import com.ciotea.cdcng.front.domain.carPremises.maintainRecord.service.MaintainRecordService; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.specialInspection.allquery.repository.BottleRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| /** | |||
| * 维护登记 | |||
| * | |||
| */ | |||
| @Controller | |||
| @RequestMapping(value = "maintenance") | |||
| public class MaintenanceController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| BottleRepository bottleRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| MaintainRecordRepository maintainRecordRepository; | |||
| @Resource | |||
| MaintainRecordService maintainRecordService; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value = "maintenances", method = RequestMethod.GET) | |||
| Pagination getMaintenances(CngCdCar vo, Context context, Pagination pagination) { | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| pagination.setRows(carStrategy.getMaintenances(vo, permissionFilter, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "maintenance", method = RequestMethod.POST) | |||
| void pass(MaintainRecord maintainRecord, Context context) { | |||
| CngCdCar cngCdCar = repository.get(CngCdCar.class, maintainRecord.getCar().getId()); | |||
| if(cngCdCar.getCarState()!=5){ | |||
| throw new AppException("该车辆处于不可添加维护状态。"); | |||
| } | |||
| Refit refit = refitRepository.getRefitAllCar(cngCdCar.getId()); | |||
| CngUser cngUser = cngUserRepository.findBySysUserId(context.getUser().getId()); | |||
| if (null != cngUser) { | |||
| maintainRecord.setRegUserId(cngUser.getId()); | |||
| } | |||
| if (null != context.getPosition().getDepartment()) { | |||
| maintainRecord.setRegDept(authorityDepartmentRepository.findByMemo(context.getPosition().getDepartment().getId())); | |||
| } | |||
| if (null != refit) { | |||
| maintainRecord.setRefitNum(refit.getRefitNum()); | |||
| } else { | |||
| maintainRecord.setRefitNum(null); | |||
| } | |||
| maintainRecord.setRowState(1); | |||
| maintainRecord.setDateJoined(new Date()); | |||
| maintainRecord.setDateUpdate(new Date()); | |||
| maintainRecord.setCar(cngCdCar); | |||
| maintainRecordService.addMaintainRecord(maintainRecord); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "bottles", method = RequestMethod.GET) | |||
| List<Bottle> getBottles(String platenum) { | |||
| List<Bottle> list = new ArrayList<Bottle>(); | |||
| if (!StringUtil.isNullOrEmpty(platenum)) { | |||
| list = bottleRepository.getBottleByPlatenum(platenum); | |||
| } | |||
| return list; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "maintenanceRecords", method = RequestMethod.GET) | |||
| List<MaintainRecord> getMaintenanceRecords(Integer id) { | |||
| List<MaintainRecord> list = new ArrayList<MaintainRecord>(); | |||
| if (null != id) { | |||
| list = maintainRecordRepository.getMaintainRecords(id); | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| @ -0,0 +1,142 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.print; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.vo.BottleView; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.service.RefitService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value="change/print") | |||
| public class ChangePrintController { | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| @Resource | |||
| RefitService refitService; | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| /** | |||
| * 查询 | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="prints", method = RequestMethod.GET) | |||
| Pagination refitPlatenum(Refit refit,String platenum,String vin,Pagination pagination,Context context){ | |||
| CngCdCar bean = new CngCdCar(); | |||
| //得到当前登陆用户的id | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| bean.setRowState(1); | |||
| //审核通过 | |||
| bean.setRefitState(5); | |||
| if(regDept!=null){ | |||
| bean.setRegDept(regDept); | |||
| refit.setCar(bean); | |||
| } | |||
| pagination.setRows(refitRepository.getRefitPrintMybatis(permissionFilter,refit, pagination, platenum, vin)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 汽车处信息打印 | |||
| * @param refit | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="car/prints", method = RequestMethod.GET) | |||
| Pagination refitPlatenumCar(Refit refit,String platenum,String vin,Pagination pagination,Context context){ | |||
| CngCdCar bean = new CngCdCar(); | |||
| //得到当前登陆用户的id | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| bean.setRowState(1); | |||
| //审核通过 | |||
| bean.setRefitState(5); | |||
| if(regDept!=null){ | |||
| bean.setRegDept(regDept); | |||
| refit.setCar(bean); | |||
| } | |||
| pagination.setRows(refitRepository.getRefitPrintMybatis(permissionFilter,refit, pagination, platenum, vin)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 修改打印次数 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="updateRefitCarCount", method = RequestMethod.PUT) | |||
| Refit updateRefitCar(Integer id, Context context){ | |||
| Refit refit = repository.get(Refit.class, id); | |||
| Integer printCount = Integer.parseInt(refit.getPrintCount()) + 1; | |||
| String print = String.valueOf(printCount); | |||
| refit.setPrintCount(print);; | |||
| return refitService.updateRefitCount(refit, context); | |||
| } | |||
| /** | |||
| * 得到气瓶 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="bottle", method = RequestMethod.GET) | |||
| List<BottleView> getbottleByCar(Integer carid){ | |||
| return airBottleRepository.getBottlesByCarMybatis(carid); | |||
| } | |||
| /** | |||
| * 汽车处得到气瓶 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="car/bottle", method = RequestMethod.GET) | |||
| List<BottleView> getbottle(Integer carid){ | |||
| return airBottleRepository.getBottlesByCarMybatis(carid); | |||
| } | |||
| } | |||
| @ -0,0 +1,211 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.refit; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.DeviceDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.RefitNormDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.CarManageImportRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.DeviceRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.service.RefitService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.service.CngCdCarService; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="refit/refit") | |||
| public class RefitController { | |||
| @Resource | |||
| com.ciotea.cdcng.front.domain.repository.system.Repository repository; | |||
| @Resource | |||
| RefitService refitService; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| CngCdCarService carService; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| DeviceRepository deviceRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarManageImportRepository carManageImportRepository; | |||
| /** | |||
| * | |||
| * 添加 | |||
| * @param cngcdcarBean | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "refitCar", method = RequestMethod.POST) | |||
| Refit addCngCdCar(Refit vo,Context context){ | |||
| if(vo.getCar().getId()==null){ | |||
| throw new AppException("请先选择车辆!"); | |||
| } | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| vo.setRowState(1); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(new Date()); | |||
| vo.setDateUpdate(startTime); | |||
| vo.setDateJoined(startTime); | |||
| vo.setRegDept(regDept); | |||
| vo.setRefitStatus(1); | |||
| vo.setPrintCount("0"); | |||
| vo.setRegUserId(regUser.getId()); | |||
| return refitService.addRefit(vo); | |||
| } | |||
| /** | |||
| * 修改 | |||
| * @param bean | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="refitCar",method = RequestMethod.PUT) | |||
| Refit updateCngCdCar(Refit bean,Context context){ | |||
| if(bean.getId()==null){ | |||
| throw new AppException("请选择有改装记录的车辆!"); | |||
| } | |||
| Refit refit = repository.get(Refit.class, bean.getId()); | |||
| if(refit.getRefitStatus()==2){ | |||
| throw new AppException("该改装证处于不可编辑状态。"); | |||
| } | |||
| if(refit.getRefitStatus()==5 || refit.getRefitStatus()==7){ | |||
| throw new AppException("该车辆处于不可编辑状态。"); | |||
| } | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| String startTime = sdf.format(new Date()); | |||
| refit.setRefitNum(bean.getRefitNum()); | |||
| refit.setNorm(bean.getNorm()); | |||
| refit.setSetupDate(bean.getSetupDate()); | |||
| refit.setDeviceCode(bean.getDeviceCode()); | |||
| refit.setDeviceVendor(bean.getDeviceVendor()); | |||
| refit.setDeviceModel(bean.getDeviceModel()); | |||
| refit.setRefitMsg(bean.getRefitMsg()); | |||
| refit.setCheckMsg(bean.getCheckMsg()); | |||
| refit.setRefiter(bean.getRefiter()); | |||
| refit.setChecker(bean.getChecker()); | |||
| refit.setLeader(bean.getLeader()); | |||
| refit.setLeadMsg(bean.getLeadMsg()); | |||
| refit.setRefitDate(bean.getRefitDate()); | |||
| refit.setDateUpdate(startTime); | |||
| refit.setTouchDeptId(regDept.getId()); | |||
| refit.setTouchUserId(regUser.getId()); | |||
| return refitService.updateRefit(refit); | |||
| } | |||
| /** | |||
| * 查询改装登记 | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="refitCar", method = RequestMethod.GET) | |||
| Pagination refitPlatenum(String platenum,String vin,Integer refitState,Pagination pagination, Context context){ | |||
| CngCdCar bean = new CngCdCar(); | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| bean.setRowState(1); | |||
| bean.setRegDept(regDept); | |||
| bean.setPlatenum(platenum.trim()); | |||
| bean.setVin(vin.trim()); | |||
| bean.setRefitState(refitState); | |||
| pagination.setRows(carStrategy.getCngCdCarPlatenumMybatis(permissionFilter,bean, pagination)); | |||
| // pagination.setRows(refitRepository.selectRefitBy(permissionFilter,bean, pagination)); | |||
| return pagination; | |||
| } | |||
| //根据carid查询改装信息 | |||
| @ResponseBody | |||
| @RequestMapping(value="refitCarId", method = RequestMethod.GET) | |||
| List<Refit> refitCarId(Integer id){ | |||
| return refitRepository.getRefitAll(id); | |||
| } | |||
| /** | |||
| * 根据car id 查询气瓶详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCarId",method = RequestMethod.GET) | |||
| Pagination getBottleByCarId(Integer id, Pagination pagination){ | |||
| pagination.setRows(carStrategy.getBottleAll(id, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 查询专用装置生产企业 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectDeviceDictAll" ,method = RequestMethod.GET) | |||
| List<DeviceDict> selectDeviceDictAll(){ | |||
| return deviceRepository.getDevoceAll(); | |||
| } | |||
| /** | |||
| * 执行标准 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectNormAll" ,method = RequestMethod.GET) | |||
| List<RefitNormDict> selectNormAll(){ | |||
| return deviceRepository.getNormAll(); | |||
| } | |||
| /** | |||
| * 删除 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "deleteRefitCar", method = RequestMethod.PUT) | |||
| void removeCngCdCar(Integer ids, Context context){ | |||
| if(ids==null){ | |||
| throw new AppException("请选择有改装记录的车辆!"); | |||
| } | |||
| refitService.removeRefit(ids, context); | |||
| } | |||
| } | |||
| @ -0,0 +1,204 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.refitByCar; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.vo.RefitView; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CarTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.WorkingTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value="change/refitByCar") | |||
| public class RefitByCarController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| /** | |||
| * 查询 | |||
| * @param start_refitDate | |||
| * @param end_refitDate | |||
| * @param platenum | |||
| * @param vin | |||
| * @param carTypeDict | |||
| * @param workingTypeDict | |||
| * @param pagination | |||
| * @param context | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getRefitByCar", method = RequestMethod.GET) | |||
| Pagination getRefitByCar(String start_refitDate, String end_refitDate,String platenum,String vin, | |||
| Integer carTypeDict,Integer workingTypeDict, Pagination pagination,Context context){ | |||
| // List<Integer> list = departmentRepository.getLoginerDepartmentType(context); | |||
| if(context.getUser().getUsername().equals("cngpublic")){ | |||
| pagination.setRows(refitRepository.publicRefitCar(platenum, vin)); | |||
| }else{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| Refit bean = new Refit(); | |||
| bean.setRegDept(regDept); | |||
| // pagination.setRows(refitRepository.getRefitCar(permissionFilter,bean, platenum, vin, carTypeDict, workingTypeDict, pagination,start_refitDate,end_refitDate)); | |||
| pagination.setRows(refitRepository.getRefitByCarsMybatis(permissionFilter, bean, pagination, platenum, vin, start_refitDate, end_refitDate)); | |||
| } | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 导出excel表格 | |||
| * @param start_refitDate | |||
| * @param end_refitDate | |||
| * @param platenum | |||
| * @param vin | |||
| * @param carTypeDict | |||
| * @param workingTypeDict | |||
| * @param pagination | |||
| * @param context | |||
| * @throws Exception | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="refitByCarExcel", method = RequestMethod.GET) | |||
| public void exportExcel(String start_refitDate, String end_refitDate,String platenum,String vin, | |||
| Integer carTypeDict,Integer workingTypeDict, Pagination pagination,Context context, | |||
| HttpServletRequest req, HttpServletResponse res)throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| Refit bean = new Refit(); | |||
| bean.setRegDept(regDept); | |||
| // List<RefitView> list= refitRepository.getRefitByCars(permissionFilter,bean, platenum, vin, | |||
| // carTypeDict, workingTypeDict, pagination,start_refitDate,end_refitDate); | |||
| List<RefitView> list = refitRepository.getRefitByCarsMybatis(permissionFilter, bean, null, platenum, vin, start_refitDate, end_refitDate); | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/CarAndBottleTatle/CarAndBottleTatle.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| tempRow.createCell(0).setCellValue("车牌号"); | |||
| tempRow.createCell(1).setCellValue("车架号"); | |||
| tempRow.createCell(2).setCellValue("发动机号"); | |||
| tempRow.createCell(3).setCellValue("使用性质"); | |||
| tempRow.createCell(4).setCellValue("车辆类型"); | |||
| tempRow.createCell(5).setCellValue("车主名称"); | |||
| tempRow.createCell(6).setCellValue("联系方式"); | |||
| tempRow.createCell(7).setCellValue("地址"); | |||
| tempRow.createCell(8).setCellValue("改装证编号"); | |||
| tempRow.createCell(9).setCellValue("改装日期"); | |||
| if(null!=list && list.size()>0){ | |||
| for(int i=0;i<list.size();i++){ | |||
| Row row = sheet.createRow(i+1); | |||
| row.createCell(0).setCellValue(list.get(i).getPlatenum()); | |||
| row.createCell(1).setCellValue(list.get(i).getCarVin()); | |||
| row.createCell(2).setCellValue(list.get(i).getEngineid()); | |||
| row.createCell(3).setCellValue(list.get(i).getWorkTypeName()); | |||
| row.createCell(4).setCellValue(list.get(i).getCarTypeDictName()); | |||
| row.createCell(5).setCellValue(list.get(i).getOwnerName()); | |||
| row.createCell(6).setCellValue(list.get(i).getOwnerMobile()); | |||
| row.createCell(7).setCellValue(list.get(i).getOwnerAddress()); | |||
| row.createCell(8).setCellValue(list.get(i).getRefitNum()); | |||
| if(null!=list.get(i).getRefitDate()){ | |||
| row.createCell(9).setCellValue(list.get(i).getRefitDate()!=null?(list.get(i).getRefitDate()).substring(0, 10):""); | |||
| } | |||
| } | |||
| } | |||
| Pagination tal = this.getRefitByCar(start_refitDate, end_refitDate, platenum, vin, carTypeDict, workingTypeDict, pagination, context); | |||
| Row row1 = sheet.createRow(list.size()+1); | |||
| row1.createCell(0).setCellValue("合计"); | |||
| row1.createCell(1).setCellValue(tal.getTotal()); | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("改装车辆信息查询.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| /** | |||
| * 得到所有的车辆类型 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCarTypeDictAll", method = RequestMethod.GET) | |||
| List<CarTypeDict> selectAll(){ | |||
| return carTypeDictRepository.selectAll(); | |||
| } | |||
| /** | |||
| * 得到使用性质 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectWorkingTypeDictAll",method=RequestMethod.GET) | |||
| List<WorkingTypeDict> selectWorkingTypeDictAll(){ | |||
| return carTypeDictRepository.selectWorkingTypeDict(); | |||
| } | |||
| /** | |||
| * 根据car id 查询气瓶详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCarId",method = RequestMethod.GET) | |||
| Pagination getBottleByCarId(Integer id,Pagination pagination){ | |||
| pagination.setRows(carStrategy.getBottleAll(id, pagination)); | |||
| return pagination; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="getCarById", method = RequestMethod.GET) | |||
| CngCdCar getCarById(Integer id){ | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| } | |||
| @ -0,0 +1,41 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.refitByCarHome; | |||
| import infrastructure.support.exception.AppException; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refitByCarHome.repository.refitByCarHomeRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refitByCarHome.vo.refitByCarHomeVo; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| @Controller | |||
| @RequestMapping(value="refitByCarHome") | |||
| public class RefitByCarHomeController { | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| refitByCarHomeRepository refitByCarHomeRepository; | |||
| @ResponseBody | |||
| @RequestMapping(value="refitByCarHome", method = RequestMethod.GET) | |||
| List<List<refitByCarHomeVo>> getRefitByCarHome(String date_start,String date_end,Context context){ | |||
| if((""!=null && date_start.length()>0 && (date_end==null || date_end.length()<1)) | |||
| || (""!=date_end && date_end.length()>0 && (date_start==null || date_start.length()<1))){ | |||
| throw new AppException("请选择完整的起始日期"); | |||
| } | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| List<List<refitByCarHomeVo>> resList = refitByCarHomeRepository.getRefitByCarHomes(date_start, date_end, permissionFilter); | |||
| return resList; | |||
| } | |||
| } | |||
| @ -0,0 +1,500 @@ | |||
| package com.ciotea.cdcng.front.application.refittingFactory.refittingCar; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.InputStream; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Properties; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.ss.usermodel.Sheet; | |||
| import org.apache.poi.ss.usermodel.Workbook; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.entity.system.CngUser; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.bottle.repository.AirBottleRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.entity.Refit; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refit.repository.RefitRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AreaDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.AuthorityDepartment; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CarTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.FuelTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.ModelDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Owner; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.PlateTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.WorkingTypeDict; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.AuthorityDepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CarTypeDictRepository; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.repository.CngCdCarStrategy; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.service.CngCdCarService; | |||
| import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.vo.ModelDictVo; | |||
| import com.ciotea.cdcng.front.domain.repository.system.CngUserRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.DepartmentRepository; | |||
| import com.ciotea.cdcng.front.domain.repository.system.Repository; | |||
| import com.ciotea.cdcng.front.domain.trafficCommittee.repository.CarImportRepository; | |||
| import com.ciotea.cdcng.front.domain.user.vo.PermissionFilter; | |||
| import com.ciotea.cdcng.front.infrastructure.filestore.FileInfo; | |||
| import com.ciotea.cdcng.front.infrastructure.spring.web.Context; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| @Controller | |||
| @RequestMapping(value="changeManage/cngCdCarTank") | |||
| public class CngCdCarController { | |||
| @Resource | |||
| Repository repository; | |||
| @Resource | |||
| CngCdCarStrategy carStrategy; | |||
| @Resource | |||
| CngCdCarService cngCdCarService; | |||
| @Resource | |||
| CarTypeDictRepository carTypeDictRepository; | |||
| @Resource | |||
| RefitRepository refitRepository; | |||
| @Resource | |||
| AuthorityDepartmentRepository authorityDepartmentRepository; | |||
| @Resource | |||
| DepartmentRepository departmentRepository; | |||
| @Resource | |||
| CngUserRepository cngUserRepository; | |||
| @Resource | |||
| CarImportRepository carImportRepository; | |||
| @Resource | |||
| AirBottleRepository airBottleRepository; | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| /** | |||
| * 添加 | |||
| * @param cngcdcarBean | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "getCngCdCarBy", method = RequestMethod.POST) | |||
| void addCngCdCar(CngCdCar cngcdcarBean,Context context){ | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser regUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| cngcdcarBean.setRegUser(regUser); | |||
| cngcdcarBean.setCngUser(regUser); | |||
| cngcdcarBean.setRegDept(regDept); | |||
| //默认为改装车 | |||
| cngcdcarBean.setIsorig("0"); | |||
| //设置车辆状态(登记车辆/准备就绪) | |||
| cngcdcarBean.setCarState(1); | |||
| String str = sdf.format(new Date()); | |||
| cngcdcarBean.setDateJoined(str); | |||
| cngcdcarBean.setDateUpdate(new Date()); | |||
| cngcdcarBean.setRefitState(0); | |||
| cngcdcarBean.setCheck_state(0); | |||
| if("".equals(cngcdcarBean.getMadeDate())){ | |||
| cngcdcarBean.setMadeDate(null); | |||
| } | |||
| if("".equals(cngcdcarBean.getNextCheckDate())){ | |||
| cngcdcarBean.setNextCheckDate(null); | |||
| } | |||
| if("2".equals(cngcdcarBean.getRegisteType())){ | |||
| cngcdcarBean.setIsorigtype("2"); | |||
| } | |||
| if("1".equals(cngcdcarBean.getRegisteType())){ | |||
| cngcdcarBean.setIsMakeQRCode(0); | |||
| }else{ | |||
| cngcdcarBean.setIsMakeQRCode(1); | |||
| } | |||
| cngcdcarBean.setRfidNum(0); | |||
| cngcdcarBean.setRfided(0); | |||
| cngcdcarBean.setRowState(1); | |||
| //设置气瓶个数为0个 | |||
| cngcdcarBean.setBottleNum(0); | |||
| cngCdCarService.addCngCdCar(cngcdcarBean); | |||
| } | |||
| /** | |||
| * 修改 | |||
| * @param bean | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getCngCdCarBy",method = RequestMethod.PUT) | |||
| CngCdCar updateCngCdCar(CngCdCar bean,Context context){ | |||
| if(bean.getId()==null){ | |||
| throw new AppException("请选择车辆!"); | |||
| } | |||
| CngCdCar be = repository.get(CngCdCar.class, bean.getId()); | |||
| if(be.getCarState()!=1 && (be.getCarState()!=2 && be.getRefitState()!=-1)){ | |||
| throw new AppException("该车辆处于不可修改状态"); | |||
| } | |||
| //得到当前登陆用户的id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| String myuserId = context.getUser().getId(); | |||
| CngUser cngUser= authorityDepartmentRepository.findByUser(myuserId); | |||
| be.setCngUser(cngUser); | |||
| be.setDateUpdate(new Date()); | |||
| if("".equals(bean.getMadeDate())){ | |||
| be.setMadeDate(null); | |||
| }else{ | |||
| be.setMadeDate(bean.getMadeDate()); | |||
| } | |||
| if("".equals(bean.getNextCheckDate())){ | |||
| be.setNextCheckDate(null); | |||
| }else{ | |||
| be.setNextCheckDate(bean.getNextCheckDate()); | |||
| } | |||
| if("1".equals(bean.getRegisteType())){ | |||
| be.setIsMakeQRCode(0); | |||
| }else{ | |||
| be.setIsMakeQRCode(1); | |||
| } | |||
| be.setRegisteType(bean.getRegisteType()); | |||
| be.setPlatenum(bean.getPlatenum()); | |||
| be.setVin(bean.getVin()); | |||
| be.setPlateTypeDict(bean.getPlateTypeDict()); | |||
| be.setEngineid(bean.getEngineid()); | |||
| be.setPcolor(bean.getPcolor()); | |||
| be.setWorkingTypeDict(bean.getWorkingTypeDict()); | |||
| be.setMadeVendor(bean.getMadeVendor()); | |||
| be.setModelDict(bean.getModelDict()); | |||
| be.setCarTypeDict(bean.getCarTypeDict()); | |||
| be.setFuelTypeDict(bean.getFuelTypeDict()); | |||
| be.setAreaDict(bean.getAreaDict()); | |||
| be.setRegistDate(bean.getRegistDate()); | |||
| be.setCarWeight(bean.getCarWeight()); | |||
| Owner owner = be.getOwner(); | |||
| owner.setName(bean.getOwner().getName()); | |||
| owner.setAddress(bean.getOwner().getAddress()); | |||
| owner.setMobile(bean.getOwner().getMobile()); | |||
| owner.setIdcard(bean.getOwner().getIdcard()); | |||
| owner.setTouchDeptId(regDept.getId()); | |||
| owner.setTouchUserId(cngUser.getId()); | |||
| be.setOwner(owner); | |||
| be.setAuthDeptid(regDept); | |||
| be.setFromDept(bean.getFromDept()); | |||
| return cngCdCarService.updateCngCdCar(be); | |||
| } | |||
| /** | |||
| * 查询 | |||
| * @param platenum | |||
| * @param vin | |||
| * @param pagination | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getCngCdCarBy", method = RequestMethod.GET) | |||
| Pagination getCngCdCarBy(String platenum,String vin,Integer refitState,Pagination pagination,Context context){ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict()); | |||
| //得到当前登陆用户的id | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| CngCdCar bean = new CngCdCar(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| bean.setRowState(1); | |||
| bean.setRefitState(refitState); | |||
| bean.setRegDept(regDept); | |||
| bean.setPlatenum(platenum.trim()); | |||
| bean.setVin(vin.trim()); | |||
| pagination.setRows(carStrategy.getCngCdCarPlatenumMybatis(permissionFilter,bean, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 查看详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getCngCdCar", method= RequestMethod.GET) | |||
| CngCdCar getCngCdCar(String id){ | |||
| return repository.get(CngCdCar.class, id); | |||
| } | |||
| /** | |||
| * 得到所有的车辆类型 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCarTypeDictAll", method = RequestMethod.GET) | |||
| List<CarTypeDict> selectAll(){ | |||
| return carTypeDictRepository.selectAll(); | |||
| } | |||
| /** | |||
| * 得到使用性质 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectWorkingTypeDictAll",method=RequestMethod.GET) | |||
| List<WorkingTypeDict> selectWorkingTypeDictAll(){ | |||
| return carTypeDictRepository.selectWorkingTypeDict(); | |||
| } | |||
| /** | |||
| * 得到车辆列表 | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectCngCdCarAll",method = RequestMethod.GET) | |||
| List<CngCdCar> selectCngCdCarAll(){ | |||
| return carStrategy.selcetCngCdCarAll(); | |||
| } | |||
| /** | |||
| * 得到所属区域信息 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectAreaDictAll" , method= RequestMethod.GET) | |||
| List<AreaDict> selectAreaDictAll(){ | |||
| return carTypeDictRepository.selectAreaDict(); | |||
| } | |||
| /** | |||
| * 得到车辆厂牌 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectModelDictAll" ,method = RequestMethod.GET) | |||
| List<ModelDict> selectModelDictAll(){ | |||
| return carTypeDictRepository.selectModelDict(); | |||
| } | |||
| /** | |||
| * 燃料类型 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectFuelTypeDictAll" ,method = RequestMethod.GET) | |||
| List<FuelTypeDict> selectFuelTypeDictAll(){ | |||
| return carTypeDictRepository.selectFuelTypeDict(); | |||
| } | |||
| /** | |||
| * 号牌种类 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="selectPlateTypeDictAll" ,method = RequestMethod.GET) | |||
| List<PlateTypeDict> selectPlateTypeDict(){ | |||
| return carTypeDictRepository.selectPlateTypeDict(); | |||
| } | |||
| /** | |||
| * 根据car id 查询气瓶详情 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value="getBottleByCarId",method = RequestMethod.GET) | |||
| Pagination getBottleByCarId(Integer id,Pagination pagination){ | |||
| pagination.setRows(carStrategy.getBottleAll(id, pagination)); | |||
| return pagination; | |||
| } | |||
| /** | |||
| * 删除 | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "deleteCngCdCarBy", method = RequestMethod.PUT) | |||
| void removeCngCdCar(Integer ids, Context context){ | |||
| CngCdCar be = repository.get(CngCdCar.class, ids); | |||
| if(be.getId()==null){ | |||
| throw new AppException("请选择车辆!"); | |||
| } | |||
| if(be.getCarState()!=1 && (be.getCarState()!=2 && be.getRefitState()!=-1)){ | |||
| throw new AppException("该车辆处于不可修改状态"); | |||
| } | |||
| cngCdCarService.removeCngCdCar(ids, context); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRefitByCarId", method = RequestMethod.GET) | |||
| Refit refitCngCdCar(Integer carid){ | |||
| return refitRepository.getRefitByCarId(carid); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getRefitBId", method = RequestMethod.GET) | |||
| Refit getRefitBId(Integer id){ | |||
| return repository.get(Refit.class, id); | |||
| } | |||
| /** | |||
| * 登记方式 | |||
| * @param context | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @ResponseBody | |||
| @RequestMapping(value = "registeTypeState", method = RequestMethod.GET) | |||
| List<Map<String, String>> registeTypeState(Context context)throws Exception{ | |||
| //读取Properties中的文件 | |||
| Properties property = new Properties(); | |||
| InputStream in = getClass().getResourceAsStream("registeConfig.properties"); | |||
| property.load(in); | |||
| String regUserKong = property.getProperty("refittingCar.CngCdCar.regDept"); | |||
| String[] str = regUserKong.split(","); | |||
| List<Map<String, String>> listregiste= new ArrayList<Map<String,String>>(); | |||
| Map<String,String> map = new HashMap<String, String>(); | |||
| List<String> list = new ArrayList<String>(); | |||
| list.add("1"); | |||
| list.add("2"); | |||
| List<String> listMakeup = new ArrayList<String>(); | |||
| listMakeup.add("新装"); | |||
| listMakeup.add("外地转入录入"); | |||
| //取得当前登录用户部门id | |||
| String userId= context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| if(regDept!=null){ | |||
| for(int k = 0;k<str.length;k++){ | |||
| if(regDept.getId()==Integer.parseInt(str[k])){ | |||
| for(int i=0;i<list.size();i++){ | |||
| Map<String,String> mapK = new HashMap<String, String>(); | |||
| mapK.put("add", (String) list.get(i)); | |||
| mapK.put("makeup", (String) listMakeup.get(i)); | |||
| listregiste.add(mapK); | |||
| } | |||
| }else{ | |||
| map.put("add", (String) list.get(0)); | |||
| map.put("makeup", (String) listMakeup.get(0)); | |||
| } | |||
| } | |||
| if(listregiste.size()<2){ | |||
| listregiste.add(map); | |||
| } | |||
| }else{ | |||
| for(int i=0;i<list.size();i++){ | |||
| Map<String,String> mapK = new HashMap<String, String>(); | |||
| mapK.put("add", (String) list.get(i)); | |||
| mapK.put("makeup", (String) listMakeup.get(i)); | |||
| listregiste.add(mapK); | |||
| } | |||
| } | |||
| return listregiste; | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "addPlateType", method = RequestMethod.POST) | |||
| void addPlateType(ModelDict modelDict){ | |||
| if(modelDict != null && !StringUtil.isNullOrEmpty(modelDict.getDictValue())) { | |||
| ModelDict org = carTypeDictRepository.getByDictValue(modelDict.getDictValue()); | |||
| if(org == null) { | |||
| ModelDictVo model = carTypeDictRepository.findModelMax(); | |||
| if(model != null && model.getId() != null) { | |||
| modelDict.setId(model.getId() + 1); | |||
| modelDict.setRowState(1); | |||
| repository.save(modelDict); | |||
| } else { | |||
| throw new AppException("获取厂牌最大ID失败"); | |||
| } | |||
| } else { | |||
| throw new AppException("厂牌已存在,请勿重复录入"); | |||
| } | |||
| } else { | |||
| throw new AppException("请输入厂牌"); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="updateIsMakeQRCode",method = RequestMethod.PUT) | |||
| public void updateisMakeQRCode(Integer id, Integer isMakeQRCode){ | |||
| if(id == null){ | |||
| throw new AppException("请选择车辆!"); | |||
| } | |||
| CngCdCar be = repository.get(CngCdCar.class, id); | |||
| if(be != null){ | |||
| be.setIsMakeQRCode(isMakeQRCode); | |||
| } | |||
| repository.save(be); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value="exportExcel", method = RequestMethod.GET) | |||
| public void exportExcel(String platenum, String vin, Integer refitState, Pagination pagination, Context context, HttpServletRequest req, HttpServletResponse res)throws Exception{ | |||
| PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(), context.getDistrict()); | |||
| //得到当前登陆用户的id | |||
| String userId = context.getPosition().getDepartment().getId(); | |||
| AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); | |||
| CngCdCar bean = new CngCdCar(); | |||
| bean.setRowState(1); | |||
| bean.setRefitState(refitState); | |||
| bean.setRegDept(regDept); | |||
| bean.setPlatenum(platenum.trim()); | |||
| bean.setVin(vin.trim()); | |||
| List<CngCdCar> list = carStrategy.getCngCdCarPlatenumExcel(permissionFilter, bean); | |||
| String path = ServletUtil.getWebRootPath(req, "/app/qualityCheck/CarAndBottleTatle/CarAndBottleTatle.xlsx"); | |||
| Workbook wb = new XSSFWorkbook(new FileInputStream(new File(path))); | |||
| Sheet sheet = wb.getSheetAt(0); | |||
| Row tempRow = sheet.createRow(0); | |||
| tempRow.createCell(0).setCellValue("车辆牌号"); | |||
| tempRow.createCell(1).setCellValue("号牌种类"); | |||
| tempRow.createCell(2).setCellValue("车架号"); | |||
| tempRow.createCell(3).setCellValue("发动机号"); | |||
| tempRow.createCell(4).setCellValue("品牌型号"); | |||
| tempRow.createCell(5).setCellValue("车辆注册时间"); | |||
| tempRow.createCell(6).setCellValue("车辆整备质量(KG)"); | |||
| tempRow.createCell(7).setCellValue("车辆类型"); | |||
| tempRow.createCell(8).setCellValue("安装气瓶体积(升)"); | |||
| tempRow.createCell(9).setCellValue("备注"); | |||
| if(null != list && list.size() > 0){ | |||
| for(int i = 0; i < list.size(); i++){ | |||
| Row row = sheet.createRow(i + 1); | |||
| row.createCell(0).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getPlatenum()) ? "" : list.get(i).getPlatenum()); | |||
| row.createCell(1).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getPlateTypeDict().getDictValue()) ? "" : list.get(i).getPlateTypeDict().getDictValue()); | |||
| row.createCell(2).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getVin()) ? "" : list.get(i).getVin()); | |||
| row.createCell(3).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getEngineid()) ? "" : list.get(i).getEngineid()); | |||
| row.createCell(4).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getModelDict().getDictValue()) ? "" : list.get(i).getModelDict().getDictValue()); | |||
| row.createCell(5).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getRegistDate()) ? "" : list.get(i).getRegistDate()); | |||
| row.createCell(6).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getCarWeight()) ? "" : list.get(i).getCarWeight() + "kg"); | |||
| row.createCell(7).setCellValue(StringUtil.isNullOrEmpty(list.get(i).getCarTypeDict().getDictValue()) ? "" : list.get(i).getCarTypeDict().getDictValue()); | |||
| List<Bottle> bottles = airBottleRepository.findBottleByCar(list.get(i).getId()); | |||
| if(null != bottles && bottles.size() > 0){ | |||
| double capacity = 0; | |||
| for(int j = 0; j < bottles.size(); j++){ | |||
| capacity = capacity + Double.parseDouble(bottles.get(j).getCapacity()); | |||
| } | |||
| row.createCell(8).setCellValue(this.intORdouble(capacity + "") + "L"); | |||
| }else{ | |||
| row.createCell(8).setCellValue(""); | |||
| } | |||
| row.createCell(9).setCellValue(""); | |||
| } | |||
| } | |||
| ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |||
| wb.write(bos); | |||
| byte[] bytes = bos.toByteArray(); | |||
| ServletUtil.respondFileInfo(res, new FileInfo("申报CNG改装证车辆情况汇总表.xlsx", bytes.length, new Date())); | |||
| ServletUtil.respondBytes(res, bytes); | |||
| } | |||
| // 解决1234.0 去掉后面的.0 | |||
| private String intORdouble (String str){ | |||
| if(null != str && !"".equals(str.trim())){ | |||
| String[] item = str.split("[.]"); | |||
| if(1 < item.length && "0".equals(item[1])){ | |||
| str = item[0]; | |||
| } | |||
| } | |||
| return str; | |||
| } | |||
| } | |||
| @ -0,0 +1,3 @@ | |||
| #\u6210\u90fd\u822a\u7a7a\u56db\u7ad9\u603b\u5382,\u56db\u5ddd\u91d1\u6e90\u5927\u9e4f\u8d38\u6613\u6709\u9650\u516c\u53f8(\u539f\u6210\u90fd\u5b89\u8fbe\u6539\u88c5\u5382),\u6210\u90fd\u5e02\u7eff\u5dde\u73af\u536b\u673a\u68b0\u5382,\u7b80\u9633\u5e02\u6c7d\u8f66\u8fd0\u8f93\u6709\u9650\u516c\u53f8\u538b\u7f29\u5929\u7136\u6c14\u6539\u88c5\u5382 | |||
| #\u6210\u90fd\u83b1\u8fbe\u673a\u68b0\u7535\u5b50\u6709\u9650\u516c\u53f8, \u56db\u5ddd\u5f6d\u5dde\u5e02\u5174\u5a01\u538b\u7f29\u5929\u7136\u6c14\u6280\u672f\u53d1\u5c55\u6709\u9650\u516c\u53f8 | |||
| refittingCar.CngCdCar.regDept = 38,42,45,305,47,53 | |||
| @ -0,0 +1,114 @@ | |||
| package com.ciotea.cdcng.front.application.refittingRegister; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| import infrastructure.support.exception.AppException; | |||
| import infrastructure.support.records.Pagination; | |||
| import javax.annotation.Resource; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.complaint.Complaint; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.complaint.ComplaintRepo; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.complaint.ComplaintServer; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.publicity.PublicityRepo; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.user.RefittingUserServer; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.FileUtil; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper; | |||
| import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; | |||
| import com.fasterxml.jackson.core.JsonEncoding; | |||
| @Controller | |||
| @RequestMapping(value = "complaint") | |||
| public class ComplaintController { | |||
| @Resource | |||
| ComplaintRepo complaintRepo; | |||
| @Resource | |||
| ComplaintServer complaintServer; | |||
| @Resource | |||
| RefittingUserServer refittingUserServer; | |||
| @Resource | |||
| PublicityRepo publicityRepo; | |||
| private static final String tempDir = "/usrslk/local/temp/cng/complaint/"; | |||
| @ResponseBody | |||
| @RequestMapping( value = "", method = RequestMethod.GET) | |||
| Pagination getList(String searchName, Pagination pagination){ | |||
| return pagination.setRows(complaintRepo.getList(searchName, pagination)); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping( value = "", method = RequestMethod.POST) | |||
| public Complaint create(Complaint complaint){ | |||
| return complaintServer.create(complaint); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "true", method = RequestMethod.PUT) | |||
| public Complaint updateTrue (String id, Integer isTrue){ | |||
| return complaintServer.updateTrue(id, isTrue); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "notTrue", method = RequestMethod.PUT) | |||
| public Complaint updateNotTrue (String id, Integer isTrue){ | |||
| return complaintServer.updateNotTrue(id, isTrue); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "fileUpload", method = RequestMethod.POST) | |||
| void postFileUp(MultipartHttpServletRequest req, HttpServletResponse resp) { | |||
| try { | |||
| MultipartFile multipartFile = req.getFile("file"); | |||
| // String fileName = multipartFile.getOriginalFilename(); | |||
| // String[] str = fileName.split("[.]"); | |||
| // int i = str.length - 1; | |||
| // if (!"png".equalsIgnoreCase(str[i]) && !"jpg".equalsIgnoreCase(str[i]) | |||
| // && !"bmp".equalsIgnoreCase(str[i]) | |||
| // && !"jpeg".equalsIgnoreCase(str[i])) { | |||
| // throw new AppException("请选择以png,jpg,bmp,jpeg结尾的图片签名"); | |||
| // } | |||
| File temp = FileUtil.createFile(tempDir | |||
| + UUID.randomUUID().toString() + ".tmp"); | |||
| // FileInputStream fis = new FileInputStream(temp); | |||
| // ftpTemplate.saveFile(multipartFile.getName(), multipartFile.getInputStream()); | |||
| multipartFile.transferTo(temp); | |||
| Map<String, String> ret = new HashMap<String, String>(); | |||
| ret.put("path", temp.getPath()); | |||
| ret.put("name", multipartFile.getOriginalFilename()); | |||
| resp.setContentType("text/plain"); | |||
| resp.setCharacterEncoding("UTF-8"); | |||
| new ObjectMapper().getFactory().createJsonGenerator(resp.getOutputStream(),JsonEncoding.UTF8).writeObject(ret); | |||
| resp.getOutputStream().flush(); | |||
| } catch (IOException e) { | |||
| throw new AppException("文件上传失败", e); | |||
| } | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "uploadAnnex", method = RequestMethod.GET) | |||
| void uploadAnnex(String fileNameUrl, String id, String fileName,HttpServletRequest req){ | |||
| complaintServer.uploadAnnex(fileNameUrl, id, fileName,ServletUtil.getWebRootPath(req, "complaint")); | |||
| } | |||
| } | |||
| @ -0,0 +1,33 @@ | |||
| package com.ciotea.cdcng.front.application.refittingRegister; | |||
| import java.util.List; | |||
| import javax.annotation.Resource; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.dataNotpass.DataNotpass; | |||
| import com.ciotea.cdcng.front.domain.refittingRegister.dataNotpass.DataNotpassRepo; | |||
| @Controller | |||
| @RequestMapping(value="dataNotpass") | |||
| public class DataNotpassController { | |||
| @Resource | |||
| DataNotpassRepo dataNotpassRepo; | |||
| @ResponseBody | |||
| @RequestMapping(value = "getByRefitUserId", method = RequestMethod.GET) | |||
| public List<DataNotpass> getByRefitUserId(String refitUserId){ | |||
| return dataNotpassRepo.getByRefittingUserId(refitUserId); | |||
| } | |||
| @ResponseBody | |||
| @RequestMapping(value = "getByUserId", method = RequestMethod.GET) | |||
| public DataNotpass getByUserId(String refitUserId){ | |||
| return dataNotpassRepo.getByUserId(refitUserId); | |||
| } | |||
| } | |||