|
@@ -0,0 +1,1144 @@
|
|
|
+package com.jpsoft.excellent.modules.base.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.excellent.config.OSSConfig;
|
|
|
+import com.jpsoft.excellent.modules.base.dto.AttachmentDTO;
|
|
|
+import com.jpsoft.excellent.modules.base.dto.SpecialOpinionReportDTO;
|
|
|
+import com.jpsoft.excellent.modules.base.dto.NextStepDTO;
|
|
|
+import com.jpsoft.excellent.modules.base.entity.*;
|
|
|
+import com.jpsoft.excellent.modules.base.service.*;
|
|
|
+import com.jpsoft.excellent.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.excellent.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.excellent.modules.common.utils.OSSUtil;
|
|
|
+import com.jpsoft.excellent.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.excellent.modules.common.utils.SMSUtil;
|
|
|
+import com.jpsoft.excellent.modules.sys.entity.User;
|
|
|
+import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.excellent.modules.sys.service.UserService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+import org.apache.poi.ss.usermodel.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/base/specialOpinion")
|
|
|
+@Api(description = "specialOpinion")
|
|
|
+public class SpecialOpinionController {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OSSConfig ossConfig;
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private WorkStationService workStationService;
|
|
|
+ @Autowired
|
|
|
+ private SpecialOpinionService specialOpinionService;
|
|
|
+ @Autowired
|
|
|
+ private SpecialStepService specialStepService;
|
|
|
+ @Autowired
|
|
|
+ private SpecialStepStatusService specialStepStatusService;
|
|
|
+ @Autowired
|
|
|
+ private SpecialAttachmentService specialAttachmentService;
|
|
|
+ @Autowired
|
|
|
+ private AreaService areaService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+
|
|
|
+ @ApiOperation(value="创建空记录")
|
|
|
+ @GetMapping("create")
|
|
|
+ public MessageResult<SpecialOpinion> create(){
|
|
|
+ MessageResult<SpecialOpinion> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ List<AttachmentDTO> specialAttachmentList = new ArrayList<AttachmentDTO>();
|
|
|
+
|
|
|
+ SpecialOpinion specialOpinion = new SpecialOpinion();
|
|
|
+ specialOpinion.setAttList(specialAttachmentList);
|
|
|
+ specialOpinion.setPicList(specialAttachmentList);
|
|
|
+
|
|
|
+ msgResult.setData(specialOpinion);
|
|
|
+ msgResult.setResult(true);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="添加信息")
|
|
|
+ @PostMapping("add")
|
|
|
+ public MessageResult<SpecialOpinion> add(@RequestBody SpecialOpinion specialOpinion,@RequestAttribute String subject){
|
|
|
+ MessageResult<SpecialOpinion> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ specialOpinion.setId(UUID.randomUUID().toString());
|
|
|
+ specialOpinion.setDelFlag(false);
|
|
|
+ specialOpinion.setCreateBy(subject);
|
|
|
+ specialOpinion.setCreateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = specialOpinionService.insert(specialOpinion);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(specialOpinion);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库添加失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="获取信息")
|
|
|
+ @GetMapping("edit/{id}")
|
|
|
+ public MessageResult<SpecialOpinion> edit(@PathVariable("id") String id, @RequestAttribute String subject){
|
|
|
+ MessageResult<SpecialOpinion> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ User userNow = userService.get(subject);
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(id);
|
|
|
+ specialOpinion.setUpdateBy(userNow.getStationId());
|
|
|
+ Area area = areaService.get(specialOpinion.getAreaId());
|
|
|
+ if(area != null){
|
|
|
+ specialOpinion.setAreaName(area.getName());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(specialOpinion.getAppendix())){
|
|
|
+ specialOpinion.setAppendixList(specialOpinion.getAppendix().split(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ //附件列表
|
|
|
+ List<AttachmentDTO> attachmentDTOList1 = new ArrayList<>();
|
|
|
+ List<SpecialAttachment> specialAttachmentList1 = specialAttachmentService.findListBySpecialOpinionId(id,"3");
|
|
|
+ for(SpecialAttachment specialAttachment : specialAttachmentList1){
|
|
|
+ AttachmentDTO attachmentDTO = new AttachmentDTO();
|
|
|
+ attachmentDTO.setName(specialAttachment.getAttachmentTitle());
|
|
|
+ attachmentDTO.setUrl(specialAttachment.getAttachmentUrl());
|
|
|
+ attachmentDTOList1.add(attachmentDTO);
|
|
|
+ }
|
|
|
+ specialOpinion.setAttList(attachmentDTOList1);
|
|
|
+ //图片列表
|
|
|
+ List<AttachmentDTO> attachmentDTOList2 = new ArrayList<>();
|
|
|
+ List<SpecialAttachment> specialAttachmentList2 = specialAttachmentService.findListBySpecialOpinionId(id,"2");
|
|
|
+ String[] picUrlList = new String[specialAttachmentList2.size()];
|
|
|
+ for(int i=0;i<specialAttachmentList2.size();i++){
|
|
|
+ SpecialAttachment specialAttachment = specialAttachmentList2.get(i);
|
|
|
+ AttachmentDTO attachmentDTO = new AttachmentDTO();
|
|
|
+ attachmentDTO.setName(specialAttachment.getAttachmentTitle());
|
|
|
+ attachmentDTO.setUrl(specialAttachment.getAttachmentUrl());
|
|
|
+ attachmentDTOList2.add(attachmentDTO);
|
|
|
+ picUrlList[i] = specialAttachment.getAttachmentUrl();
|
|
|
+ }
|
|
|
+ specialOpinion.setPicList(attachmentDTOList2);
|
|
|
+ specialOpinion.setPicUrlList(picUrlList);
|
|
|
+ //步进列表
|
|
|
+ List<SpecialStepStatus> specialStepStatusList = specialStepStatusService.findByList(specialOpinion.getId(),null);
|
|
|
+ for(SpecialStepStatus specialStepStatus : specialStepStatusList){
|
|
|
+ if(StringUtils.isNotEmpty(specialStepStatus.getOrgId())){
|
|
|
+ Organization organization = organizationService.get(specialStepStatus.getOrgId());
|
|
|
+ specialStepStatus.setOrgName(organization.getName());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(specialStepStatus.getUserId())){
|
|
|
+ User user = userService.get(specialStepStatus.getUserId());
|
|
|
+ specialStepStatus.setUserName(user.getRealName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ specialOpinion.setStepStatusList(specialStepStatusList);
|
|
|
+
|
|
|
+ if (specialOpinion != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(specialOpinion);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="更新用户")
|
|
|
+ @PostMapping("update")
|
|
|
+ public MessageResult<SpecialOpinion> update(@RequestBody SpecialOpinion specialOpinion,@RequestAttribute String subject){
|
|
|
+ MessageResult<SpecialOpinion> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ specialOpinion.setUpdateBy(subject);
|
|
|
+ specialOpinion.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = specialOpinionService.update(specialOpinion);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ if (specialOpinion.getConfirmStatus() == null || specialOpinion.getConfirmStatus() == 0) {
|
|
|
+ //删除关联附件及图片
|
|
|
+ List<SpecialAttachment> specialAttachmentList = specialAttachmentService.findListBySpecialOpinionId(specialOpinion.getId(), null);
|
|
|
+ for (SpecialAttachment specialAttachment : specialAttachmentList) {
|
|
|
+ specialAttachmentService.delete(specialAttachment.getId());
|
|
|
+ }
|
|
|
+ //关联附件
|
|
|
+ for (int i = 0; i < specialOpinion.getAttList().size(); i++) {
|
|
|
+ AttachmentDTO attachmentDTO = specialOpinion.getAttList().get(i);
|
|
|
+ SpecialAttachment specialAttachment = new SpecialAttachment();
|
|
|
+ specialAttachment.setId(UUID.randomUUID().toString());
|
|
|
+ specialAttachment.setSpecialOpinionId(specialOpinion.getId());
|
|
|
+ specialAttachment.setAttachmentType("1");
|
|
|
+ specialAttachment.setAttachmentTitle(attachmentDTO.getName());
|
|
|
+ specialAttachment.setAttachmentUrl(attachmentDTO.getUrl());
|
|
|
+ specialAttachment.setSortNo(i);
|
|
|
+ specialAttachment.setCreateBy(subject);
|
|
|
+ specialAttachment.setCreateTime(new Date());
|
|
|
+ specialAttachmentService.insert(specialAttachment);
|
|
|
+ }
|
|
|
+ //关联图片
|
|
|
+ for (int i = 0; i < specialOpinion.getPicList().size(); i++) {
|
|
|
+ AttachmentDTO attachmentDTO = specialOpinion.getPicList().get(i);
|
|
|
+ SpecialAttachment specialAttachment = new SpecialAttachment();
|
|
|
+ specialAttachment.setId(UUID.randomUUID().toString());
|
|
|
+ specialAttachment.setSpecialOpinionId(specialOpinion.getId());
|
|
|
+ specialAttachment.setAttachmentType("2");
|
|
|
+ specialAttachment.setAttachmentTitle(attachmentDTO.getName());
|
|
|
+ specialAttachment.setAttachmentUrl(attachmentDTO.getUrl());
|
|
|
+ specialAttachment.setSortNo(i);
|
|
|
+ specialAttachment.setCreateBy(subject);
|
|
|
+ specialAttachment.setCreateTime(new Date());
|
|
|
+ specialAttachmentService.insert(specialAttachment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(specialOpinion);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="删除")
|
|
|
+ @PostMapping("delete/{id}")
|
|
|
+ public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(id);
|
|
|
+ specialOpinion.setDelFlag(true);
|
|
|
+ specialOpinion.setUpdateBy(subject);
|
|
|
+ specialOpinion.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = specialOpinionService.update(specialOpinion);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(affectCount);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="批量删除")
|
|
|
+ @PostMapping("batchDelete")
|
|
|
+ public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ int affectCount = 0;
|
|
|
+
|
|
|
+ for (String id : idList) {
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(id);
|
|
|
+ specialOpinion.setDelFlag(true);
|
|
|
+ specialOpinion.setUpdateBy(subject);
|
|
|
+ specialOpinion.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ affectCount += specialOpinionService.update(specialOpinion);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(affectCount);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="列表")
|
|
|
+ @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageList(
|
|
|
+ String sort, String connect, String connectPhone, String areaId, String workStation, String window,
|
|
|
+ String isSatisfied, String opinionStatus, String confirmStatus, Date[] reportDate,
|
|
|
+ Boolean areaSubordinate, String timeout,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(sort)) {
|
|
|
+ searchParams.put("sort","%" + sort + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(connect)) {
|
|
|
+ searchParams.put("connect","%" + connect + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(connectPhone)) {
|
|
|
+ searchParams.put("connectPhone","%" + connectPhone + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(areaId) && !"null".equals(areaId)) {
|
|
|
+ if (areaSubordinate) {
|
|
|
+ Area area = areaService.get(areaId);
|
|
|
+ searchParams.put("code", area.getCode() + "%");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ searchParams.put("areaId", areaId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(workStation)) {
|
|
|
+ searchParams.put("workStation",workStation);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(window)) {
|
|
|
+ searchParams.put("window","%"+window+"%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(isSatisfied)) {
|
|
|
+ if("1".equals(isSatisfied)) {
|
|
|
+ searchParams.put("isSatisfied", true);
|
|
|
+ }
|
|
|
+ if("0".equals(isSatisfied)) {
|
|
|
+ searchParams.put("isSatisfied", false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(opinionStatus)) {
|
|
|
+ if("1".equals(opinionStatus)) {
|
|
|
+ searchParams.put("opinionStatus", true);
|
|
|
+ }
|
|
|
+ if("0".equals(opinionStatus)) {
|
|
|
+ searchParams.put("opinionStatus", false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(confirmStatus)) {
|
|
|
+ searchParams.put("confirmStatus", confirmStatus);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ searchParams.put("avail", true);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(timeout)) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if("1".equals(timeout)) {
|
|
|
+ searchParams.put("timeout", sdf.format(new Date()));
|
|
|
+ }
|
|
|
+ if("0".equals(timeout)) {
|
|
|
+ searchParams.put("noTimeout", sdf.format(new Date()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reportDate.length > 0) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE,1);
|
|
|
+
|
|
|
+ searchParams.put("reportDateStart",sdf.format(reportDate[0]));
|
|
|
+ searchParams.put("reportDateEnd",sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<SpecialOpinion> page = specialOpinionService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for(SpecialOpinion specialOpinion : page.getResult()){
|
|
|
+ if(StringUtils.isNotEmpty(specialOpinion.getAreaId())) {
|
|
|
+ specialOpinion.setAreaName(parentFullName(specialOpinion.getAreaId()));
|
|
|
+ }
|
|
|
+ int num = specialStepStatusService.findByList(specialOpinion.getId(),false).size();
|
|
|
+ if(num > 0) {
|
|
|
+ specialOpinion.setIsProcessed(false);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ specialOpinion.setIsProcessed(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="导出报表")
|
|
|
+ @RequestMapping(value = "reportListXls",method = RequestMethod.POST)
|
|
|
+ public String reportListXls(String sort, String connect, String connectPhone, String areaId, String workStation, String window,
|
|
|
+ String isSatisfied, String opinionStatus, String confirmStatus, Date[] reportDate,
|
|
|
+ Boolean areaSubordinate, String timeout, @RequestAttribute String subject){
|
|
|
+ String downloadUrl = "";
|
|
|
+
|
|
|
+ //新建文档
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
+
|
|
|
+ //单元格样式
|
|
|
+ sheet.setDefaultColumnWidth(15);
|
|
|
+ sheet.setDefaultRowHeight((short) 400);
|
|
|
+
|
|
|
+ Font fontTitle = workbook.createFont();
|
|
|
+ fontTitle.setFontName("宋体");
|
|
|
+ fontTitle.setFontHeightInPoints((short) 11);
|
|
|
+ fontTitle.setBold(true);
|
|
|
+
|
|
|
+ CellStyle cellStyleTitle = workbook.createCellStyle();
|
|
|
+ cellStyleTitle.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setFont(fontTitle);
|
|
|
+
|
|
|
+ Font fontContent = workbook.createFont();
|
|
|
+ fontContent.setFontName("宋体");
|
|
|
+ fontContent.setFontHeightInPoints((short) 11);
|
|
|
+
|
|
|
+ CellStyle cellStyleContent = workbook.createCellStyle();
|
|
|
+ cellStyleContent.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleContent.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleContent.setFont(fontContent);
|
|
|
+
|
|
|
+ //表头
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
+ String[] titles = new String[]{"序号","联系人","联系电话","区域","站点","窗口","是否满意","内容","上报时间","处理进度","确认状态"};
|
|
|
+ for (int i=0;i<titles.length;i++) {
|
|
|
+ Cell cell = rowTitle.createCell(i);
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
+ cell.setCellStyle(cellStyleTitle);
|
|
|
+ }
|
|
|
+
|
|
|
+ //读取数据
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","asc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(sort)) {
|
|
|
+ searchParams.put("sort","%" + sort + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(connect)) {
|
|
|
+ searchParams.put("connect","%" + connect + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(connectPhone)) {
|
|
|
+ searchParams.put("connectPhone","%" + connectPhone + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(areaId) && !"null".equals(areaId)) {
|
|
|
+ if (areaSubordinate) {
|
|
|
+ Area area = areaService.get(areaId);
|
|
|
+ searchParams.put("code", area.getCode() + "%");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ searchParams.put("areaId", areaId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(workStation)) {
|
|
|
+ searchParams.put("workStation",workStation);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(window)) {
|
|
|
+ searchParams.put("window","%"+window+"%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(isSatisfied)) {
|
|
|
+ if("1".equals(isSatisfied)) {
|
|
|
+ searchParams.put("isSatisfied", true);
|
|
|
+ }
|
|
|
+ if("0".equals(isSatisfied)) {
|
|
|
+ searchParams.put("isSatisfied", false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(opinionStatus)) {
|
|
|
+ if("1".equals(opinionStatus)) {
|
|
|
+ searchParams.put("opinionStatus", true);
|
|
|
+ }
|
|
|
+ if("0".equals(opinionStatus)) {
|
|
|
+ searchParams.put("opinionStatus", false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(confirmStatus)) {
|
|
|
+ searchParams.put("confirmStatus", confirmStatus);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(timeout)) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if("1".equals(timeout)) {
|
|
|
+ searchParams.put("timeout", sdf.format(new Date()));
|
|
|
+ }
|
|
|
+ if("0".equals(timeout)) {
|
|
|
+ searchParams.put("noTimeout", sdf.format(new Date()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reportDate.length > 0) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE,1);
|
|
|
+
|
|
|
+ searchParams.put("reportDateStart",sdf.format(reportDate[0]));
|
|
|
+ searchParams.put("reportDateEnd",sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<SpecialOpinion> page = specialOpinionService.pageSearch(searchParams,1,100000,false,sortList);
|
|
|
+ //写入数据
|
|
|
+ for(int i=0; i<page.getResult().size(); i++){
|
|
|
+ SpecialOpinion specialOpinion = page.getResult().get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i+1);
|
|
|
+ row.createCell(0);
|
|
|
+ row.createCell(1);
|
|
|
+ row.createCell(2);
|
|
|
+ row.createCell(3);
|
|
|
+ row.createCell(4);
|
|
|
+ row.createCell(5);
|
|
|
+ row.createCell(6);
|
|
|
+ row.createCell(7);
|
|
|
+ row.createCell(8);
|
|
|
+ row.createCell(9);
|
|
|
+ row.createCell(10);
|
|
|
+
|
|
|
+ row.getCell(0).setCellValue(specialOpinion.getSort());
|
|
|
+ row.getCell(1).setCellValue(specialOpinion.getConnect());
|
|
|
+ row.getCell(2).setCellValue(specialOpinion.getConnectPhone());
|
|
|
+ row.getCell(3).setCellValue(parentFullName(specialOpinion.getAreaId()));
|
|
|
+ row.getCell(4).setCellValue(specialOpinion.getStationName());
|
|
|
+ row.getCell(5).setCellValue(specialOpinion.getWindow());
|
|
|
+ if(specialOpinion.getIsSatisfied()){
|
|
|
+ row.getCell(6).setCellValue("满意");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ row.getCell(6).setCellValue("不满意");
|
|
|
+ }
|
|
|
+ row.getCell(7).setCellValue(specialOpinion.getContent());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ row.getCell(8).setCellValue(sdf.format(specialOpinion.getCreateTime()));
|
|
|
+ if(specialOpinion.getOpinionStatus()){
|
|
|
+ row.getCell(9).setCellValue("已处理");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ row.getCell(9).setCellValue("未处理");
|
|
|
+ }
|
|
|
+ if(specialOpinion.getConfirmStatus() == 1){
|
|
|
+ row.getCell(10).setCellValue("已确认");
|
|
|
+ }
|
|
|
+ if(specialOpinion.getConfirmStatus() == 0){
|
|
|
+ row.getCell(10).setCellValue("待确认");
|
|
|
+ }
|
|
|
+ if(specialOpinion.getConfirmStatus() == 2){
|
|
|
+ row.getCell(10).setCellValue("忽略");
|
|
|
+ }
|
|
|
+
|
|
|
+ row.getCell(0).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(1).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(2).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(3).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(4).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(5).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(6).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(7).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(8).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(9).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(10).setCellStyle(cellStyleContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ try {
|
|
|
+ workbook.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
+ String now = sdf2.format(new Date());
|
|
|
+ String fileName = "反馈意见-" + now + ".xls";
|
|
|
+ downloadUrl = OSSUtil.upload(ossConfig,"InsuranceReport",fileName,input);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return downloadUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="导出上报报表")
|
|
|
+ @RequestMapping(value = "reportListXlsSB",method = RequestMethod.POST)
|
|
|
+ public String reportListXlsSB(Date[] reportDate, @RequestAttribute String subject){
|
|
|
+ String downloadUrl = "";
|
|
|
+
|
|
|
+ try{
|
|
|
+ String xlsPath = "static/jzs_qzp_pjsjb.xls";
|
|
|
+ ClassPathResource resource = new ClassPathResource(xlsPath);
|
|
|
+ Workbook workbook = WorkbookFactory.create(resource.getInputStream());
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+
|
|
|
+ //读取数据
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("lv3",true);
|
|
|
+ if (reportDate.length > 0) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE,1);
|
|
|
+
|
|
|
+ searchParams.put("reportDateStart",sdf.format(reportDate[0]));
|
|
|
+ searchParams.put("reportDateEnd",sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","asc"));
|
|
|
+
|
|
|
+ Page<SpecialOpinion> page = specialOpinionService.pageSearch(searchParams,1,100000,false,sortList);
|
|
|
+
|
|
|
+ //写入数据
|
|
|
+ for(int i=0; i<page.getResult().size(); i++){
|
|
|
+ SpecialOpinion specialOpinion = page.getResult().get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i+2);
|
|
|
+ row.createCell(0).setCellValue(specialOpinion.getId());
|
|
|
+// row.createCell(1).setCellValue(1);
|
|
|
+ if(StringUtils.isNotEmpty(specialOpinion.getAreaId())) {
|
|
|
+ Area area = areaService.get(specialOpinion.getAreaId());
|
|
|
+ row.createCell(2).setCellValue(area.getName());
|
|
|
+ }
|
|
|
+ row.createCell(3).setCellValue("5");
|
|
|
+// row.createCell(4).setCellValue(4);
|
|
|
+ row.createCell(5).setCellValue(specialOpinion.getStationName());
|
|
|
+ row.createCell(6).setCellValue(specialOpinion.getConnect());
|
|
|
+ row.createCell(7).setCellValue(specialOpinion.getConnectPhone());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ row.createCell(8).setCellValue(sdf.format(specialOpinion.getCreateTime()));
|
|
|
+ if(specialOpinion.getIsSatisfied()){
|
|
|
+ row.createCell(9).setCellValue("4");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ row.createCell(9).setCellValue("2");
|
|
|
+ }
|
|
|
+// row.createCell(10).setCellValue(10);
|
|
|
+// row.createCell(11).setCellValue(11);
|
|
|
+// row.createCell(12).setCellValue(12);
|
|
|
+// row.createCell(13).setCellValue(13);
|
|
|
+ row.createCell(14).setCellValue(specialOpinion.getContent());
|
|
|
+ if(specialOpinion.getConfirmStatus() == 2){
|
|
|
+ row.createCell(15).setCellValue("0");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ row.createCell(15).setCellValue("1");
|
|
|
+ }
|
|
|
+ if(specialOpinion.getOpinionStatus()){
|
|
|
+ row.createCell(16).setCellValue("1");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ row.createCell(16).setCellValue("0");
|
|
|
+ }
|
|
|
+// row.createCell(17).setCellValue(17);
|
|
|
+ if(StringUtils.isNotEmpty(specialOpinion.getContentAttachment())) {
|
|
|
+ row.createCell(18).setCellValue(specialOpinion.getContentAttachment());
|
|
|
+ }
|
|
|
+ if(specialOpinion.getUpdateTime() != null) {
|
|
|
+ row.createCell(19).setCellValue(sdf.format(specialOpinion.getUpdateTime()));
|
|
|
+ row.createCell(20).setCellValue(sdf.format(specialOpinion.getUpdateTime()));
|
|
|
+ }
|
|
|
+ row.createCell(21).setCellValue("I");
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ workbook.write(output);
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ String fileName = "荆州市双优督办反馈报表.xls";
|
|
|
+ downloadUrl = OSSUtil.upload(ossConfig,"InsuranceReport",fileName,input);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return downloadUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="列表")
|
|
|
+ @RequestMapping(value = "pageListStatistics",method = RequestMethod.POST)
|
|
|
+ public MessageResult<List> pageListStatistics(String areaId, String workStation, String isSatisfied, Date[] reportDate){
|
|
|
+ MessageResult<List> msgResult = new MessageResult<>();
|
|
|
+ List<SpecialOpinionReportDTO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(areaId)) {
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+// if (StringUtils.isNotEmpty(workStation)) {
|
|
|
+// searchParams.put("workStation", workStation);
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(isSatisfied)) {
|
|
|
+// if ("1".equals(isSatisfied)) {
|
|
|
+// searchParams.put("isSatisfied", true);
|
|
|
+// }
|
|
|
+// if ("0".equals(isSatisfied)) {
|
|
|
+// searchParams.put("isSatisfied", false);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (reportDate.length > 0) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE, 1);
|
|
|
+
|
|
|
+ searchParams.put("reportDateStart", sdf.format(reportDate[0]));
|
|
|
+ searchParams.put("reportDateEnd", sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
+
|
|
|
+ //区域-直属
|
|
|
+ Integer ZsMY = 0;
|
|
|
+ Integer ZsBMY = 0;
|
|
|
+ Integer ZsYCL = 0;
|
|
|
+ Integer ZsWCY = 0;
|
|
|
+ Integer ZsYQR = 0;
|
|
|
+ Integer ZsWQR = 0;
|
|
|
+ Area areaZS = areaService.get(areaId);
|
|
|
+ searchParams.put("areaId", areaId);
|
|
|
+ Page<SpecialOpinion> pageZS = specialOpinionService.pageSearch(searchParams, 1, 10000, false, sortList);
|
|
|
+ for (SpecialOpinion specialOpinion : pageZS.getResult()) {
|
|
|
+ if (specialOpinion.getIsSatisfied() != null && specialOpinion.getIsSatisfied()) {
|
|
|
+ ZsMY++;
|
|
|
+ } else {
|
|
|
+ ZsBMY++;
|
|
|
+ }
|
|
|
+ if (specialOpinion.getOpinionStatus() != null && specialOpinion.getOpinionStatus()) {
|
|
|
+ ZsYCL++;
|
|
|
+ } else {
|
|
|
+ ZsWCY++;
|
|
|
+ }
|
|
|
+ if (specialOpinion.getConfirmStatus() != null && specialOpinion.getConfirmStatus() == 1) {
|
|
|
+ ZsYQR++;
|
|
|
+ } else {
|
|
|
+ ZsWQR++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SpecialOpinionReportDTO ZsDto = new SpecialOpinionReportDTO();
|
|
|
+ ZsDto.setArea(areaZS.getName()+"直属");
|
|
|
+ ZsDto.setCountMY(ZsMY);
|
|
|
+ ZsDto.setCountBMY(ZsBMY);
|
|
|
+ ZsDto.setCountYCL(ZsYCL);
|
|
|
+ ZsDto.setCountWCL(ZsWCY);
|
|
|
+ ZsDto.setCountYQR(ZsYQR);
|
|
|
+ ZsDto.setCountWQR(ZsWQR);
|
|
|
+ list.add(ZsDto);
|
|
|
+
|
|
|
+ searchParams.remove("areaId");
|
|
|
+
|
|
|
+ //区域-下级
|
|
|
+ List<Area> areaList = areaService.getListByParentId(areaId);
|
|
|
+ for (Area area : areaList) {
|
|
|
+ Integer countMY = 0;
|
|
|
+ Integer countBMY = 0;
|
|
|
+ Integer countYCL = 0;
|
|
|
+ Integer countWCY = 0;
|
|
|
+ Integer countYQR = 0;
|
|
|
+ Integer countWQR = 0;
|
|
|
+
|
|
|
+ searchParams.put("code", area.getCode() + "%");
|
|
|
+ Page<SpecialOpinion> page = specialOpinionService.pageSearch(searchParams, 1, 10000, false, sortList);
|
|
|
+ for (SpecialOpinion specialOpinion : page.getResult()) {
|
|
|
+ if (specialOpinion.getIsSatisfied() != null && specialOpinion.getIsSatisfied()) {
|
|
|
+ countMY++;
|
|
|
+ } else {
|
|
|
+ countBMY++;
|
|
|
+ }
|
|
|
+ if (specialOpinion.getOpinionStatus() != null && specialOpinion.getOpinionStatus()) {
|
|
|
+ countYCL++;
|
|
|
+ } else {
|
|
|
+ countWCY++;
|
|
|
+ }
|
|
|
+ if (specialOpinion.getConfirmStatus() != null && specialOpinion.getConfirmStatus() == 1) {
|
|
|
+ countYQR++;
|
|
|
+ } else {
|
|
|
+ countWQR++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SpecialOpinionReportDTO specialOpinionReportDTO = new SpecialOpinionReportDTO();
|
|
|
+ specialOpinionReportDTO.setArea(area.getName());
|
|
|
+ specialOpinionReportDTO.setCountMY(countMY);
|
|
|
+ specialOpinionReportDTO.setCountBMY(countBMY);
|
|
|
+ specialOpinionReportDTO.setCountYCL(countYCL);
|
|
|
+ specialOpinionReportDTO.setCountWCL(countWCY);
|
|
|
+ specialOpinionReportDTO.setCountYQR(countYQR);
|
|
|
+ specialOpinionReportDTO.setCountWQR(countWQR);
|
|
|
+ list.add(specialOpinionReportDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(list);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="列表")
|
|
|
+ @RequestMapping(value = "pageListTodo",method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageListTodo(
|
|
|
+ String connectPhone, Date[] reportDate,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ User user = userService.get(subject);
|
|
|
+ if(StringUtils.isNotEmpty(user.getOrgId())) {
|
|
|
+ searchParams.put("orgId", user.getOrgId());
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ searchParams.put("orgId", "0");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(connectPhone)) {
|
|
|
+ searchParams.put("connectPhone","%" + connectPhone + "%");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (reportDate.length > 0) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE,1);
|
|
|
+
|
|
|
+ searchParams.put("reportDateStart",sdf.format(reportDate[0]));
|
|
|
+ searchParams.put("reportDateEnd",sdf.format(calendar.getTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<SpecialOpinion> page = specialOpinionService.pageSearchTodo(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="意见待办处理")
|
|
|
+ @RequestMapping(value = "saveTodo",method = RequestMethod.POST)
|
|
|
+ public MessageResult saveTodo(String stepStatusId, String content, @RequestAttribute String subject){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ SpecialStepStatus specialStepStatus = specialStepStatusService.get(stepStatusId);
|
|
|
+ specialStepStatus.setUserId(subject);
|
|
|
+ specialStepStatus.setContent(content);
|
|
|
+ specialStepStatus.setStatus(true);
|
|
|
+ specialStepStatus.setUpdateBy(subject);
|
|
|
+ specialStepStatus.setUpdateTime(new Date());
|
|
|
+ specialStepStatusService.update(specialStepStatus);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception exception) {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(exception.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="导出报表")
|
|
|
+ @RequestMapping(value = "reportXls",method = RequestMethod.POST)
|
|
|
+ public String reportXls(@RequestBody SpecialOpinionReportDTO specialOpinionReportDTO){
|
|
|
+ String downloadUrl = "";
|
|
|
+
|
|
|
+ //新建文档
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
+
|
|
|
+ //单元格样式
|
|
|
+ sheet.setDefaultColumnWidth(15);
|
|
|
+ sheet.setDefaultRowHeight((short) 400);
|
|
|
+
|
|
|
+ Font fontTitle = workbook.createFont();
|
|
|
+ fontTitle.setFontName("宋体");
|
|
|
+ fontTitle.setFontHeightInPoints((short) 11);
|
|
|
+ fontTitle.setBold(true);
|
|
|
+
|
|
|
+ CellStyle cellStyleTitle = workbook.createCellStyle();
|
|
|
+ cellStyleTitle.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setFont(fontTitle);
|
|
|
+
|
|
|
+ Font fontContent = workbook.createFont();
|
|
|
+ fontContent.setFontName("宋体");
|
|
|
+ fontContent.setFontHeightInPoints((short) 11);
|
|
|
+
|
|
|
+ CellStyle cellStyleContent = workbook.createCellStyle();
|
|
|
+ cellStyleContent.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleContent.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleContent.setFont(fontContent);
|
|
|
+
|
|
|
+ //表头
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
+ String[] titles = new String[]{"区域","满意","不满意","已处理","未处理","已确认","未确认"};
|
|
|
+ for (int i=0;i<titles.length;i++) {
|
|
|
+ Cell cell = rowTitle.createCell(i);
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
+ cell.setCellStyle(cellStyleTitle);
|
|
|
+ }
|
|
|
+
|
|
|
+ //写入数据
|
|
|
+ for(int i=0; i<specialOpinionReportDTO.getTableData().size(); i++){
|
|
|
+ SpecialOpinionReportDTO dto = specialOpinionReportDTO.getTableData().get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i+1);
|
|
|
+ row.createCell(0);
|
|
|
+ row.createCell(1);
|
|
|
+ row.createCell(2);
|
|
|
+ row.createCell(3);
|
|
|
+ row.createCell(4);
|
|
|
+ row.createCell(5);
|
|
|
+ row.createCell(6);
|
|
|
+
|
|
|
+ row.getCell(0).setCellValue(dto.getArea());
|
|
|
+ row.getCell(1).setCellValue(dto.getCountMY());
|
|
|
+ row.getCell(2).setCellValue(dto.getCountBMY());
|
|
|
+ row.getCell(3).setCellValue(dto.getCountYCL());
|
|
|
+ row.getCell(4).setCellValue(dto.getCountWCL());
|
|
|
+ row.getCell(5).setCellValue(dto.getCountYQR());
|
|
|
+ row.getCell(6).setCellValue(dto.getCountWQR());
|
|
|
+
|
|
|
+ row.getCell(0).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(1).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(2).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(3).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(4).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(5).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(6).setCellStyle(cellStyleContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ try {
|
|
|
+ workbook.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
+ String now = sdf2.format(new Date());
|
|
|
+ String fileName = "群众评议-" + now + ".xls";
|
|
|
+ downloadUrl = OSSUtil.upload(ossConfig,"InsuranceReport",fileName,input);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return downloadUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="步进")
|
|
|
+ @PostMapping("nextStep")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public MessageResult nextStep(@RequestBody NextStepDTO nextStepDTO, @RequestAttribute String subject){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ try {
|
|
|
+ //反馈意见
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(nextStepDTO.getOpinionId());
|
|
|
+ specialOpinion.setConfirmStatus(1);
|
|
|
+ specialOpinion.setAllotedDate(sdf.parse(nextStepDTO.getAllotedDate()));
|
|
|
+ specialOpinionService.update(specialOpinion);
|
|
|
+
|
|
|
+ //反馈意见附件
|
|
|
+ for(AttachmentDTO dto : nextStepDTO.getAttList()) {
|
|
|
+ SpecialAttachment specialAttachment = new SpecialAttachment();
|
|
|
+ specialAttachment.setId(UUID.randomUUID().toString());
|
|
|
+ specialAttachment.setSpecialOpinionId(specialOpinion.getId());
|
|
|
+ specialAttachment.setAttachmentType("3");
|
|
|
+ specialAttachment.setAttachmentTitle(dto.getName());
|
|
|
+ specialAttachment.setAttachmentUrl(dto.getUrl());
|
|
|
+ specialAttachment.setCreateBy(subject);
|
|
|
+ specialAttachment.setCreateTime(new Date());
|
|
|
+ specialAttachmentService.insert(specialAttachment);
|
|
|
+ }
|
|
|
+
|
|
|
+ //反馈意见步进
|
|
|
+ SpecialStep specialStep = new SpecialStep();
|
|
|
+ specialStep.setId(UUID.randomUUID().toString());
|
|
|
+ specialStep.setSpecialOpinionId(specialOpinion.getId());
|
|
|
+ specialStep.setAllotedDate(sdf.parse(nextStepDTO.getAllotedDate()));
|
|
|
+ specialStep.setDelFlag(false);
|
|
|
+ specialStep.setCreateTime(new Date());
|
|
|
+ specialStep.setCreateBy(subject);
|
|
|
+ specialStepService.insert(specialStep);
|
|
|
+
|
|
|
+ //反馈意见反馈
|
|
|
+ for(String orgId : nextStepDTO.getOrgIds()) {
|
|
|
+ SpecialStepStatus specialStepStatus = new SpecialStepStatus();
|
|
|
+ specialStepStatus.setId(UUID.randomUUID().toString());
|
|
|
+ specialStepStatus.setSpecialStepId(specialStep.getId());
|
|
|
+ specialStepStatus.setOrgId(orgId);
|
|
|
+ specialStepStatus.setStatus(false);
|
|
|
+ specialStepStatus.setAllotedDate(sdf.parse(nextStepDTO.getAllotedDate()));
|
|
|
+ specialStepStatus.setDelFlag(false);
|
|
|
+ specialStepStatus.setCreateTime(new Date());
|
|
|
+ specialStepStatus.setCreateBy(subject);
|
|
|
+ specialStepStatusService.insert(specialStepStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ //发送交办单位短信
|
|
|
+ String MessageContent = "";
|
|
|
+ MessageContent = "【双优督办】您有一条待办反馈,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
|
|
|
+ sendSMSing(MessageContent, nextStepDTO.getOrgIds(), null);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendSMSing(String MessageContent, String[] orgIds, String ScheduleTime){
|
|
|
+ if(orgIds.length > 0) {
|
|
|
+ List<String> phones = new ArrayList<>();
|
|
|
+ for(String orgId : orgIds){
|
|
|
+ List<User> userList = userService.findListByOrgId(orgId);
|
|
|
+ for(User user : userList){
|
|
|
+ if(StringUtils.isNotEmpty(user.getPhone())) {
|
|
|
+ phones.add(user.getPhone().replace(" ",""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SMSUtil.sendSMS(MessageContent, StringUtils.join(phones.toArray(), ","), ScheduleTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="完成")
|
|
|
+ @PostMapping("finish")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public MessageResult finish(String specialOpinionId, @RequestAttribute String subject){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ try {
|
|
|
+ //反馈意见
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(specialOpinionId);
|
|
|
+ specialOpinion.setConfirmStatus(1);
|
|
|
+ specialOpinion.setOpinionStatus(true);
|
|
|
+ specialOpinion.setUpdateBy(subject);
|
|
|
+ specialOpinion.setUpdateTime(new Date());
|
|
|
+ specialOpinionService.update(specialOpinion);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="完成")
|
|
|
+ @PostMapping("noAvail")
|
|
|
+ public MessageResult noAvail(String specialOpinionId, @RequestAttribute String subject){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ try {
|
|
|
+ //反馈意见
|
|
|
+ SpecialOpinion specialOpinion = specialOpinionService.get(specialOpinionId);
|
|
|
+ specialOpinion.setConfirmStatus(2);
|
|
|
+ specialOpinion.setUpdateBy(subject);
|
|
|
+ specialOpinion.setUpdateTime(new Date());
|
|
|
+ specialOpinionService.update(specialOpinion);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String parentFullName(String parentId){
|
|
|
+ String fullName = "";
|
|
|
+
|
|
|
+ Area area = areaService.get(parentId);
|
|
|
+ if(StringUtils.isNotEmpty(area.getParentId())){
|
|
|
+ fullName = parentFullName(area.getParentId()) + "-" + area.getName();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ fullName = area.getName();
|
|
|
+ }
|
|
|
+
|
|
|
+ return fullName;
|
|
|
+ }
|
|
|
+}
|